prima: WLAN Driver Release 3.1.7.9
This is the initial release of the Prima WLAN Driver
diff --git a/CORE/MAC/inc/aniCompiler.h b/CORE/MAC/inc/aniCompiler.h
new file mode 100644
index 0000000..91b6b1e
--- /dev/null
+++ b/CORE/MAC/inc/aniCompiler.h
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Compiler abstraction layer
+ *
+ *
+ *
+ * Copyright (C) 2005-2006 Airgo Networks, Inc
+ * This file tries to abstract the differences among compilers.
+ * Supported compilers are :
+ *
+ * - GNU C/C++ compiler
+ * - Microsoft C/C++ compiler
+ * - Intel C/C++ compiler
+ *
+ * Written by Ho Lee
+ */
+
+#ifndef __ANI_COMPILER_ABSTRACT_H
+#define __ANI_COMPILER_ABSTRACT_H
+
+/*
+ * 1. GNU C/C++ Compiler
+ *
+ * How to detect gcc : __GNUC__
+ * How to detect gcc version :
+ * major version : __GNUC__ (2 = 2.x, 3 = 3.x, 4 = 4.x)
+ * minor version : __GNUC_MINOR__
+ *
+ * 2. Microsoft C/C++ Compiler
+ *
+ * How to detect msc : _MSC_VER
+ * How to detect msc version :
+ * _MSC_VER (1200 = MSVC 6.0, 1300 = MSVC 7.0, ...)
+ *
+ * 3. Intel C/C++ Compiler
+ *
+ * How to detect icc : __INTEL_COMPILER, __ICC (legacy), __ECC (legacy)
+ * How to detect icc version :
+ * __INTEL_COMPILER, __ICC, __ECC (700 = 7.0, 900 = 9.0, ...)
+ *
+ * 4. Other compilers (not supported)
+ *
+ * Borland : __BORLANDC__
+ * Greenhills : __ghs
+ * Metrowerks : __MWERKS__
+ * SGI MIPSpro : __sgi
+ */
+
+/*
+ * Packing directives : These are used to force compiler to pack bits and
+ * bytes in the data structure. C standard does not regulate this strictly,
+ * and many things are to compiler implementation. Many compilers support
+ * compiler specific directives or options that allow different packing
+ * and alignment.
+ *
+ * Alignment directives : Compiler may think packed data structures have
+ * no specific alignment requirement. Then compiler may generate multiple
+ * byte accesses to access two byte or four bytes data structures. This
+ * affects on performance especially for RISC systems. If some data
+ * structure is located on specific alignment always, alignment directives
+ * help compiler generate more efficient codes.
+ */
+
+#undef __ANI_COMPILER_PRAGMA_PACK_STACK
+#undef __ANI_COMPILER_PRAGMA_PACK
+
+#if defined(_MSC_VER)
+#define __ANI_COMPILER_PRAGMA_PACK_STACK 1
+#define __ANI_COMPILER_PRAGMA_PACK 1
+#define __ani_attr_pre_packed
+#define __ani_attr_packed
+#define __ani_attr_aligned_2
+#define __ani_attr_aligned_4
+#define __ani_attr_aligned_8
+#define __ani_attr_aligned_16
+#define __ani_attr_aligned_32
+#elif defined(__INTEL_COMPILER) || defined(__ICC) || defined(__ECC)
+#define __ANI_COMPILER_PRAGMA_PACK 1
+#define __ani_attr_pre_packed
+#define __ani_attr_packed
+#define __ani_attr_aligned_2
+#define __ani_attr_aligned_4
+#define __ani_attr_aligned_8
+#define __ani_attr_aligned_16
+#define __ani_attr_aligned_32
+#elif defined(__GNUC__)
+#define __ani_attr_pre_packed
+#define __ani_attr_packed __attribute__((packed))
+#define __ani_attr_aligned_2 __attribute__((aligned(2)))
+#define __ani_attr_aligned_4 __attribute__((aligned(4)))
+#define __ani_attr_aligned_8 __attribute__((aligned(8)))
+#define __ani_attr_aligned_16 __attribute__((aligned(16)))
+#define __ani_attr_aligned_32 __attribute__((aligned(32)))
+#elif defined(ANI_COMPILER_TYPE_RVCT)
+/* Nothing defined so far */
+#define __ani_attr_packed
+#define __ani_attr_pre_packed __packed
+#define __ani_attr_aligned_2 __align(2)
+#define __ani_attr_aligned_4 __align(4)
+#define __ani_attr_aligned_8 __align(8)
+#define __ani_attr_aligned_16 __align(16)
+#define __ani_attr_aligned_32 __align(32)
+#else
+#error "Unknown compiler"
+#endif
+
+#if defined(ANI_DATAPATH_SECTION)
+#define __DP_SRC_RX __attribute__ ((section(".dpsrcrx")))
+#define __DP_SRC_TX __attribute__ ((section(".dpsrctx")))
+#define __DP_SRC __attribute__ ((section(".dpsrc")))
+#define __ANIHDD_MODULE __attribute__ ((section(".anihdd")))
+#else
+#define __DP_SRC_RX
+#define __DP_SRC_TX
+#define __DP_SRC
+#define __ANIHDD_MODULE
+#endif
+
+#endif
+
diff --git a/CORE/MAC/inc/aniDbgTest.h b/CORE/MAC/inc/aniDbgTest.h
new file mode 100644
index 0000000..e80b1b9
--- /dev/null
+++ b/CORE/MAC/inc/aniDbgTest.h
@@ -0,0 +1,1582 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _ANIDBGTEST_H_
+#define _ANIDBGTEST_H_
+
+#include "sirTypes.h"
+
+#define MAX_PARMS_SIZE 256
+#define MAX_RESPONSE_SIZE 512
+#define MAX_PCI_CFG_WRDS 19
+#define MAX_NUM_TST_STAS_PER_AP 3
+
+#define ANI_PCI_CFG_MIN_GNT 4
+#define ANI_PCI_CFG_MAX_LAT 32
+/// EEPROM Product Ids for different types of NICs.
+#define EEP_PRODUCT_ID_MPCI_3_2 1
+#define EEP_PRODUCT_ID_MPCI_2_2 2
+#define EEP_PRODUCT_ID_CARDBUS 3
+#define EEP_PRODUCT_ID_HEAP_W_INT 4
+#define EEP_PRODUCT_ID_HEAP_W_EXT 5
+#define EEP_PRODUCT_ID_MRAP 6
+
+#define ANI_CARDBUS_EXPECTED_CIS \
+ (((0x3416 + sizeof(tPolSystemParameters)) << 3)|1)
+
+
+/// Here is an example of a test structure
+typedef enum sANI_TEST_ID
+{
+ // All DVT test Ids, beginning with BMU, INT, HIF, SP, TFP, RHP,
+ // RFP, SYS, PHY, SPI, CYG, LO, and EEPROM in the order specified.
+ ANI_TESTID_NONE = 0,
+
+ // PLEASE PRESERVE THE ORDER; IF YOU NEED TO CHANGE.
+ // TEST SCRIPTS DEPEND ON THIS ORDER.
+
+ ANI_BUS_ACCESS_TEST,
+ ANI_MEMORY_TEST,
+ ANI_INTERRUPT_TEST,
+ ANI_REG_READ_WRITE_TEST,
+ ANI_BMU_INIT_PDU_TEST,
+ ANI_HASH_TBL_ADD_DEL_GET_TEST_ID,
+ ANI_HASH_TBL_MULT_ENTRY_TEST_ID,
+
+ // Data path tests
+ ANI_SEND_CONTINUOUS_TEST,
+ ANI_PKT_ROUTING_TEST,
+
+ ANI_ADD_STA_TEST_ID,
+ ANI_DELETE_STA_TEST_ID,
+
+ // HIF Tests
+ ANI_BURST_READ_WRITE_TEST_ID,
+ ANI_MOVE_ACK_TEST_ID,
+ ANI_RESET_WQ_TEST_ID,
+ ANI_HIF_LPBK_TEST_ID,
+
+ // SP Tests
+
+ // TFP Tests
+ ANI_BCN_GEN_TEST_ID,
+
+ // RHP Tests
+
+ ANI_HASH_TBL_DELETE_TEST_ID,
+ ANI_HASH_TBL_GET_TEST_ID,
+
+ // RHP Tests
+ ANI_AGING_TEST_ID,
+ ANI_COUNTERS_TEST_ID,
+
+ // SYS Tests
+ ANI_SET_PROMOSCOUS_MODE_TEST_ID,
+ ANI_SET_SCAN_MODE_TEST_ID,
+
+ // SPI Tests
+ ANI_SET_CYG_REG_READ_WRITE_TEST_ID,
+
+ // CYG Tests
+ ANI_SET_BB_CAL_TEST_ID,
+
+ // LO Tests
+ ANI_SET_LO_CHAN_TEST_ID,
+
+ // EEPROM Tests
+
+ // Cal test
+ ANI_CAL_TEST_ID,
+
+ // HIF Burst DMA test
+ ANI_HIF_BURST_DMA_TEST_ID,
+
+ // Add all your test Ids above this.
+ ANI_TESTS_MAX
+} tANI_TEST_ID;
+
+/// Test IDs for tests directly handled by the HDD
+typedef enum sANI_HDD_TEST_ID {
+ ANI_HDD_TESTS_START = 0x10000,
+ ANI_PCI_CFG_TEST = ANI_HDD_TESTS_START,
+ ANI_EEPROM_TEST,
+
+ // Add all your HDD test Ids above this.
+ ANI_HDD_TESTS_MAX
+
+} tANI_HDD_TEST_ID;
+
+/// Test trigger types can be enhanced with this enumeration
+typedef enum sANI_TEST_TRIG_TYPE
+{
+ ANI_TRIG_TYPE_NONE = 0,
+
+ ANI_TRIG_TYPE_CFG,
+ ANI_TRIG_TYPE_START,
+ ANI_TRIG_TYPE_GET_RESULTS,
+ ANI_TRIG_TYPE_STOP,
+
+ ANI_TRIG_TYPE_MAX
+} tANI_TEST_TRIG_TYPE;
+
+/// Test states
+typedef enum sANI_DBG_TEST_STATE
+{
+ ANI_TEST_STATE_IDLE = 0,
+ ANI_TEST_STATE_IN_PROGRESS,
+ ANI_TEST_STATE_DONE
+
+} tANI_DBG_TEST_STATE;
+
+/**
+ * The following CFG Types are defined for each type of a parameter that can
+ * be independently set
+ */
+typedef enum sANI_DBG_CFG_TYPES
+{
+ ANI_DBG_CFG_PHY_MODE_RATE,
+ ANI_DBG_CFG_ROUTING_FLAGS,
+ ANI_DBG_CFG_STA_ID,
+ ANI_DBG_CFG_IS_INFRASTRUCTURE_MODE,
+ ANI_DBG_CFG_USE_REAL_PHY,
+ ANI_DBG_CFG_PHY_DROPS,
+ ANI_DBG_CFG_ADD_STA,
+ ANI_DBG_CFG_DEL_STA,
+ ANI_DBG_CFG_ENABLE_STA_TX,
+ ANI_DBG_CFG_DISABLE_STA_TX,
+ ANI_DBG_CFG_READ_REGISTER,
+ ANI_DBG_CFG_WRITE_REGISTER,
+ ANI_DBG_CFG_GET_ARQ_WINDOW_SIZE,
+ ANI_DBG_CFG_SET_ARQ_WINDOW_SIZE,
+ ANI_DBG_CFG_SET_CHANNEL,
+ ANI_DBG_CFG_SET_MAC_ADDRESS,
+ ANI_DBG_CFG_SET_MEM,
+ ANI_DBG_CFG_GET_MEM,
+ ANI_DBG_CFG_CTRL_TXWQ,
+ ANI_DBG_CFG_GET_ACTIVITY_SET,
+ ANI_DBG_CFG_SET_ACK_POLICY,
+ ANI_DBG_CFG_AGING_CMD,
+ ANI_DBG_CFG_SET_KEY,
+ ANI_DBG_CFG_SET_PER_STA_KEY,
+ ANI_DBG_CFG_TFP_ABORT,
+ ANI_DBG_CFG_GET_ACT_CHAINS,
+ ANI_DBG_CFG_IS_CHAIN_ACTIVE,
+ ANI_DBG_CFG_BB_FILTER_CAL,
+ ANI_DBG_CFG_DCO_CAL,
+ ANI_DBG_CFG_IQ_CAL,
+ ANI_DBG_CFG_TX_LO_LEAKAGE_CAL,
+ ANI_DBG_CFG_SEND_PKTS,
+ ANI_DBG_CFG_STOP_PKTS,
+ ANI_DBG_CFG_ENABLE_DISABLE_BEACON_GEN,
+ ANI_DBG_CFG_DCO_GET,
+ ANI_DBG_CFG_DCO_SET,
+ ANI_DBG_CFG_SET_PWR_TEMPL,
+ ANI_DBG_CFG_GET_PWR_TEMPL,
+ ANI_DBG_CFG_INIT,
+ ANI_DBG_CFG_SET_EEPROM_FLD,
+ ANI_DBG_CFG_GET_EEPROM_FLD,
+ ANI_DBG_CFG_SET_NUM_TRANSMITTERS,
+ ANI_DBG_CFG_SET_RX_CHAINS,
+ ANI_DBG_CFG_HCF_TEST,
+ ANI_DBG_CFG_POLARIS_REV_ID,
+ ANI_DBG_CFG_UPDATE_DATA_FROM_EEPROM,
+ ANI_DBG_CFG_GET_TEMP,
+ ANI_DBG_CFG_SET_STA_ADDRLST,
+ ANI_DBG_CFG_GET_PWR_GAIN,
+ ANI_DBG_CFG_SW_CLOSED_LOOP_TPC,
+
+ ANI_DBG_CFG_TYPE_MAX
+} tANI_DBG_CFG_TYPES;
+
+/**
+ * The following are the length definitions for each CFG TYPE defined
+ * in earlier Type enum.
+ */
+
+// first byte mode and second rate
+# define ANI_DBG_CFG_PHY_MODE_RATE_LEN 2
+
+// MSN is type and LSN is sub-type in the MSB. 4 LSBs are routing flags
+# define ANI_DBG_CFG_ROUTING_FLAGS_LEN 5
+
+# define ANI_DBG_CFG_STA_ID_LEN 2
+
+// ======================================================================
+//
+// Following are the structure definitions for the config input parameters
+//
+// ======================================================================
+//
+// --------------------------------------------------------
+
+// --------------------------------------------------------
+// Output Params for Read Register Config request
+typedef struct sAniDbgCfgGetPolarisVersionResponse
+{
+ // Output parameters
+ unsigned int rc; // 0 - SUCCESS
+ unsigned long version;
+} tAniDbgCfgGetPolarisVersionResponse, *tpAniDbgCfgGetPolarisVersionResponse;
+
+// -------------------------------------------------------------
+// Input Params for the Phy Mode Rate
+
+typedef struct sAniDbgCfgPhyModeRateParams
+{
+ unsigned int phyMode;
+ unsigned int phyRate;
+} tAniDbgCfgPhyModeRateParams, *tpAniDbgCfgPhyModeRateParams;
+
+// --------------------------------------------------------
+// Input Params for the Routing Flags
+typedef struct sAniDbgCfgRoutingFlagsParams
+{
+ unsigned int type;
+ unsigned int subType;
+ unsigned int routingFlags;
+} tAniDbgCfgRoutingFlagsParams, *tpAniDbgCfgRoutingFlagsParams;
+
+// --------------------------------------------------------
+// Input Params for the STA ID
+typedef struct sAniDbgCfgStaIdParams
+{
+ unsigned int staId;
+} tAniDbgCfgStaIdParams, *tpAniDbgCfgStaIdParams;
+
+// --------------------------------------------------------
+// Input Params for "Is Infrastructure Mode"
+typedef struct sAniDbgCfgIsInfrastructureParams
+{
+ unsigned int isInfrastructureMode;
+} tAniDbgCfgIsInfrastructureParams, *tpAniDbgCfgIsInfrastructureParams;
+
+// --------------------------------------------------------
+// Input Params for the Real Phy
+typedef struct sAniDbgCfgRealPhyParams
+{
+ unsigned int useRealPhy;
+} tAniDbgCfgRealPhyParams, *tpAniDbgCfgRealPhyParams;
+
+// --------------------------------------------------------
+// Input Params for Phy Drops
+typedef struct sAniDbgCfgPhyDropParams
+{
+ unsigned int usePhyDrops;
+ unsigned int rate;
+ unsigned int burstSize;
+ unsigned int mode;
+} tAniDbgCfgPhyDropParams, *tpAniDbgCfgPhyDropParams;
+
+// --------------------------------------------------------
+// Input Params for Add Sta
+typedef struct sAniDbgCfgAddStaParams
+{
+ unsigned int staId;
+ unsigned char macAddr[6];
+ unsigned int phyMode;
+ unsigned int rate;
+ unsigned int skipSP;
+ unsigned int ackPolicy;
+} tAniDbgCfgAddStaParams, *tpAniDbgCfgAddStaParams;
+
+// --------------------------------------------------------
+// Input Params for Delete Sta
+typedef struct sAniDbgCfgDelStaParams
+{
+ unsigned int staId;
+ unsigned char macAddr[6];
+} tAniDbgCfgDelStaParams, *tpAniDbgCfgDelStaParams;
+
+// --------------------------------------------------------
+// Lowest register address allowable for the Read Register calls
+#define ANI_TIT_MIN_REG_ADDR 0x02000000
+
+
+// --------------------------------------------------------
+// Highest register address allowable for the Read Register call
+#define ANI_TIT_MAX_REG_ADDR 0x0203ffff
+
+// --------------------------------------------------------
+// Input Params for Read Register Config request
+typedef struct sAniDbgCfgReadRegParams
+{
+ unsigned long regAddr;
+} tAniDbgCfgReadRegParams, *tpAniDbgCfgReadRegParams;
+
+// --------------------------------------------------------
+// Input Params for Write Register Config request
+typedef struct sAniDbgCfgWriteRegParams
+{
+ unsigned long regAddr;
+ unsigned long regVal;
+} tAniDbgCfgWriteRegParams, *tpAniDbgCfgWriteRegParams;
+
+
+
+
+// --------------------------------------------------------
+// ANI_DBG_CFG_SET_CAL_TONE,
+typedef struct
+{
+ unsigned long toneID; //0 = -28, 1 = -24, ..., 6 = -4, 7 = +4, 8 = +8, 9 = +12, ..., 13 = +28
+}tAniDbgCfgSetToneId, *tpAniDbgCfgSetToneId;
+
+
+// --------------------------------------------------------
+// Output Params for Read Register Config request
+typedef struct sAniDbgCfgRegReadResponse
+{
+ // Output parameters
+ unsigned int rc; // 0 - SUCCESS
+ unsigned long regVal;
+} tAniDbgCfgReadRegResponse, *tpAniDbgCfgReadRegResponse;
+
+// --------------------------------------------------------
+// Output Params for getting ARQ Window
+typedef struct sAniDbgCfgGetArqWindowResponse
+{
+ unsigned int rc; // 0 - SUCCESS
+ unsigned long val;
+} tAniDbgCfgGetArqWindowResponse, *tpAniDbgCfgGetArqWindowResponse;
+
+// --------------------------------------------------------
+// Input Params for Write Register Config request
+typedef struct sAniDbgCfgSetArqWindowParams
+{
+ unsigned long windowSize;
+} tAniDbgCfgSetArqWindowRegParams, *tpAniDbgCfgSetArqWindowParams;
+
+// --------------------------------------------------------
+// Input Params for Write Register Config request
+typedef struct sAniDbgCfgSetChanParams
+{
+ unsigned long chId;
+} tAniDbgCfgSetChanParams, *tpAniDbgCfgSetChanParams;
+
+
+// --------------------------------------------------------
+// Input Params for Write Register Config request
+typedef struct sAniDbgCfgSetMacAddrParams
+{
+ unsigned char macAddr[6];
+ unsigned int flag; // 0 - BSSID; 1 - MAC Address of DUT
+} tAniDbgCfgSetMacAddrParams, *tpAniDbgCfgSetMacAddrParams;
+
+// --------------------------------------------------------
+// Input Params for Set Memory request
+typedef struct sAniDbgCfgSetMemoryParams
+{
+ unsigned int fUseBurstDma;
+ unsigned int numOfWords;
+ unsigned int ahbAddr;
+ unsigned int writeData; // Pattern to be written out in memory
+} tAniDbgCfgSetMemoryParams, *tpAniDbgCfgSetMemoryParams;
+
+// --------------------------------------------------------
+// Input Params for Get Memory request
+typedef struct sAniDbgCfgGetMemoryParams
+{
+ unsigned int fUseBurstDma;
+ unsigned int numOfWords;
+ unsigned int ahbAddr;
+} tAniDbgCfgGetMemoryParams, *tpAniDbgCfgGetMemoryParams;
+
+// --------------------------------------------------------
+// Response structure for the Get Memory request
+typedef struct sAniDbgCfgGetMemoryResponse
+{
+ unsigned int rc; // 0 - SUCCESS; Otherwise FAILED
+ unsigned int readData[1];
+} tAniDbgCfgGetMemoryResponse, *tpAniDbgCfgGetMemoryResponse;
+
+
+// --------------------------------------------------------
+// Input Params for Controls Enable/Disable of TX WQ
+typedef struct sAniDbgCfgCtrlTxWqParams
+{
+ unsigned int staId;
+ unsigned int wqId;
+ unsigned int action; // 0 - Disable; 1 - Enable
+
+} tAniDbgCfgCtrlTxWqParams, *tpAniDbgCfgCtrlTxWqParams;
+
+// --------------------------------------------------------
+// Input Params for Getting TX/RX Activity Set
+typedef struct sAniDbgCfgGetAsParams
+{
+ unsigned int id; // 0 - tx; 1 - rx
+
+} tAniDbgCfgGetAsParams, *tpAniDbgCfgGetAsParams;
+
+// Input Params for Getting TX/RX Activity Set
+typedef struct sAniDbgCfgGetAsResponse
+{
+ unsigned int rc; // 0 - Success
+ unsigned int nEntries;
+ unsigned int entries[64];
+
+} tAniDbgCfgGetAsResponse, *tpAniDbgCfgGetAsResponse;
+
+// --------------------------------------------------------
+// Input Params for Set ACK Policy
+typedef struct sAniDbgCfgSetAckPolicyParams
+{
+ unsigned int id; // 0 - tx; 1 - rx
+ unsigned int policy;
+ unsigned int staId;
+ unsigned int tcId;
+
+} tAniDbgCfgSetAckPolicyParams, *tpAniDbgCfgSetAckPolicyParams;
+
+// --------------------------------------------------------
+// Input Params to Run AGING command
+typedef struct sAniDbgCfgAgingCmdParams
+{
+ unsigned int staId;
+ unsigned int tcId;
+
+} tAniDbgCfgAgingCmdParams, *tpAniDbgCfgAgingCmdParams;
+
+// --------------------------------------------------------
+// Input Params to TFP Abort command
+typedef struct sAniDbgCfgTfpAbortParams
+{
+ unsigned int staId;
+
+} tAniDbgCfgTfpAbortParams, *tpAniDbgCfgTfpAbortParams;
+
+// --------------------------------------------------------
+// Input Params to Enable/Disable Beacon command
+typedef struct sAniDbgCfgEnableBeaconParams
+{
+ unsigned int fEnableBeacons;
+
+} tAniDbgCfgEnableBeaconParams, *tpAniDbgCfgEnableBeaconParams;
+
+// --------------------------------------------------------
+// Input Params to SET WEP / AES MULTICAST KEY
+typedef struct sAniDbgCfgSetKeyParams
+{
+ unsigned int type; // 0 - WEP; 1 - AES
+ unsigned int keyId; // If AES, 0 - TX; 1 - RX
+ unsigned int keyLen;
+ unsigned char key[16];
+
+} tAniDbgCfgSetKeyParams, *tpAniDbgCfgSetKeyParams;
+
+// --------------------------------------------------------
+// Input Params to SET per STA keys
+typedef struct sAniDbgCfgSetPerStaKeyParams
+{
+ unsigned int staId;
+ unsigned int id0;
+ unsigned int id1;
+ unsigned int keyValid; // 0 - Tx; Anything else Rx
+ unsigned int useDefaultKey;
+ unsigned int defaultKeyId;
+ unsigned int edPolicy;
+ unsigned char key[16];
+ unsigned char keylen;
+
+} tAniDbgCfgSetPerStaKeyParams, *tpAniDbgCfgSetPerStaKeyParams;
+
+// --------------------------------------------------------
+// Cal test and Set Chan functions
+typedef struct sAniDbgCalTestParams
+{
+ unsigned int id; // 0 - Cal; 1 - Set Channel
+ unsigned int chId; // if id == 1; then chId is 1 - 14 or 36 - end of 11a
+}tAniDbgCalTestParams, *tpAniDbgCalTestParams;
+
+typedef struct sAniDbgCalTestResponse
+{
+ unsigned int rc;
+}tAniDbgCalTestResponse, *tpAniDbgCalTestResponse;
+
+// ---------------------------------------------------------
+// Input params to Get DCO params
+typedef struct sAniDbgCfgGetDcoParams
+{
+ unsigned int chain;
+ unsigned int address;
+} tAniDbgCfgGetDcoParams, *tpAniDbgCfgGetDcoParams;
+
+typedef struct sAniDbgCfgGetDcoResponse
+{
+ unsigned int rc;
+ unsigned int val;
+} tAniDbgCfgGetDcoResponse, *tpAniDbgCfgGetDcoResponse;
+
+// --------------------------------------------------------
+// Input params to Get DCO params
+typedef struct sAniDbgCfgSetDcoParams
+{
+ unsigned int chain;
+ unsigned int address;
+ unsigned int val;
+} tAniDbgCfgSetDcoParams, *tpAniDbgCfgSetDcoParams;
+
+// --------------------------------------------------------
+// Input params to setting power template
+typedef struct sAniDbgCfgSetPwrTemplParams
+{
+ unsigned int staId;
+ unsigned int mode;
+ unsigned int rate;
+} tAniDbgCfgSetPwrTemplParams, *tpAniDbgCfgSetPwrTemplParams;
+
+
+// Response struct for Getting power template
+typedef struct sAniDbgCfgGetPwrTemplParams
+{
+ unsigned int staId;
+} tAniDbgCfgGetPwrTemplParams, *tpAniDbgCfgGetPwrTemplParams;
+
+// --------------------------------------------------------
+// Request struct for Setting the init config parameters
+typedef struct sAniDbgCfgInitParams
+{
+ unsigned int mode; // default mode
+ unsigned int rate; // default rate
+ unsigned int fIsInfMode; // Set 1 for infrastructure mode
+ unsigned int staId;
+ unsigned char ownMacAddr[6]; // Set the configured MAC address
+ unsigned int fFwd2Host; // Set 1 to Forward data to host
+ unsigned int fUseRealPhy; // Set 1 to use the real Phy
+ unsigned int fEnablePhyDrops; // Set 1 to enable Phy drops
+ unsigned int dropModeRate; // Set this when Phy drops are enabled
+ unsigned int dropModeSize; // Set this when Phy drops are enabled
+ unsigned int dropModeMode; // Set this when Phy drops are enabled
+} tAniDbgCfgInitParams, *tpAniDbgCfgInitParams;
+
+
+// Response struct for Getting power template
+typedef struct sAniDbgCfgGetPwrTemplResponse
+{
+ unsigned int rc;
+ unsigned int val;
+} tAniDbgCfgGetPwrTemplResponse, *tpAniDbgCfgGetPwrTemplResponse;
+
+
+// --------------------------------------------------------
+// Input params for setting a field in the EEPROM
+
+typedef union sAniDbgCfgEepByteSetParams
+{
+ unsigned char mask;
+ unsigned char value;
+
+} tAniDbgCfgEepByteSetParams, *tpAniDbgCfgEepByteSetParams;
+
+
+// Request struct for Setting the EEPROM field
+typedef struct sAniDbgCfgEepSetParams
+{
+ unsigned int offset;
+ unsigned int size;
+ unsigned int fIsMaskPresent;
+ unsigned char setParams[1];
+} tAniDbgCfgEepSetParams, *tpAniDbgCfgEepSetParams;
+
+// The response structure for this particular request is same as
+// the generic response structure.
+
+// ------------------------------------------------------------
+// Input params for getting the value of a field in the EEPROM
+
+// Request struct for Getting the EEPROM field
+typedef struct sAniDbgCfgEepGetParams
+{
+ unsigned int offset;
+ unsigned int size;
+} tAniDbgCfgEepGetParams, *tpAniDbgCfgEepGetParams;
+
+
+// Response struct for Getting the EEPROM field
+typedef struct sAniDbgCfgEepGetResponse
+{
+ unsigned int rc;
+ unsigned char value[1];
+} tAniDbgCfgEepGetResponse, *tpAniDbgCfgEepGetResponse;
+
+// --------------------------------------------------------
+// Input params for setting the number of transmitters
+
+// Request struct for setting the number of transmitters
+typedef struct sAniDbgCfgSetNumTransmitters
+{
+ unsigned int numTransmitters;
+
+} tAniDbgCfgSetNumTransmitters, *tpAniDbgCfgSetNumTransmitters;
+
+// --------------------------------------------------------
+// Input params for Enabling/Disabling Rx chains
+
+// Request struct for Enabling/Disabling Rx chains
+typedef struct sAniDbgCfgSetRxChains
+{
+ unsigned int numChains;
+ unsigned char chainIndices[3];
+} tAniDbgCfgSetRxChains, *tpAniDbgCfgSetRxChains;
+
+// --------------------------------------------------------
+// Input params for enable/disable SW closed loop TPC
+
+// Request struct for enable/disable SW closed loop TPC
+typedef struct sAniDbgCfgSwClosedLoopTpc
+{
+ unsigned int action;
+} tAniDbgCfgSwClosedLoopTpc, *tpAniDbgCfgSwClosedLoopTpc;
+
+// --------------------------------------------------------
+// Input params for setting the list of test STA MAC address,
+// that will be operating with the AP, for the Multi-NIC tests.
+typedef struct sAniDbgCfgSetStaAddrLst
+{
+ unsigned long numStas;
+ unsigned char macAddrLst[MAX_NUM_TST_STAS_PER_AP][6];
+} tAniDbgCfgSetStaAddrLst, *tpAniDbgCfgSetStaAddrLst;
+
+// --------------------------------------------------------
+// Output Params for getting the current Power and Gain settings
+// for a particular STA.
+typedef struct sAniDbgCfgGetPwrGainResponse
+{
+ unsigned int rc; // 0 - SUCCESS
+ unsigned long pwrCode;
+ unsigned long gain0;
+ unsigned long gain1;
+} tAniDbgCfgGetPwrGainResponse, *tpAniDbgCfgGetPwrGainResponse;
+
+// --------------------------------------------------------
+// Input Params containing the STAID for getting the current Power and Gain settings.
+typedef struct sAniDbgCfgGetPwrGainParams
+{
+ unsigned long staID;
+} tAniDbgCfgGetPwrGainParams, *tpAniDbgCfgGetPwrGainParams;
+
+
+// --------------------------------------------------------
+// Output params for getting temperature
+
+// Response struct for getting temperature of the radio card
+// NOTE:- Stop the traffic to measure temperature
+typedef struct sAniDbgCfgGetTempRsp
+{
+ unsigned int rc; // 0 - SUCCESS; Otherwise FAILED
+ unsigned int temp0; // Chain 0 temperature
+ unsigned int temp1; // Chain 1 temperature
+} tAniDbgCfgGetTempRsp, *tpAniDbgCfgGetTempRsp;
+
+
+// --------------------------------------------------------
+// Generic Response structure for Config requests
+typedef struct sAniDbgCfgResponse
+{
+ unsigned int rc; // 0 - SUCCESS; Otherwise FAILED
+} tAniDbgCfgResponse, *tpAniDbgCfgResponse;
+
+// ====================================================================
+/*
+ For each test there will be a structure defined in this file with
+ the following test descriptions of testId, test trigger type, input
+ parameters and expected output
+
+ This is a template for DBG test structure
+
+ typedef struct sANIAPI_XXXX_TEST_PARAMS
+ {
+ // Input paramters
+ int xyz; // Test specific
+ } tANIAPI_XXXX_TEST_PARAMS;
+
+ typedef struct sANIAPI_XXXX_TEST_RESPONSE
+ {
+ // Output parameters
+ int rc; // Must be ZERO for success and must have error code
+ // for failure
+ int zyx; // Any counters or any debug these will be test spefics
+ } tANIAPI_XXXX_TEST_RESPONSE;
+
+ ********************************************* */
+// =====================================================================
+
+#define ANI_CFG_OPER_GET 0x0
+#define ANI_CFG_OPER_SET 0x1
+
+
+typedef struct sAniDbgCfg
+{
+ unsigned char oper;
+ unsigned char data[124]; // total parms structure must be MAX 128 bytes
+} tAniDbgCfg;
+
+// --------------------------------------------------------------------
+
+// Response structures for InitPdu test
+// No Input Params for this test
+typedef struct sAniDbgInitPduTestResponse
+{
+ // Output parameters
+ unsigned int rc; // Must be ZERO for success and must have error code
+ // for failure
+
+ unsigned int expected;
+ unsigned int i_current;
+ unsigned int totalPduCount;
+} tAniDbgInitPduTestResponse, *tpAniDbgInitPduTestResponse;
+
+
+// --------------------------------------------------------
+// Response structures for BusAccess/RegReadWrite tests
+// No Input Params for this test
+
+typedef struct sAniDbgRegReadWriteTestResponse
+{
+ // Output parameters
+ unsigned int rc; // 0 - SUCCESS; Anything else is an ERROR
+ unsigned int registerAddress;
+ unsigned int expected;
+ unsigned int i_current;
+} tAniDbgRegReadWriteTestResponse, *tpAniDbgRegReadWriteTestResponse;
+
+// --------------------------------------------------------
+// Response structures for Interrupt test
+// No Input Params for this test
+
+typedef struct sAniDbgIntrTestResponse
+{
+ // Output parameters
+ unsigned int rc; // 0 - SUCCESS; Anything else is an ERROR
+ unsigned int status; // Interrupt status register
+ unsigned int mask; // Interrupt mask in test
+ unsigned int bmu; // BMU MB status register contents
+
+} tAniDbgIntrTestResponse, *tpAniDbgIntrTestResponse;
+
+// --------------------------------------------------------
+// No Input Params for this test
+
+typedef struct sAniDbgMemoryTestParams
+{
+ unsigned int startAddress;
+ unsigned int endAddress;
+ unsigned int pattern;
+ unsigned int testLevel;
+} tAniDbgMemoryTestParams, *tpAniDbgMemoryTestParams;
+
+// ---------------------------------------------------------------------
+
+// Response structures for RegReadWrite test
+
+typedef struct sAniDbgMemoryTestResponse
+{
+ // Output parameters
+ unsigned int rc; // Must be ZERO for success and must have error code
+ // for failure
+ unsigned int expected;
+ unsigned int i_current;
+ unsigned int currentAddress;
+ unsigned int testAddress;
+} tAniDbgMemoryTestResponse, *tpAniDbgMemoryTestResponse;
+
+// --------------------------------------------------------
+// Input Parameters for the HIF Burst Read Write test
+
+typedef struct sAniDbgHIFBurstRdWrtTestParams
+{
+ unsigned int AHBAddr;
+ unsigned int size;
+ unsigned char data[1];
+
+} tAniDbgHIFBurstRdWrtTestParams, *tpAniDbgHIFBurstRdWrtTestParams;
+
+// ---------------------------------------------------------------------
+
+// Response structure for the HIF Burst Read Write test
+
+typedef struct sAniDbgHIFBurstRdWrtTestResponse
+{
+ // Output parameters
+ unsigned int rc; // Must be ZERO for success and must have error code
+ // for failure
+ unsigned char readData[1];
+
+} tAniDbgHIFBurstRdWrtTestResponse, *tpAniDbgHIFBurstRdWrtTestResponse;
+
+
+// --------------------------------------------------------
+
+// Take the routing flags and number of frames, as Params for this test
+
+typedef struct sAniDbgSendContinuousTestParams
+{
+ unsigned int routingFlags;
+
+ // 0 - continuously send packets till it is instructed to stop.
+ unsigned int numFramesToSend;
+
+ // 1 - TM ring, otherwise the TD ring will be used.
+ unsigned int fUseTMRing;
+
+ // 1 - loopback packets through the MAC
+ unsigned int fLoopBkPkts;
+} tAniDbgSendContinuousTestParams, *tpAniDbgSendContinuousTestParams;
+
+// Response structures for SendContinuous test
+
+typedef struct sAniDbgSendContinuousTestResponse
+{
+ unsigned int rc; // 0 - Success and anything else is a failure
+
+ unsigned int numPktsSent;
+ unsigned int numPktsFailed;
+ // Size of the last frame attempted to be sent, in case of a failure
+ unsigned int lastFailedPayloadSize;
+} tAniDbgSendContinuousTestResponse, *tpAniDbgSendContinuousTestResponse;
+
+// --------------------------------------------------------
+// Input parameters for the Packet Routing test
+typedef struct sAniDbgPktRoutingTestParams
+{
+ // Routing flags for the test
+ unsigned int routingFlags;
+
+ // Enter 1 for Hardware Seqno
+ unsigned int hsBit;
+
+ // Enter unicast ackPolicy(4 for random)
+ unsigned int ackPolicy;
+
+ // RTS (2 for random)
+ unsigned int rtsFlag;
+
+ // 0 - continuously send packets till it is instructed to stop.
+ unsigned int numPktsToSend;
+
+ // 0xffffffff - For random frame types.
+ unsigned int frameType;
+
+ // 0xffffffff - generates random frame sub-types.
+ unsigned int frmSubType;
+
+ // 1 - TM ring; Otherwise the TD ring will be used.
+ unsigned int fUseTMRing;
+
+ // 0 - random payload sizes
+ unsigned int payloadSize;
+
+ // If "payloadSize" above is set to zero then this is ignored
+ unsigned int fragSize;
+
+ // This parameter specifies whether a unicast packet should be fragmented.
+ // Ignored, if "payloadSize" above is set to a non-zero value.
+ unsigned int fragment;
+
+ // Use a value >3 for random staId generation
+ unsigned int staId;
+
+ // Use a value >7 for random tcId generation
+ unsigned int tcId;
+
+ // Enter random STA range (1 for STAs(0-1),3 for STAs(0-3))
+ unsigned int staRange;
+
+ // TC range (1 for TCs(0-1),3 for TCs(0-3),7 for TCs(0-7)
+ unsigned int tcRange;
+
+ // burst size (< 11)
+ unsigned int burst;
+
+ // Enter 1 to compute CRC
+ unsigned int crc;
+
+ // Enter 1 to loopback packets through the MAC
+ unsigned int fLoopBkPkts;
+
+} tAniDbgPktRoutingTestParams, *tpAniDbgPktRoutingTestParams;
+
+// Structures where response parameters are constructed by the
+// dvtSendPackets() routine
+
+typedef struct sAniDbgSendPktResponse
+{
+ // Total packets sent
+ unsigned int pktGenCount;
+
+ unsigned int fragCnt;
+
+ unsigned int byteCnt;
+
+ unsigned int lowPduCnt;
+
+ unsigned int qFullCnt;
+
+ // Specifies the size of the last frame attempted to be sent
+ unsigned int lastPayloadSize;
+
+ // Specifies the size of the last frame's fragment size
+ unsigned int lastFragSize;
+
+ // Immediate ACK
+ unsigned int cumImmAck;
+
+ // NoACK
+ unsigned int cumNoAck;
+
+ // RTS
+ unsigned int cumRTS;
+
+ // No ACK
+ unsigned int cumNoRTS;
+
+ // TC histogram (pkts)
+ unsigned int cumTC[8];
+
+ //Fragments histogram (frags)
+ unsigned int cumFrag[16];
+
+ // STA histogram (pkts,frags)
+ unsigned int cumSTA[4];
+ unsigned int cumSTAFrags[4];
+
+} tAniDbgSendPktResponse, *tpAniDbgSendPktResponse;
+
+// Response structures for the Packet Routing test
+typedef struct sAniDbgPktRoutingTestResponse
+{
+ // Output parameters
+ unsigned int rc; // Must be ZERO for success and must have error code
+ // for failure
+
+ // Field where response parameters are constructed by the
+ // dvtSendPackets() routine
+ tAniDbgSendPktResponse sendPktsRsp;
+
+} tAniDbgPktRoutingTestResponse, *tpAniDbgPktRoutingTestResponse;
+
+// --------------------------------------------------------
+
+typedef enum sPciCfgTestStatus
+{
+ ePCI_CFG_TEST_SUCCESS,
+ ePCI_CFG_TEST_READ_FAILURE,
+ ePCI_CFG_TEST_VEN_DEV_ID_MISMATCH,
+ ePCI_CFG_TEST_MIN_GNT_MISMATCH,
+ ePCI_CFG_TEST_MAX_LAT_MISMATCH,
+ ePCI_CFG_TEST_CIS_PTR_MISMATCH,
+ ePCI_CFG_TEST_CIS_CONTENTS_MISMATCH
+} tPciCfgTestStatus;
+
+// Response structures for the PCI Config test
+typedef struct sAniDbgPciCfgTestResponse
+{
+ // Output parameters
+ unsigned int rc; // Must be ZERO for success and must have error code
+ // for failure
+
+ // Field where the PCI config words, for Polaris are returned by the HDD
+ unsigned int pciConfig[MAX_PCI_CFG_WRDS];
+
+} tAniDbgPciCfgTestResponse, *tpAniDbgPciCfgTestResponse;
+
+// --------------------------------------------------------
+
+// Various return codes returned for the EEPROM test.
+typedef enum sEepromTestStatus
+{
+ eEEPROM_TEST_SUCCESS,
+ eEEPROM_TEST_FILE_OPEN_FAILURE,
+ eEEPROM_TEST_FILE_MAP_FAILURE,
+ eEEPROM_TEST_INVALID_FILE_SIZE,
+ eEEPROM_TEST_MEMORY_ALLOC_FAILURE,
+ eEEPROM_TEST_CRC_MISMATCH_FAILURE
+} tEepromTestStatus;
+
+
+// Take the EEPROM filename, as Params for this test
+
+typedef struct sAniDbgEepromTestParams
+{
+ // EEPROM File Name.
+ char eepromFilename[256];
+
+} tAniDbgEepromTestParams, *tpAniDbgEepromTestParams;
+
+// Response structures for SendContinuous test
+
+typedef struct sAniDbgEepromTestResponse
+{
+ unsigned int rc; // 0 - Success and anything else is a failure
+
+} tAniDbgEepromTestResponse, *tpAniDbgEepromTestResponse;
+
+// ---------------------------------------------------------------------
+
+// input params for RHP HASH TBL tests
+
+typedef struct sAniDbgRhpHashTblMultipleEntryTestParams
+{
+ unsigned int n; // number of entries
+
+} tAniDbgRhpHashTblMultipleEntryTestParams,
+ *tpAniDbgRhpHashTblMultipleEntryTestParams;
+
+typedef struct sAniDbgRhpHashTblTestParams
+{
+ unsigned int staId;
+ unsigned char macAddr[6];
+ unsigned int flags;
+ unsigned int hashFlagRsvd;
+ unsigned int rsvdField;
+
+} tAniDbgRhpHashTblTestParams, *tpAniDbgRhpHashTblTestParams;
+
+
+typedef struct sAniDbgRhpHashTblTestResponse
+{
+ unsigned int rc; // 0 For Success
+} tAniDbgRhpHashTblTestResponse, *tpAniDbgRhpHashTblTestResponse;
+
+
+// -----------------------------------------------------------
+
+// Here both pParms and pResponse structures are interpreted by the
+// User of the API based on testId
+
+typedef struct sANI_DBG_TEST_INFO {
+
+ tANI_TEST_ID testId;
+
+ // This field indicates this test runs synchronously or not.
+ // If it is not, then, the test originator will have the
+ // ability to query for intermediate results.
+ // ANI_START = 1; ANI_GET_RESULTS = 2; ANI_STOP = 3
+ tANI_TEST_TRIG_TYPE testTriggerType;
+
+ // test state
+ tANI_DBG_TEST_STATE testState;
+
+ // This points to a structure which contains parameters for
+ // test defined by dvtTestId. May be NULL if no parameters
+ // are needed
+ unsigned long sizeOfParms;
+ unsigned char parms[MAX_PARMS_SIZE];
+
+ // This points to a buffer to hold response from the test
+ // Response shall be there from the test and it MUST have
+ // return code ZERO for SUCCESS and error code for test
+ // failure
+ unsigned long sizeOfResponse;
+ unsigned char response[MAX_RESPONSE_SIZE];
+
+} tANI_DBG_TEST_INFO;
+
+// Returns test start function pointer or stop function pointer or
+// get info on test function pointer from the function pointer array
+// that is initialized during the dvtInitGlobal routine.
+#ifdef __cplusplus
+extern "C" void* dvtGetFuncPtr(void *, int, int );
+#else
+extern void* dvtGetFuncPtr(void *, int, int );
+#endif
+
+
+// declare a function prototype for 'start', 'update' and 'stop' routines
+typedef void t_DbgTestRoutine(void *);
+
+// called by the test routine when it completes
+extern void dbgTestCompleted(void *mpAdapterPtr);
+
+
+// DBG/DVT dump information structures & defines
+
+#define ANI_DBG_GRP_INFO_TYPE_MISC 0x00000001
+#define ANI_DBG_GRP_INFO_TYPE_BMU 0x00000002
+#define ANI_DBG_GRP_INFO_TYPE_TFP 0x00000004
+#define ANI_DBG_GRP_INFO_TYPE_RHP 0x00000008
+#define ANI_DBG_GRP_INFO_TYPE_RFP 0x00000010
+#define ANI_DBG_GRP_INFO_TYPE_STA 0x00000020
+#define ANI_DBG_GRP_INFO_TYPE_FPHY 0x00000040
+#define ANI_DBG_GRP_INFO_TYPE_FPHY_FIFO 0x00000080
+#define ANI_DBG_GRP_INFO_TYPE_RPHY 0x00000100
+#define ANI_DBG_GRP_INFO_TYPE_HCF 0x00000200
+#define ANI_DBG_GRP_INFO_TYPE_SP 0x00000400
+#define ANI_DBG_GRP_INFO_TYPE_CP 0x00000800
+
+
+#define ANI_DBG_GRP_INFO_TYPE_ALL (ANI_DBG_GRP_INFO_TYPE_MISC | \
+ ANI_DBG_GRP_INFO_TYPE_BMU | \
+ ANI_DBG_GRP_INFO_TYPE_TFP | \
+ ANI_DBG_GRP_INFO_TYPE_RHP | \
+ ANI_DBG_GRP_INFO_TYPE_RFP | \
+ ANI_DBG_GRP_INFO_TYPE_STA | \
+ ANI_DBG_GRP_INFO_TYPE_FPHY| \
+ ANI_DBG_GRP_INFO_TYPE_FPHY_FIFO | \
+ ANI_DBG_GRP_INFO_TYPE_RPHY | \
+ ANI_DBG_GRP_INFO_TYPE_HCF | \
+ ANI_DBG_GRP_INFO_TYPE_SP)
+
+
+
+typedef struct sANI_DBG_MISC_INFO {
+
+ unsigned long sysMode;
+ unsigned long sysIntrMask;
+ unsigned long intrMask;
+ unsigned long phyIntrMask;
+ unsigned long intrStatus[32];
+ unsigned long phyIntrStatus[16];
+ unsigned long eofSofExceptionResets;
+ unsigned long bmuExceptionResets;
+ unsigned long lowPduExceptionResets;
+ unsigned long userTriggeredResets;
+ unsigned long logPExceptionResets;
+
+} tANI_DBG_MISC_INFO;
+
+
+typedef struct sANI_DBG_BMU_INFO {
+
+ unsigned long control;
+ unsigned long fp_hptr;
+ unsigned long tptr;
+ unsigned long pdu;
+ unsigned long exception;
+ unsigned long exceptionMaster;
+ unsigned long dropCount;
+ unsigned long workQueue[10][4];
+
+} tANI_DBG_BMU_INFO;
+
+
+typedef struct sANI_DBG_TFP_INFO {
+
+ unsigned long control;
+ unsigned long modeEnable;
+ unsigned long templEnable;
+ unsigned long retryQid;
+ unsigned long tsfHi;
+ unsigned long tsfLo;
+ unsigned long beacon;
+ unsigned long probeDelay;
+ unsigned long tbttHi;
+ unsigned long tbttLo;
+ unsigned long nav;
+ unsigned long listenInterval;
+ unsigned long delayTx;
+ unsigned long dtimPeriod;
+ unsigned long rtsCount;
+ unsigned long rtsFailure;
+
+} tANI_DBG_TFP_INFO;
+
+
+typedef struct sANI_DBG_RHP_INFO {
+
+ unsigned long sof;
+ unsigned long sof_chunk;
+ unsigned long fragCount;
+ unsigned long dropCount;
+ unsigned long fcsCount;
+ unsigned long bssIdMismatch;
+ unsigned long destMismatch;
+ unsigned long lengthError;
+ unsigned long pduError;
+ unsigned long abortCount;
+ unsigned long reqRate;
+ unsigned long delayAB;
+ unsigned long macAddrHi;
+ unsigned long macAddrLo;
+ unsigned long bssIdHi;
+ unsigned long bssIdLo;
+ unsigned long relayCount;
+ unsigned long hash_MissCount;
+ unsigned long hash_srcHi;
+ unsigned long hash_srcLo;
+ unsigned long hash_type;
+ unsigned long hash_subType;
+ unsigned long dbg_hangStatus;
+ unsigned long dbg_fragIgnoreCount;
+ unsigned long pduCount;
+
+} tANI_DBG_RHP_INFO;
+
+
+typedef struct sANI_DBG_RFP_INFO {
+
+ unsigned long packets;
+ unsigned long multicastPackets;
+ unsigned long dupPackets;
+ unsigned long byteCount;
+ unsigned long dropCount;
+ unsigned long byte64;
+ unsigned long byte128;
+ unsigned long byte256;
+ unsigned long byte512;
+ unsigned long byte1024;
+ unsigned long byte1519;
+ unsigned long byte2048;
+ unsigned long byte4096;
+
+} tANI_DBG_RFP_INFO;
+
+typedef struct sANI_DBG_SP_INFO {
+
+ unsigned long wep_dky0_w0;
+ unsigned long wep_dky0_w1;
+ unsigned long wep_default_rc0;
+
+ unsigned long wep_dky1_w0;
+ unsigned long wep_dky1_w1;
+ unsigned long wep_default_rc1;
+
+ unsigned long wep_dky2_w0;
+ unsigned long wep_dky2_w1;
+ unsigned long wep_default_rc2;
+
+ unsigned long wep_dky3_w0;
+ unsigned long wep_dky3_w1;
+ unsigned long wep_default_rc3;
+
+} tANI_DBG_SP_INFO;
+
+typedef struct sANI_DBG_CP_INFO {
+
+ unsigned long cp_control;
+ unsigned long Compression_Expansion_Cnt;
+ unsigned long Compression_NUM_pkts;
+
+ unsigned long Decompression_NUM_pkts;
+ unsigned long Compression_50p_NUM_pkts;
+ unsigned long CP_Error_status;
+
+ unsigned long Cp_maximum_pkt_len;
+
+} tANI_DBG_CP_INFO;
+
+
+typedef struct sANI_DBG_STA_TX_WQ_INFO {
+
+ unsigned long txWqAddr;
+ unsigned long txWqDump[4];
+
+ unsigned long tptr;
+ unsigned long hptr;
+ unsigned long aptr;
+ unsigned long a_tpkts;
+ unsigned long h_tpkts;
+ unsigned long frag;
+ unsigned long bytes;
+ unsigned long ack;
+ unsigned long valid;
+
+} tANI_DBG_STA_TX_WQ_INFO;
+
+
+
+typedef struct sANI_DBG_TC_DESC {
+
+ unsigned long valid;
+ unsigned long rxAckType;
+ unsigned long newPkt;
+ unsigned long rxSeqNum;
+ unsigned long rxPktTimeStamp;
+ unsigned long SV;
+ unsigned long ackTimeout;
+ unsigned long numOfFragsSucessful;
+ unsigned long rxBDPtr;
+ unsigned long txReplayCountHi;
+ unsigned long txReplayCountLo;
+ unsigned long rxReplayCountHi;
+ unsigned long rxReplayCountLo;
+
+} tANI_DBG_TC_DESC;
+
+
+typedef struct sANI_DBG_PWR_TEMPL {
+
+ unsigned long retryPhyMode;
+ unsigned long retryCb;
+ unsigned long retryEsf;
+ unsigned long sb;
+ unsigned long rate;
+ unsigned long esf;
+ unsigned long tifs;
+ unsigned long edcf;
+ unsigned long cb;
+ unsigned long mode;
+ unsigned long pwrLvl;
+ unsigned long nTransmitters;
+ unsigned long retry1rate;
+ unsigned long retry2rate;
+
+ unsigned long pwrTemplate; //entire value
+
+} tANI_DBG_PWR_TEMPL;
+
+
+typedef struct sANI_DBG_STA {
+
+ unsigned long staDescAddr;
+ unsigned long staDump[256];
+
+ tANI_DBG_TC_DESC tcDesc[9]; // 8 tc Ids and 9th mgmt TC
+
+ unsigned long cbits_hcf;
+ unsigned long cbits_ps;
+ unsigned long cbits_ps1;
+ unsigned long cbits_tx_en;
+
+ unsigned long descStat_aes_sent;
+ unsigned long descStat_aes_recv;
+ unsigned long descStat_replays;
+ unsigned long descStat_formaterr;
+ unsigned long descStat_aes_decypterr_default;
+ unsigned long descStat_aes_decypterr_ucast;
+
+ unsigned long tfpStat_failed;
+ unsigned long tfpStat_retry;
+ unsigned long tfpStat_multiretry;
+ unsigned long tfpStat_ackto;
+ unsigned long tfpStat_frags;
+ unsigned long tfpStat_rtsBrqs;
+ unsigned long tfpStat_pkts;
+ unsigned long tfpStat_ctsBackTimeouts;
+
+
+ unsigned long phyStatHi;
+ unsigned long phyStatLo;
+
+ unsigned long ackToNonPrimRates;
+ unsigned long nFragSuccNonPrimRates;
+
+} tANI_DBG_STA;
+
+
+typedef struct sANI_DBG_STA_INFO {
+
+ unsigned long staId; // input
+
+ tANI_DBG_STA sta;
+
+ tANI_DBG_STA_TX_WQ_INFO txwq[8];
+
+ tANI_DBG_PWR_TEMPL pwrTempl;
+
+} tANI_DBG_STA_INFO;
+
+
+typedef struct sANI_DBG_FPHY_INFO {
+
+ unsigned long fphy_symPer;
+ unsigned long cca_delayOffset;
+ unsigned long cca_startDelay;
+ unsigned long timeStamp_Hi;
+ unsigned long timeStamp_Lo;
+ unsigned long dropRate;
+ unsigned long burstSize;
+ unsigned long reg;
+ unsigned long stat_bytes01;
+ unsigned long stat_bytes23;
+ unsigned long stat_bytes45;
+ unsigned long pkts_tx;
+ unsigned long pkts_rx;
+ unsigned long pkts_drops;
+ unsigned long rxin_sof;
+ unsigned long rxin_eof;
+ unsigned long rxout_sof;
+ unsigned long rxout_eof;
+ unsigned long txin_sof;
+ unsigned long txin_eof;
+ unsigned long txout_sof;
+ unsigned long txout_eof;
+
+} tANI_DBG_FPHY_INFO;
+
+
+#define MAX_FIFO_ENTRIES_PER_REQUEST 200
+
+typedef struct sAniDvtPhyfEntry
+{
+ unsigned char bytes[50];
+ unsigned char len;
+ unsigned char mode;
+ unsigned char phyLen;
+ unsigned char macLen;
+ unsigned char dropByte;
+ unsigned char reserved;
+ unsigned long sof;
+ unsigned long eof;
+} tAniDvtPhyfEntry;
+
+
+#define ANI_DBG_FIFO_CMD_GET 0x1
+#define ANI_DBG_FIFO_CMD_CLEAR 0x2
+
+
+typedef struct sANI_DBG_FPHY_FIFO {
+
+ unsigned long command; // set to either 'get' of 'clear' fifo
+ unsigned long entries; // entries to read
+ unsigned long offset; // offset to read from
+
+ unsigned long totalBytes;
+ unsigned long approxEntries;
+
+ unsigned long validEntries;
+ tAniDvtPhyfEntry Fifo[MAX_FIFO_ENTRIES_PER_REQUEST];
+
+} tANI_DBG_FPHY_FIFO;
+
+
+typedef struct sANI_DBG_RPHY_MPI_INFO {
+
+ unsigned long tfp_phy_sof;
+ unsigned long tfp_phy_eof;
+ unsigned long phy_tfp_req;
+ unsigned long txa_mpi_data_req;
+ unsigned long txb_mpi_data_req;
+ unsigned long mpi_txa_data_val;
+ unsigned long mpi_txb_data_val;
+ unsigned long mpi_txa_pktend;
+ unsigned long mpi_txb_pktend;
+ unsigned long mpi_txctl_pktend;
+ unsigned long mpi_txctl_ctlbytes_val;
+
+} tANI_DBG_RPHY_MPI_INFO;
+
+
+typedef struct sANI_DBG_RPHY_PMI_INFO {
+
+ unsigned long rxa_mpi_pktstart;
+ unsigned long rxb_mpi_pktstart;
+ unsigned long rxa_mpi_pktend;
+ unsigned long rxb_mpi_pktend;
+ unsigned long rxa_mpi_data_val;
+ unsigned long rxb_mpi_data_val;
+ unsigned long rhp_phy_shutoff;
+ unsigned long rhp_phy_sof_c;
+ unsigned long rhp_phy_sof_p;
+ unsigned long rhp_phy_eof_c;
+ unsigned long rhp_phy_eof_p;
+ unsigned long phy_rhp_data_val;
+ unsigned long pmi_int;
+
+} tANI_DBG_RPHY_PMI_INFO;
+
+typedef struct sANI_DBG_RPHY_PHYINT_INFO {
+
+ unsigned long status;
+ unsigned long fast_mask;
+ unsigned long slow_mask;
+ unsigned long host_mask;
+
+} tANI_DBG_RPHY_PHYINT_INFO;
+
+
+typedef struct sANI_DBG_RPHY_INFO {
+
+ tANI_DBG_RPHY_MPI_INFO mpi;
+ tANI_DBG_RPHY_PMI_INFO pmi;
+ tANI_DBG_RPHY_PHYINT_INFO phyint;
+
+} tANI_DBG_RPHY_INFO;
+
+
+typedef struct sANI_DBG_SCH_INFO
+{
+ unsigned long curSch; // RO
+ unsigned long numSch; // RO
+ unsigned long numInt; // RO
+ unsigned long numEndInt; // RO
+ unsigned long numCFB; // RO
+ unsigned long firstCFB; // RO
+
+ unsigned long fixedSch; // RW
+ unsigned long gDvtPoll; // RW
+ unsigned long maxTimeout; // RW
+ unsigned long minTxop; // RW
+ unsigned long maxTxop; // RW
+ unsigned long maxTcid; // RW
+ unsigned long maxSta; // RW
+ unsigned long minSta; // RW
+ unsigned long maxInst; // RW
+
+ unsigned long firstSch; // RO
+ unsigned long cfbStart; // RO
+ unsigned long cfbEnd; // RO
+ unsigned long cumCFB; // RO
+ unsigned long cumCP; // RO
+
+ unsigned long haltSch; // RW
+ unsigned long numTim; // RO
+} tANI_DBG_SCH_INFO;
+
+
+typedef struct sANI_DBG_HCF_INFO {
+
+ unsigned long bSetInfo; // 0 = read info, 1 = set info
+ tANI_DBG_SCH_INFO schInfo;
+
+} tANI_DBG_HCF_INFO;
+
+typedef struct sANI_DBG_AP_SWITCH_INFO {
+
+
+ // Space to hold the SSIDList and the BSSID.
+ unsigned char SSID_BSSID_BUF[262]; // 262 == WNIAPI_MAX_SSID_LIST_STR + WNIAPI_BSSID_SIZE
+
+
+} tANI_DBG_AP_SWITCH_INFO;
+
+
+typedef struct sANI_DBG_INFO {
+
+ unsigned long dbgInfoMask; // indicates which members are valid
+
+ tANI_DBG_MISC_INFO miscInfo;
+ tANI_DBG_BMU_INFO bmuInfo;
+ tANI_DBG_TFP_INFO tfpInfo;
+ tANI_DBG_RHP_INFO rhpInfo;
+ tANI_DBG_RFP_INFO rfpInfo;
+ tANI_DBG_STA_INFO staInfo;
+ tANI_DBG_FPHY_INFO fphyInfo;
+ tANI_DBG_FPHY_FIFO fphyFifo;
+ tANI_DBG_RPHY_INFO rphyInfo;
+ tANI_DBG_HCF_INFO hcfInfo;
+ tANI_DBG_SP_INFO spInfo;
+ tANI_DBG_CP_INFO cpInfo;
+
+} tANI_DBG_INFO;
+
+extern tSirRetStatus dvtGetDumpInfo(void *pMac, tANI_DBG_INFO *pDbgInfo );
+
+extern tSirRetStatus dvtGetConfigInfo(void *pMac, tANI_DBG_TEST_INFO *pTestInfo );
+
+#ifdef __cplusplus
+extern "C" void dvtSetStopTestFlag( unsigned char stopTest );
+#else
+extern void dvtSetStopTestFlag( unsigned char stopTest );
+#endif
+
+
+#endif // _ANIDBGTEST_H_
diff --git a/CORE/MAC/inc/aniGlobal.h b/CORE/MAC/inc/aniGlobal.h
new file mode 100644
index 0000000..880a6bf
--- /dev/null
+++ b/CORE/MAC/inc/aniGlobal.h
@@ -0,0 +1,1122 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved
+ * aniGlobal.h: MAC Modules Adapter Definitions.
+ * Author: V. K. Kandarpa
+ * Date: 10/25/2002
+ *
+ * History:-
+ * Date: 04/08/2008 Modified by: Santosh Mandiganal
+ * Modification Information: Added the logDump.h header file and defined the
+ * dumpTablecurrentId, dumpTableEntry.
+ * --------------------------------------------------------------------------
+ *
+ */
+
+#ifndef _ANIGLOBAL_H
+#define _ANIGLOBAL_H
+
+// Take care to avoid redefinition of this type, if it is
+// already defined in "halWmmApi.h"
+#if !defined(_HALMAC_WMM_API_H)
+typedef struct sAniSirGlobal *tpAniSirGlobal;
+#endif
+
+#include "halTypes.h"
+#include "sirCommon.h"
+#include "aniSystemDefs.h"
+#ifndef ANI_OS_TYPE_OSX
+#include "sysDef.h"
+#endif
+#include "dphGlobal.h"
+#include "limGlobal.h"
+#include "pmmGlobal.h"
+#include "schGlobal.h"
+#include "sysGlobal.h"
+#include "cfgGlobal.h"
+#include "utilsGlobal.h"
+#include "sirApi.h"
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halGlobal.h"
+#include "halDataStruct.h"
+#include "phyGlobal.h"
+#include "pttModule.h"
+#endif
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#include "wlan_qct_hal.h"
+#endif
+
+#ifdef ANI_PRODUCT_TYPE_CLIENT
+#include "pmc.h"
+#endif
+
+#include "csrApi.h"
+#ifdef WLAN_FEATURE_VOWIFI_11R
+#include "sme_FTApi.h"
+#endif
+#include "csrSupport.h"
+#include "smeInternal.h"
+#include "ccmApi.h"
+#include "btcApi.h"
+#include "csrInternal.h"
+
+
+#if defined WLAN_FEATURE_VOWIFI
+#include "smeRrmInternal.h"
+#include "rrmGlobal.h"
+#endif
+#if defined FEATURE_WLAN_CCX
+#include "ccxApi.h"
+#include "ccxGlobal.h"
+#endif
+#ifdef WLAN_FEATURE_P2P
+#include "p2p_Api.h"
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+#include <limFTDefs.h>
+#endif
+
+
+#ifdef ANI_DVT_DEBUG
+#include "dvtModule.h"
+#endif
+
+// New HAL API interface defs.
+#include "logDump.h"
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+//Check if this definition can actually move here from halInternal.h even for Volans. In that case
+//this featurization can be removed.
+#define PMAC_STRUCT( _hHal ) ( (tpAniSirGlobal)_hHal )
+#endif
+
+#define ANI_DRIVER_TYPE(pMac) (((tpAniSirGlobal)(pMac))->gDriverType)
+// -------------------------------------------------------------------
+// Bss Qos Caps bit map definition
+#define LIM_BSS_CAPS_OFFSET_HCF 0
+#define LIM_BSS_CAPS_OFFSET_WME 1
+#define LIM_BSS_CAPS_OFFSET_WSM 2
+
+#define LIM_BSS_CAPS_HCF (1 << LIM_BSS_CAPS_OFFSET_HCF)
+#define LIM_BSS_CAPS_WME (1 << LIM_BSS_CAPS_OFFSET_WME)
+#define LIM_BSS_CAPS_WSM (1 << LIM_BSS_CAPS_OFFSET_WSM)
+
+// cap should be one of HCF/WME/WSM
+#define LIM_BSS_CAPS_GET(cap, val) (((val) & (LIM_BSS_CAPS_ ## cap)) >> LIM_BSS_CAPS_OFFSET_ ## cap)
+#define LIM_BSS_CAPS_SET(cap, val) (val) |= (LIM_BSS_CAPS_ ## cap )
+#define LIM_BSS_CAPS_CLR(cap, val) (val) &= (~ (LIM_BSS_CAPS_ ## cap))
+
+// 40 beacons per heart beat interval is the default + 1 to count the rest
+#define MAX_NO_BEACONS_PER_HEART_BEAT_INTERVAL 41
+
+/* max number of legacy bssid we can store during scan on one channel */
+#define MAX_NUM_LEGACY_BSSID_PER_CHANNEL 10
+
+#if defined WLAN_FEATURE_P2P
+#define P2P_WILDCARD_SSID "DIRECT-" //TODO Put it in proper place;
+#define P2P_WILDCARD_SSID_LEN 7
+
+#ifdef WLAN_FEATURE_CONCURRENT_P2P
+#define MAX_NO_OF_P2P_SESSIONS 5
+#endif //WLAN_FEATURE_CONCURRENT_P2P
+#endif //WLAN_FEATURE_P2P
+
+// -------------------------------------------------------------------
+// Change channel generic scheme
+typedef void (*CHANGE_CHANNEL_CALLBACK)(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
+ tpPESession psessionEntry);
+
+/// LIM global definitions
+typedef struct sAniSirLimIbss
+{
+ void *pHdr;
+ void *pBeacon;
+} tAniSirLimIbss;
+
+typedef struct sDialogueToken
+{
+ //bytes 0-3
+ tANI_U16 assocId;
+ tANI_U8 token;
+ tANI_U8 rsvd1;
+ //Bytes 4-7
+ tANI_U16 tid;
+ tANI_U8 rsvd2[2];
+
+ struct sDialogueToken* next;
+}tDialogueToken, *tpDialogueToken;
+
+typedef struct sLimTimers
+{
+ //TIMERS IN LIM ARE NOT SUPPOSED TO BE ZEROED OUT DURING RESET.
+ //DURING limInitialize DONOT ZERO THEM OUT.
+
+//STA SPECIFIC TIMERS
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ // Periodic background scan timer
+ TX_TIMER gLimBackgroundScanTimer;
+#endif
+
+ TX_TIMER gLimPreAuthClnupTimer;
+ //TX_TIMER gLimAuthResponseTimer[HAL_NUM_STA];
+
+ // Association related timers
+ TX_TIMER gLimAssocFailureTimer;
+ TX_TIMER gLimReassocFailureTimer;
+
+
+ /// Heartbeat timer on STA
+ TX_TIMER gLimHeartBeatTimer;
+
+ /// Wait for Probe after Heartbeat failure timer on STA
+ TX_TIMER gLimProbeAfterHBTimer;
+
+
+ // Authentication related timers
+ TX_TIMER gLimAuthFailureTimer;
+
+ // Join Failure timeout on STA
+ TX_TIMER gLimJoinFailureTimer;
+
+ // Keepalive timer
+ TX_TIMER gLimKeepaliveTimer;
+
+ // Scan related timers
+ TX_TIMER gLimMinChannelTimer;
+ TX_TIMER gLimMaxChannelTimer;
+ TX_TIMER gLimPeriodicProbeReqTimer;
+
+ // CNF_WAIT timer
+ TX_TIMER *gpLimCnfWaitTimer;
+
+ // Send Disassociate frame threshold parameters
+ TX_TIMER gLimSendDisassocFrameThresholdTimer;
+
+ TX_TIMER gLimAddtsRspTimer; // max wait for a response
+
+ // Update OLBC Cache Timer
+ TX_TIMER gLimUpdateOlbcCacheTimer;
+
+ TX_TIMER gLimChannelSwitchTimer;
+ // This TIMER is started on the STA, as indicated by the
+ // AP in its Quiet BSS IE, for the specified interval
+ TX_TIMER gLimQuietTimer;
+ // This TIMER is started on the AP, prior to the AP going
+ // into LEARN mode
+ // This TIMER is started on the STA, for the specified
+ // quiet duration
+ TX_TIMER gLimQuietBssTimer;
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ TX_TIMER gLimFTPreAuthRspTimer;
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+ TX_TIMER gLimCcxTsmTimer;
+#endif
+#ifdef WLAN_FEATURE_P2P
+ TX_TIMER gLimRemainOnChannelTimer;
+#endif
+
+//********************TIMER SECTION ENDS**************************************************
+// ALL THE FIELDS BELOW THIS CAN BE ZEROED OUT in limInitialize
+//****************************************************************************************
+
+}tLimTimers;
+
+
+typedef struct sAniSirLim
+{
+ ////////////////////////////////////// TIMER RELATED START ///////////////////////////////////////////
+
+ tLimTimers limTimers;
+ /// Flag to track if LIM timers are created or not
+ tANI_U32 gLimTimersCreated;
+
+
+ ////////////////////////////////////// TIMER RELATED END ///////////////////////////////////////////
+
+ ////////////////////////////////////// SCAN/LEARN RELATED START ///////////////////////////////////////////
+ /**
+ * This flag when set, will use scan mode instead of
+ * Learn mode on BP/AP. By default this flag is set
+ * to true until HIF getting stuck in 0x800 state is
+ * debugged.
+ */
+ tANI_U32 gLimUseScanModeForLearnMode;
+
+ /**
+ * This is useful for modules other than LIM
+ * to see if system is in scan/learn mode or not
+ */
+ tANI_U32 gLimSystemInScanLearnMode;
+
+ // Scan related globals on STA
+ tANI_U8 gLimReturnAfterFirstMatch;
+ tANI_U8 gLim24Band11dScanDone;
+ tANI_U8 gLim50Band11dScanDone;
+ tANI_U8 gLimReturnUniqueResults;
+
+ // Background Scan related globals on STA
+ tANI_U32 gLimNumOfBackgroundScanSuccess;
+ tANI_U32 gLimNumOfConsecutiveBkgndScanFailure;
+ tANI_U32 gLimNumOfForcedBkgndScan;
+ tANI_U8 gLimBackgroundScanDisable; //based on BG timer
+ tANI_U8 gLimForceBackgroundScanDisable; //debug control flag
+ tANI_U8 gLimBackgroundScanTerminate; //controlled by SME
+ tANI_U8 gLimReportBackgroundScanResults;//controlled by SME
+
+ /// Place holder for current channel ID
+ /// being scanned
+ tANI_U32 gLimCurrentScanChannelId;
+
+ // Hold onto SCAN criteria
+ tLimMlmScanReq *gpLimMlmScanReq;
+
+ /// This indicates total length of 'matched' scan results
+ tANI_U16 gLimMlmScanResultLength;
+
+ /// This indicates total length of 'cached' scan results
+ tANI_U16 gLimSmeScanResultLength;
+
+ /**
+ * Hash table definition for storing SCAN results
+ * This is the placed holder for 'cached' scan results
+ */
+ tLimScanResultNode
+ *gLimCachedScanHashTable[LIM_MAX_NUM_OF_SCAN_RESULTS];
+
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ /// Place holder for current channel ID
+ /// being scanned during background scanning
+ tANI_U32 gLimBackgroundScanChannelId;
+ /// flag to indicate that bacground scan timer has been started
+ tANI_U8 gLimBackgroundScanStarted;
+
+ /* Used to store the list of legacy bss sta detected during scan on one channel */
+ tANI_U16 gLimRestoreCBNumScanInterval;
+ tANI_U16 gLimRestoreCBCount;
+ tSirMacAddr gLimLegacyBssidList[MAX_NUM_LEGACY_BSSID_PER_CHANNEL];
+#endif
+
+ //
+ // If this flag is 1,
+ // then, LIM will "try and trigger" a background
+ // scan whenever it receives a Quiet BSS IE
+ //
+ // If this flag is 0,
+ // then, LIM will simply shut-off Tx/Rx whenever it
+ // receives a Quiet BSS IE.
+ // This is the default behavior when a Quiet BSS IE
+ // is received and 11H is enabled
+ //
+ tANI_U32 gLimTriggerBackgroundScanDuringQuietBss;
+
+#ifdef ANI_AP_SDK
+ tLimScanDurationConvert gLimScanDurationConvert; /* Used to store converted scan duration values in TU and TICKS */
+#endif /* ANI_AP_SDK */
+
+#ifdef WLAN_FEATURE_P2P
+ // This variable store the total duration to do scan
+ tANI_U32 gTotalScanDuration;
+#endif
+
+ // abort scan is used to abort an on-going scan
+ tANI_U8 abortScan;
+ tLimScanChnInfo scanChnInfo;
+
+ ////////////////////////////////////// SCAN/LEARN RELATED START ///////////////////////////////////////////
+ tSirMacAddr gSelfMacAddr; //added for BT-AMP Support
+
+ ////////////////////////////////////////// BSS RELATED END ///////////////////////////////////////////
+ // Place holder for StartBssReq message
+ // received by SME state machine
+
+#if defined(ANI_PRODUCT_TYPE_AP)
+ // Place holder for Neighbor BSS list received in
+ // SME_JOIN/REASSOC_REQ messages
+ tSirMultipleNeighborBssInfo gLimNeighborBssList;
+#endif
+ tANI_U8 gLimCurrentBssUapsd;
+
+
+/* These global varibales are now moved to session Table in order to support BT-AMP oct 9th review */
+#if 0
+ // Place holder for BSS description that we're
+ // currently joined with
+ tSirMacAddr gLimCurrentBssId;
+ tSirMacChanNum gLimCurrentChannelId;
+ tSirMacSSid gLimCurrentSSID;
+ tANI_U16 gLimCurrentBssCaps;
+
+ // QosCaps is a bit map of various qos capabilities - see defn above
+ tANI_U8 gLimCurrentBssQosCaps;
+ tANI_U16 gLimCurrentBssPropCap;
+ tANI_U8 gLimSentCapsChangeNtf;
+ tANI_U32 gLimCurrentTitanHtCaps;
+
+ // Place holder for BSS description that
+ // we're currently Reassociating
+ tSirMacAddr gLimReassocBssId;
+ tSirMacChanNum gLimReassocChannelId;
+ tSirMacSSid gLimReassocSSID;
+ tANI_U16 gLimReassocBssCaps;
+ tANI_U8 gLimReassocBssQosCaps;
+ tANI_U16 gLimReassocBssPropCap;
+ tANI_U32 gLimReassocTitanHtCaps;
+
+ tANI_U8 gLimBssIdx; // BSSIdx is made session speicific
+#endif
+
+ tANI_U8 gLimForceNoPropIE; /* This is used for testing sta legacy bss detect feature */
+
+ //
+ // Store the BSS Index returned by HAL during
+ // WDA_ADD_BSS_RSP here.
+ //
+ // For now:
+ // This will be used during WDA_SET_BSSKEY_REQ in
+ // order to set the GTK
+ // Later:
+ // There could be other interfaces needing this info
+ //
+
+ //
+ // Due to the asynchronous nature of the interface
+ // between PE <-> HAL, some transient information
+ // like this needs to be cached.
+ // This is cached upon receipt of eWNI_SME_SETCONTEXT_REQ.
+ // This is released while posting LIM_MLM_SETKEYS_CNF
+ //
+ void* gpLimMlmSetKeysReq;
+ void* gpLimMlmRemoveKeyReq;
+
+ //On STA: staid for self generated by HAL and sent as response to 'ADD STA' msg.
+ //On AP: staid corresponding to BSS generated by HAL and sent as response to 'ADD BSS' msg.
+ // tANI_U16 gLimStaid; // TO SUPPORT BT-AMP
+
+ ////////////////////////////////////////// BSS RELATED END ///////////////////////////////////////////
+
+ ////////////////////////////////////////// IBSS RELATED START ///////////////////////////////////////////
+ // This indicates whether we've a partner
+ // that is also transmitting Beacon frame
+ // in IBSS
+ //tANI_U8 gLimIbssActive; oct1 review
+
+ //This indicates whether this STA coalesced and adapter to peer's capabilities or not.
+ tANI_U8 gLimIbssCoalescingHappened;
+
+ /// Definition for storing IBSS peers BSS description
+ tLimIbssPeerNode *gLimIbssPeerList;
+ tANI_U32 gLimNumIbssPeers;
+
+ // ibss info - params for which ibss to join while coalescing
+ tAniSirLimIbss ibssInfo;
+
+ ////////////////////////////////////////// IBSS RELATED END ///////////////////////////////////////////
+
+ ////////////////////////////////////////// STATS/COUNTER RELATED START ///////////////////////////////////////////
+
+ tANI_U16 maxStation;
+ tANI_U16 maxBssId;
+
+ tANI_U32 gLimNumBeaconsRcvd;
+ tANI_U32 gLimNumBeaconsIgnored;
+
+ tANI_U32 gLimNumDeferredMsgs;
+
+ /// Variable to keep track of number of currently associated STAs
+ tANI_U16 gLimNumOfCurrentSTAs;
+ tANI_U16 gLimNumOfAniSTAs; // count of ANI peers
+ tANI_U16 gLimAssocStaLimit;
+
+ /// This indicates number of RXed Beacons during HB period
+ // tANI_U8 gLimRxedBeaconCntDuringHB;
+
+ // Heart-Beat interval value
+ tANI_U32 gLimHeartBeatCount;
+
+ // Statistics to keep track of no. beacons rcvd in heart beat interval
+ tANI_U16 gLimHeartBeatBeaconStats[MAX_NO_BEACONS_PER_HEART_BEAT_INTERVAL];
+
+#ifdef WLAN_DEBUG
+ // Debug counters
+ tANI_U32 numTot, numBbt, numProtErr, numLearn, numLearnIgnore;
+ tANI_U32 numSme, numMAC[4][16];
+
+ // Debug counter to track number of Assoc Req frame drops
+ // when received in pStaDs->mlmState other than LINK_ESTABLISED
+ tANI_U32 gLimNumAssocReqDropInvldState;
+ // counters to track rejection of Assoc Req due to Admission Control
+ tANI_U32 gLimNumAssocReqDropACRejectTS;
+ tANI_U32 gLimNumAssocReqDropACRejectSta;
+ // Debug counter to track number of Reassoc Req frame drops
+ // when received in pStaDs->mlmState other than LINK_ESTABLISED
+ tANI_U32 gLimNumReassocReqDropInvldState;
+ // Debug counter to track number of Hash Miss event that
+ // will not cause a sending of de-auth/de-associate frame
+ tANI_U32 gLimNumHashMissIgnored;
+
+ // Debug counter to track number of Beacon frames
+ // received in unexpected state
+ tANI_U32 gLimUnexpBcnCnt;
+
+ // Debug counter to track number of Beacon frames
+ // received in wt-join-state that do have SSID mismatch
+ tANI_U32 gLimBcnSSIDMismatchCnt;
+
+ // Debug counter to track number of Link establishments on STA/BP
+ tANI_U32 gLimNumLinkEsts;
+
+ // Debug counter to track number of Rx cleanup
+ tANI_U32 gLimNumRxCleanup;
+
+ // Debug counter to track different parse problem
+ tANI_U32 gLim11bStaAssocRejectCount;
+
+#endif
+
+ //Time stamp of the last beacon received from the BSS to which STA is connected.
+ tANI_U64 gLastBeaconTimeStamp;
+ //RX Beacon count for the current BSS to which STA is connected.
+ tANI_U32 gCurrentBssBeaconCnt;
+ tANI_U8 gLastBeaconDtimCount;
+ tANI_U8 gLastBeaconDtimPeriod;
+
+
+ ////////////////////////////////////////// STATS/COUNTER RELATED END ///////////////////////////////////////////
+
+
+ ////////////////////////////////////////// STATES RELATED START ///////////////////////////////////////////
+ // Counts Heartbeat failures
+ tANI_U8 gLimHBfailureCntInLinkEstState;
+ tANI_U8 gLimProbeFailureAfterHBfailedCnt;
+ tANI_U8 gLimHBfailureCntInOtherStates;
+
+ /**
+ * This variable indicates whether LIM module need to
+ * send response to host. Used to identify whether a request
+ * is generated internally within LIM module or by host
+ */
+ tANI_U8 gLimRspReqd;
+
+ /// Previous SME State
+ tLimSmeStates gLimPrevSmeState;
+
+ /// MLM State visible across all Sirius modules
+ tLimMlmStates gLimMlmState;
+
+ /// Previous MLM State
+ tLimMlmStates gLimPrevMlmState;
+
+#ifdef GEN4_SCAN
+ // LIM to HAL SCAN Management Message Interface states
+ tLimLimHalScanState gLimHalScanState;
+//WLAN_SUSPEND_LINK Related
+ SUSPEND_RESUME_LINK_CALLBACK gpLimSuspendCallback;
+ tANI_U32 *gpLimSuspendData;
+ SUSPEND_RESUME_LINK_CALLBACK gpLimResumeCallback;
+ tANI_U32 *gpLimResumeData;
+//end WLAN_SUSPEND_LINK Related
+ tANI_U8 fScanDisabled;
+ //Can be set to invalid channel. If it is invalid, HAL
+ //should move to previous valid channel or stay in the
+ //current channel.
+ tANI_U16 gResumeChannel;
+ //TODO - Add CB state here.
+#endif // GEN4_SCAN
+
+ // Change channel generic scheme
+ CHANGE_CHANNEL_CALLBACK gpchangeChannelCallback;
+ tANI_U32 *gpchangeChannelData;
+
+ /// SME State visible across all Sirius modules
+ tLimSmeStates gLimSmeState;
+ /// This indicates whether we're an AP, STA in BSS/IBSS
+ tLimSystemRole gLimSystemRole;
+
+ // Number of STAs that do not support short preamble
+ tLimNoShortParams gLimNoShortParams;
+
+ // Number of STAs that do not support short slot time
+ tLimNoShortSlotParams gLimNoShortSlotParams;
+
+
+ // OLBC parameters
+ tLimProtStaParams gLimOverlap11gParams;
+
+ tLimProtStaParams gLimOverlap11aParams;
+ tLimProtStaParams gLimOverlapHt20Params;
+ tLimProtStaParams gLimOverlapNonGfParams;
+
+ //
+ // ---------------- DPH -----------------------
+ // these used to live in DPH but are now moved here (where they belong)
+ tANI_U32 gLimPhyMode;
+ tANI_U32 propRateAdjustPeriod;
+ tANI_U32 scanStartTime; // used to measure scan time
+
+ tANI_U8 gLimBssid[6];
+ tANI_U8 gLimMyMacAddr[6];
+ tANI_U8 ackPolicy;
+
+ tANI_U8 gLimQosEnabled:1; //11E
+ tANI_U8 gLimWmeEnabled:1; //WME
+ tANI_U8 gLimWsmEnabled:1; //WSM
+ tANI_U8 gLimHcfEnabled:1;
+ tANI_U8 gLim11dEnabled:1;
+ tANI_U8 gLimProbeRespDisableFlag:1; // control over probe response
+ // ---------------- DPH -----------------------
+
+ ////////////////////////////////////////// STATES RELATED END ///////////////////////////////////////////
+
+ ////////////////////////////////////////// MISC RELATED START ///////////////////////////////////////////
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ // Place holder for alternate radio list
+ tSirMultipleAlternateRadioInfo gLimAlternateRadioList;
+#endif
+
+ // Place holder for Measurement Req/Rsp/Ind related info
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+ tpSirSmeMeasurementReq gpLimMeasReq;
+ tLimMeasParams gLimMeasParams;
+ tpLimMeasData gpLimMeasData;
+#endif
+
+ // WDS info
+ tANI_U32 gLimNumWdsInfoInd;
+ tANI_U32 gLimNumWdsInfoSet;
+ tSirWdsInfo gLimWdsInfo;
+
+ // Deferred Queue Paramters
+ tLimDeferredMsgQParams gLimDeferredMsgQ;
+
+ // addts request if any - only one can be outstanding at any time
+ tSirAddtsReq gLimAddtsReq;
+ tANI_U8 gLimAddtsSent;
+ tANI_U8 gLimAddtsRspTimerCount;
+
+ //protection related config cache
+ tCfgProtection cfgProtection;
+
+ tANI_U8 gLimProtectionControl;
+ //RF band to determibe 2.4/5 GHZ
+
+ // alternate radio info used by STA
+ tSirAlternateRadioInfo gLimAlternateRadio;
+
+ //This flag will remain to be set except while LIM is waiting for specific response messages
+ //from HAL. e.g when LIM issues ADD_STA req it will clear this flag and when it will receive
+ //the response the flag will be set.
+ tANI_U8 gLimProcessDefdMsgs;
+
+ // UAPSD flag used on AP
+ tANI_U8 gUapsdEnable;
+
+ /* Used on STA, this is a static UAPSD mask setting
+ * derived from SME_JOIN_REQ and SME_REASSOC_REQ. If a
+ * particular AC bit is set, it means the AC is both
+ * trigger enabled and delivery enabled.
+ */
+ tANI_U8 gUapsdPerAcBitmask;
+
+ /* Used on STA, this is a dynamic UPASD mask setting
+ * derived from AddTS Rsp and DelTS frame. If a
+ * particular AC bit is set, it means AC is trigger
+ * enabled.
+ */
+ tANI_U8 gUapsdPerAcTriggerEnableMask;
+
+ /* Used on STA, dynamic UPASD mask setting
+ * derived from AddTS Rsp and DelTs frame. If
+ * a particular AC bit is set, it means AC is
+ * delivery enabled.
+ */
+ tANI_U8 gUapsdPerAcDeliveryEnableMask;
+
+ /* Used on STA for AC downgrade. This is a dynamic mask
+ * setting which keep tracks of ACs being admitted.
+ * If bit is set to 0: That partiular AC is not admitted
+ * If bit is set to 1: That particular AC is admitted
+ */
+ tANI_U8 gAcAdmitMask[SIR_MAC_DIRECTION_DIRECT];
+
+ //dialogue token List head/tail for Action frames request sent.
+ tpDialogueToken pDialogueTokenHead;
+ tpDialogueToken pDialogueTokenTail;
+
+ tLimTspecInfo tspecInfo[LIM_NUM_TSPEC_MAX];
+
+ // admission control policy information
+ tLimAdmitPolicyInfo admitPolicyInfo;
+
+
+
+ ////////////////////////////////////////// MISC RELATED END ///////////////////////////////////////////
+
+ ////////////////////////////////////////// ASSOC RELATED START ///////////////////////////////////////////
+ // Place holder for JoinReq message
+ // received by SME state machine
+ // tpSirSmeJoinReq gpLimJoinReq;
+
+ // Place holder for ReassocReq message
+ // received by SME state machine
+ //tpSirSmeReassocReq gpLimReassocReq; sep23 review
+
+ /**
+ * Following is the place holder for free AID pool.
+ * A non-zero value indicates that AID is available
+ * for assignment.
+ */
+ tANI_U8 *gpLimAIDpool;
+ tANI_U8 freeAidHead;
+ tANI_U8 freeAidTail;
+
+ // Current Authentication type used at STA
+ //tAniAuthType gLimCurrentAuthType;
+
+ // Place holder for current authentication request
+ // being handled
+ tLimMlmAuthReq *gpLimMlmAuthReq;
+
+ // Place holder for Join request that we're
+ // currently attempting
+ tLimMlmJoinReq *gpLimMlmJoinReq;
+
+ // Reason code to determine the channel change context while sending
+ // WDA_CHNL_SWITCH_REQ message to HAL
+ tANI_U32 channelChangeReasonCode;
+
+ /// MAC level Pre-authentication related globals
+ tSirMacChanNum gLimPreAuthChannelNumber;
+ tAniAuthType gLimPreAuthType;
+ tSirMacAddr gLimPreAuthPeerAddr;
+ tANI_U32 gLimNumPreAuthContexts;
+ tLimPreAuthTable gLimPreAuthTimerTable;
+
+ // Placed holder to deauth reason
+ tANI_U16 gLimDeauthReasonCode;
+
+ // Place holder for Pre-authentication node list
+ struct tLimPreAuthNode * pLimPreAuthList;
+
+ // Send Disassociate frame threshold parameters
+ tANI_U16 gLimDisassocFrameThreshold;
+ tANI_U16 gLimDisassocFrameCredit;
+
+ // Assoc or ReAssoc Response Data/Frame
+ void *gLimAssocResponseData;
+
+ //One cache for each overlap and associated case.
+ tCacheParams protStaOverlapCache[LIM_PROT_STA_OVERLAP_CACHE_SIZE];
+ tCacheParams protStaCache[LIM_PROT_STA_CACHE_SIZE];
+
+ ////////////////////////////////////////// ASSOC RELATED END ///////////////////////////////////////////
+
+
+ // 11h Spectrum Management Related Flag
+ tANI_U32 gLim11hEnable;
+ tLimSpecMgmtInfo gLimSpecMgmt;
+ // CB Primary/Secondary Channel Switch Info
+ tLimChannelSwitchInfo gLimChannelSwitch;
+
+
+ // Channel Bonding mode, as configured by SME
+ tANI_U8 gCbMode;
+
+ //
+ // Identifies the runtime OPERATIONAL state of Channel
+ // Bonding. This info is encoded as a bitmap, as
+ // configured via gCbMode.
+ //
+ // b7 b6 b5 b4 b3 b2 b1 b0
+ // --------------------------------
+ // | X | X | X | AU|CS|U/D| O | A |
+ // --------------------------------
+ //
+ tANI_U8 gCbState;
+
+ //
+ // For DEBUG purposes
+ // Primarily for - TITAN BEACON workaround
+ // Symptom - TFP/PHY gets stuck
+ //
+ tANI_U32 gLimScanOverride;
+ // Holds the desired tSirScanType, as requested by SME
+ tSirScanType gLimScanOverrideSaved;
+
+ // Override with this Phy CB state always
+ //ePhyChanBondState gLimPhyCBState;
+
+ // When operating with -
+ // a) Channel Bonding mode (as configured by SME) AND
+ // b) CB State protection turned ON
+ // this object will save the CB state as desired by SME
+ //
+ // This object mimics the bitmap encoding of the
+ // gCbState object, as follows:
+ //
+ // b7 b6 b5 b4 b3 b2 b1 b0
+ // --------------------------------
+ // | X | X | X | AU|CS|U/D| O | A |
+ // --------------------------------
+ //
+ tANI_U8 gCbStateProtected;
+
+ //
+ // CB State protection, operated upon as follows:
+ // 1 - CB is enabled in the hardware ONLY WHEN a Titan
+ // STA associates with the AP
+ // 0 - CB is enabled/disabled based on the configuration
+ // received as per eWNI_SME_START_BSS_REQ
+ //
+ tANI_U32 gLimCBStateProtection;
+
+ // Count of TITAN STA's currently associated
+ tANI_U16 gLimTitanStaCount;
+
+ //
+ // For DEBUG purposes
+ // Primarily for - TITAN workaround
+ // Symptom - Avoid NULL data frames
+ // Applies to AP only
+ //
+ tANI_U32 gLimBlockNonTitanSta;
+ /////////////////////////// TITAN related globals //////////////////////////////////////////
+
+
+ //////////////////////////////// HT RELATED //////////////////////////////////////////
+ //
+ // The following global LIM variables maintain/manage
+ // the runtime configurations related to 802.11n
+
+ // 802.11n Station detected HT capability in Beacon Frame
+ tANI_U8 htCapabilityPresentInBeacon;
+
+ // 802.11 HT capability: Enabled or Disabled
+ tANI_U8 htCapability;
+
+
+ tANI_U8 gHTGreenfield;
+
+ //0-20Mhz
+ //1-40Mhz
+ tANI_U8 gHTSupportedChannelWidthSet;
+
+ tANI_U8 gHTShortGI40Mhz;
+ tANI_U8 gHTShortGI20Mhz;
+
+ //Set to 0 for 3839 octets
+ //Set to 1 for 7935 octets
+ tANI_U8 gHTMaxAmsduLength;
+
+
+ // DSSS/CCK at 40 MHz: Enabled 1 or Disabled
+ tANI_U8 gHTDsssCckRate40MHzSupport;
+
+ // PSMP Support: Enabled 1 or Disabled 0
+ tANI_U8 gHTPSMPSupport;
+
+ // L-SIG TXOP Protection used only if peer support available
+ tANI_U8 gHTLsigTXOPProtection;
+
+ // MIMO Power Save
+ tSirMacHTMIMOPowerSaveState gHTMIMOPSState;
+
+ // Scan In Power Save
+ tANI_U8 gScanInPowersave;
+
+ //
+ // A-MPDU Density
+ // 000 - No restriction
+ // 001 - 1/8 usec
+ // 010 - 1/4 usec
+ // 011 - 1/2 usec
+ // 100 - 1 usec
+ // 101 - 2 usec
+ // 110 - 4 usec
+ // 111 - 8 usec
+ //
+ tANI_U8 gHTAMpduDensity;
+
+ tANI_BOOLEAN gMaxAmsduSizeEnabled;
+ // Maximum Tx/Rx A-MPDU factor
+ tANI_U8 gHTMaxRxAMpduFactor;
+
+ //
+ // Scheduled PSMP related - Service Interval Granularity
+ // 000 - 5 ms
+ // 001 - 10 ms
+ // 010 - 15 ms
+ // 011 - 20 ms
+ // 100 - 25 ms
+ // 101 - 30 ms
+ // 110 - 35 ms
+ // 111 - 40 ms
+ //
+ tANI_U8 gHTServiceIntervalGranularity;
+
+ // Indicates whether an AP wants to associate PSMP enabled Stations
+ tANI_U8 gHTControlledAccessOnly;
+
+ // RIFS Mode. Set if no APSD legacy devices associated
+ tANI_U8 gHTRifsMode;
+ // OBss Mode . set when we have Non HT STA is associated or with in overlap bss
+ tANI_U8 gHTObssMode;
+ //
+ // Recommended Tx Width Set
+ // 0 - use 20 MHz channel (control channel)
+ // 1 - use channel width enabled under Supported Channel Width Set
+ //
+ tANI_U8 gHTRecommendedTxWidthSet;
+
+ // Identifies the 40 MHz extension channel
+ tSirMacHTSecondaryChannelOffset gHTSecondaryChannelOffset;
+
+ // Identifies the current Operating Mode
+ tSirMacHTOperatingMode gHTOperMode;
+
+ // Indicates if PCO is activated in the BSS
+ tANI_U8 gHTPCOActive;
+
+ //
+ // If PCO is active, indicates which PCO phase to use
+ // 0 - switch to 20 MHz phase
+ // 1 - switch to 40 MHz phase
+ //
+ tANI_U8 gHTPCOPhase;
+
+ //
+ // Used only in beacons. For PR, this is set to 0
+ // 0 - Primary beacon
+ // 1 - Secondary beacon
+ //
+ tANI_U8 gHTSecondaryBeacon;
+
+ //
+ // Dual CTS Protection
+ // 0 - Use RTS/CTS
+ // 1 - Dual CTS Protection is used
+ //
+ tANI_U8 gHTDualCTSProtection;
+
+ //
+ // Identifies a single STBC MCS that shall ne used for
+ // STBC control frames and STBC beacons
+ //
+ tANI_U8 gHTSTBCBasicMCS;
+
+ tANI_U8 gHTNonGFDevicesPresent;
+
+ tANI_U8 gAddBA_Declined; // Flag to Decline the BAR if the particular bit (0-7) is being set
+
+ //////////////////////////////// HT RELATED //////////////////////////////////////////
+
+
+ // wsc info required to form the wsc IE
+ tLimWscIeInfo wscIeInfo;
+ tpPESession gpSession ; //Pointer to session table
+ /*
+ * sessionID and transactionID from SME is stored here for those messages, for which
+ * there is no session context in PE, e.g. Scan related messages.
+ **/
+ tANI_U8 gSmeSessionId;
+ tANI_U16 gTransactionId;
+
+
+#ifdef WLAN_FEATURE_P2P
+ tSirRemainOnChnReq *gpLimRemainOnChanReq; //hold remain on chan request in this buf
+ vos_list_t gLimMgmtFrameRegistratinQueue;
+ tANI_U32 actionFrameSessionId;
+#endif
+} tAniSirLim, *tpAniSirLim;
+
+#ifdef WLAN_FEATURE_P2P
+typedef struct sLimMgmtFrameRegistration
+{
+ vos_list_node_t node; // MUST be first element
+ tANI_U16 frameType;
+ tANI_U16 matchLen;
+ tANI_U16 sessionId;
+ tANI_U8 matchData[1];
+} tLimMgmtFrameRegistration, *tpLimMgmtFrameRegistration;
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI
+typedef struct sRrmContext
+{
+ tRrmSMEContext rrmSmeContext;
+ tRrmPEContext rrmPEContext;
+}tRrmContext, *tpRrmContext;
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+typedef struct sFTContext
+{
+ tftSMEContext ftSmeContext;
+ tftPEContext ftPEContext;
+} tftContext, *tpFTContext;
+#endif
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+//Check if this definition can actually move here even for Volans. In that case
+//this featurization can be removed.
+/** ------------------------------------------------------------------------- *
+
+ \typedef tDriverType
+
+ \brief Indicate the driver type to the mac, and based on this do
+ appropriate initialization.
+
+ -------------------------------------------------------------------------- */
+
+typedef enum
+{
+ eDRIVER_TYPE_PRODUCTION = 0,
+ eDRIVER_TYPE_MFG = 1,
+ eDRIVER_TYPE_DVT = 2
+} tDriverType;
+
+/** ------------------------------------------------------------------------- *
+
+ \typedef tMacOpenParameters
+
+ \brief Parameters needed for Enumeration of all status codes returned by the higher level
+ interface functions.
+
+ -------------------------------------------------------------------------- */
+
+typedef struct sMacOpenParameters
+{
+ tANI_U16 maxStation;
+ tANI_U16 maxBssId;
+ tANI_U32 frameTransRequired;
+ tDriverType driverType;
+} tMacOpenParameters;
+
+typedef enum
+{
+ HAL_STOP_TYPE_SYS_RESET,
+ HAL_STOP_TYPE_SYS_DEEP_SLEEP,
+ HAL_STOP_TYPE_RF_KILL
+}tHalStopType;
+
+typedef struct sHalMacStartParameters
+{
+ // parametes for the Firmware
+ //tHalFirmwareParameters FW;
+ tDriverType driverType;
+
+} tHalMacStartParameters;
+#endif
+
+// -------------------------------------------------------------------
+/// MAC Sirius parameter structure
+typedef struct sAniSirGlobal
+
+{
+ tDriverType gDriverType;
+#if defined(ANI_OS_TYPE_RTAI_LINUX)
+ struct rtLibApp * rt;
+#endif
+
+ // we should be able to save this hddHandle in here and deprecate
+ // the pAdapter. For now, compiles are a problem because there
+ // are dependencides on the header files that are not handling the
+ // compiler very gracefully.
+// tHddHandle hHdd; // Handle to the HDD.
+ //void *hHdd;
+ void *pAdapter; // deprecate this pAdapter pointer eventually...
+ // all interfaces to the HDD should pass hHdd, which
+ // is stored in this struct above.....
+ tSirMbMsg* pResetMsg;
+ tAniSirCfg cfg;
+ tAniSirLim lim;
+ //tAniSirDph dph;
+ tAniSirPmm pmm;
+ tAniSirSch sch;
+ tAniSirSys sys;
+ tAniSirUtils utils;
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+ tAniSirHal hal;
+ tAniSirPhy hphy;
+#endif
+
+#ifndef WLAN_FTM_STUB
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+ tPttModuleVariables ptt;
+#endif
+#endif
+
+ tAniSirTxWrapper txWrapper;
+ // PAL/HDD handle
+ tHddHandle hHdd;
+
+#ifdef ANI_DVT_DEBUG
+ tAniSirDvt dvt;
+#endif
+
+ tSmeStruct sme;
+ tCsrScanStruct scan;
+ tCsrRoamStruct roam;
+
+
+#ifdef ANI_PRODUCT_TYPE_CLIENT
+ tPmcInfo pmc;
+ tSmeBtcInfo btc;
+#endif
+
+ tCcm ccm;
+
+#if defined WLAN_FEATURE_VOWIFI
+ tRrmContext rrm;
+#endif
+#ifdef WLAN_FEATURE_P2P
+#ifdef WLAN_FEATURE_CONCURRENT_P2P
+ tp2pContext p2pContext[MAX_NO_OF_P2P_SESSIONS];
+#else
+ tp2pContext p2pContext;
+#endif
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+ tftContext ft;
+#endif
+
+ tANI_U32 gCurrentLogSize;
+ tANI_U32 menuCurrent;
+ /* logDump specific */
+ tANI_U32 dumpTablecurrentId;
+ /* Instead of static allocation I will dyanamically allocate memory for dumpTableEntry
+ Thinking of using linkedlist */
+ tDumpModuleEntry *dumpTableEntry[MAX_DUMP_TABLE_ENTRY];
+
+} tAniSirGlobal;
+
+
+
+#endif /* _ANIGLOBAL_H */
+
diff --git a/CORE/MAC/inc/aniParam.h b/CORE/MAC/inc/aniParam.h
new file mode 100644
index 0000000..b9a361d
--- /dev/null
+++ b/CORE/MAC/inc/aniParam.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved
+ * aniParam.h: MAC parameter interface.
+ * Author: Kevin Nguyen
+ * Date: 09/09/2002
+ *
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------------
+ *
+ */
+
+#ifndef _ANIPARAM_H
+#define _ANIPARAM_H
+
+#include "halTypes.h"
+
+/**
+ * -------------------------------------------------------------------------*
+ * MAC parameter structure *
+ * This structure is the only interface passed between the MAC FW and the *
+ * host driver. *
+ * *
+ * Host-to-MAC parameters: *
+ * ======================= *
+ * radioId: radio ID (1 or 2) *
+ * pPacketBufAlloc: function pointer for SKBuffer allocation *
+ * pPacketBufFree : function pointer for SKBuffer free *
+ * *
+ *-------------------------------------------------------------------------
+ */
+typedef struct
+{
+ // HDD to MAC parameters
+ int radioId;
+
+ void (*pPacketBufAlloc)(unsigned short size, void **ppBuf,
+ void **ppSkb, void *dev);
+ void (*pPacketBufFree)(void* pBuf, void *pSkb);
+
+ int rx_tasklet;
+
+ // block table allocated by HDD
+ void * block_table;
+
+ tHalHandle hHalHandle;
+
+} tAniMacParam;
+
+
+#ifdef ANI_AP_SDK
+#define NUM_RADIO 1
+#else
+#define NUM_RADIO 2
+#endif
+
+
+#endif /* _ANIPARAM_H */
+
+
diff --git a/CORE/MAC/inc/aniSystemDefs.h b/CORE/MAC/inc/aniSystemDefs.h
new file mode 100644
index 0000000..f8b1f9f
--- /dev/null
+++ b/CORE/MAC/inc/aniSystemDefs.h
@@ -0,0 +1,230 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file aniSystemDefs.h contains definitions used by
+ * various ANI entities
+ * Author: Chandra Modumudi
+ * Date: 09/18/2002
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+
+#ifndef __ANI_SYSTEM_DEFS_H
+#define __ANI_SYSTEM_DEFS_H
+
+#include "sirTypes.h"
+#include "sirMacProtDef.h"
+
+#define ANI_OUI 0x000AF5
+
+/// Max WDS info length.
+#define ANI_WDS_INFO_MAX_LENGTH 64
+
+
+/// Max number of SSIDs to support Multiple SSID feature
+#define ANI_MAX_NUM_OF_SSIDS 16
+
+//This is to force compiler to use the maximum of an int for enum
+#define SIR_MAX_ENUM_SIZE 0x7FFFFFFF
+
+/* Max key size including the WAPI and TKIP */
+#define WLAN_MAX_KEY_RSC_LEN 16
+#define WLAN_WAPI_KEY_RSC_LEN 16
+
+
+
+#ifndef FALSE
+#undef FALSE
+#define FALSE 0
+#endif
+#ifndef TRUE
+#undef TRUE
+#define TRUE 1
+#endif
+
+typedef enum eAniBool
+{
+ eSIR_FALSE,
+ eSIR_TRUE,
+ eSIR_DONOT_USE_BOOL = SIR_MAX_ENUM_SIZE
+} tAniBool;
+
+/// Authentication type enum used with peer
+typedef enum eAniAuthType
+{
+ eSIR_OPEN_SYSTEM,
+ eSIR_SHARED_KEY,
+#if defined WLAN_FEATURE_VOWIFI_11R
+ eSIR_FT_AUTH,
+#endif
+#if defined FEATURE_WLAN_CCX
+ eSIR_LEAP_AUTH = 0x80,
+#endif
+ eSIR_AUTO_SWITCH,
+ eSIR_DONOT_USE_AUTH_TYPE = SIR_MAX_ENUM_SIZE
+} tAniAuthType;
+
+/// Encryption type enum used with peer
+typedef enum eAniEdType
+{
+ eSIR_ED_NONE,
+ eSIR_ED_WEP40,
+ eSIR_ED_WEP104,
+ eSIR_ED_TKIP,
+ eSIR_ED_CCMP,
+#if defined(FEATURE_WLAN_WAPI)
+ eSIR_ED_WPI,
+#endif
+ /*DPU HW treats encryption mode 4 plus RMF bit set in TX BD as BIP.
+ Thus while setting BIP encryption mode in corresponding DPU Desc
+ eSIR_ED_AES_128_CMAC should be set to eSIR_ED_CCMP*/
+ eSIR_ED_AES_128_CMAC,
+ eSIR_ED_NOT_IMPLEMENTED = SIR_MAX_ENUM_SIZE
+} tAniEdType;
+
+
+typedef enum eAniWepType
+{
+ eSIR_WEP_STATIC,
+ eSIR_WEP_DYNAMIC,
+} tAniWepType;
+
+/// Enum to specify whether key is used
+/// for TX only, RX only or both
+typedef enum eAniKeyDirection
+{
+ eSIR_TX_ONLY,
+ eSIR_RX_ONLY,
+ eSIR_TX_RX,
+#ifdef WLAN_SOFTAP_FEATURE
+ eSIR_TX_DEFAULT,
+#endif
+ eSIR_DONOT_USE_KEY_DIRECTION = SIR_MAX_ENUM_SIZE
+} tAniKeyDirection;
+
+/// Enum for rate
+typedef enum eAniRate
+{
+ eSIR_ANY_RATE
+} tAniRate;
+
+typedef struct sAniSSID
+{
+ tANI_U8 length;
+ tANI_U8 ssId[SIR_MAC_MAX_SSID_LENGTH];
+} tAniSSID, *tpAniSSID;
+
+typedef struct sAniApName
+{
+ tANI_U8 length;
+ tANI_U8 name[SIR_MAC_MAX_SSID_LENGTH];
+} tAniApName, *tpAniApName;
+
+/// RSN IE information
+typedef struct sSirRSNie
+{
+ tANI_U16 length;
+ tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
+} tSirRSNie, *tpSirRSNie;
+
+/// Additional IE information :
+/// This can include WSC IE, P2P IE, and/or FTIE from upper layer.
+/// MAC layer transparently convey these IE info between peer STA and upper layer,
+/// but never requires to parse it.
+typedef struct sSirAddie
+{
+ tANI_U16 length;
+ tANI_U8 addIEdata[SIR_MAC_MAX_IE_LENGTH+2];
+} tSirAddie, *tpSirAddie;
+
+#ifdef FEATURE_WLAN_CCX
+
+// The CCKM IE needs to be in the
+// Join and Reassoc Req.
+typedef struct sSirCCKMie
+{
+ tANI_U16 length;
+ tANI_U8 cckmIEdata[SIR_MAC_MAX_IE_LENGTH+2];
+} tSirCCKMie, *tpSirCCKMie;
+
+#endif
+
+/// Need to refine structure definitions for Keying material,
+/// QoS policy, etc
+
+/// Definition Quality of Service
+typedef struct sSirQos
+{
+ tANI_U16 temp1; // Need to define later
+ tANI_U16 temp2; // Need to define later
+} tSirQos, *tpSirQos;
+
+/// Definition for Encryption Keys
+typedef struct sSirKeys
+{
+ tANI_U8 keyId;
+ tANI_U8 unicast; // 0 for multicast
+ tAniKeyDirection keyDirection;
+ tANI_U8 keyRsc[WLAN_MAX_KEY_RSC_LEN]; // Usage is unknown
+ tANI_U8 paeRole; // =1 for authenticator,
+ // =0 for supplicant
+ tANI_U16 keyLength;
+ tANI_U8 key[SIR_MAC_MAX_KEY_LENGTH];
+} tSirKeys, *tpSirKeys;
+
+/// Definition for Keying material
+typedef struct sSirKeyMaterial
+{
+ tANI_U16 length; // This is the length of all
+ // data that follows
+ tAniEdType edType; // Encryption/Decryption type
+ tANI_U8 numKeys;
+ tSirKeys key[1];
+} tSirKeyMaterial, *tpSirKeyMaterial;
+
+#define SIR_CIPHER_SEQ_CTR_SIZE 6
+/// Definition for MIC failure indication
+typedef struct sSirMicFailureInfo
+{
+ tSirMacAddr srcMacAddr; //address used to compute MIC
+ tSirMacAddr taMacAddr; //transmitter address
+ tSirMacAddr dstMacAddr;
+ tAniBool multicast;
+ tANI_U8 IV1; // first byte of IV
+ tANI_U8 keyId; // second byte of IV
+ tANI_U8 TSC[SIR_CIPHER_SEQ_CTR_SIZE]; // sequence number
+ tSirMacAddr rxMacAddr; // receive address
+
+} tSirMicFailureInfo, *tpSirMicFailureInfo;
+
+// Boa command. Used mainly for radar info persistance
+typedef struct sBoaCommand
+{
+ tANI_U8 length;
+ tANI_U8 cmd[64];
+}tBoaCommand;
+
+#endif /* __ANI_SYSTEM_DEFS_H */
+
diff --git a/CORE/MAC/inc/logDump.h b/CORE/MAC/inc/logDump.h
new file mode 100644
index 0000000..4af9cdd
--- /dev/null
+++ b/CORE/MAC/inc/logDump.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*============================================================================
+Copyright (c) 2007 QUALCOMM Incorporated.
+All Rights Reserved.
+Qualcomm Confidential and Proprietary
+
+logDump.h
+
+Provides api's for dump commands.
+
+Author: Santosh Mandiganal
+Date: 04/06/2008
+============================================================================*/
+
+
+#ifndef __LOGDUMP_H__
+#define __LOGDUMP_H__
+
+#define MAX_DUMP_CMD 999
+#define MAX_DUMP_TABLE_ENTRY 10
+
+typedef char * (*tpFunc)(tpAniSirGlobal, tANI_U32, tANI_U32, tANI_U32, tANI_U32, char *);
+
+typedef struct sDumpFuncEntry {
+ tANI_U32 id;
+ char *description;
+ tpFunc func;
+} tDumpFuncEntry;
+
+typedef struct sDumpModuleEntry {
+ tANI_U32 mindumpid;
+ tANI_U32 maxdumpid;
+ tANI_U32 nItems;
+ tDumpFuncEntry *dumpTable;
+} tDumpModuleEntry;
+
+typedef struct sRegList {
+ tANI_U32 addr;
+ char *name;
+} tLogdRegList;
+
+int log_sprintf(tpAniSirGlobal pMac, char *pBuf, char *fmt, ... );
+
+char *
+dump_thread_info( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p);
+
+char *
+dump_log_level_set( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p);
+
+char *
+dump_cfg_set( tpAniSirGlobal pMac, tANI_U32 arg1,
+ tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p);
+
+char *
+dump_cfg_get( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2,
+ tANI_U32 arg3, tANI_U32 arg4, char *p);
+
+char *
+dump_cfg_group_get( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2,
+ tANI_U32 arg3, tANI_U32 arg4, char *p);
+
+void logDumpRegisterTable( tpAniSirGlobal pMac, tDumpFuncEntry *pEntry,
+ tANI_U32 nItems );
+
+
+void logDumpInit(tpAniSirGlobal pMac);
+
+#endif /* __LOGDUMP_H__ */
diff --git a/CORE/MAC/inc/macInitApi.h b/CORE/MAC/inc/macInitApi.h
new file mode 100644
index 0000000..91d0c32
--- /dev/null
+++ b/CORE/MAC/inc/macInitApi.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * macInitApi.c - Header file for mac level init functions
+ * Author: Dinesh Upadhyay
+ * Date: 04/23/2007
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------------
+ *
+ */
+#ifndef __MAC_INIT_API_H
+#define __MAC_INIT_API_H
+
+#include "aniGlobal.h"
+
+tSirRetStatus macStart(tHalHandle hHal, void* pHalMacStartParams);
+tSirRetStatus macStop(tHalHandle hHal, tHalStopType stopType);
+tSirRetStatus macOpen(tHalHandle * pHalHandle, tHddHandle hHdd, tMacOpenParameters * pMacOpenParms);
+tSirRetStatus macClose(tHalHandle hHal);
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+tSirRetStatus macPreStart(tHalHandle hHal);
+#endif
+
+#endif //__MAC_INIT_API_H
+
diff --git a/CORE/MAC/inc/macTrace.h b/CORE/MAC/inc/macTrace.h
new file mode 100644
index 0000000..6de267c
--- /dev/null
+++ b/CORE/MAC/inc/macTrace.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**=========================================================================
+
+ \file macTrace.h
+
+ \brief definition for trace related APIs
+
+ \author Sunit Bhatia
+
+ Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
+
+ Qualcomm Confidential and Proprietary.
+
+ ========================================================================*/
+
+
+
+#ifndef __MAC_TRACE_H
+#define __MAC_TRACE_H
+
+#include "aniGlobal.h"
+
+
+#ifdef TRACE_RECORD
+
+#define CASE_RETURN_STRING( str ) \
+ case ( ( str ) ): return( (tANI_U8*)(#str) ); break \
+
+#define MAC_TRACE_GET_MODULE_ID(data) ((data >> 8) & 0xff)
+#define MAC_TRACE_GET_MSG_ID(data) (data & 0xffff)
+
+
+typedef struct sTraceRecord
+{
+ tANI_U16 time;
+ tANI_U8 module;
+ tANI_U8 code;
+ tANI_U8 session;
+ tANI_U32 data;
+}tTraceRecord, *tpTraceRecord;
+
+
+
+#define MAX_TRACE_RECORDS 500
+#define INVALID_TRACE_ADDR 0xffffffff
+#define DEFAULT_TRACE_DUMP_COUNT 200
+
+
+
+typedef void (*tpTraceCb)(tpAniSirGlobal, tpTraceRecord, tANI_U16);
+
+
+
+
+typedef struct sTraceData
+{
+ tANI_U32 head;
+ tANI_U32 tail;
+ tANI_U32 num;
+ tANI_U16 numSinceLastDump;
+
+ //Config for controlling the trace
+ tANI_U8 enable;
+ tANI_U16 dumpCount; //will dump after number of records reach this number.
+
+}tTraceData;
+
+
+
+void macTraceInit(tpAniSirGlobal pMac);
+void macTraceReset(tpAniSirGlobal pMac);
+void macTrace(tpAniSirGlobal pMac, tANI_U8 code, tANI_U8 session, tANI_U32 data);
+void macTraceNew(tpAniSirGlobal pMac, tANI_U8 module, tANI_U8 code, tANI_U8 session, tANI_U32 data);
+void macTraceDumpAll(tpAniSirGlobal pMac, tANI_U8 code, tANI_U8 session, tANI_U32 count);
+void macTraceCfg(tpAniSirGlobal pMac, tANI_U32 enable, tANI_U32 dumpWhenFull, tANI_U32 code, tANI_U32 session);
+void macTraceRegister( tpAniSirGlobal pMac, VOS_MODULE_ID moduleId, tpTraceCb traceCb);
+tANI_U8* macTraceGetCfgMsgString( tANI_U16 cfgMsg );
+tANI_U8* macTraceGetLimMsgString( tANI_U16 limMsg );
+tANI_U8* macTraceGetHalMsgString( tANI_U16 halMsg );
+tANI_U8* macTraceGetSmeMsgString( tANI_U16 smeMsg );
+tANI_U8* macTraceGetModuleString( tANI_U8 moduleId);
+
+
+
+#endif
+
+#endif
+
diff --git a/CORE/MAC/inc/qwlan_version.h b/CORE/MAC/inc/qwlan_version.h
new file mode 100644
index 0000000..5e3c6bc
--- /dev/null
+++ b/CORE/MAC/inc/qwlan_version.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef QWLAN_VERSION_H
+#define QWLAN_VERSION_H
+/*===========================================================================
+
+FILE:
+ qwlan_version.h
+
+BRIEF DESCRIPTION:
+ WLAN Host Version file.
+ Build number automaticly updated by build scripts.
+
+
+ Copyright (c) 2008-2011 QUALCOMM Incorporated.
+ All Right Reserved.
+ Qualcomm Confidential and Proprietary
+===========================================================================*/
+
+#define QWLAN_VERSION_MAJOR 3
+#define QWLAN_VERSION_MINOR 1
+#define QWLAN_VERSION_PATCH 7
+#define QWLAN_VERSION_EXTRA ""
+#define QWLAN_VERSION_BUILD 9
+
+#define QWLAN_VERSIONSTR "3.1.7.9"
+
+#endif /* QWLAN_VERSION_H */
diff --git a/CORE/MAC/inc/sirApi.h b/CORE/MAC/inc/sirApi.h
new file mode 100644
index 0000000..0daad70
--- /dev/null
+++ b/CORE/MAC/inc/sirApi.h
@@ -0,0 +1,4230 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file sirApi.h contains definitions exported by
+ * Sirius software.
+ * Author: Chandra Modumudi
+ * Date: 04/16/2002
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+
+#ifndef __SIR_API_H
+#define __SIR_API_H
+
+#include "sirTypes.h"
+#include "sirMacProtDef.h"
+#include "aniSystemDefs.h"
+
+#ifdef FEATURE_WLAN_CCX
+#include "ccxGlobal.h"
+#endif
+
+/// Maximum number of STAs allowed in the BSS
+#define SIR_MAX_NUM_STA 256
+
+/// Maximum number of Neighbors reported by STA for LB feature
+#define SIR_MAX_NUM_NEIGHBOR_BSS 3
+
+/// Maximum number of Neighbors reported by STA for LB feature
+#define SIR_MAX_NUM_ALTERNATE_RADIOS 5
+
+/// Maximum size of SCAN_RSP message
+#define SIR_MAX_SCAN_RSP_MSG_LENGTH 2600
+
+/// Start of Sirius software/Host driver message types
+#define SIR_HAL_HOST_MSG_START 0x1000
+
+/// Power save level definitions
+#define SIR_MAX_POWER_SAVE 3
+#define SIR_INTERMEDIATE_POWER_SAVE 4
+#define SIR_NO_POWER_SAVE 5
+
+/// Max supported channel list
+#define SIR_MAX_SUPPORTED_CHANNEL_LIST 96
+
+/// Maximum DTIM Factor
+#define SIR_MAX_DTIM_FACTOR 32
+
+#define SIR_MDIE_SIZE 3
+
+
+
+#define SIR_NUM_11B_RATES 4 //1,2,5.5,11
+#define SIR_NUM_11A_RATES 8 //6,9,12,18,24,36,48,54
+#define SIR_NUM_POLARIS_RATES 3 //72,96,108
+#define SIR_NUM_TITAN_RATES 26
+#define SIR_NUM_TAURUS_RATES 4 //136.5, 151.7,283.5,315
+#define SIR_NUM_PROP_RATES (SIR_NUM_TITAN_RATES + SIR_NUM_TAURUS_RATES)
+
+#define SIR_11N_PROP_RATE_136_5 (1<<28)
+#define SIR_11N_PROP_RATE_151_7 (1<<29)
+#define SIR_11N_PROP_RATE_283_5 (1<<30)
+#define SIR_11N_PROP_RATE_315 (1<<31)
+#define SIR_11N_PROP_RATE_BITMAP 0x80000000 //only 315MBPS rate is supported today
+//Taurus is going to support 26 Titan Rates(no ESF/concat Rates will be supported)
+//First 26 bits are reserved for Titan and last 4 bits for Taurus, 2(27 and 28) bits are reserved.
+//#define SIR_TITAN_PROP_RATE_BITMAP 0x03FFFFFF
+//Disable all Titan rates
+#define SIR_TITAN_PROP_RATE_BITMAP 0
+#define SIR_CONVERT_2_U32_BITMAP(nRates) ((nRates + 31)/32)
+
+/* #tANI_U32's needed for a bitmap representation for all prop rates */
+#define SIR_NUM_U32_MAP_RATES SIR_CONVERT_2_U32_BITMAP(SIR_NUM_PROP_RATES)
+
+
+#define SIR_PM_SLEEP_MODE 0
+#define SIR_PM_ACTIVE_MODE 1
+
+// Used by various modules to load ALL CFG's
+#define ANI_IGNORE_CFG_ID 0xFFFF
+
+//hidden SSID options
+#define SIR_SCAN_NO_HIDDEN_SSID 0
+#define SIR_SCAN_HIDDEN_SSID_PE_DECISION 1
+#define SIR_SCAN_HIDDEN_SSID 2
+
+#define SIR_MAC_ADDR_LEN 6
+#define SIR_IPV4_ADDR_LEN 4
+
+typedef tANI_U8 tSirIpv4Addr[SIR_IPV4_ADDR_LEN];
+
+#define SIR_VERSION_STRING_LEN 64
+typedef tANI_U8 tSirVersionString[SIR_VERSION_STRING_LEN];
+
+enum eSirHostMsgTypes
+{
+ SIR_HAL_APP_SETUP_NTF = SIR_HAL_HOST_MSG_START,
+ SIR_HAL_INITIAL_CAL_FAILED_NTF,
+ SIR_HAL_NIC_OPER_NTF,
+ SIR_HAL_INIT_START_REQ,
+ SIR_HAL_SHUTDOWN_REQ,
+ SIR_HAL_SHUTDOWN_CNF,
+ SIR_HAL_RESET_REQ,
+ SIR_HAL_RADIO_ON_OFF_IND,
+ SIR_HAL_RESET_CNF,
+ SIR_WRITE_TO_TD,
+ SIR_HAL_HDD_ADDBA_REQ, // MAC -> HDD
+ SIR_HAL_HDD_ADDBA_RSP, // HDD -> HAL
+ SIR_HAL_DELETEBA_IND, // MAC -> HDD
+ SIR_HAL_BA_FAIL_IND, // HDD -> MAC
+ SIR_TL_HAL_FLUSH_AC_REQ,
+ SIR_HAL_TL_FLUSH_AC_RSP
+};
+
+
+
+/**
+ * Module ID definitions.
+ */
+enum {
+ SIR_BOOT_MODULE_ID = 1,
+ SIR_HAL_MODULE_ID = 0x10,
+ SIR_CFG_MODULE_ID,
+ SIR_LIM_MODULE_ID,
+ SIR_ARQ_MODULE_ID,
+ SIR_SCH_MODULE_ID,
+ SIR_PMM_MODULE_ID,
+ SIR_MNT_MODULE_ID,
+ SIR_DBG_MODULE_ID,
+ SIR_DPH_MODULE_ID,
+ SIR_SYS_MODULE_ID,
+ SIR_SMS_MODULE_ID,
+
+ SIR_PHY_MODULE_ID = 0x20,
+
+
+ // Add any modules above this line
+ SIR_DVT_MODULE_ID
+};
+
+#define SIR_WDA_MODULE_ID SIR_HAL_MODULE_ID
+
+/**
+ * First and last module definition for logging utility
+ *
+ * NOTE: The following definitions need to be updated if
+ * the above list is changed.
+ */
+#define SIR_FIRST_MODULE_ID SIR_HAL_MODULE_ID
+#define SIR_LAST_MODULE_ID SIR_DVT_MODULE_ID
+
+
+// Type declarations used by Firmware and Host software
+
+// Scan type enum used in scan request
+typedef enum eSirScanType
+{
+ eSIR_PASSIVE_SCAN,
+ eSIR_ACTIVE_SCAN,
+} tSirScanType;
+
+/// Result codes Firmware return to Host SW
+typedef enum eSirResultCodes
+{
+ eSIR_SME_SUCCESS,
+
+ eSIR_EOF_SOF_EXCEPTION,
+ eSIR_BMU_EXCEPTION,
+ eSIR_LOW_PDU_EXCEPTION,
+ eSIR_USER_TRIG_RESET,
+ eSIR_LOGP_EXCEPTION,
+ eSIR_CP_EXCEPTION,
+ eSIR_STOP_BSS,
+ eSIR_AHB_HANG_EXCEPTION,
+ eSIR_DPU_EXCEPTION,
+ eSIR_RPE_EXCEPTION,
+ eSIR_TPE_EXCEPTION,
+ eSIR_DXE_EXCEPTION,
+ eSIR_RXP_EXCEPTION,
+ eSIR_MCPU_EXCEPTION,
+ eSIR_MCU_EXCEPTION,
+ eSIR_MTU_EXCEPTION,
+ eSIR_MIF_EXCEPTION,
+ eSIR_FW_EXCEPTION,
+ eSIR_PS_MUTEX_READ_EXCEPTION,
+ eSIR_PHY_HANG_EXCEPTION,
+ eSIR_MAILBOX_SANITY_CHK_FAILED,
+ eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF, // Only where this switch is present
+ eSIR_CFB_FLAG_STUCK_EXCEPTION,
+
+ eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS=30,
+
+ eSIR_SME_INVALID_PARAMETERS=500,
+ eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,
+ eSIR_SME_RESOURCES_UNAVAILABLE,
+ eSIR_SME_SCAN_FAILED, // Unable to find a BssDescription
+ // matching requested scan criteria
+ eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED,
+ eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE,
+ eSIR_SME_REFUSED,
+ eSIR_SME_JOIN_TIMEOUT_RESULT_CODE,
+ eSIR_SME_AUTH_TIMEOUT_RESULT_CODE,
+ eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE,
+ eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE,
+ eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED,
+ eSIR_SME_AUTH_REFUSED,
+ eSIR_SME_INVALID_WEP_DEFAULT_KEY,
+ eSIR_SME_NO_KEY_MAPPING_KEY_FOR_PEER,
+ eSIR_SME_ASSOC_REFUSED,
+ eSIR_SME_REASSOC_REFUSED,
+ eSIR_SME_DEAUTH_WHILE_JOIN, //Received Deauth while joining or pre-auhtentication.
+ eSIR_SME_DISASSOC_WHILE_JOIN, //Received Disassociation while joining.
+ eSIR_SME_DEAUTH_WHILE_REASSOC, //Received Deauth while ReAssociate.
+ eSIR_SME_DISASSOC_WHILE_REASSOC, //Received Disassociation while ReAssociate
+ eSIR_SME_STA_NOT_AUTHENTICATED,
+ eSIR_SME_STA_NOT_ASSOCIATED,
+ eSIR_SME_STA_DISASSOCIATED,
+ eSIR_SME_ALREADY_JOINED_A_BSS,
+ eSIR_ULA_COMPLETED,
+ eSIR_ULA_FAILURE,
+ eSIR_SME_LINK_ESTABLISHED,
+ eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS,
+ eSIR_SME_UNABLE_TO_PERFORM_DFS,
+ eSIR_SME_DFS_FAILED,
+ eSIR_SME_TRANSFER_STA, // To be used when STA need to be LB'ed
+ eSIR_SME_INVALID_LINK_TEST_PARAMETERS,// Given in LINK_TEST_START_RSP
+ eSIR_SME_LINK_TEST_MAX_EXCEEDED, // Given in LINK_TEST_START_RSP
+ eSIR_SME_UNSUPPORTED_RATE, // Given in LINK_TEST_RSP if peer does
+ // support requested rate in
+ // LINK_TEST_REQ
+ eSIR_SME_LINK_TEST_TIMEOUT, // Given in LINK_TEST_IND if peer does
+ // not respond before next test packet
+ // is sent
+ eSIR_SME_LINK_TEST_COMPLETE, // Given in LINK_TEST_IND at the end
+ // of link test
+ eSIR_SME_LINK_TEST_INVALID_STATE, // Given in LINK_TEST_START_RSP
+ eSIR_SME_LINK_TEST_TERMINATE, // Given in LINK_TEST_START_RSP
+ eSIR_SME_LINK_TEST_INVALID_ADDRESS, // Given in LINK_TEST_STOP_RSP
+ eSIR_SME_POLARIS_RESET, // Given in SME_STOP_BSS_REQ
+ eSIR_SME_SETCONTEXT_FAILED, // Given in SME_SETCONTEXT_REQ when
+ // unable to plumb down keys
+ eSIR_SME_BSS_RESTART, // Given in SME_STOP_BSS_REQ
+
+ eSIR_SME_MORE_SCAN_RESULTS_FOLLOW, // Given in SME_SCAN_RSP message
+ // that more SME_SCAN_RSP
+ // messages are following.
+ // SME_SCAN_RSP message with
+ // eSIR_SME_SUCCESS status
+ // code is the last one.
+ eSIR_SME_INVALID_ASSOC_RSP_RXED, // Sent in SME_JOIN/REASSOC_RSP
+ // messages upon receiving
+ // invalid Re/Assoc Rsp frame.
+ eSIR_SME_MIC_COUNTER_MEASURES, // STOP BSS triggered by MIC failures: MAC software to disassoc all stations
+ // with MIC_FAILURE reason code and perform the stop bss operation
+ eSIR_SME_ADDTS_RSP_TIMEOUT, // didn't get response from peer within
+ // timeout interval
+ eSIR_SME_ADDTS_RSP_FAILED, // didn't get success response from HAL
+ eSIR_SME_RECEIVED,
+ // TBA - TSPEC related Result Codes
+
+ eSIR_SME_CHANNEL_SWITCH_FAIL, // failed to send out Channel Switch Action Frame
+ eSIR_SME_INVALID_STA_ROLE,
+ eSIR_SME_INVALID_STATE,
+#ifdef GEN4_SCAN
+ eSIR_SME_CHANNEL_SWITCH_DISABLED, // either 11h is disabled or channelSwitch is currently active
+ eSIR_SME_HAL_SCAN_INIT_FAILED, // SIR_HAL_SIR_HAL_INIT_SCAN_RSP returned failed status
+ eSIR_SME_HAL_SCAN_START_FAILED, // SIR_HAL_START_SCAN_RSP returned failed status
+ eSIR_SME_HAL_SCAN_END_FAILED, // SIR_HAL_END_SCAN_RSP returned failed status
+ eSIR_SME_HAL_SCAN_FINISH_FAILED, // SIR_HAL_FINISH_SCAN_RSP returned failed status
+ eSIR_SME_HAL_SEND_MESSAGE_FAIL, // Failed to send a message to HAL
+#else // GEN4_SCAN
+ eSIR_SME_CHANNEL_SWITCH_DISABLED, // either 11h is disabled or channelSwitch is currently active
+ eSIR_SME_HAL_SEND_MESSAGE_FAIL, // Failed to send a message to HAL
+#endif // GEN4_SCAN
+ eSIR_SME_STOP_BSS_FAILURE, // Failed to stop the bss
+ eSIR_SME_STA_ASSOCIATED,
+ eSIR_SME_INVALID_PMM_STATE,
+ eSIR_SME_CANNOT_ENTER_IMPS,
+ eSIR_SME_IMPS_REQ_FAILED,
+ eSIR_SME_BMPS_REQ_FAILED,
+ eSIR_SME_UAPSD_REQ_FAILED,
+ eSIR_SME_WOWL_ENTER_REQ_FAILED,
+ eSIR_SME_WOWL_EXIT_REQ_FAILED,
+#if defined WLAN_FEATURE_VOWIFI_11R
+ eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE,
+ eSIR_SME_FT_REASSOC_FAILURE,
+#endif
+#ifdef WLAN_FEATURE_P2P
+ eSIR_SME_SEND_ACTION_FAIL,
+#endif
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+ eSIR_SME_PC_FILTER_MATCH_COUNT_REQ_FAILED,
+#endif // WLAN_FEATURE_PACKET_FILTERING
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+ eSIR_SME_GTK_OFFLOAD_GETINFO_REQ_FAILED,
+#endif // WLAN_FEATURE_GTK_OFFLOAD
+ eSIR_DONOT_USE_RESULT_CODE = SIR_MAX_ENUM_SIZE
+} tSirResultCodes;
+
+//
+// Enumerated constants to identify
+// 1) the operating state of Channel Bonding
+// 2) the secondary CB channel to be used
+//
+typedef enum eAniCBSecondaryMode
+{
+ eANI_CB_SECONDARY_NONE,
+ eANI_CB_SECONDARY_DOWN,
+ eANI_CB_SECONDARY_UP,
+ eANI_DONOT_USE_SECONDARY_MODE = SIR_MAX_ENUM_SIZE
+} tAniCBSecondaryMode;
+
+
+
+
+/* each station added has a rate mode which specifies the sta attributes */
+typedef enum eStaRateMode {
+ eSTA_TAURUS = 0,
+ eSTA_TITAN,
+ eSTA_POLARIS,
+ eSTA_11b,
+ eSTA_11bg,
+ eSTA_11a,
+ eSTA_11n,
+ eSTA_INVALID_RATE_MODE
+} tStaRateMode, *tpStaRateMode;
+
+//although in tSirSupportedRates each IE is 16bit but PE only passes IEs in 8 bits with MSB=1 for basic rates.
+//change the mask for bit0-7 only so HAL gets correct basic rates for setting response rates.
+#define IERATE_BASICRATE_MASK 0x80
+#define IERATE_RATE_MASK 0x7f
+#define IERATE_IS_BASICRATE(x) ((x) & IERATE_BASICRATE_MASK)
+#define ANIENHANCED_TAURUS_RATEMAP_BITOFFSET_START 28
+
+typedef struct sSirSupportedRates {
+ /*
+ * For Self STA Entry: this represents Self Mode.
+ * For Peer Stations, this represents the mode of the peer.
+ * On Station:
+ * --this mode is updated when PE adds the Self Entry.
+ * -- OR when PE sends 'ADD_BSS' message and station context in BSS is used to indicate the mode of the AP.
+ * ON AP:
+ * -- this mode is updated when PE sends 'ADD_BSS' and Sta entry for that BSS is used
+ * to indicate the self mode of the AP.
+ * -- OR when a station is associated, PE sends 'ADD_STA' message with this mode updated.
+ */
+
+ tStaRateMode opRateMode;
+ // 11b, 11a and aniLegacyRates are IE rates which gives rate in unit of 500Kbps
+ tANI_U16 llbRates[SIR_NUM_11B_RATES];
+ tANI_U16 llaRates[SIR_NUM_11A_RATES];
+ tANI_U16 aniLegacyRates[SIR_NUM_POLARIS_RATES];
+
+ //Taurus only supports 26 Titan Rates(no ESF/concat Rates will be supported)
+ //First 26 bits are reserved for those Titan rates and
+ //the last 4 bits(bit28-31) for Taurus, 2(bit26-27) bits are reserved.
+ tANI_U32 aniEnhancedRateBitmap; //Titan and Taurus Rates
+
+ /*
+ * 0-76 bits used, remaining reserved
+ * bits 0-15 and 32 should be set.
+ */
+ tANI_U8 supportedMCSSet[SIR_MAC_MAX_SUPPORTED_MCS_SET];
+
+ /*
+ * RX Highest Supported Data Rate defines the highest data
+ * rate that the STA is able to receive, in unites of 1Mbps.
+ * This value is derived from "Supported MCS Set field" inside
+ * the HT capability element.
+ */
+ tANI_U16 rxHighestDataRate;
+
+} tSirSupportedRates, *tpSirSupportedRates;
+
+
+typedef enum eSirRFBand
+{
+ SIR_BAND_UNKNOWN,
+ SIR_BAND_2_4_GHZ,
+ SIR_BAND_5_GHZ,
+} tSirRFBand;
+
+
+/*
+* Specifies which beacons are to be indicated upto the host driver when
+* Station is in power save mode.
+*/
+typedef enum eBeaconForwarding
+{
+ ePM_BEACON_FWD_NTH,
+ ePM_BEACON_FWD_TIM,
+ ePM_BEACON_FWD_DTIM,
+ ePM_BEACON_FWD_NONE
+} tBeaconForwarding;
+
+
+#ifdef WLAN_FEATURE_P2P
+typedef struct sSirRemainOnChnReq
+{
+ tANI_U16 messageType;
+ tANI_U16 length;
+ tANI_U8 sessionId;
+ tSirMacAddr selfMacAddr;
+ tANI_U8 chnNum;
+ tANI_U8 phyMode;
+ tANI_U32 duration;
+ tANI_U8 probeRspIe[1];
+}tSirRemainOnChnReq, *tpSirRemainOnChnReq;
+
+typedef struct sSirRegisterMgmtFrame
+{
+ tANI_U16 messageType;
+ tANI_U16 length;
+ tANI_U8 sessionId;
+ tANI_BOOLEAN registerFrame;
+ tANI_U16 frameType;
+ tANI_U16 matchLen;
+ tANI_U8 matchData[1];
+}tSirRegisterMgmtFrame, *tpSirRegisterMgmtFrame;
+#endif
+
+//
+// A bit-encoding, identifying the new TITAN capabilities
+// and state information. The capabilities being exposed
+// are -
+// Concatenation
+// Compression
+//FIXME_CBMODE: need to seperate out HT and TITAN CB mode fields.
+// Channel Bonding - Only this filed is used for HT also.
+// Reverse FCS
+//
+// The bitfield encoding is as follows -
+//
+// b7 b6 b5 b4 b3 b2 b1 b0
+// --------------------------------------
+// | X | X |CB/O|CB/O|CB/A|RFCS| CP | CC |
+// --------------------------------------
+// where,
+// CC - Concatenation: 1 - ON, 0 - OFF
+// CP - Compression: 1 - ON, 0 - OFF
+// RFCS - Reverse FCS Support: 1 - ON, 0 - OFF
+// CB/A - Channel Bonding "Admin" state: 1 - ON, 0 - OFF
+// CB/O - Channel Bonding "Oper" state:
+// 00 - CB Oper state OFF
+// 01 - CB Secondary channel DOWN
+// 10 - CB Secondary channel UP
+// 11 - Reserved
+// X - Don't care
+//
+// This enumerated data type is used for IPC between the
+// LIM and SME (WSM/HDD) for the following northbound
+// interfaces -
+// LIM -> WSM
+// tSirNeighborBssInfo,
+// tSirSmeAssocInd,
+// tSirSmeReassocInd
+//
+// LIM -> HDD/Roaming
+// tSirBssDescription
+//
+typedef tANI_U8 tAniTitanHtCapabilityInfo;
+
+//
+// Identifies the neighbor BSS' that was(were) detected
+// by an STA and reported to the AP
+//
+typedef struct sAniTitanCBNeighborInfo
+{
+ // A BSS was found on the Primary
+ tANI_U8 cbBssFoundPri;
+
+ // A BSS was found on the adjacent Upper Secondary
+ tANI_U8 cbBssFoundSecUp;
+
+ // A BSS was found on the adjacent Lower Secondary
+ tANI_U8 cbBssFoundSecDown;
+
+} tAniTitanCBNeighborInfo, *tpAniTitanCBNeighborInfo;
+
+//
+// MACRO's to extract info from tAniTitanHtCapabilityInfo
+//
+#define SME_GET_CONCAT_STATE(titanHtCaps) \
+ (titanHtCaps & 0x01)
+#define SME_SET_CONCAT_STATE(titanHtCaps,state) \
+ (((state) == eHAL_CLEAR)? \
+ ((titanHtCaps) = (titanHtCaps) & (0x3E)): \
+ ((titanHtCaps) = (titanHtCaps) | (0x01)))
+
+#define SME_GET_COMPRESSION_STATE(titanHtCaps) \
+ ((titanHtCaps & 0x02) >> 1)
+#define SME_SET_COMPRESSION_STATE(titanHtCaps,state) \
+ (((state) == eHAL_CLEAR)? \
+ ((titanHtCaps) = (titanHtCaps) & (0x3D)): \
+ ((titanHtCaps) = (titanHtCaps) | (0x02)))
+
+#define SME_GET_RFCS_STATE(titanHtCaps) \
+ ((titanHtCaps & 0x04) >> 2)
+#define SME_SET_RFCS_STATE(titanHtCaps,state) \
+ (((state) == eHAL_CLEAR)? \
+ ((titanHtCaps) = (titanHtCaps) & (0x3B)): \
+ ((titanHtCaps) = (titanHtCaps) | (0x04)))
+
+#define SME_GET_CB_ADMIN_STATE(titanHtCaps) \
+ ((titanHtCaps & 0x08) >> 3)
+#define SME_SET_CB_ADMIN_STATE(titanHtCaps,state) \
+ (((state) == eHAL_CLEAR)? \
+ ((titanHtCaps) = (titanHtCaps) & (0x37)): \
+ ((titanHtCaps) = (titanHtCaps) | (0x08)))
+
+// NOTE - The value returned by this MACRO, SME_GET_CB_OPER_STATE,
+// can be used along with the enumerated type,
+// tAniCBSecondaryMode, to identify the Admin/Oper state of CB
+#define SME_GET_CB_OPER_STATE(titanHtCaps) \
+ ((titanHtCaps & 0x30) >> 4)
+#define SME_SET_CB_OPER_STATE(titanHtCaps,state) \
+ ((titanHtCaps) = (tANI_U8)(((titanHtCaps) & (0x0F)) | ((state) << 4)))
+
+/// Generic type for sending a response message
+/// with result code to host software
+typedef struct sSirSmeRsp
+{
+ tANI_U16 messageType; // eWNI_SME_*_RSP
+ tANI_U16 length;
+ tANI_U8 sessionId; // To support BT-AMP
+ tANI_U16 transactionId; // To support BT-AMP
+ tSirResultCodes statusCode;
+} tSirSmeRsp, *tpSirSmeRsp;
+
+/// Definition for kick starting Firmware on STA
+typedef struct sSirSmeStartReq
+{
+ tANI_U16 messageType; // eWNI_SME_START_REQ
+ tANI_U16 length;
+ tANI_U8 sessionId; //Added for BT-AMP Support
+ tANI_U16 transcationId; //Added for BT-AMP Support
+ tSirMacAddr bssId; //Added For BT-AMP Support
+ tANI_U32 roamingAtPolaris;
+#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA) || defined(ANI_AP_CLIENT_SDK)
+ tANI_U32 sendNewBssInd;
+#endif
+} tSirSmeStartReq, *tpSirSmeStartReq;
+
+/// Definition for indicating all modules ready on STA
+typedef struct sSirSmeReadyReq
+{
+ tANI_U16 messageType; // eWNI_SME_SYS_READY_IND
+ tANI_U16 length;
+ tANI_U16 transactionId;
+} tSirSmeReadyReq, *tpSirSmeReadyReq;
+
+/// Definition for response message to previously issued start request
+typedef struct sSirSmeStartRsp
+{
+ tANI_U16 messageType; // eWNI_SME_START_RSP
+ tANI_U16 length;
+ tSirResultCodes statusCode;
+ tANI_U16 transactionId;
+} tSirSmeStartRsp, *tpSirSmeStartRsp;
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+/**
+ * Trigger Type
+ */
+typedef enum {
+ // During Initialization and NM triggers only
+ eSIR_TRIGGER_INIT_NM,
+
+ // During Initialization, NM triggers and Periodic evaluation
+ eSIR_TRIGGER_INIT_NM_PERIODIC
+}tSirDfsTrigType;
+#endif
+
+/// Definition for Load structure
+typedef struct sSirLoad
+{
+ tANI_U16 numStas;
+ tANI_U16 channelUtilization;
+} tSirLoad, *tpSirLoad;
+
+/// BSS type enum used in while scanning/joining etc
+typedef enum eSirBssType
+{
+ eSIR_INFRASTRUCTURE_MODE,
+#ifdef WLAN_SOFTAP_FEATURE
+ eSIR_INFRA_AP_MODE, //Added for softAP support
+#endif
+ eSIR_IBSS_MODE,
+ eSIR_BTAMP_STA_MODE, //Added for BT-AMP support
+ eSIR_BTAMP_AP_MODE, //Added for BT-AMP support
+ eSIR_AUTO_MODE,
+ eSIR_DONOT_USE_BSS_TYPE = SIR_MAX_ENUM_SIZE
+} tSirBssType;
+
+/// Definition for WDS Information
+typedef struct sSirWdsInfo
+{
+ tANI_U16 wdsLength;
+ tANI_U8 wdsBytes[ANI_WDS_INFO_MAX_LENGTH];
+} tSirWdsInfo, *tpSirWdsInfo;
+
+/// Power Capability info used in 11H
+typedef struct sSirMacPowerCapInfo
+{
+ tANI_U8 minTxPower;
+ tANI_U8 maxTxPower;
+} tSirMacPowerCapInfo, *tpSirMacPowerCapInfo;
+
+/// Supported Channel info used in 11H
+typedef struct sSirSupChnl
+{
+ tANI_U8 numChnl;
+ tANI_U8 channelList[SIR_MAX_SUPPORTED_CHANNEL_LIST];
+} tSirSupChnl, *tpSirSupChnl;
+
+typedef enum eSirNwType
+{
+ eSIR_11A_NW_TYPE,
+ eSIR_11B_NW_TYPE,
+ eSIR_11G_NW_TYPE,
+ eSIR_11N_NW_TYPE,
+ eSIR_DONOT_USE_NW_TYPE = SIR_MAX_ENUM_SIZE
+} tSirNwType;
+
+/// Definition for new iBss peer info
+typedef struct sSirNewIbssPeerInfo
+{
+ tSirMacAddr peerAddr;
+ tANI_U16 aid;
+} tSirNewIbssPeerInfo, *tpSirNewIbssPeerInfo;
+
+/// Definition for Alternate BSS info
+typedef struct sSirAlternateRadioInfo
+{
+ tSirMacAddr bssId;
+ tANI_U8 channelId;
+} tSirAlternateRadioInfo, *tpSirAlternateRadioInfo;
+
+/// Definition for Alternate BSS list
+typedef struct sSirAlternateRadioList
+{
+ tANI_U8 numBss;
+ tSirAlternateRadioInfo alternateRadio[1];
+} tSirAlternateRadioList, *tpSirAlternateRadioList;
+
+/// Definition for kick starting BSS
+/// ---> MAC
+/**
+ * Usage of ssId, numSSID & ssIdList:
+ * ---------------------------------
+ * 1. ssId.length of zero indicates that Broadcast/Suppress SSID
+ * feature is enabled.
+ * 2. If ssId.length is zero, MAC SW will advertise NULL SSID
+ * and interpret the SSID list from numSSID & ssIdList.
+ * 3. If ssId.length is non-zero, MAC SW will advertise the SSID
+ * specified in the ssId field and it is expected that
+ * application will set numSSID to one (only one SSID present
+ * in the list) and SSID in the list is same as ssId field.
+ * 4. Application will always set numSSID >= 1.
+ */
+//*****NOTE: Please make sure all codes are updated if inserting field into this structure..**********
+typedef struct sSirSmeStartBssReq
+{
+ tANI_U16 messageType; // eWNI_SME_START_BSS_REQ
+ tANI_U16 length;
+ tANI_U8 sessionId; //Added for BT-AMP Support
+ tANI_U16 transactionId; //Added for BT-AMP Support
+ tSirMacAddr bssId; //Added for BT-AMP Support
+ tSirMacAddr selfMacAddr; //Added for BT-AMP Support
+ tANI_U16 beaconInterval; //Added for BT-AMP Support
+ tANI_U8 dot11mode;
+ tSirBssType bssType;
+ tSirMacSSid ssId;
+ tANI_U8 channelId;
+ tAniCBSecondaryMode cbMode;
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+ tSirAlternateRadioList alternateRadioList;
+ tANI_S8 powerLevel;
+ tSirWdsInfo wdsInfo;
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE
+ tANI_U8 privacy;
+ tANI_U8 apUapsdEnable;
+ tANI_U8 ssidHidden;
+ tANI_BOOLEAN fwdWPSPBCProbeReq;
+ tANI_BOOLEAN protEnabled;
+ tANI_BOOLEAN obssProtEnabled;
+ tANI_U16 ht_capab;
+ tAniAuthType authType;
+ tANI_U32 dtimPeriod;
+ tANI_U8 wps_state;
+#endif
+ tVOS_CON_MODE bssPersona;
+
+ tSirRSNie rsnIE; // RSN IE to be sent in
+ // Beacon and Probe
+ // Response frames
+ tSirNwType nwType; // Indicates 11a/b/g
+ tSirMacRateSet operationalRateSet;// Has 11a or 11b rates
+ tSirMacRateSet extendedRateSet; // Has 11g rates
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+ tANI_U8 numSSID;
+ tSirMacSSid ssIdList[ANI_MAX_NUM_OF_SSIDS];
+#endif
+} tSirSmeStartBssReq, *tpSirSmeStartBssReq;
+
+#define GET_IE_LEN_IN_BSS(lenInBss) ( lenInBss + sizeof(lenInBss) - \
+ ((int) OFFSET_OF( tSirBssDescription, ieFields)))
+
+#define WSCIE_PROBE_RSP_LEN (317 + 2)
+
+typedef struct sSirBssDescription
+{
+ //offset of the ieFields from bssId.
+ tANI_U16 length;
+ tSirMacAddr bssId;
+ v_TIME_t scanSysTimeMsec;
+ tANI_U32 timeStamp[2];
+ tANI_U16 beaconInterval;
+ tANI_U16 capabilityInfo;
+ tSirNwType nwType; // Indicates 11a/b/g
+ tANI_U8 aniIndicator;
+ tANI_S8 rssi;
+ tANI_S8 sinr;
+ //channelId what peer sent in beacon/probersp.
+ tANI_U8 channelId;
+ //channelId on which we are parked at.
+ //used only in scan case.
+ tANI_U8 channelIdSelf;
+ tANI_U8 sSirBssDescriptionRsvd[3];
+ //
+ // FIXME - This structure is not packed!
+ // Thus, the fields should be aligned at DWORD boundaries
+ // Elsewhere, titanHtCaps is of type tAniTitanHtCapabilityInfo
+ //
+ tANI_U32 titanHtCaps;
+ tANI_TIMESTAMP nReceivedTime; //base on a tick count. It is a time stamp, not a relative time.
+#if defined WLAN_FEATURE_VOWIFI
+ tANI_U32 parentTSF;
+ tANI_U32 startTSF[2];
+#endif
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ tANI_U8 mdiePresent;
+ tANI_U8 mdie[SIR_MDIE_SIZE]; // MDIE for 11r, picked from the beacons
+#endif
+#ifdef FEATURE_WLAN_CCX
+ tANI_U16 QBSSLoad_present;
+ tANI_U16 QBSSLoad_avail;
+#endif
+ // Please keep the structure 4 bytes aligned above the ieFields
+
+ tANI_U8 fProbeRsp; //whether it is from a probe rsp
+ tANI_U32 WscIeLen;
+ tANI_U8 WscIeProbeRsp[WSCIE_PROBE_RSP_LEN];
+
+ tANI_U32 ieFields[1];
+} tSirBssDescription, *tpSirBssDescription;
+
+/// Definition for response message to previously
+/// issued start BSS request
+/// MAC --->
+typedef struct sSirSmeStartBssRsp
+{
+ tANI_U16 messageType; // eWNI_SME_START_BSS_RSP
+ tANI_U16 length;
+ tANI_U8 sessionId;
+ tANI_U16 transactionId;//transaction ID for cmd
+ tSirResultCodes statusCode;
+ tSirBssType bssType;//Add new type for WDS mode
+ tANI_U16 beaconInterval;//Beacon Interval for both type
+ tANI_U32 staId;//Staion ID for Self
+ tSirBssDescription bssDescription;//Peer BSS description
+} tSirSmeStartBssRsp, *tpSirSmeStartBssRsp;
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+typedef struct sSirMeasControl
+{
+ // Periodic Measurements enabled flag
+ tAniBool periodicMeasEnabled;
+ // Indicates whether to involve STAs in measurements or not
+ tAniBool involveSTAs;
+ // Basic or enhanced measurement metrics
+ // 0 - for basic, 1 - for enhanced
+ tANI_U8 metricsType;
+ // Indicates active or passive scanning
+ tSirScanType scanType;
+ // Following indicates how often measurements
+ // on each channel are made for long-scan-duration
+ tANI_U8 longChannelScanPeriodicity;
+ //
+ // Channel Bonding plus 11H related scan control
+ // 0 - CB and/or 11H is disabled
+ // 1 - CB and 11H is enabled
+ //
+ tANI_BOOLEAN cb11hEnabled;
+} tSirMeasControl, *tpSirMeasControl;
+
+typedef struct sSirMeasDuration
+{
+ // Following indicates time duration over which
+ // all channels in the channelList to be measured once
+ tANI_U32 shortTermPeriod;
+ // Following indicates time duration over which
+ // cached DFS measurements are averaged
+ tANI_U32 averagingPeriod;
+ // Following indicates time duration for making
+ // DFS measurements on each channel
+ tANI_U32 shortChannelScanDuration;
+ // Following indicates time duration for making
+ // DFS measurements on each channel for long term measurements
+ tANI_U32 longChannelScanDuration;
+} tSirMeasDuration, *tpSirMeasDuration;
+#endif
+
+typedef struct sSirChannelList
+{
+ tANI_U8 numChannels;
+ tANI_U8 channelNumber[1];
+} tSirChannelList, *tpSirChannelList;
+
+#ifdef FEATURE_WLAN_CCX
+typedef struct sTspecInfo {
+ tANI_U8 valid;
+ tSirMacTspecIE tspec;
+} tTspecInfo;
+
+#define SIR_CCX_MAX_TSPEC_IES 4
+typedef struct sCCXTspecTspecInfo {
+ tANI_U8 numTspecs;
+ tTspecInfo tspec[SIR_CCX_MAX_TSPEC_IES];
+} tCCXTspecInfo;
+#endif
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+/// Definition for Neighbor BSS info
+typedef struct sSirNeighborBssInfo
+{
+ tSirMacAddr bssId;
+ tANI_U8 channelId;
+ tAniTitanHtCapabilityInfo titanHtCaps;
+ tAniBool wniIndicator;
+ tSirBssType bssType;
+ tANI_U8 sinr;
+ tANI_S8 rssi;
+ tSirLoad load;
+ tAniSSID ssId;
+ tAniApName apName;
+ tSirRSNie rsnIE;
+#if 0
+ tDot11fIEHTCaps HTCaps;
+ tDot11fIEHTInfo HTInfo;
+#endif
+ tSirNwType nwType; // Indicates 11a/b/g
+ tANI_U16 capabilityInfo;
+ tSirMacRateSet operationalRateSet; // Has 11a or 11b rates
+ tSirMacRateSet extendedRateSet; // Has 11g rates
+ tANI_U16 beaconInterval;
+ tANI_U8 dtimPeriod;
+ tANI_U8 HTCapsPresent;
+ tANI_U8 HTInfoPresent;
+ tANI_U8 wmeInfoPresent;
+ tANI_U8 wmeEdcaPresent;
+ tANI_U8 wsmCapablePresent;
+ tANI_U8 hcfEnabled;
+ tANI_U16 propIECapability;
+ tANI_U32 localPowerConstraints;
+ tANI_S32 aggrRssi;
+ tANI_U32 dataCount;
+ tANI_U32 totalPackets;
+} tSirNeighborBssInfo, *tpSirNeighborBssInfo;
+
+
+/// Definition for Neighbor BSS with WDS info
+typedef struct sSirNeighborBssWdsInfo
+{
+ tSirNeighborBssInfo neighborBssInfo;
+ tSirWdsInfo wdsInfo;
+} tSirNeighborBssWdsInfo, *tpSirNeighborBssWdsInfo;
+
+/// Definition for Neighbor BSS list
+typedef struct sSirNeighborBssList
+{
+ tANI_U32 numBss;
+ tSirNeighborBssInfo bssList[1];
+} tSirNeighborBssList, *tpSirNeighborBssList;
+
+/// Definition for Neighbor BSS list with WDS info
+typedef struct sSirNeighborBssWdsList
+{
+ tANI_U32 numBssWds;
+ tSirNeighborBssWdsInfo bssWdsList[1];
+} tSirNeighborBssWdsList, *tpSirNeighborBssWdsList;
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+/// Definition for kick starting measurements
+/// ---> MAC
+typedef struct sSirSmeMeasurementReq
+{
+ tANI_U16 messageType; // eWNI_SME_MEASUREMENT_REQ
+ tANI_U16 length;
+ tSirMeasControl measControl;
+ tSirMeasDuration measDuration;
+ // This indicates how often SME_MEASUREMENT_IND message
+ // is sent to host
+ tANI_U32 measIndPeriod;
+ // This channel list will have current channel also
+ tSirChannelList channelList;
+} tSirSmeMeasurementReq, *tpSirSmeMeasurementReq;
+
+/// Definition for response message to previously
+/// issued Measurement request
+/// MAC --->
+typedef struct sSirSmeMeasurementRsp
+{
+ tANI_U16 messageType; // eWNI_SME_MEASUREMENT_RSP
+ tANI_U16 length;
+ tSirResultCodes statusCode;
+ tANI_U16 transactionId; // Transaction ID for cmd
+} tSirSmeMeasurementRsp, *tpSirSmeMeasurementRsp;
+
+/// Definition for Measurement Matrix info
+// NOTE: This should include current channel measurements
+typedef struct sSirMeasMatrixInfo
+{
+ tANI_U8 channelNumber;
+ tANI_S8 compositeRssi;
+ tANI_S32 aggrRssi; // Due to all packets in this channel
+ tANI_U32 totalPackets;
+} tSirMeasMatrixInfo, *tpSirMeasMatrixInfo;
+
+/// Definition for Measurement Matrix List
+typedef struct sSirMeasMatrixList
+{
+ tANI_U8 numChannels;
+ tSirMeasMatrixInfo measMatrixList[1];
+} tSirMeasMatrixList, *tpSirMeasMatrixList;
+/// Definition for Measurement indication
+/// MAC --->
+/// Note : This is only sent when there was prior
+/// SME_MEASUREMENT_REQ received by MAC
+typedef struct sSirSmeMeasurementInd
+{
+ tANI_U16 messageType; // eWNI_SME_MEASUREMENT_IND
+ tANI_U16 length;
+ tANI_U32 duration;
+ tSirLoad currentLoad; // on this AP radio
+ tSirMeasMatrixList measMatrixList;
+ tSirNeighborBssWdsList neighborBssWdsList;
+} tSirSmeMeasurementInd, *tpSirSmeMeasurementInd;
+
+/// Definition for Backhaul Link status change Indication
+/// MAC --->
+typedef struct sSirSmeWdsInfoInd
+{
+ tANI_U16 messageType; // eWNI_SME_WDS_INFO_IND
+ tANI_U16 length;
+ tSirWdsInfo wdsInfo;
+} tSirSmeWdsInfoInd, *tpSirSmeWdsInfoInd;
+
+/// Definition for Backhaul Link Info Set Request
+/// ---> MAC
+typedef struct sSirSmeSetWdsInfoReq
+{
+ tANI_U16 messageType; // eWNI_SME_SET_WDS_INFO_REQ
+ tANI_U16 length;
+ tANI_U16 transactionId;
+ tSirWdsInfo wdsInfo;
+} tSirSmeSetWdsInfoReq, *tpSirSmeSetWdsInfoReq;
+
+/// Definition for Backhaul Link Lnfo Set Response
+/// MAC --->
+typedef struct sSirSmeSetWdsInfoRsp
+{
+ tANI_U16 messageType; // eWNI_SME_SET_WDS_INFO_RSP
+ tANI_U16 length;
+ tSirResultCodes statusCode;
+ tANI_U16 transactionId;
+} tSirSmeSetWdsInfoRsp, *tpSirSmeSetWdsInfoRsp;
+#endif
+#endif
+
+/// Definition for Radar Info
+typedef struct sSirRadarInfo
+{
+ tANI_U8 channelNumber;
+ tANI_U16 radarPulseWidth; // in usecond
+ tANI_U16 numRadarPulse;
+} tSirRadarInfo, *tpSirRadarInfo;
+
+#define SIR_RADAR_INFO_SIZE (sizeof(tANI_U8) + 2 *sizeof(tANI_U16))
+
+/// Two Background Scan mode
+typedef enum eSirBackgroundScanMode
+{
+ eSIR_AGGRESSIVE_BACKGROUND_SCAN = 0,
+ eSIR_NORMAL_BACKGROUND_SCAN = 1
+} tSirBackgroundScanMode;
+
+/// Two types of traffic check
+typedef enum eSirLinkTrafficCheck
+{
+ eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN = 0,
+ eSIR_CHECK_LINK_TRAFFIC_BEFORE_SCAN = 1
+} tSirLinkTrafficCheck;
+
+#define SIR_BG_SCAN_RETURN_CACHED_RESULTS 0x0
+#define SIR_BG_SCAN_PURGE_RESUTLS 0x80
+#define SIR_BG_SCAN_RETURN_FRESH_RESULTS 0x01
+#define SIR_SCAN_MAX_NUM_SSID 0x09
+
+/// Definition for scan request
+typedef struct sSirSmeScanReq
+{
+ tANI_U16 messageType; // eWNI_SME_SCAN_REQ
+ tANI_U16 length;
+ tANI_U8 sessionId; // Session ID
+ tANI_U16 transactionId; // Transaction ID for cmd
+ tSirMacAddr bssId;
+ tSirMacSSid ssId[SIR_SCAN_MAX_NUM_SSID];
+ tSirMacAddr selfMacAddr; //Added For BT-AMP Support
+ tSirBssType bssType;
+ tANI_U8 dot11mode;
+ tSirScanType scanType;
+ /**
+ * minChannelTime. Not used if scanType is passive.
+ * 0x0 - Dont Use min channel timer. Only max channel timeout will used.
+ * 11k measurements set this to zero to user only single duration for scan.
+ * <valid timeout> - Timeout value used for min channel timeout.
+ */
+ tANI_U32 minChannelTime;
+ /**
+ * maxChannelTime.
+ * 0x0 - Invalid. In case of active scan.
+ * In case of passive scan, MAX( maxChannelTime, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME) is used.
+ *
+ */
+ tANI_U32 maxChannelTime;
+ /**
+ * returnAfterFirstMatch can take following values:
+ * 0x00 - Return SCAN_RSP message after complete channel scan
+ * 0x01 - Return SCAN_RSP message after collecting BSS description
+ * that matches scan criteria.
+ * 0xC0 - Return after collecting first 11d IE from 2.4 GHz &
+ * 5 GHz band channels
+ * 0x80 - Return after collecting first 11d IE from 5 GHz band
+ * channels
+ * 0x40 - Return after collecting first 11d IE from 2.4 GHz
+ * band channels
+ *
+ * Values of 0xC0, 0x80 & 0x40 are to be used by
+ * Roaming/application when 11d is enabled.
+ */
+ tANI_U8 returnAfterFirstMatch;
+
+ /**
+ * returnUniqueResults can take following values:
+ * 0 - Collect & report all received BSS descriptions from same BSS.
+ * 1 - Collect & report unique BSS description from same BSS.
+ */
+ tANI_U8 returnUniqueResults;
+
+ /**
+ * returnFreshResults can take following values:
+ * 0x00 - Return background scan results.
+ * 0x80 - Return & purge background scan results
+ * 0x01 - Trigger fresh scan instead of returning background scan
+ * results.
+ * 0x81 - Trigger fresh scan instead of returning background scan
+ * results and purge background scan results.
+ */
+ tANI_U8 returnFreshResults;
+
+ /* backgroundScanMode can take following values:
+ * 0x0 - agressive scan
+ * 0x1 - normal scan where HAL will check for link traffic
+ * prior to proceeding with the scan
+ */
+ tSirBackgroundScanMode backgroundScanMode;
+
+ tANI_U8 hiddenSsid;
+
+ /* Number of SSIDs to scan */
+ tANI_U8 numSsid;
+
+ //channelList has to be the last member of this structure. Check tSirChannelList for the reason.
+ /* This MUST be the last field of the structure */
+
+
+#ifdef WLAN_FEATURE_P2P
+ tANI_BOOLEAN p2pSearch;
+#endif
+ tANI_U16 uIEFieldLen;
+ tANI_U16 uIEFieldOffset;
+
+ //channelList MUST be the last field of this structure
+ tSirChannelList channelList;
+ /*-----------------------------
+ tSirSmeScanReq....
+ -----------------------------
+ uIEFiledLen
+ -----------------------------
+ uIEFiledOffset ----+
+ ----------------------------- |
+ channelList.numChannels |
+ ----------------------------- |
+ ... variable size up to |
+ channelNumber[numChannels-1] |
+ This can be zero, if |
+ numChannel is zero. |
+ ----------------------------- <--+
+ ... variable size uIEFiled
+ up to uIEFieldLen (can be 0)
+ -----------------------------*/
+} tSirSmeScanReq, *tpSirSmeScanReq;
+
+
+/// Definition for response message to previously issued scan request
+typedef struct sSirSmeScanRsp
+{
+ tANI_U16 messageType; // eWNI_SME_SCAN_RSP
+ tANI_U16 length;
+ tANI_U8 sessionId;
+ tSirResultCodes statusCode;
+ tANI_U16 transcationId;
+ tSirBssDescription bssDescription[1];
+} tSirSmeScanRsp, *tpSirSmeScanRsp;
+
+/// Sme Req message to set the Background Scan mode
+typedef struct sSirSmeBackgroundScanModeReq
+{
+ tANI_U16 messageType; // eWNI_SME_BACKGROUND_SCAN_MODE_REQ
+ tANI_U16 length;
+ tSirBackgroundScanMode mode;
+} tSirSmeBackgroundScanModeReq, *tpSirSmeBackgroundScanModeReq;
+
+/// Background Scan Statisics
+typedef struct sSirBackgroundScanInfo {
+ tANI_U32 numOfScanSuccess;
+ tANI_U32 numOfScanFailure;
+ tANI_U32 reserved;
+} tSirBackgroundScanInfo, *tpSirBackgroundScanInfo;
+
+#define SIR_BACKGROUND_SCAN_INFO_SIZE (3 * sizeof(tANI_U32))
+
+/// Definition for Authentication request
+typedef struct sSirSmeAuthReq
+{
+ tANI_U16 messageType; // eWNI_SME_AUTH_REQ
+ tANI_U16 length;
+ tANI_U8 sessionId; // Session ID
+ tANI_U16 transactionId; // Transaction ID for cmd
+ tSirMacAddr bssId; // Self BSSID
+ tSirMacAddr peerMacAddr;
+ tAniAuthType authType;
+ tANI_U8 channelNumber;
+} tSirSmeAuthReq, *tpSirSmeAuthReq;
+
+/// Definition for reponse message to previously issued Auth request
+typedef struct sSirSmeAuthRsp
+{
+ tANI_U16 messageType; // eWNI_SME_AUTH_RSP
+ tANI_U16 length;
+ tANI_U8 sessionId; // Session ID
+ tANI_U16 transactionId; // Transaction ID for cmd
+ tSirMacAddr peerMacAddr;
+ tAniAuthType authType;
+ tSirResultCodes statusCode;
+ tANI_U16 protStatusCode; //It holds reasonCode when Pre-Auth fails due to deauth frame.
+ //Otherwise it holds status code.
+} tSirSmeAuthRsp, *tpSirSmeAuthRsp;
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+/// Association type
+typedef enum eSirAssocType
+{
+ eSIR_NORMAL,
+ eSIR_TRANSFERRED,
+ eSIR_DONOT_USE_ASSOC_TYPE = SIR_MAX_ENUM_SIZE
+} tSirAssocType;
+#endif
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+typedef enum eSirBpIndicatorType
+{
+ eSIR_WIRELESS_BP,
+ eSIR_WIRED_BP
+} tSirBpIndicatorType;
+
+#endif
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+/// Definition for Join/Reassoc info - Reshmi: need to check if this is a def which moved from elsehwere.
+typedef struct sJoinReassocInfo
+{
+ tAniTitanCBNeighborInfo cbNeighbors;
+ tAniBool spectrumMgtIndicator;
+ tSirMacPowerCapInfo powerCap;
+ tSirSupChnl supportedChannels;
+} tJoinReassocInfo, *tpJoinReassocInfo;
+#endif
+
+/// Definition for join request
+/// ---> MAC
+/// WARNING! If you add a field in JOIN REQ.
+/// Make sure to add it in REASSOC REQ
+/// The Serdes function is the same and its
+/// shared with REASSOC. So if we add a field
+// here and dont add it in REASSOC REQ. It will BREAK!!! REASSOC.
+typedef struct sSirSmeJoinReq
+{
+ tANI_U16 messageType; // eWNI_SME_JOIN_REQ
+ tANI_U16 length;
+ tANI_U8 sessionId;
+ tANI_U16 transactionId;
+ tSirMacSSid ssId;
+ tSirMacAddr selfMacAddr; // self Mac address
+ tSirBssType bsstype; // add new type for BT -AMP STA and AP Modules
+ tANI_U8 dot11mode; // to support BT-AMP
+ tVOS_CON_MODE staPersona; //Persona
+
+ /*This contains the UAPSD Flag for all 4 AC
+ * B0: AC_VO UAPSD FLAG
+ * B1: AC_VI UAPSD FLAG
+ * B2: AC_BK UAPSD FLAG
+ * B3: AC_BE UASPD FLAG
+ */
+ tANI_U8 uapsdPerAcBitmask;
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ tSirAssocType assocType; // Indicates whether STA is
+ // sending (Re) Association
+ // due to load balance or not
+#endif
+ tSirMacRateSet operationalRateSet;// Has 11a or 11b rates
+ tSirMacRateSet extendedRateSet; // Has 11g rates
+ tSirRSNie rsnIE; // RSN IE to be sent in
+ // (Re) Association Request
+#ifdef FEATURE_WLAN_CCX
+ tSirCCKMie cckmIE; // CCMK IE to be included as handler for join and reassoc is
+ // the same. The join will never carry cckm, but will be set to
+ // 0.
+#endif
+
+ tSirAddie addIEScan; // Additional IE to be sent in
+ // (unicast) Probe Request at the time of join
+
+ tSirAddie addIEAssoc; // Additional IE to be sent in
+ // (Re) Association Request
+
+ tAniEdType UCEncryptionType;
+
+ tAniEdType MCEncryptionType;
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ tAniBool is11Rconnection;
+#endif
+#ifdef FEATURE_WLAN_CCX
+ tAniBool isCCXconnection;
+ tCCXTspecInfo ccxTspecInfo;
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX
+ tAniBool isFastTransitionEnabled;
+#endif
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+ tAniBool bpIndicator;
+ tSirBpIndicatorType bpType;
+ tSirNeighborBssList neighborBssList; // TBD Move this outside 'AP'
+ // flag
+#endif
+ tAniTitanCBNeighborInfo cbNeighbors;
+ tAniBool spectrumMgtIndicator;
+ tSirMacPowerCapInfo powerCap;
+ tSirSupChnl supportedChannels;
+//#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA )
+ tSirBssDescription bssDescription;
+//#endif
+
+} tSirSmeJoinReq, *tpSirSmeJoinReq;
+
+/// Definition for reponse message to previously issued join request
+/// MAC --->
+typedef struct sSirSmeJoinRsp
+{
+ tANI_U16 messageType; // eWNI_SME_JOIN_RSP
+ tANI_U16 length;
+ tANI_U8 sessionId; // Session ID
+ tANI_U16 transactionId; // Transaction ID for cmd
+ tSirResultCodes statusCode;
+#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA)
+ tAniAuthType authType;
+// tANI_U16 staId; // Station ID for peer
+#endif
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ // Following are needed for Roaming algorithm
+ // to 'associate' with an alternate BSS.
+ tSirMacAddr alternateBssId;
+ tANI_U8 alternateChannelId;
+#endif
+ tANI_U16 protStatusCode; //It holds reasonCode when join fails due to deauth/disassoc frame.
+ //Otherwise it holds status code.
+ tANI_U16 aid;
+ tANI_U32 beaconLength;
+ tANI_U32 assocReqLength;
+ tANI_U32 assocRspLength;
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ tANI_U32 parsedRicRspLen;
+#endif
+#ifdef FEATURE_WLAN_CCX
+ tANI_U32 tspecIeLen;
+#endif
+ tANI_U32 staId;//Station ID for peer
+
+ /*The DPU signatures will be sent eventually to TL to help it determine the
+ association to which a packet belongs to*/
+ /*Unicast DPU signature*/
+ tANI_U8 ucastSig;
+
+ /*Broadcast DPU signature*/
+ tANI_U8 bcastSig;
+
+ tANI_U8 frames[ 1 ];
+} tSirSmeJoinRsp, *tpSirSmeJoinRsp;
+
+/// Definition for Authentication indication from peer
+typedef struct sSirSmeAuthInd
+{
+ tANI_U16 messageType; // eWNI_SME_AUTH_IND
+ tANI_U16 length;
+ tANI_U8 sessionId;
+ tSirMacAddr bssId; // Self BSSID
+ tSirMacAddr peerMacAddr;
+ tAniAuthType authType;
+} tSirSmeAuthInd, *tpSirSmeAuthInd;
+
+/// probereq from peer, when wsc is enabled
+typedef struct sSirSmeProbereq
+{
+ tANI_U16 messageType; // eWNI_SME_PROBE_REQ
+ tANI_U16 length;
+ tANI_U8 sessionId;
+ tSirMacAddr peerMacAddr;
+ tANI_U16 devicePasswdId;
+} tSirSmeProbeReq, *tpSirSmeProbeReq;
+
+/// Definition for Association indication from peer
+/// MAC --->
+typedef struct sSirSmeAssocInd
+{
+ tANI_U16 messageType; // eWNI_SME_ASSOC_IND
+ tANI_U16 length;
+ tANI_U8 sessionId;
+ tSirMacAddr peerMacAddr;
+ tANI_U16 aid;
+ tSirMacAddr bssId; // Self BSSID
+ tANI_U16 staId; // Station ID for peer
+ tANI_U8 uniSig; // DPU signature for unicast packets
+ tANI_U8 bcastSig; // DPU signature for broadcast packets
+ tAniAuthType authType;
+ tAniSSID ssId; // SSID used by STA to associate
+ tSirRSNie rsnIE;// RSN IE received from peer
+ tSirAddie addIE;// Additional IE received from peer, which possibly include WSC IE and/or P2P IE
+
+#if defined (ANI_PRODUCT_TYPE_AP)
+ tANI_U16 seqNum;
+ tAniBool wniIndicator;
+ tAniBool bpIndicator;
+ tSirBpIndicatorType bpType;
+ tSirAssocType assocType; // Indicates whether STA is LB'ed or not
+ tSirLoad load; // Current load on the radio for LB
+ tSirNeighborBssList neighborList; // List received from STA
+ tANI_U16 capabilityInfo; // STA capability
+ tSirNwType nwType; // Indicates 11a/b/g
+#endif
+ tAniTitanHtCapabilityInfo titanHtCaps;
+ // powerCap & supportedChannels are present only when
+ // spectrumMgtIndicator flag is set
+ tAniBool spectrumMgtIndicator;
+ tSirMacPowerCapInfo powerCap;
+ tSirSupChnl supportedChannels;
+#ifdef WLAN_SOFTAP_FEATURE
+ tAniBool wmmEnabledSta; /* if present - STA is WMM enabled */
+ tAniBool reassocReq;
+ // Required for indicating the frames to upper layer
+ tANI_U32 beaconLength;
+ tANI_U8* beaconPtr;
+ tANI_U32 assocReqLength;
+ tANI_U8* assocReqPtr;
+#endif
+} tSirSmeAssocInd, *tpSirSmeAssocInd;
+
+
+/// Definition for Association confirm
+/// ---> MAC
+typedef struct sSirSmeAssocCnf
+{
+ tANI_U16 messageType; // eWNI_SME_ASSOC_CNF
+ tANI_U16 length;
+ tSirResultCodes statusCode;
+ tSirMacAddr bssId; // Self BSSID
+ tSirMacAddr peerMacAddr;
+ tANI_U16 aid;
+ tSirMacAddr alternateBssId;
+ tANI_U8 alternateChannelId;
+} tSirSmeAssocCnf, *tpSirSmeAssocCnf;
+
+/// Definition for Reassociation request
+/// ---> MAC
+/// WARNING! If you add a field in REASSOC REQ.
+/// Make sure to add it in JOIN REQ
+/// The Serdes function is the same and its
+/// shared with REASSOC. So if we add a field
+// here and dont add it in JOIN REQ. It will BREAK!!! JOIN.
+typedef struct sSirSmeReassocReq
+{
+ tANI_U16 messageType; // eWNI_SME_REASSOC_REQ
+ tANI_U16 length;
+ tANI_U8 sessionId;
+ tANI_U16 transactionId;
+ tSirMacSSid ssId;
+ tSirMacAddr selfMacAddr; // self Mac address
+ tSirBssType bsstype; // add new type for BT -AMP STA and AP Modules
+ tANI_U8 dot11mode; // to support BT-AMP
+ tVOS_CON_MODE staPersona; //Persona
+
+ /*This contains the UAPSD Flag for all 4 AC
+ * B0: AC_VO UAPSD FLAG
+ * B1: AC_VI UAPSD FLAG
+ * B2: AC_BK UAPSD FLAG
+ * B3: AC_BE UASPD FLAG
+ */
+ tANI_U8 uapsdPerAcBitmask;
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ tSirAssocType assocType; // Indicates whether STA is
+ // sending (Re) Association
+ // due to load balance or not
+#endif
+
+ tSirMacRateSet operationalRateSet;// Has 11a or 11b rates
+ tSirMacRateSet extendedRateSet; // Has 11g rates
+
+ tSirRSNie rsnIE; // RSN IE to be sent in
+ // (Re) Association Request
+
+#ifdef FEATURE_WLAN_CCX
+ tSirCCKMie cckmIE; // CCMK IE to be included in ReAssoc if length != 0.
+#endif
+ tSirAddie addIEScan; // Addtional IE to be sent in
+ // (unicast) Probe Request at the time of join
+
+ tSirAddie addIEAssoc; // Additional IE to be sent in
+ // (Re) Association Request
+
+ tAniEdType UCEncryptionType;
+ tAniEdType MCEncryptionType;
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ tAniBool is11Rconnection;
+#endif
+#ifdef FEATURE_WLAN_CCX
+ tAniBool isCCXconnection;
+ tCCXTspecInfo ccxTspecInfo;
+#endif
+#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX
+ tAniBool isFastTransitionEnabled;
+#endif
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+ tAniBool bpIndicator;
+ tSirBpIndicatorType bpType;
+ tSirNeighborBssList neighborBssList;
+#endif
+ tAniTitanCBNeighborInfo cbNeighbors;
+ tAniBool spectrumMgtIndicator;
+ tSirMacPowerCapInfo powerCap;
+ tSirSupChnl supportedChannels;
+//#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA )
+ tSirBssDescription bssDescription;
+//#endif
+} tSirSmeReassocReq, *tpSirSmeReassocReq;
+
+/// Definition for reponse message to previously issued
+/// Reassociation request
+typedef struct sSirSmeReassocRsp
+{
+ tANI_U16 messageType; // eWNI_SME_REASSOC_RSP
+ tANI_U16 length;
+ tANI_U8 sessionId; // Session ID
+ tANI_U16 transactionId; // Transaction ID for cmd
+ tSirResultCodes statusCode;
+ tANI_U8 staId; // Station ID for peer
+#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA)
+ tAniAuthType authType;
+#endif
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ tSirMacAddr alternateBssId;
+ tANI_U8 alternateChannelId;
+#endif
+} tSirSmeReassocRsp, *tpSirSmeReassocRsp;
+
+/// Definition for Reassociation indication from peer
+typedef struct sSirSmeReassocInd
+{
+ tANI_U16 messageType; // eWNI_SME_REASSOC_IND
+ tANI_U16 length;
+ tANI_U8 sessionId; // Session ID
+ tSirMacAddr peerMacAddr;
+ tSirMacAddr oldMacAddr;
+ tANI_U16 aid;
+ tSirMacAddr bssId; // Self BSSID
+ tANI_U16 staId; // Station ID for peer
+ tAniAuthType authType;
+ tAniSSID ssId; // SSID used by STA to reassociate
+ tSirRSNie rsnIE; // RSN IE received from peer
+
+ tSirAddie addIE; // Additional IE received from peer
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ tANI_U16 seqNum;
+ tAniBool wniIndicator;
+ tAniBool bpIndicator;
+ tSirBpIndicatorType bpType;
+ tSirAssocType reassocType; // Indicates whether STA is LB'ed or not
+ tSirLoad load; // Current load on the radio for LB
+ tSirNeighborBssList neighborList; // List received from STA
+ tANI_U16 capabilityInfo; // STA capability
+ tSirNwType nwType; // Indicates 11a/b/g
+#endif
+ tAniTitanHtCapabilityInfo titanHtCaps;
+ // powerCap & supportedChannels are present only when
+ // spectrumMgtIndicator flag is set
+ tAniBool spectrumMgtIndicator;
+ tSirMacPowerCapInfo powerCap;
+ tSirSupChnl supportedChannels;
+#ifdef WLAN_SOFTAP_FEATURE
+ // Required for indicating the frames to upper layer
+ // TODO: use the appropriate names to distinguish between the other similar names used above for station mode of operation
+ tANI_U32 beaconLength;
+ tANI_U8* beaconPtr;
+ tANI_U32 assocReqLength;
+ tANI_U8* assocReqPtr;
+#endif
+} tSirSmeReassocInd, *tpSirSmeReassocInd;
+
+/// Definition for Reassociation confirm
+/// ---> MAC
+typedef struct sSirSmeReassocCnf
+{
+ tANI_U16 messageType; // eWNI_SME_REASSOC_CNF
+ tANI_U16 length;
+ tSirResultCodes statusCode;
+ tSirMacAddr bssId; // Self BSSID
+ tSirMacAddr peerMacAddr;
+ tANI_U16 aid;
+ tSirMacAddr alternateBssId;
+ tANI_U8 alternateChannelId;
+} tSirSmeReassocCnf, *tpSirSmeReassocCnf;
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+typedef enum {
+ // Based on Periodic evaluation
+ eSIR_PERIODIC_EVALATION,
+
+ // Dectection of primary users such as RADARs
+ eSIR_DETECTION_OF_RADAR,
+
+ // Degradation in system performance (eg. Triggered by
+ // increase in PER beyond a certain threshold)
+ eSIR_PERFORMANCE_DEGRADATION,
+
+ // Frequency changed due to previously issued SWITCH_CHANNEL_REQ
+ eSIR_UPPER_LAYER_TRIGGERED
+}tSirFreqChangeReason;
+#endif
+
+/// Enum definition for Wireless medium status change codes
+typedef enum eSirSmeStatusChangeCode
+{
+ eSIR_SME_DEAUTH_FROM_PEER,
+ eSIR_SME_DISASSOC_FROM_PEER,
+ eSIR_SME_LOST_LINK_WITH_PEER,
+ eSIR_SME_CHANNEL_SWITCH,
+ eSIR_SME_JOINED_NEW_BSS,
+ eSIR_SME_LEAVING_BSS,
+ eSIR_SME_IBSS_ACTIVE,
+ eSIR_SME_IBSS_INACTIVE,
+ eSIR_SME_IBSS_PEER_DEPARTED,
+ eSIR_SME_RADAR_DETECTED,
+ eSIR_SME_IBSS_NEW_PEER,
+ eSIR_SME_AP_CAPS_CHANGED,
+ eSIR_SME_BACKGROUND_SCAN_FAIL,
+ eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP,
+ eSIR_SME_CB_LEGACY_BSS_FOUND_BY_STA
+} tSirSmeStatusChangeCode;
+
+typedef struct sSirSmeNewBssInfo
+{
+ tSirMacAddr bssId;
+ tANI_U8 channelNumber;
+ tANI_U8 reserved;
+ tSirMacSSid ssId;
+} tSirSmeNewBssInfo, *tpSirSmeNewBssInfo;
+
+typedef struct sSirSmeApNewCaps
+{
+ tANI_U16 capabilityInfo;
+ tSirMacAddr bssId;
+ tANI_U8 channelId;
+ tANI_U8 reserved[3];
+ tSirMacSSid ssId;
+} tSirSmeApNewCaps, *tpSirSmeApNewCaps;
+
+/**
+ * Table below indicates what information is passed for each of
+ * the Wireless Media status change notifications:
+ *
+ * Status Change code Status change info
+ * ----------------------------------------------------------------------
+ * eSIR_SME_DEAUTH_FROM_PEER Reason code received in DEAUTH frame
+ * eSIR_SME_DISASSOC_FROM_PEER Reason code received in DISASSOC frame
+ * eSIR_SME_LOST_LINK_WITH_PEER None
+ * eSIR_SME_CHANNEL_SWITCH New channel number
+ * eSIR_SME_JOINED_NEW_BSS BSSID, SSID and channel number
+ * eSIR_SME_LEAVING_BSS None
+ * eSIR_SME_IBSS_ACTIVE Indicates that another STA joined
+ * IBSS apart from this STA that
+ * started IBSS
+ * eSIR_SME_IBSS_INACTIVE Indicates that only this STA is left
+ * in IBSS
+ * eSIR_SME_RADAR_DETECTED Indicates that radar is detected
+ * eSIR_SME_IBSS_NEW_PEER Indicates that a new peer is detected
+ * eSIR_SME_AP_CAPS_CHANGED Indicates that capabilities of the AP
+ * that STA is currently associated with
+ * have changed.
+ * eSIR_SME_BACKGROUND_SCAN_FAIL Indicates background scan failure
+ */
+
+/// Definition for Wireless medium status change notification
+typedef struct sSirSmeWmStatusChangeNtf
+{
+ tANI_U16 messageType; // eWNI_SME_WM_STATUS_CHANGE_NTF
+ tANI_U16 length;
+ tANI_U8 sessionId; // Session ID
+ tSirSmeStatusChangeCode statusChangeCode;
+ tSirMacAddr bssId; // Self BSSID
+ union
+ {
+ tANI_U16 deAuthReasonCode; // eSIR_SME_DEAUTH_FROM_PEER
+ tANI_U16 disassocReasonCode; // eSIR_SME_DISASSOC_FROM_PEER
+ // none for eSIR_SME_LOST_LINK_WITH_PEER
+ tANI_U8 newChannelId; // eSIR_SME_CHANNEL_SWITCH
+ tSirSmeNewBssInfo newBssInfo; // eSIR_SME_JOINED_NEW_BSS
+ // none for eSIR_SME_LEAVING_BSS
+ // none for eSIR_SME_IBSS_ACTIVE
+ // none for eSIR_SME_IBSS_INACTIVE
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+ tSirRadarInfo radarInfo; // eSIR_SME_RADAR_DETECTED
+#endif
+ tSirNewIbssPeerInfo newIbssPeerInfo; // eSIR_SME_IBSS_NEW_PEER
+ tSirSmeApNewCaps apNewCaps; // eSIR_SME_AP_CAPS_CHANGED
+ tSirBackgroundScanInfo bkgndScanInfo; // eSIR_SME_BACKGROUND_SCAN_FAIL
+ tAniTitanCBNeighborInfo cbNeighbors; // eSIR_SME_CB_LEGACY_BSS_FOUND_BY_STA
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ tSirNeighborBssWdsInfo neighborWdsInfo; // eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP
+#endif
+ } statusChangeInfo;
+} tSirSmeWmStatusChangeNtf, *tpSirSmeWmStatusChangeNtf;
+
+/// Definition for Disassociation request
+typedef
+#ifdef WLAN_SOFTAP_FEATURE
+__ani_attr_pre_packed
+#endif
+struct sSirSmeDisassocReq
+{
+ tANI_U16 messageType; // eWNI_SME_DISASSOC_REQ
+ tANI_U16 length;
+ tANI_U8 sessionId; // Session ID
+ tANI_U16 transactionId; // Transaction ID for cmd
+ tSirMacAddr bssId; // Peer BSSID
+ tSirMacAddr peerMacAddr;
+ tANI_U16 reasonCode;
+ tANI_U8 doNotSendOverTheAir; //This flag tells LIM whether to send the disassoc OTA or not
+ //This will be set in while handing off from one AP to other
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ tANI_U16 aid;
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ tANI_U16 seqNum;
+#endif
+#endif
+}
+#ifdef WLAN_SOFTAP_FEATURE
+__ani_attr_packed
+#endif
+tSirSmeDisassocReq, *tpSirSmeDisassocReq;
+
+/// Definition for Tkip countermeasures request
+#ifdef WLAN_SOFTAP_FEATURE
+typedef __ani_attr_pre_packed struct sSirSmeTkipCntrMeasReq
+{
+ tANI_U16 messageType; // eWNI_SME_DISASSOC_REQ
+ tANI_U16 length;
+ tANI_U8 sessionId; // Session ID
+ tANI_U16 transactionId; // Transaction ID for cmd
+ tSirMacAddr bssId; // Peer BSSID
+ tANI_BOOLEAN bEnable; // Start/stop countermeasures
+} __ani_attr_packed tSirSmeTkipCntrMeasReq, *tpSirSmeTkipCntrMeasReq;
+#endif
+
+typedef struct sAni64BitCounters
+{
+ tANI_U32 Hi;
+ tANI_U32 Lo;
+}tAni64BitCounters, *tpAni64BitCounters;
+
+typedef struct sAniSecurityStat
+{
+ tAni64BitCounters txBlks;
+ tAni64BitCounters rxBlks;
+ tAni64BitCounters formatErrorCnt;
+ tAni64BitCounters decryptErr;
+ tAni64BitCounters protExclCnt;
+ tAni64BitCounters unDecryptableCnt;
+ tAni64BitCounters decryptOkCnt;
+
+}tAniSecurityStat, *tpAniSecurityStat;
+
+typedef struct sAniTxRxCounters
+{
+ tANI_U32 txFrames; // Incremented for every packet tx
+ tANI_U32 rxFrames;
+ tANI_U32 nRcvBytes;
+ tANI_U32 nXmitBytes;
+}tAniTxRxCounters, *tpAniTxRxCounters;
+
+typedef struct sAniTxRxStats
+{
+ tAni64BitCounters txFrames;
+ tAni64BitCounters rxFrames;
+ tAni64BitCounters nRcvBytes;
+ tAni64BitCounters nXmitBytes;
+
+}tAniTxRxStats,*tpAniTxRxStats;
+
+typedef struct sAniSecStats
+{
+ tAniSecurityStat aes;
+ tAni64BitCounters aesReplays;
+ tAniSecurityStat tkip;
+ tAni64BitCounters tkipReplays;
+ tAni64BitCounters tkipMicError;
+
+ tAniSecurityStat wep;
+#if defined(FEATURE_WLAN_WAPI) && !defined(LIBRA_WAPI_SUPPORT)
+ tAniSecurityStat wpi;
+ tAni64BitCounters wpiReplays;
+ tAni64BitCounters wpiMicError;
+#endif
+}tAniSecStats, *tpAniSecStats;
+
+#define SIR_MAX_RX_CHAINS 3
+
+typedef struct sAniStaStatStruct
+{
+ /* following statistic elements till expandPktRxCntLo are not filled with valid data.
+ * These are kept as it is, since WSM is using this structure.
+ * These elements can be removed whenever WSM is updated.
+ * Phystats is used to hold phystats from BD.
+ */
+ tANI_U32 sentAesBlksUcastHi;
+ tANI_U32 sentAesBlksUcastLo;
+ tANI_U32 recvAesBlksUcastHi;
+ tANI_U32 recvAesBlksUcastLo;
+ tANI_U32 aesFormatErrorUcastCnts;
+ tANI_U32 aesReplaysUcast;
+ tANI_U32 aesDecryptErrUcast;
+ tANI_U32 singleRetryPkts;
+ tANI_U32 failedTxPkts;
+ tANI_U32 ackTimeouts;
+ tANI_U32 multiRetryPkts;
+ tANI_U32 fragTxCntsHi;
+ tANI_U32 fragTxCntsLo;
+ tANI_U32 transmittedPktsHi;
+ tANI_U32 transmittedPktsLo;
+ tANI_U32 phyStatHi; //These are used to fill in the phystats.
+ tANI_U32 phyStatLo; //This is only for private use.
+
+ tANI_U32 uplinkRssi;
+ tANI_U32 uplinkSinr;
+ tANI_U32 uplinkRate;
+ tANI_U32 downlinkRssi;
+ tANI_U32 downlinkSinr;
+ tANI_U32 downlinkRate;
+ tANI_U32 nRcvBytes;
+ tANI_U32 nXmitBytes;
+
+ // titan 3c stats
+ tANI_U32 chunksTxCntHi; // Number of Chunks Transmitted
+ tANI_U32 chunksTxCntLo;
+ tANI_U32 compPktRxCntHi; // Number of Packets Received that were actually compressed
+ tANI_U32 compPktRxCntLo;
+ tANI_U32 expanPktRxCntHi; // Number of Packets Received that got expanded
+ tANI_U32 expanPktRxCntLo;
+
+
+ /* Following elements are valid and filled in correctly. They have valid values.
+ */
+
+ //Unicast frames and bytes.
+ tAniTxRxStats ucStats;
+
+ //Broadcast frames and bytes.
+ tAniTxRxStats bcStats;
+
+ //Multicast frames and bytes.
+ tAniTxRxStats mcStats;
+
+ tANI_U32 currentTxRate;
+ tANI_U32 currentRxRate; //Rate in 100Kbps
+
+ tANI_U32 maxTxRate;
+ tANI_U32 maxRxRate;
+
+ tANI_S8 rssi[SIR_MAX_RX_CHAINS];
+
+
+ tAniSecStats securityStats;
+
+ tANI_U8 currentRxRateIdx; //This the softmac rate Index.
+ tANI_U8 currentTxRateIdx;
+
+} tAniStaStatStruct, *tpAniStaStatStruct;
+
+//Statistics that are not maintained per stations.
+typedef struct sAniGlobalStatStruct
+{
+ tAni64BitCounters txError;
+ tAni64BitCounters rxError;
+ tAni64BitCounters rxDropNoBuffer;
+ tAni64BitCounters rxDropDup;
+ tAni64BitCounters rxCRCError;
+
+ tAni64BitCounters singleRetryPkts;
+ tAni64BitCounters failedTxPkts;
+ tAni64BitCounters ackTimeouts;
+ tAni64BitCounters multiRetryPkts;
+ tAni64BitCounters fragTxCnts;
+ tAni64BitCounters fragRxCnts;
+
+ tAni64BitCounters txRTSSuccess;
+ tAni64BitCounters txCTSSuccess;
+ tAni64BitCounters rxRTSSuccess;
+ tAni64BitCounters rxCTSSuccess;
+
+ tAniSecStats securityStats;
+
+ tAniTxRxStats mcStats;
+ tAniTxRxStats bcStats;
+
+}tAniGlobalStatStruct,*tpAniGlobalStatStruct;
+
+typedef enum sPacketType
+{
+ ePACKET_TYPE_UNKNOWN,
+ ePACKET_TYPE_11A,
+ ePACKET_TYPE_11G,
+ ePACKET_TYPE_11B,
+ ePACKET_TYPE_11N
+
+}tPacketType, *tpPacketType;
+
+typedef struct sAniStatSummaryStruct
+{
+ tAniTxRxStats uc; //Unicast counters.
+ tAniTxRxStats bc; //Broadcast counters.
+ tAniTxRxStats mc; //Multicast counters.
+ tAni64BitCounters txError;
+ tAni64BitCounters rxError;
+ tANI_S8 rssi[SIR_MAX_RX_CHAINS]; //For each chain.
+ tANI_U32 rxRate; // Rx rate of the last received packet.
+ tANI_U32 txRate;
+ tANI_U16 rxMCSId; //MCS index is valid only when packet type is ePACKET_TYPE_11N
+ tANI_U16 txMCSId;
+ tPacketType rxPacketType;
+ tPacketType txPacketType;
+ tSirMacAddr macAddr; //Mac Address of the station from which above RSSI and rate is from.
+}tAniStatSummaryStruct,*tpAniStatSummaryStruct;
+
+#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA)
+//structure for stats that may be reset, like the ones in sta descriptor
+//The stats are saved into here before reset. It should be tANI_U32 aligned.
+typedef struct _sPermStaStats
+{
+ //tANI_U32 sentAesBlksUcastHi;
+ //tANI_U32 sentAesBlksUcastLo;
+ //tANI_U32 recvAesBlksUcastHi;
+ //tANI_U32 recvAesBlksUcastLo;
+ tANI_U32 aesFormatErrorUcastCnts;
+ tANI_U32 aesReplaysUcast;
+ tANI_U32 aesDecryptErrUcast;
+ tANI_U32 singleRetryPkts;
+ tANI_U32 failedTxPkts;
+ tANI_U32 ackTimeouts;
+ tANI_U32 multiRetryPkts;
+ tANI_U32 fragTxCntsHi;
+ tANI_U32 fragTxCntsLo;
+ tANI_U32 transmittedPktsHi;
+ tANI_U32 transmittedPktsLo;
+
+ // titan 3c stats
+ tANI_U32 chunksTxCntHi; // Number of Chunks Transmitted
+ tANI_U32 chunksTxCntLo;
+ tANI_U32 compPktRxCntHi; // Number of Packets Received that were actually compressed
+ tANI_U32 compPktRxCntLo;
+ tANI_U32 expanPktRxCntHi; // Number of Packets Received that got expanded
+ tANI_U32 expanPktRxCntLo;
+}tPermanentStaStats;
+
+#endif//#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA)
+
+
+
+/// Definition for Disassociation response
+typedef struct sSirSmeDisassocRsp
+{
+ tANI_U16 messageType; // eWNI_SME_DISASSOC_RSP
+ tANI_U16 length;
+ tANI_U8 sessionId; // Session ID
+ tANI_U16 transactionId; // Transaction ID for cmd
+ tSirResultCodes statusCode;
+ tSirMacAddr peerMacAddr;
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ tANI_U16 aid;
+#endif
+ tAniStaStatStruct perStaStats; // STA stats
+#ifdef WLAN_SOFTAP_FEATURE
+ tANI_U16 staId;
+#endif
+}
+#ifdef WLAN_SOFTAP_FEATURE
+__ani_attr_packed
+#endif
+ tSirSmeDisassocRsp, *tpSirSmeDisassocRsp;
+
+/// Definition for Disassociation indication from peer
+typedef struct sSirSmeDisassocInd
+{
+ tANI_U16 messageType; // eWNI_SME_DISASSOC_IND
+ tANI_U16 length;
+ tANI_U8 sessionId; // Session Identifier
+ tANI_U16 transactionId; // Transaction Identifier with PE
+ tSirResultCodes statusCode;
+ tSirMacAddr bssId;
+ tSirMacAddr peerMacAddr;
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ tANI_U16 aid;
+#endif
+ tAniStaStatStruct perStaStats; // STA stats
+#ifdef WLAN_SOFTAP_FEATURE
+ tANI_U16 staId;
+#endif
+} tSirSmeDisassocInd, *tpSirSmeDisassocInd;
+
+/// Definition for Disassociation confirm
+/// MAC --->
+typedef struct sSirSmeDisassocCnf
+{
+ tANI_U16 messageType; // eWNI_SME_DISASSOC_CNF
+ tANI_U16 length;
+ tSirResultCodes statusCode;
+ tSirMacAddr bssId;
+ tSirMacAddr peerMacAddr;
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ tANI_U16 aid;
+#endif
+} tSirSmeDisassocCnf, *tpSirSmeDisassocCnf;
+
+/// Definition for Deauthetication request
+typedef struct sSirSmeDeauthReq
+{
+ tANI_U16 messageType; // eWNI_SME_DEAUTH_REQ
+ tANI_U16 length;
+ tANI_U8 sessionId; // Session ID
+ tANI_U16 transactionId; // Transaction ID for cmd
+ tSirMacAddr bssId; // AP BSSID
+ tSirMacAddr peerMacAddr;
+ tANI_U16 reasonCode;
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ tANI_U16 aid;
+#endif
+} tSirSmeDeauthReq, *tpSirSmeDeauthReq;
+
+/// Definition for Deauthetication response
+typedef struct sSirSmeDeauthRsp
+{
+ tANI_U16 messageType; // eWNI_SME_DEAUTH_RSP
+ tANI_U16 length;
+ tANI_U8 sessionId; // Session ID
+ tANI_U16 transactionId; // Transaction ID for cmd
+ tSirResultCodes statusCode;
+ tSirMacAddr peerMacAddr;
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ tANI_U16 aid;
+#endif
+} tSirSmeDeauthRsp, *tpSirSmeDeauthRsp;
+
+/// Definition for Deauthetication indication from peer
+typedef struct sSirSmeDeauthInd
+{
+ tANI_U16 messageType; // eWNI_SME_DEAUTH_IND
+ tANI_U16 length;
+ tANI_U8 sessionId; //Added for BT-AMP
+ tANI_U16 transactionId; //Added for BT-AMP
+ tSirResultCodes statusCode;
+ tSirMacAddr bssId;// AP BSSID
+ tSirMacAddr peerMacAddr;
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ tANI_U16 aid;
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE
+ tANI_U16 staId;
+#endif
+} tSirSmeDeauthInd, *tpSirSmeDeauthInd;
+
+/// Definition for Deauthentication confirm
+/// MAC --->
+typedef struct sSirSmeDeauthCnf
+{
+ tANI_U16 messageType; // eWNI_SME_DEAUTH_CNF
+ tANI_U16 length;
+ tSirResultCodes statusCode;
+ tSirMacAddr bssId; // AP BSSID
+ tSirMacAddr peerMacAddr;
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ tANI_U16 aid;
+#endif
+} tSirSmeDeauthCnf, *tpSirSmeDeauthCnf;
+
+/// Definition for stop BSS request message
+typedef struct sSirSmeStopBssReq
+{
+ tANI_U16 messageType; // eWNI_SME_STOP_BSS_REQ
+ tANI_U16 length;
+ tANI_U8 sessionId; //Session ID
+ tANI_U16 transactionId; //tranSaction ID for cmd
+ tSirResultCodes reasonCode;
+ tSirMacAddr bssId; //Self BSSID
+} tSirSmeStopBssReq, *tpSirSmeStopBssReq;
+
+/// Definition for stop BSS response message
+typedef struct sSirSmeStopBssRsp
+{
+ tANI_U16 messageType; // eWNI_SME_STOP_BSS_RSP
+ tANI_U16 length;
+ tSirResultCodes statusCode;
+ tANI_U8 sessionId; // Session ID
+ tANI_U16 transactionId; // Transaction ID for cmd
+} tSirSmeStopBssRsp, *tpSirSmeStopBssRsp;
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+/// Definition for Channel Select request
+/// ---> MAC
+typedef struct sSirSmeSelectChannelReq
+{
+ tANI_U16 messageType; // eWNI_SME_SELECT_CHL_REQ
+ tANI_U16 length;
+ tANI_U16 transactionId; // Transaction ID for cmd
+ tANI_U8 channelId;
+} tSirSmeSelectChannelReq, *tpSirSmeSelectChannelReq;
+
+/// Definition for Channel Select response
+/// MAC --->
+typedef struct sSirSmeSelectChannelRsp
+{
+ tANI_U16 messageType; // eWNI_SME_SELECT_CHL_RSP
+ tANI_U16 length;
+ tSirResultCodes statusCode;
+ tANI_U16 transactionId; // Transaction ID for cmd
+} tSirSmeSelectChannelRsp, *tpSirSmeSelectChannelRsp;
+
+/// Definition for Channel Switch request
+/// ---> MAC
+typedef struct sSirSmeSwitchChannelReq
+{
+ // eWNI_SME_SWITCH_CHL_REQ,
+ // eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ,
+ // eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ
+ tANI_U16 messageType;
+
+ tANI_U16 length;
+ tANI_U16 transactionId; // Transaction ID for cmd
+ tANI_U8 channelId;
+ //
+ // The cbMode field is applicable to TITAN only.
+ // This indicates as to how the CB secondary
+ // channel will be used (if at all).
+ //
+ // In a non-CB environment, with 11H enabled,
+ // this field will be ignored
+ //
+ tAniCBSecondaryMode cbMode;
+
+ // dtimFactor indicates the number of DTIM
+ // Beacon before LIM switches channel
+ tANI_U32 dtimFactor;
+} tSirSmeSwitchChannelReq, *tpSirSmeSwitchChannelReq;
+
+/// Definition for Channel Switch response
+/// MAC --->
+typedef struct sSirSmeSwitchChannelRsp
+{
+ tANI_U16 messageType; // eWNI_SME_SWITCH_CHL_RSP
+ tANI_U16 length;
+ tSirResultCodes statusCode;
+ tANI_U16 transactionId; // Transaction ID for cmd
+} tSirSmeSwitchChannelRsp, *tpSirSmeSwitchChannelRsp;
+
+#endif
+
+
+/// Definition for Channel Switch indication for station
+/// MAC --->
+typedef struct sSirSmeSwitchChannelInd
+{
+ tANI_U16 messageType; // eWNI_SME_SWITCH_CHL_REQ
+ tANI_U16 length;
+ tANI_U8 sessionId;
+ tANI_U16 newChannelId;
+ tSirMacAddr bssId; // BSSID
+} tSirSmeSwitchChannelInd, *tpSirSmeSwitchChannelInd;
+
+/// Definition for ULA complete indication message
+typedef struct sirUlaCompleteInd
+{
+ tANI_U16 messageType; // eWNI_ULA_COMPLETE_IND
+ tANI_U16 length;
+ tSirResultCodes statusCode;
+ tSirMacAddr peerMacAddr;
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ tANI_U16 aid;
+#endif
+} tSirUlaCompleteInd, *tpSirUlaCompleteInd;
+
+/// Definition for ULA complete confirmation message
+typedef struct sirUlaCompleteCnf
+{
+ tANI_U16 messageType; // eWNI_ULA_COMPLETE_CNF
+ tANI_U16 length;
+ tSirResultCodes statusCode;
+ tSirMacAddr peerMacAddr;
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ tANI_U16 aid;
+#endif
+} tSirUlaCompleteCnf, *tpSirUlaCompleteCnf;
+
+/// Definition for Neighbor BSS indication
+/// MAC --->
+/// MAC reports this each time a new I/BSS is detected
+typedef struct sSirSmeNeighborBssInd
+{
+ tANI_U16 messageType; // eWNI_SME_NEIGHBOR_BSS_IND
+ tANI_U16 length;
+ tANI_U8 sessionId;
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+ tSirNeighborBssInfo neighborInfo;
+ tSirWdsInfo wdsInfo;
+#else
+ tSirBssDescription bssDescription[1];
+#endif
+} tSirSmeNeighborBssInd, *tpSirSmeNeighborBssInd;
+
+/// Definition for MIC failure indication
+/// MAC --->
+/// MAC reports this each time a MIC failure occures on Rx TKIP packet
+typedef struct sSirSmeMicFailureInd
+{
+ tANI_U16 messageType; // eWNI_SME_MIC_FAILURE_IND
+ tANI_U16 length;
+ tANI_U8 sessionId;
+ tSirMacAddr bssId; // BSSID
+ tSirMicFailureInfo info;
+} tSirSmeMicFailureInd, *tpSirSmeMicFailureInd;
+
+
+/// Definition for Set Context request
+/// ---> MAC
+typedef struct sSirSmeSetContextReq
+{
+ tANI_U16 messageType; // eWNI_SME_SET_CONTEXT_REQ
+ tANI_U16 length;
+ tANI_U8 sessionId; //Session ID
+ tANI_U16 transactionId; //Transaction ID for cmd
+ tSirMacAddr peerMacAddr;
+ tSirMacAddr bssId; // BSSID
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ tANI_U16 aid;
+#endif
+ // TBD Following QOS fields to be uncommented
+ //tAniBool qosInfoPresent;
+ //tSirQos qos;
+ tSirKeyMaterial keyMaterial;
+} tSirSmeSetContextReq, *tpSirSmeSetContextReq;
+
+/// Definition for Set Context response
+/// MAC --->
+typedef struct sSirSmeSetContextRsp
+{
+ tANI_U16 messageType; // eWNI_SME_SET_CONTEXT_RSP
+ tANI_U16 length;
+ tANI_U8 sessionId; // Session ID
+ tANI_U16 transactionId; // Transaction ID for cmd
+ tSirResultCodes statusCode;
+ tSirMacAddr peerMacAddr;
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ tANI_U16 aid;
+#endif
+} tSirSmeSetContextRsp, *tpSirSmeSetContextRsp;
+
+/// Definition for Remove Key Context request
+/// ---> MAC
+typedef struct sSirSmeRemoveKeyReq
+{
+ tANI_U16 messageType; // eWNI_SME_REMOVE_KEY_REQ
+ tANI_U16 length;
+ tANI_U8 sessionId; // Session ID
+ tANI_U16 transactionId; // Transaction ID for cmd
+ tSirMacAddr bssId; // BSSID
+ tSirMacAddr peerMacAddr;
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ tANI_U16 aid;
+#endif
+ tANI_U8 edType;
+ tANI_U8 wepType;
+ tANI_U8 keyId;
+ tANI_BOOLEAN unicast;
+} tSirSmeRemoveKeyReq, *tpSirSmeRemoveKeyReq;
+
+/// Definition for Remove Key Context response
+/// MAC --->
+typedef struct sSirSmeRemoveKeyRsp
+{
+ tANI_U16 messageType; // eWNI_SME_REMOVE_KEY_RSP
+ tANI_U16 length;
+ tANI_U8 sessionId; // Session ID
+ tANI_U16 transactionId; // Transaction ID for cmd
+ tSirResultCodes statusCode;
+ tSirMacAddr peerMacAddr;
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ tANI_U16 aid;
+#endif
+} tSirSmeRemoveKeyRsp, *tpSirSmeRemoveKeyRsp;
+
+/// Definition for Set Power request
+/// ---> MAC
+typedef struct sSirSmeSetPowerReq
+{
+ tANI_U16 messageType; // eWNI_SME_SET_POWER_REQ
+ tANI_U16 length;
+ tANI_U16 transactionId; // Transaction ID for cmd
+ tANI_S8 powerLevel;
+} tSirSmeSetPowerReq, *tpSirSmeSetPowerReq;
+
+/// Definition for Set Power response
+/// MAC --->
+typedef struct sSirSmeSetPowerRsp
+{
+ tANI_U16 messageType; // eWNI_SME_SET_POWER_RSP
+ tANI_U16 length;
+ tSirResultCodes statusCode;
+ tANI_U16 transactionId; // Transaction ID for cmd
+} tSirSmeSetPowerRsp, *tpSirSmeSetPowerRsp;
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+/// Definition for Client Side Load Balancing request
+/// ---> MAC
+typedef struct sSirSmeSetClientLoadBalanceReq
+{
+ tANI_U16 messageType; // eWNI_SME_CLIENT_LOAD_BALANCE_REQ
+ tANI_U16 length;
+ tANI_U16 transactionId; // Transaction ID for cmd
+ tSirMacAddr alternateBssId;
+ tANI_U8 alternateChannelId;
+ tANI_U8 numberStas;
+} tSirSmeClientLoadBalanceReq, *tpSirSmeClientLoadBalanceReq;
+
+/// Definition for Client Side Load Balancing response
+/// MAC --->
+typedef struct sSirSmeSetClientLoadBalanceRsp
+{
+ tANI_U16 messageType; // eWNI_SME_CLIENT_LOAD_BALANCE_RSP
+ tANI_U16 length;
+ tANI_U16 transactionId; // Transaction ID for cmd
+ tSirResultCodes statusCode;
+} tSirSmeClientLoadBalanceRsp, *tpSirSmeClientLoadBalanceRsp;
+#endif
+
+/// Definition for Link Test Start response
+/// MAC --->
+typedef struct sSirSmeLinkTestStartRsp
+{
+ tANI_U16 messageType; // eWNI_SME_LINK_TEST_START_RSP
+ tANI_U16 length;
+ tSirMacAddr peerMacAddr;
+ tSirResultCodes statusCode;
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ tANI_U16 aid;
+#endif
+} tSirSmeLinkTestStartRsp, *tpSirSmeLinkTestStartRsp;
+
+/// Definition for Link Test Stop response
+/// WSM ---> MAC
+typedef struct sSirSmeLinkTestStopRsp
+{
+ tANI_U16 messageType; // eWNI_SME_LINK_TEST_STOP_RSP
+ tANI_U16 length;
+ tSirMacAddr peerMacAddr;
+ tSirResultCodes statusCode;
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ tANI_U16 aid;
+#endif
+} tSirSmeLinkTestStopRsp, *tpSirSmeLinkTestStopRsp;
+
+/// Definition for kick starting DFS measurements
+typedef struct sSirSmeDFSreq
+{
+ tANI_U16 messageType; // eWNI_SME_DFS_REQ
+ tANI_U16 length;
+ tANI_U16 transactionId; // Transaction ID for cmd
+} tSirSmeDFSrequest, *tpSirSmeDFSrequest;
+
+/// Definition for response message to previously
+/// issued DFS request
+typedef struct sSirSmeDFSrsp
+{
+ tANI_U16 messageType; // eWNI_SME_DFS_RSP
+ tANI_U16 length;
+ tSirResultCodes statusCode;
+ tANI_U16 transactionId; // Transaction ID for cmd
+ tANI_U32 dfsReport[1];
+} tSirSmeDFSrsp, *tpSirSmeDFSrsp;
+
+/// Statistic definitions
+//=============================================================
+// Per STA statistic structure; This same struct will be used for Aggregate
+// STA stats as well.
+
+// Clear radio stats and clear per sta stats
+typedef enum
+{
+ eANI_CLEAR_ALL_STATS, // Clears all stats
+ eANI_CLEAR_RX_STATS, // Clears RX statistics of the radio interface
+ eANI_CLEAR_TX_STATS, // Clears TX statistics of the radio interface
+ eANI_CLEAR_RADIO_STATS, // Clears all the radio stats
+ eANI_CLEAR_PER_STA_STATS, // Clears Per STA stats
+ eANI_CLEAR_AGGR_PER_STA_STATS, // Clears aggregate stats
+
+ // Used to distinguish between per sta to security stats.
+ // Used only by AP, FW just returns the same parameter as it received.
+ eANI_LINK_STATS, // Get Per STA stats
+ eANI_SECURITY_STATS, // Get Per STA security stats
+
+ eANI_CLEAR_STAT_TYPES_END
+} tAniStatSubTypes;
+
+typedef struct sAniTxCtrs
+{
+ // add the rate counters here
+ tANI_U32 tx1Mbps;
+ tANI_U32 tx2Mbps;
+ tANI_U32 tx5_5Mbps;
+ tANI_U32 tx6Mbps;
+ tANI_U32 tx9Mbps;
+ tANI_U32 tx11Mbps;
+ tANI_U32 tx12Mbps;
+ tANI_U32 tx18Mbps;
+ tANI_U32 tx24Mbps;
+ tANI_U32 tx36Mbps;
+ tANI_U32 tx48Mbps;
+ tANI_U32 tx54Mbps;
+ tANI_U32 tx72Mbps;
+ tANI_U32 tx96Mbps;
+ tANI_U32 tx108Mbps;
+
+ // tx path radio counts
+ tANI_U32 txFragHi;
+ tANI_U32 txFragLo;
+ tANI_U32 txFrameHi;
+ tANI_U32 txFrameLo;
+ tANI_U32 txMulticastFrameHi;
+ tANI_U32 txMulticastFrameLo;
+ tANI_U32 txFailedHi;
+ tANI_U32 txFailedLo;
+ tANI_U32 multipleRetryHi;
+ tANI_U32 multipleRetryLo;
+ tANI_U32 singleRetryHi;
+ tANI_U32 singleRetryLo;
+ tANI_U32 ackFailureHi;
+ tANI_U32 ackFailureLo;
+ tANI_U32 xmitBeacons;
+
+ // titan 3c stats
+ tANI_U32 txCbEscPktCntHi; // Total Number of Channel Bonded/Escort Packet Transmitted
+ tANI_U32 txCbEscPktCntLo;
+ tANI_U32 txChunksCntHi; // Total Number of Chunks Transmitted
+ tANI_U32 txChunksCntLo;
+ tANI_U32 txCompPktCntHi; // Total Number of Compresssed Packet Transmitted
+ tANI_U32 txCompPktCntLo;
+ tANI_U32 tx50PerCompPktCntHi; // Total Number of Packets with 50% or more compression
+ tANI_U32 tx50PerCompPktCntLo;
+ tANI_U32 txExpanPktCntHi; // Total Number of Packets Transmitted that got expanded
+ tANI_U32 txExpanPktCntLo;
+} tAniTxCtrs, *tpAniTxCtrs;
+
+typedef struct sAniRxCtrs
+{
+ // receive frame rate counters
+ tANI_U32 rx1Mbps;
+ tANI_U32 rx2Mbps;
+ tANI_U32 rx5_5Mbps;
+ tANI_U32 rx6Mbps;
+ tANI_U32 rx9Mbps;
+ tANI_U32 rx11Mbps;
+ tANI_U32 rx12Mbps;
+ tANI_U32 rx18Mbps;
+ tANI_U32 rx24Mbps;
+ tANI_U32 rx36Mbps;
+ tANI_U32 rx48Mbps;
+ tANI_U32 rx54Mbps;
+ tANI_U32 rx72Mbps;
+ tANI_U32 rx96Mbps;
+ tANI_U32 rx108Mbps;
+
+ // receive size counters; 'Lte' = Less than or equal to
+ tANI_U32 rxLte64;
+ tANI_U32 rxLte128Gt64;
+ tANI_U32 rxLte256Gt128;
+ tANI_U32 rxLte512Gt256;
+ tANI_U32 rxLte1kGt512;
+ tANI_U32 rxLte1518Gt1k;
+ tANI_U32 rxLte2kGt1518;
+ tANI_U32 rxLte4kGt2k;
+
+ // rx radio stats
+ tANI_U32 rxFrag;
+ tANI_U32 rxFrame;
+ tANI_U32 fcsError;
+ tANI_U32 rxMulticast;
+ tANI_U32 duplicate;
+ tANI_U32 rtsSuccess;
+ tANI_U32 rtsFailed;
+ tANI_U32 wepUndecryptables;
+ tANI_U32 drops;
+ tANI_U32 aesFormatErrorUcastCnts;
+ tANI_U32 aesReplaysUcast;
+ tANI_U32 aesDecryptErrUcast;
+
+ // titan 3c stats
+ tANI_U32 rxDecompPktCntHi; // Total Number of Packets that got decompressed
+ tANI_U32 rxDecompPktCntLo;
+ tANI_U32 rxCompPktCntHi; // Total Number of Packets received that were actually compressed
+ tANI_U32 rxCompPktCntLo;
+ tANI_U32 rxExpanPktCntHi; // Total Number of Packets received that got expanded
+ tANI_U32 rxExpanPktCntLo;
+} tAniRxCtrs, *tpAniRxCtrs;
+
+// Radio stats
+typedef struct sAniRadioStats
+{
+ tAniTxCtrs tx;
+ tAniRxCtrs rx;
+} tAniRadioStats, *tpAniRadioStats;
+
+// Get Radio Stats request structure
+// This structure shall be used for both Radio stats and Aggregate stats
+// A valid request must contain entire structure with/without valid fields.
+// Based on the request type, the valid fields will be checked.
+typedef struct sAniGetStatsReq
+{
+ // Common for all types are requests
+ tANI_U16 msgType; // message type is same as the request type
+ tANI_U16 msgLen; // length of the entire request
+ tANI_U8 sessionId; //Session ID
+ tANI_U16 transactionId;
+ tSirMacAddr bssId; //BSSID
+ // only used for clear stats and per sta stats clear
+ tAniStatSubTypes stat; // Clears the stats of the described types.
+ tANI_U32 staId; // Per STA stats request must contain valid
+ // values
+ tANI_U8 macAddr[6];
+} tAniGetStatsReq, *tpAniGetStatsReq;
+
+// Get Radio Stats response struct
+typedef struct sAniGetRadioStatsRsp
+{
+ tANI_U16 type; // message type is same as the request type
+ tANI_U16 msgLen; // length of the entire request
+ tANI_U32 rc;
+ tANI_U16 transactionId;
+ tAniRadioStats radio;
+} tAniGetRadioStatsRsp, *tpAniGetRadioStatsRsp;
+
+// Per Sta stats response struct
+typedef struct sAniGetPerStaStatsRsp
+{
+ tANI_U16 type; // message type is same as the request type
+ tANI_U16 msgLen; // length of the entire request
+ tANI_U32 rc;
+ tANI_U16 transactionId;
+ tAniStatSubTypes stat; // Sub type needed by AP. Returns the same value
+ tAniStaStatStruct sta;
+ tANI_U32 staId;
+ tANI_U8 macAddr[6];
+} tAniGetPerStaStatsRsp, *tpAniGetPerStaStatsRsp;
+
+// Get Aggregate stats
+typedef struct sAniGetAggrStaStatsRsp
+{
+ tANI_U16 type; // message type is same as the request type
+ tANI_U16 msgLen; // length of the entire request
+ tANI_U32 rc;
+ tANI_U16 transactionId;
+ tAniStaStatStruct sta;
+} tAniGetAggrStaStatsRsp, *tpAniGetAggrStaStatsRsp;
+
+// Clear stats request and response structure. 'rc' field is unused in
+// request and this field is used in response field.
+typedef struct sAniClearStatsRsp
+{
+ tANI_U16 type; // message type is same as the request type
+ tANI_U16 msgLen; // length of the entire request
+ tANI_U32 rc; // return code - will be filled by FW on
+ // response.
+ // Same transaction ID will be returned by the FW
+ tANI_U16 transactionId;
+ tAniStatSubTypes stat; // Clears the stats of the described types.
+ tANI_U32 staId; // Applicable only to PER STA stats clearing
+ tANI_U8 macAddr[6]; // Applicable only to PER STA stats clearing
+} tAniClearStatsRsp, *tpAniClearStatsRsp;
+
+typedef struct sAniGetGlobalStatsRsp
+{
+ tANI_U16 type; // message type is same as the request type
+ tANI_U16 msgLen; // length of the entire request
+ tANI_U32 rc;
+ tANI_U16 transactionId;
+ tAniGlobalStatStruct global;
+} tAniGetGlobalStatsRsp, *tpAniGetGlobalStatsRsp;
+
+typedef struct sAniGetStatSummaryRsp
+{
+ tANI_U16 type; // message type is same as the request type
+ tANI_U16 msgLen; // length of the entire request --Why?
+ tANI_U32 rc;
+ tANI_U16 transactionId;
+ tAniStatSummaryStruct stat;
+} tAniGetStatSummaryRsp, *tpAniGetStatSummaryRsp;
+
+//***************************************************************
+
+
+/*******************PE Statistics*************************/
+typedef enum
+{
+ PE_SUMMARY_STATS_INFO = 0x00000001,
+ PE_GLOBAL_CLASS_A_STATS_INFO = 0x00000002,
+ PE_GLOBAL_CLASS_B_STATS_INFO = 0x00000004,
+ PE_GLOBAL_CLASS_C_STATS_INFO = 0x00000008,
+ PE_GLOBAL_CLASS_D_STATS_INFO = 0x00000010,
+ PE_PER_STA_STATS_INFO = 0x00000020
+}ePEStatsMask;
+
+/*
+ * tpAniGetPEStatsReq is tied to
+ * for SME ==> PE eWNI_SME_GET_STATISTICS_REQ msgId and
+ * for PE ==> HAL SIR_HAL_GET_STATISTICS_REQ msgId
+ */
+typedef struct sAniGetPEStatsReq
+{
+ // Common for all types are requests
+ tANI_U16 msgType; // message type is same as the request type
+ tANI_U16 msgLen; // length of the entire request
+ tANI_U32 staId; // Per STA stats request must contain valid
+ tANI_U32 statsMask; // categories of stats requested. look at ePEStatsMask
+} tAniGetPEStatsReq, *tpAniGetPEStatsReq;
+
+/*
+ * tpAniGetPEStatsRsp is tied to
+ * for PE ==> SME eWNI_SME_GET_STATISTICS_RSP msgId and
+ * for HAL ==> PE SIR_HAL_GET_STATISTICS_RSP msgId
+ */
+typedef struct sAniGetPEStatsRsp
+{
+ // Common for all types are responses
+ tANI_U16 msgType; // message type is same as the request type
+ tANI_U16 msgLen; // length of the entire request, includes the pStatsBuf length too
+ tANI_U8 sessionId;
+ tANI_U32 rc; //success/failure
+ tANI_U32 staId; // Per STA stats request must contain valid
+ tANI_U32 statsMask; // categories of stats requested. look at ePEStatsMask
+/**********************************************************************************************
+ //void *pStatsBuf;
+ The Stats buffer starts here and can be an aggregate of more than one statistics
+ structure depending on statsMask.The void pointer "pStatsBuf" is commented out
+ intentionally and the src code that uses this structure should take that into account.
+**********************************************************************************************/
+} tAniGetPEStatsRsp, *tpAniGetPEStatsRsp;
+
+typedef struct sAniGetRssiReq
+{
+ // Common for all types are requests
+ tANI_U16 msgType; // message type is same as the request type
+ tANI_U16 msgLen; // length of the entire request
+ tANI_U8 sessionId;
+ tANI_U8 staId;
+ void *rssiCallback;
+ void *pDevContext; //device context
+ void *pVosContext; //voss context
+
+} tAniGetRssiReq, *tpAniGetRssiReq;
+
+/* Change country code request MSG structure */
+typedef struct sAniChangeCountryCodeReq
+{
+ // Common for all types are requests
+ tANI_U16 msgType; // message type is same as the request type
+ tANI_U16 msgLen; // length of the entire request
+ tANI_U8 countryCode[WNI_CFG_COUNTRY_CODE_LEN]; //3 char country code
+ void *changeCCCallback;
+ void *pDevContext; //device context
+ void *pVosContext; //voss context
+
+} tAniChangeCountryCodeReq, *tpAniChangeCountryCodeReq;
+
+typedef struct sAniSummaryStatsInfo
+{
+ tANI_U32 retry_cnt[4]; //Total number of packets(per AC) that were successfully transmitted with retries
+ tANI_U32 multiple_retry_cnt[4];//The number of MSDU packets and MMPDU frames per AC that the 802.11
+ // station successfully transmitted after more than one retransmission attempt
+
+ tANI_U32 tx_frm_cnt[4]; //Total number of packets(per AC) that were successfully transmitted
+ //(with and without retries, including multi-cast, broadcast)
+ //tANI_U32 tx_fail_cnt;
+ //tANI_U32 num_rx_frm_crc_err; //Total number of received frames with CRC Error
+ //tANI_U32 num_rx_frm_crc_ok; //Total number of successfully received frames with out CRC Error
+ tANI_U32 rx_frm_cnt; //Total number of packets that were successfully received
+ //(after appropriate filter rules including multi-cast, broadcast)
+ tANI_U32 frm_dup_cnt; //Total number of duplicate frames received successfully
+ tANI_U32 fail_cnt[4]; //Total number packets(per AC) failed to transmit
+ tANI_U32 rts_fail_cnt; //Total number of RTS/CTS sequence failures for transmission of a packet
+ tANI_U32 ack_fail_cnt; //Total number packets failed transmit because of no ACK from the remote entity
+ tANI_U32 rts_succ_cnt; //Total number of RTS/CTS sequence success for transmission of a packet
+ tANI_U32 rx_discard_cnt; //The sum of the receive error count and dropped-receive-buffer error count.
+ //HAL will provide this as a sum of (FCS error) + (Fail get BD/PDU in HW)
+ tANI_U32 rx_error_cnt; //The receive error count. HAL will provide the RxP FCS error global counter.
+ tANI_U32 tx_byte_cnt; //The sum of the transmit-directed byte count, transmit-multicast byte count
+ //and transmit-broadcast byte count. HAL will sum TPE UC/MC/BCAST global counters
+ //to provide this.
+#if 0
+ //providing the following stats, in case of wrap around for tx_byte_cnt
+ tANI_U32 tx_unicast_lower_byte_cnt;
+ tANI_U32 tx_unicast_upper_byte_cnt;
+ tANI_U32 tx_multicast_lower_byte_cnt;
+ tANI_U32 tx_multicast_upper_byte_cnt;
+ tANI_U32 tx_broadcast_lower_byte_cnt;
+ tANI_U32 tx_broadcast_upper_byte_cnt;
+#endif
+
+}tAniSummaryStatsInfo, *tpAniSummaryStatsInfo;
+
+typedef enum eTxRateInfo
+{
+ eHAL_TX_RATE_LEGACY = 0x1, /* Legacy rates */
+ eHAL_TX_RATE_HT20 = 0x2, /* HT20 rates */
+ eHAL_TX_RATE_HT40 = 0x4, /* HT40 rates */
+ eHAL_TX_RATE_SGI = 0x8, /* Rate with Short guard interval */
+ eHAL_TX_RATE_LGI = 0x10 /* Rate with Long guard interval */
+} tTxrateinfoflags;
+
+typedef struct sAniGlobalClassAStatsInfo
+{
+ tANI_U32 rx_frag_cnt; //The number of MPDU frames received by the 802.11 station for MSDU packets
+ //or MMPDU frames
+ tANI_U32 promiscuous_rx_frag_cnt; //The number of MPDU frames received by the 802.11 station for MSDU packets
+ //or MMPDU frames when a promiscuous packet filter was enabled
+ //tANI_U32 rx_fcs_err; //The number of MPDU frames that the 802.11 station received with FCS errors
+ tANI_U32 rx_input_sensitivity; //The receiver input sensitivity referenced to a FER of 8% at an MPDU length
+ //of 1024 bytes at the antenna connector. Each element of the array shall correspond
+ //to a supported rate and the order shall be the same as the supporteRates parameter.
+ tANI_U32 max_pwr; //The maximum transmit power in dBm upto one decimal.
+ //for eg: if it is 10.5dBm, the value would be 105
+ //tANI_U32 default_pwr; //The nominal transmit level used after normal power on sequence
+ tANI_U32 sync_fail_cnt; //Number of times the receiver failed to synchronize with the incoming signal
+ //after detecting the sync in the preamble of the transmitted PLCP protocol data unit.
+ tANI_U32 tx_rate; //Legacy transmit rate, in units of
+ //500 kbit/sec, for the most
+ //recently transmitted frame
+ tANI_U32 mcs_index; //mcs index for HT20 and HT40 rates
+ tANI_U32 tx_rate_flags; //to differentiate between HT20 and
+ //HT40 rates; short and long guard interval
+
+}tAniGlobalClassAStatsInfo, *tpAniGlobalClassAStatsInfo;
+
+
+typedef struct sAniGlobalSecurityStats
+{
+ tANI_U32 rx_wep_unencrypted_frm_cnt; //The number of unencrypted received MPDU frames that the MAC layer discarded when
+ //the IEEE 802.11 dot11ExcludeUnencrypted management information base (MIB) object
+ //is enabled
+ tANI_U32 rx_mic_fail_cnt; //The number of received MSDU packets that that the 802.11 station discarded
+ //because of MIC failures
+ tANI_U32 tkip_icv_err; //The number of encrypted MPDU frames that the 802.11 station failed to decrypt
+ //because of a TKIP ICV error
+ tANI_U32 aes_ccmp_format_err; //The number of received MPDU frames that the 802.11 discarded because of an
+ //invalid AES-CCMP format
+ tANI_U32 aes_ccmp_replay_cnt; //The number of received MPDU frames that the 802.11 station discarded because of
+ //the AES-CCMP replay protection procedure
+ tANI_U32 aes_ccmp_decrpt_err; //The number of received MPDU frames that the 802.11 station discarded because of
+ //errors detected by the AES-CCMP decryption algorithm
+ tANI_U32 wep_undecryptable_cnt; //The number of encrypted MPDU frames received for which a WEP decryption key was
+ //not available on the 802.11 station
+ tANI_U32 wep_icv_err; //The number of encrypted MPDU frames that the 802.11 station failed to decrypt
+ //because of a WEP ICV error
+ tANI_U32 rx_decrypt_succ_cnt; //The number of received encrypted packets that the 802.11 station successfully
+ //decrypted
+ tANI_U32 rx_decrypt_fail_cnt; //The number of encrypted packets that the 802.11 station failed to decrypt
+
+}tAniGlobalSecurityStats, *tpAniGlobalSecurityStats;
+
+typedef struct sAniGlobalClassBStatsInfo
+{
+ tAniGlobalSecurityStats ucStats;
+ tAniGlobalSecurityStats mcbcStats;
+}tAniGlobalClassBStatsInfo, *tpAniGlobalClassBStatsInfo;
+
+typedef struct sAniGlobalClassCStatsInfo
+{
+ tANI_U32 rx_amsdu_cnt; //This counter shall be incremented for a received A-MSDU frame with the stations
+ //MAC address in the address 1 field or an A-MSDU frame with a group address in the
+ //address 1 field
+ tANI_U32 rx_ampdu_cnt; //This counter shall be incremented when the MAC receives an AMPDU from the PHY
+ tANI_U32 tx_20_frm_cnt; //This counter shall be incremented when a Frame is transmitted only on the
+ //primary channel
+ tANI_U32 rx_20_frm_cnt; //This counter shall be incremented when a Frame is received only on the primary channel
+ tANI_U32 rx_mpdu_in_ampdu_cnt; //This counter shall be incremented by the number of MPDUs received in the A-MPDU
+ //when an A-MPDU is received
+ tANI_U32 ampdu_delimiter_crc_err;//This counter shall be incremented when an MPDU delimiter has a CRC error when this
+ //is the first CRC error in the received AMPDU or when the previous delimiter has been
+ //decoded correctly
+
+}tAniGlobalClassCStatsInfo, *tpAniGlobalClassCStatsInfo;
+
+typedef struct sAniPerStaStatsInfo
+{
+ tANI_U32 tx_frag_cnt[4]; //The number of MPDU frames that the 802.11 station transmitted and acknowledged
+ //through a received 802.11 ACK frame
+ tANI_U32 tx_ampdu_cnt; //This counter shall be incremented when an A-MPDU is transmitted
+ tANI_U32 tx_mpdu_in_ampdu_cnt; //This counter shall increment by the number of MPDUs in the AMPDU when an A-MPDU
+ //is transmitted
+
+}tAniPerStaStatsInfo, *tpAniPerStaStatsInfo;
+
+/**********************PE Statistics end*************************/
+
+
+
+typedef struct sSirRSSIThresholds
+{
+#ifdef ANI_BIG_BYTE_ENDIAN
+ tANI_S8 ucRssiThreshold1 : 8;
+ tANI_S8 ucRssiThreshold2 : 8;
+ tANI_S8 ucRssiThreshold3 : 8;
+ tANI_U8 bRssiThres1PosNotify : 1;
+ tANI_U8 bRssiThres1NegNotify : 1;
+ tANI_U8 bRssiThres2PosNotify : 1;
+ tANI_U8 bRssiThres2NegNotify : 1;
+ tANI_U8 bRssiThres3PosNotify : 1;
+ tANI_U8 bRssiThres3NegNotify : 1;
+ tANI_U8 bReserved10 : 2;
+#else
+ tANI_U8 bReserved10 : 2;
+ tANI_U8 bRssiThres3NegNotify : 1;
+ tANI_U8 bRssiThres3PosNotify : 1;
+ tANI_U8 bRssiThres2NegNotify : 1;
+ tANI_U8 bRssiThres2PosNotify : 1;
+ tANI_U8 bRssiThres1NegNotify : 1;
+ tANI_U8 bRssiThres1PosNotify : 1;
+ tANI_S8 ucRssiThreshold3 : 8;
+ tANI_S8 ucRssiThreshold2 : 8;
+ tANI_S8 ucRssiThreshold1 : 8;
+#endif
+
+}tSirRSSIThresholds, *tpSirRSSIThresholds;
+
+typedef struct sSirRSSINotification
+{
+#ifdef ANI_BIG_BYTE_ENDIAN
+ tANI_U32 bRssiThres1PosCross : 1;
+ tANI_U32 bRssiThres1NegCross : 1;
+ tANI_U32 bRssiThres2PosCross : 1;
+ tANI_U32 bRssiThres2NegCross : 1;
+ tANI_U32 bRssiThres3PosCross : 1;
+ tANI_U32 bRssiThres3NegCross : 1;
+ tANI_U32 bReserved : 26;
+#else
+ tANI_U32 bReserved : 26;
+ tANI_U32 bRssiThres3NegCross : 1;
+ tANI_U32 bRssiThres3PosCross : 1;
+ tANI_U32 bRssiThres2NegCross : 1;
+ tANI_U32 bRssiThres2PosCross : 1;
+ tANI_U32 bRssiThres1NegCross : 1;
+ tANI_U32 bRssiThres1PosCross : 1;
+#endif
+
+}tSirRSSINotification, *tpSirRSSINotification;
+
+#ifdef WLAN_FEATURE_P2P
+typedef struct sSirP2PNoaAttr
+{
+#ifdef ANI_BIG_BYTE_ENDIAN
+ tANI_U32 index :8;
+ tANI_U32 oppPsFlag :1;
+ tANI_U32 ctWin :7;
+ tANI_U32 rsvd1: 16;
+#else
+ tANI_U32 rsvd1: 16;
+ tANI_U32 ctWin :7;
+ tANI_U32 oppPsFlag :1;
+ tANI_U32 index :8;
+#endif
+
+#ifdef ANI_BIG_BYTE_ENDIAN
+ tANI_U32 uNoa1IntervalCnt:8;
+ tANI_U32 rsvd2:24;
+#else
+ tANI_U32 rsvd2:24;
+ tANI_U32 uNoa1IntervalCnt:8;
+#endif
+ tANI_U32 uNoa1Duration;
+ tANI_U32 uNoa1Interval;
+ tANI_U32 uNoa1StartTime;
+
+#ifdef ANI_BIG_BYTE_ENDIAN
+ tANI_U32 uNoa2IntervalCnt:8;
+ tANI_U32 rsvd3:24;
+#else
+ tANI_U32 rsvd3:24;
+ tANI_U32 uNoa2IntervalCnt:8;
+#endif
+ tANI_U32 uNoa2Duration;
+ tANI_U32 uNoa2Interval;
+ tANI_U32 uNoa2StartTime;
+} tSirP2PNoaAttr, *tpSirP2PNoaAttr;
+#endif
+
+typedef __ani_attr_pre_packed struct sSirTclasInfo
+{
+ tSirMacTclasIE tclas;
+ tANI_U8 version; // applies only for classifier type ip
+ __ani_attr_pre_packed union {
+ tSirMacTclasParamEthernet eth;
+ tSirMacTclasParamIPv4 ipv4;
+ tSirMacTclasParamIPv6 ipv6;
+ tSirMacTclasParam8021dq t8021dq;
+ }__ani_attr_packed tclasParams;
+} __ani_attr_packed tSirTclasInfo;
+
+typedef struct sSirAddtsReqInfo
+{
+ tANI_U8 dialogToken;
+ tSirMacTspecIE tspec;
+
+ tANI_U8 numTclas; // number of Tclas elements
+ tSirTclasInfo tclasInfo[SIR_MAC_TCLASIE_MAXNUM];
+ tANI_U8 tclasProc;
+#ifdef FEATURE_WLAN_CCX
+ tSirMacCCXTSRSIE tsrsIE;
+ tANI_U8 tsrsPresent:1;
+#endif
+ tANI_U8 wmeTspecPresent:1;
+ tANI_U8 wsmTspecPresent:1;
+ tANI_U8 lleTspecPresent:1;
+ tANI_U8 tclasProcPresent:1;
+} tSirAddtsReqInfo, *tpSirAddtsReqInfo;
+
+typedef struct sSirAddtsRspInfo
+{
+ tANI_U8 dialogToken;
+ tSirMacStatusCodes status;
+ tSirMacTsDelayIE delay;
+
+ tSirMacTspecIE tspec;
+ tANI_U8 numTclas; // number of Tclas elements
+ tSirTclasInfo tclasInfo[SIR_MAC_TCLASIE_MAXNUM];
+ tANI_U8 tclasProc;
+ tSirMacScheduleIE schedule;
+#ifdef FEATURE_WLAN_CCX
+ tSirMacCCXTSMIE tsmIE;
+ tANI_U8 tsmPresent:1;
+#endif
+ tANI_U8 wmeTspecPresent:1;
+ tANI_U8 wsmTspecPresent:1;
+ tANI_U8 lleTspecPresent:1;
+ tANI_U8 tclasProcPresent:1;
+ tANI_U8 schedulePresent:1;
+} tSirAddtsRspInfo, *tpSirAddtsRspInfo;
+
+typedef struct sSirDeltsReqInfo
+{
+ tSirMacTSInfo tsinfo;
+ tSirMacTspecIE tspec;
+ tANI_U8 wmeTspecPresent:1;
+ tANI_U8 wsmTspecPresent:1;
+ tANI_U8 lleTspecPresent:1;
+} tSirDeltsReqInfo, *tpSirDeltsReqInfo;
+
+/// Add a tspec as defined
+typedef struct sSirAddtsReq
+{
+ tANI_U16 messageType; // eWNI_SME_ADDTS_REQ
+ tANI_U16 length;
+ tANI_U8 sessionId; //Session ID
+ tANI_U16 transactionId;
+ tSirMacAddr bssId; //BSSID
+ tANI_U32 timeout; // in ms
+ tANI_U8 rspReqd;
+ tSirAddtsReqInfo req;
+} tSirAddtsReq, *tpSirAddtsReq;
+
+typedef struct sSirAddtsRsp
+{
+ tANI_U16 messageType; // eWNI_SME_ADDTS_RSP
+ tANI_U16 length;
+ tANI_U8 sessionId; // sme sessionId Added for BT-AMP support
+ tANI_U16 transactionId; //sme transaction Id Added for BT-AMP Support
+ tANI_U32 rc; // return code
+ tSirAddtsRspInfo rsp;
+} tSirAddtsRsp, *tpSirAddtsRsp;
+
+typedef struct sSirDeltsReq
+{
+ tANI_U16 messageType; // eWNI_SME_DELTS_REQ
+ tANI_U16 length;
+ tANI_U8 sessionId;//Session ID
+ tANI_U16 transactionId;
+ tSirMacAddr bssId; //BSSID
+ tANI_U16 aid; // use 0 if macAddr is being specified
+ tANI_U8 macAddr[6]; // only on AP to specify the STA
+ tANI_U8 rspReqd;
+ tSirDeltsReqInfo req;
+} tSirDeltsReq, *tpSirDeltsReq;
+
+typedef struct sSirDeltsRsp
+{
+ tANI_U16 messageType; // eWNI_SME_DELTS_RSP
+ tANI_U16 length;
+ tANI_U8 sessionId; // sme sessionId Added for BT-AMP support
+ tANI_U16 transactionId; //sme transaction Id Added for BT-AMP Support
+ tANI_U32 rc;
+ tANI_U16 aid; // use 0 if macAddr is being specified
+ tANI_U8 macAddr[6]; // only on AP to specify the STA
+ tSirDeltsReqInfo rsp;
+} tSirDeltsRsp, *tpSirDeltsRsp;
+
+#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX
+
+#define SIR_QOS_NUM_TSPEC_MAX 2
+#define SIR_QOS_NUM_AC_MAX 4
+
+typedef struct sSirAggrQosReqInfo
+{
+ tANI_U16 tspecIdx;
+ tSirAddtsReqInfo aggrAddTsInfo[SIR_QOS_NUM_AC_MAX];
+}tSirAggrQosReqInfo, *tpSirAggrQosReqInfo;
+
+typedef struct sSirAggrQosReq
+{
+ tANI_U16 messageType; // eWNI_SME_ADDTS_REQ
+ tANI_U16 length;
+ tANI_U8 sessionId; //Session ID
+ tANI_U16 transactionId;
+ tSirMacAddr bssId; //BSSID
+ tANI_U32 timeout; // in ms
+ tANI_U8 rspReqd;
+ tSirAggrQosReqInfo aggrInfo;
+}tSirAggrQosReq, *tpSirAggrQosReq;
+
+typedef struct sSirAggrQosRspInfo
+{
+ tANI_U16 tspecIdx;
+ tSirAddtsRspInfo aggrRsp[SIR_QOS_NUM_AC_MAX];
+} tSirAggrQosRspInfo, *tpSirAggrQosRspInfo;
+
+typedef struct sSirAggrQosRsp
+{
+ tANI_U16 messageType;
+ tANI_U16 length;
+ tANI_U8 sessionId;
+ tSirAggrQosRspInfo aggrInfo;
+} tSirAggrQosRsp, *tpSirAggrQosRsp;
+
+#endif/*WLAN_FEATURE_VOWIFI_11R || FEATURE_WLAN_CCX*/
+
+typedef struct sSirSetTxPowerReq
+{
+ tANI_U16 messageType;
+ tANI_U16 length;
+ tANI_U32 txPower;
+} tSirSetTxPowerReq, *tpSirSetTxPowerReq;
+
+typedef struct sSirSetTxPowerRsp
+{
+ tANI_U16 messageType;
+ tANI_U16 length;
+ tANI_U32 status;
+} tSirSetTxPowerRsp, *tpSirSetTxPowerRsp;
+
+typedef struct sSirGetTxPowerReq
+{
+ tANI_U16 messageType;
+ tANI_U16 length;
+ tANI_U16 staid;
+} tSirGetTxPowerReq, *tpSirGetTxPowerReq;
+
+typedef struct sSirGetTxPowerRsp
+{
+ tANI_U16 messageType;
+ tANI_U16 length; // length of the entire request
+ tANI_U32 power; // units of milliwatts
+ tANI_U32 status;
+} tSirGetTxPowerRsp, *tpSirGetTxPowerRsp;
+
+
+typedef tANI_U32 tSirMacNoise[3];
+
+typedef struct sSirGetNoiseRsp
+{
+ tANI_U16 messageType;
+ tANI_U16 length;
+ tSirMacNoise noise;
+} tSirGetNoiseRsp, *tpSirGetNoiseRsp;
+
+
+//
+// PMC --> PE --> HAL
+// Power save configuration parameters
+//
+typedef struct sSirPowerSaveCfg
+{
+ tANI_U16 listenInterval;
+
+ /* Number of consecutive missed beacons before
+ * hardware generates an interrupt to wake up
+ * the host. In units of listen interval.
+ */
+ tANI_U32 HeartBeatCount;
+
+ /* specifies which beacons are to be forwarded
+ * to host when beacon filtering is enabled.
+ * In units of listen interval.
+ */
+ tANI_U32 nthBeaconFilter;
+
+ /* Maximum number of PS-Poll send before
+ * firmware sends data null with PM set to 0.
+ */
+ tANI_U32 maxPsPoll;
+
+ /* If the average RSSI value falls below the
+ * minRssiThreshold, then FW will send an
+ * interrupt to wake up the host.
+ */
+ tANI_U32 minRssiThreshold;
+
+ /* Number of beacons for which firmware will
+ * collect the RSSI values and compute the average.
+ */
+ tANI_U8 numBeaconPerRssiAverage;
+
+ /* FW collects the RSSI stats for this period
+ * in BMPS mode.
+ */
+ tANI_U8 rssiFilterPeriod;
+
+ // Enabling/disabling broadcast frame filter feature
+ tANI_U8 broadcastFrameFilter;
+
+ // Enabling/disabling the ignore DTIM feature
+ tANI_U8 ignoreDtim;
+
+ /* The following configuration parameters are kept
+ * in order to be backward compatible for Gen5.
+ * These will NOT be used for Gen6 Libra chip
+ */
+ tBeaconForwarding beaconFwd;
+ tANI_U16 nthBeaconFwd;
+ tANI_U8 fEnablePwrSaveImmediately;
+ tANI_U8 fPSPoll;
+
+ // Enabling/disabling Beacon Early Termination feature
+ tANI_U8 fEnableBeaconEarlyTermination;
+ tANI_U8 bcnEarlyTermWakeInterval;
+
+}tSirPowerSaveCfg, *tpSirPowerSaveCfg;
+
+/* Reason code for requesting Full Power. This reason code is used by
+ any module requesting full power from PMC and also by PE when it
+ sends the eWNI_PMC_EXIT_BMPS_IND to PMC*/
+typedef enum eRequestFullPowerReason
+{
+ eSME_MISSED_BEACON_IND_RCVD, /* PE received a MAX_MISSED_BEACON_IND */
+ eSME_BMPS_STATUS_IND_RCVD, /* PE received a SIR_HAL_BMPS_STATUS_IND */
+ eSME_BMPS_MODE_DISABLED, /* BMPS mode was disabled by HDD in SME */
+ eSME_LINK_DISCONNECTED_BY_HDD, /* Link has been disconnected requested by HDD */
+ eSME_LINK_DISCONNECTED_BY_OTHER,/* Disconnect due to linklost or requested by peer */
+ eSME_FULL_PWR_NEEDED_BY_HDD, /* HDD request full power for some reason */
+ eSME_FULL_PWR_NEEDED_BY_BAP, /* BAP request full power for BT_AMP */
+ eSME_FULL_PWR_NEEDED_BY_CSR, /* CSR requests full power */
+ eSME_FULL_PWR_NEEDED_BY_QOS, /* QOS requests full power */
+ eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH, /* channel switch request full power*/
+ eSME_REASON_OTHER /* No specific reason. General reason code */
+} tRequestFullPowerReason, tExitBmpsReason;
+
+
+
+//This is sent alongwith eWNI_PMC_EXIT_BMPS_REQ message
+typedef struct sExitBmpsInfo
+{
+ tExitBmpsReason exitBmpsReason; /*Reason for exiting BMPS */
+}tExitBmpsInfo, *tpExitBmpsInfo;
+
+
+// MAC SW --> SME
+// Message indicating to SME to exit BMPS sleep mode
+typedef struct sSirSmeExitBmpsInd
+{
+ tANI_U16 mesgType; /* eWNI_PMC_EXIT_BMPS_IND */
+ tANI_U16 mesgLen;
+ tSirResultCodes statusCode;
+ tExitBmpsReason exitBmpsReason; /*Reason for exiting BMPS */
+
+} tSirSmeExitBmpsInd, *tpSirSmeExitBmpsInd;
+
+
+//
+// HDD -> LIM
+// tSirMsgQ.type = eWNI_SME_DEL_BA_PEER_IND
+// tSirMsgQ.reserved = 0
+// tSirMsgQ.body = instance of tDelBAParams
+//
+typedef struct sSmeDelBAPeerInd
+{
+ // Message Type
+ tANI_U16 mesgType;
+
+ tSirMacAddr bssId;//BSSID
+
+ // Message Length
+ tANI_U16 mesgLen;
+
+ // Station Index
+ tANI_U16 staIdx;
+
+ // TID for which the BA session is being deleted
+ tANI_U8 baTID;
+
+ // DELBA direction
+ // eBA_INITIATOR - Originator
+ // eBA_RECEIPIENT - Recipient
+ tANI_U8 baDirection;
+} tSmeDelBAPeerInd, *tpSmeDelBAPeerInd;
+
+typedef struct sSmeIbssPeerInd
+{
+ tANI_U16 mesgType;
+ tANI_U16 mesgLen;
+ tANI_U8 sessionId;
+
+ tSirMacAddr peerAddr;
+ tANI_U16 staId;
+
+ /*The DPU signatures will be sent eventually to TL to help it determine the
+ association to which a packet belongs to*/
+ /*Unicast DPU signature*/
+ tANI_U8 ucastSig;
+
+ /*Broadcast DPU signature*/
+ tANI_U8 bcastSig;
+
+ //Beacon will be appended for new Peer indication.
+}tSmeIbssPeerInd, *tpSmeIbssPeerInd;
+
+typedef struct sLimScanChn
+{
+ tANI_U16 numTimeScan; //how many time this channel is scan
+ tANI_U8 channelId;
+}tLimScanChn;
+
+typedef struct sSmeGetScanChnRsp
+{
+ // Message Type
+ tANI_U16 mesgType;
+ // Message Length
+ tANI_U16 mesgLen;
+ tANI_U8 sessionId;
+ tANI_U8 numChn;
+ tLimScanChn scanChn[1];
+} tSmeGetScanChnRsp, *tpSmeGetScanChnRsp;
+
+typedef struct sLimScanChnInfo
+{
+ tANI_U8 numChnInfo; //number of channels in scanChn
+ tLimScanChn scanChn[SIR_MAX_SUPPORTED_CHANNEL_LIST];
+}tLimScanChnInfo;
+
+#ifdef WLAN_SOFTAP_FEATURE
+typedef struct sSirSmeGetAssocSTAsReq
+{
+ tANI_U16 messageType; // eWNI_SME_GET_ASSOC_STAS_REQ
+ tANI_U16 length;
+ tSirMacAddr bssId; // BSSID
+ tANI_U16 modId;
+ void *pUsrContext;
+ void *pSapEventCallback;
+ void *pAssocStasArray;// Pointer to allocated memory passed in WLANSAP_GetAssocStations API
+} tSirSmeGetAssocSTAsReq, *tpSirSmeGetAssocSTAsReq;
+#endif
+
+typedef struct sSmeMaxAssocInd
+{
+ tANI_U16 mesgType; // eWNI_SME_MAX_ASSOC_EXCEEDED
+ tANI_U16 mesgLen;
+ tANI_U8 sessionId;
+ tSirMacAddr peerMac; // the new peer that got rejected due to softap max assoc limit reached
+} tSmeMaxAssocInd, *tpSmeMaxAssocInd;
+
+/*--------------------------------------------------------------------*/
+/* BootLoader message definition */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* FW image size */
+/*--------------------------------------------------------------------*/
+#define SIR_FW_IMAGE_SIZE 146332
+
+
+#define SIR_BOOT_MODULE_ID 1
+
+#define SIR_BOOT_SETUP_IND ((SIR_BOOT_MODULE_ID << 8) | 0x11)
+#define SIR_BOOT_POST_RESULT_IND ((SIR_BOOT_MODULE_ID << 8) | 0x12)
+#define SIR_BOOT_DNLD_RESULT_IND ((SIR_BOOT_MODULE_ID << 8) | 0x13)
+#define SIR_BOOT_DNLD_DEV_REQ ((SIR_BOOT_MODULE_ID << 8) | 0x41)
+#define SIR_BOOT_DNLD_DEV_RSP ((SIR_BOOT_MODULE_ID << 8) | 0x81)
+#define SIR_BOOT_DNLD_REQ ((SIR_BOOT_MODULE_ID << 8) | 0x42)
+#define SIR_BOOT_DNLD_RSP ((SIR_BOOT_MODULE_ID << 8) | 0x82)
+
+/*--------------------------------------------------------------------*/
+/* Bootloader message syntax */
+/*--------------------------------------------------------------------*/
+
+// Message header
+#define SIR_BOOT_MB_HEADER 0
+#define SIR_BOOT_MB_HEADER2 1
+
+#define SIR_BOOT_MSG_HDR_MASK 0xffff0000
+#define SIR_BOOT_MSG_LEN_MASK 0x0000ffff
+
+// BOOT_SETUP_IND parameter indices
+#define SIR_BOOT_SETUP_IND_MBADDR 2
+#define SIR_BOOT_SETUP_IND_MBSIZE 3
+#define SIR_BOOT_SETUP_IND_MEMOPT 4
+#define SIR_BOOT_SETUP_IND_LEN \
+ ((SIR_BOOT_SETUP_IND_MEMOPT+1)<<2)
+
+// BOOT_POST_RESULT_IND parameter indices
+#define SIR_BOOT_POST_RESULT_IND_RES 2
+#define SIR_BOOT_POST_RESULT_IND_LEN \
+ ((SIR_BOOT_POST_RESULT_IND_RES+1)<<2)
+
+#define SIR_BOOT_POST_RESULT_IND_SUCCESS 1
+#define SIR_BOOT_POST_RESULT_IND_MB_FAILED 2
+#define SIR_BOOT_POST_RESULT_IND_SDRAM_FAILED 3
+#define SIR_BOOT_POST_RESULT_IND_ESRAM_FAILED 4
+
+
+// BOOT_DNLD_RESULT_IND parameter indices
+#define SIR_BOOT_DNLD_RESULT_IND_RES 2
+#define SIR_BOOT_DNLD_RESULT_IND_LEN \
+ ((SIR_BOOT_DNLD_RESULT_IND_RES+1)<<2)
+
+#define SIR_BOOT_DNLD_RESULT_IND_SUCCESS 1
+#define SIR_BOOT_DNLD_RESULT_IND_HDR_ERR 2
+#define SIR_BOOT_DNLD_RESULT_IND_ERR 3
+
+// BOOT_DNLD_DEV_REQ
+#define SIR_BOOT_DNLD_DEV_REQ_SDRAMSIZE 2
+#define SIR_BOOT_DNLD_DEV_REQ_FLASHSIZE 3
+#define SIR_BOOT_DNLD_DEV_REQ_LEN \
+ ((SIR_BOOT_DNLD_DEV_REQ_FLASHSIZE+1)<<2)
+
+// BOOT_DNLD_DEV_RSP
+#define SIR_BOOT_DNLD_DEV_RSP_DEVTYPE 2
+#define SIR_BOOT_DNLD_DEV_RSP_LEN \
+ ((SIR_BOOT_DNLD_DEV_RSP_DEVTYPE+1)<<2)
+
+#define SIR_BOOT_DNLD_DEV_RSP_SRAM 1
+#define SIR_BOOT_DNLD_DEV_RSP_FLASH 2
+
+// BOOT_DNLD_REQ
+#define SIR_BOOT_DNLD_REQ_OFFSET 2
+#define SIR_BOOT_DNLD_REQ_WRADDR 3
+#define SIR_BOOT_DNLD_REQ_SIZE 4
+#define SIR_BOOT_DNLD_REQ_LEN ((SIR_BOOT_DNLD_REQ_SIZE+1)<<2)
+
+// BOOT_DNLD_RSP
+#define SIR_BOOT_DNLD_RSP_SIZE 2
+#define SIR_BOOT_DNLD_RSP_LEN ((SIR_BOOT_DNLD_RSP_SIZE+1)<<2)
+
+#if defined(ANI_OS_TYPE_RTAI_LINUX)
+// RTAI WRAPPER definition - Buffer block control entry
+// the new block Control entry is initialized by HDD
+// memory buffers (blkPool) are allocated by HDD
+// The table resides in plmac_rtai.c
+#define BLOCK_ALLOCATED_BY_HDD 1
+#define RED_ZONE 16 // 16 bytes between buffers
+#define NUM_POOL 16 // NUM_POOL defined here for now, not
+ // so good
+typedef struct
+{
+ tANI_U16 blkSize;
+ tANI_U16 blkNum;
+ void *blkPool; // pointer to memory buffer
+
+} t_mac_block_table;
+
+#endif
+
+// board capabilities fields are defined here.
+typedef __ani_attr_pre_packed struct sSirBoardCapabilities
+{
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ tANI_U32 concat:1; // 0 - Concat is not supported, 1 - Concat is supported
+ tANI_U32 compression:1; // 0 - Compression is not supported, 1 - Compression is supported
+ tANI_U32 chnlBonding:1; // 0 - Channel Bonding is not supported, 1 - Channel Bonding is supported
+ tANI_U32 reverseFCS:1; // 0 - Reverse FCS is not supported, 1 - Reverse FCS is supported
+ tANI_U32 rsvd1:2;
+ // (productId derives sub-category in the following three families)
+ tANI_U32 cbFamily:1; // 0 - Not CB family, 1 - Cardbus
+ tANI_U32 apFamily:1; // 0 - Not AP family, 1 - AP
+ tANI_U32 mpciFamily:1; // 0 - Not MPCI family, 1 - MPCI
+ tANI_U32 bgOnly:1; // 0 - default a/b/g; 1 - b/g only
+ tANI_U32 bbChipVer:4; // Baseband chip version
+ tANI_U32 loType:2; // 0 = no LO, 1 = SILABS, 2 = ORION
+ tANI_U32 radioOn:2; // Not supported is 3 or 2, 0 = Off and 1 = On
+ tANI_U32 nReceivers:2; // 0 based.
+ tANI_U32 nTransmitters:1; // 0 = 1 transmitter, 1 = 2 transmitters
+ tANI_U32 sdram:1; // 0 = no SDRAM, 1 = SDRAM
+ tANI_U32 rsvd:1;
+ tANI_U32 extVsIntAnt:1; // 0 = ext antenna, 1 = internal antenna
+#else
+
+ tANI_U32 extVsIntAnt:1; // 0 = ext antenna, 1 = internal antenna
+ tANI_U32 rsvd:1;
+ tANI_U32 sdram:1; // 0 = no SDRAM, 1 = SDRAM
+ tANI_U32 nTransmitters:1; // 0 = 1 transmitter, 1 = 2 transmitters
+ tANI_U32 nReceivers:2; // 0 based.
+ tANI_U32 radioOn:2; // Not supported is 3 or 2, 0 = Off and 1 = On
+ tANI_U32 loType:2; // 0 = no LO, 1 = SILABS, 2 = ORION
+ tANI_U32 bbChipVer:4; // Baseband chip version
+ tANI_U32 bgOnly:1; // 0 - default a/b/g; 1 - b/g only
+ // (productId derives sub-category in the following three families)
+ tANI_U32 mpciFamily:1; // 0 - Not MPCI family, 1 - MPCI
+ tANI_U32 apFamily:1; // 0 - Not AP family, 1 - AP
+ tANI_U32 cbFamily:1; // 0 - Not CB family, 1 - Cardbus
+ tANI_U32 rsvd1:2;
+ tANI_U32 reverseFCS:1; // 0 - Reverse FCS is not supported, 1 - Reverse FCS is supported
+ tANI_U32 chnlBonding:1; // 0 - Channel Bonding is not supported, 1 - Channel Bonding is supported
+ tANI_U32 compression:1; // 0 - Compression is not supported, 1 - Compression is supported
+ tANI_U32 concat:1; // 0 - Concat is not supported, 1 - Concat is supported
+#endif
+} __ani_attr_packed tSirBoardCapabilities, *tpSirBoardCapabilities;
+
+# define ANI_BCAP_EXT_VS_INT_ANT_MASK 0x1
+# define ANI_BCAP_EXT_VS_INT_ANT_OFFSET 0
+
+# define ANI_BCAP_GAL_ON_BOARD_MASK 0x2
+# define ANI_BCAP_GAL_ON_BOARD_OFFSET 1
+
+# define ANI_BCAP_SDRAM_MASK 0x4
+# define ANI_BCAP_SDRAM_OFFSET 2
+
+# define ANI_BCAP_NUM_TRANSMITTERS_MASK 0x8
+# define ANI_BCAP_NUM_TRANSMITTERS_OFFSET 3
+
+# define ANI_BCAP_NUM_RECEIVERS_MASK 0x30
+# define ANI_BCAP_NUM_RECEIVERS_OFFSET 4
+
+# define ANI_BCAP_RADIO_ON_MASK 0xC0
+# define ANI_BCAP_RADIO_ON_OFFSET 6
+
+# define ANI_BCAP_LO_TYPE_MASK 0x300
+# define ANI_BCAP_LO_TYPE_OFFSET 8
+
+# define ANI_BCAP_BB_CHIP_VER_MASK 0xC00
+# define ANI_BCAP_BB_CHIP_VER_OFFSET 10
+
+# define ANI_BCAP_CYG_DATE_CODE_MASK 0xFF000
+# define ANI_BCAP_CYG_DATE_CODE_OFFSET 12
+
+# define ANI_BCAP_RADIO_OFF 0
+# define ANI_BCAP_RADIO_ON 1
+# define ANI_BCAP_RADIO_ON_NOT_SUPPORTED 3
+
+
+/// WOW related structures
+// SME -> PE <-> HAL
+#define SIR_WOWL_BCAST_PATTERN_MAX_SIZE 128
+#define SIR_WOWL_BCAST_MAX_NUM_PATTERNS 16
+
+// SME -> PE -> HAL - This is to add WOWL BCAST wake-up pattern.
+// SME/HDD maintains the list of the BCAST wake-up patterns.
+// This is a pass through message for PE
+typedef struct sSirWowlAddBcastPtrn
+{
+ tANI_U8 ucPatternId; // Pattern ID
+ // Pattern byte offset from beginning of the 802.11 packet to start of the
+ // wake-up pattern
+ tANI_U8 ucPatternByteOffset;
+ tANI_U8 ucPatternSize; // Non-Zero Pattern size
+ tANI_U8 ucPattern[SIR_WOWL_BCAST_PATTERN_MAX_SIZE]; // Pattern
+ tANI_U8 ucPatternMaskSize; // Non-zero pattern mask size
+ tANI_U8 ucPatternMask[SIR_WOWL_BCAST_PATTERN_MAX_SIZE]; // Pattern mask
+ // Extra pattern data beyond 128 bytes
+ tANI_U8 ucPatternExt[SIR_WOWL_BCAST_PATTERN_MAX_SIZE]; // Extra Pattern
+ tANI_U8 ucPatternMaskExt[SIR_WOWL_BCAST_PATTERN_MAX_SIZE]; // Extra Pattern mask
+} tSirWowlAddBcastPtrn, *tpSirWowlAddBcastPtrn;
+
+
+// SME -> PE -> HAL - This is to delete WOWL BCAST wake-up pattern.
+// SME/HDD maintains the list of the BCAST wake-up patterns.
+// This is a pass through message for PE
+typedef struct sSirWowlDelBcastPtrn
+{
+ /* Pattern ID of the wakeup pattern to be deleted */
+ tANI_U8 ucPatternId;
+}tSirWowlDelBcastPtrn, *tpSirWowlDelBcastPtrn;
+
+
+// SME->PE: Enter WOWLAN parameters
+typedef struct sSirSmeWowlEnterParams
+{
+ /* Enables/disables magic packet filtering */
+ tANI_U8 ucMagicPktEnable;
+
+ /* Magic pattern */
+ tSirMacAddr magicPtrn;
+
+ /* Enables/disables packet pattern filtering */
+ tANI_U8 ucPatternFilteringEnable;
+
+#ifdef WLAN_WAKEUP_EVENTS
+ /* This configuration directs the WoW packet filtering to look for EAP-ID
+ * requests embedded in EAPOL frames and use this as a wake source.
+ */
+ tANI_U8 ucWoWEAPIDRequestEnable;
+
+ /* This configuration directs the WoW packet filtering to look for EAPOL-4WAY
+ * requests and use this as a wake source.
+ */
+ tANI_U8 ucWoWEAPOL4WayEnable;
+
+ /* This configuration allows a host wakeup on an network scan offload match.
+ */
+ tANI_U8 ucWowNetScanOffloadMatch;
+
+ /* This configuration allows a host wakeup on any GTK rekeying error.
+ */
+ tANI_U8 ucWowGTKRekeyError;
+
+ /* This configuration allows a host wakeup on BSS connection loss.
+ */
+ tANI_U8 ucWoWBSSConnLoss;
+#endif // WLAN_WAKEUP_EVENTS
+
+} tSirSmeWowlEnterParams, *tpSirSmeWowlEnterParams;
+
+
+// PE<->HAL: Enter WOWLAN parameters
+typedef struct sSirHalWowlEnterParams
+{
+ /* Enables/disables magic packet filtering */
+ tANI_U8 ucMagicPktEnable;
+
+ /* Magic pattern */
+ tSirMacAddr magicPtrn;
+
+ /* Enables/disables packet pattern filtering in firmware.
+ Enabling this flag enables broadcast pattern matching
+ in Firmware. If unicast pattern matching is also desired,
+ ucUcastPatternFilteringEnable flag must be set tot true
+ as well
+ */
+ tANI_U8 ucPatternFilteringEnable;
+
+ /* Enables/disables unicast packet pattern filtering.
+ This flag specifies whether we want to do pattern match
+ on unicast packets as well and not just broadcast packets.
+ This flag has no effect if the ucPatternFilteringEnable
+ (main controlling flag) is set to false
+ */
+ tANI_U8 ucUcastPatternFilteringEnable;
+
+ /* This configuration is valid only when magicPktEnable=1.
+ * It requests hardware to wake up when it receives the
+ * Channel Switch Action Frame.
+ */
+ tANI_U8 ucWowChnlSwitchRcv;
+
+ /* This configuration is valid only when magicPktEnable=1.
+ * It requests hardware to wake up when it receives the
+ * Deauthentication Frame.
+ */
+ tANI_U8 ucWowDeauthRcv;
+
+ /* This configuration is valid only when magicPktEnable=1.
+ * It requests hardware to wake up when it receives the
+ * Disassociation Frame.
+ */
+ tANI_U8 ucWowDisassocRcv;
+
+ /* This configuration is valid only when magicPktEnable=1.
+ * It requests hardware to wake up when it has missed
+ * consecutive beacons. This is a hardware register
+ * configuration (NOT a firmware configuration).
+ */
+ tANI_U8 ucWowMaxMissedBeacons;
+
+ /* This configuration is valid only when magicPktEnable=1.
+ * This is a timeout value in units of microsec. It requests
+ * hardware to unconditionally wake up after it has stayed
+ * in WoWLAN mode for some time. Set 0 to disable this feature.
+ */
+ tANI_U8 ucWowMaxSleepUsec;
+
+#ifdef WLAN_WAKEUP_EVENTS
+ /* This configuration directs the WoW packet filtering to look for EAP-ID
+ * requests embedded in EAPOL frames and use this as a wake source.
+ */
+ tANI_U8 ucWoWEAPIDRequestEnable;
+
+ /* This configuration directs the WoW packet filtering to look for EAPOL-4WAY
+ * requests and use this as a wake source.
+ */
+ tANI_U8 ucWoWEAPOL4WayEnable;
+
+ /* This configuration allows a host wakeup on an network scan offload match.
+ */
+ tANI_U8 ucWowNetScanOffloadMatch;
+
+ /* This configuration allows a host wakeup on any GTK rekeying error.
+ */
+ tANI_U8 ucWowGTKRekeyError;
+
+ /* This configuration allows a host wakeup on BSS connection loss.
+ */
+ tANI_U8 ucWoWBSSConnLoss;
+#endif // WLAN_WAKEUP_EVENTS
+
+ /* Status code to be filled by HAL when it sends
+ * SIR_HAL_WOWL_ENTER_RSP to PE.
+ */
+ eHalStatus status;
+} tSirHalWowlEnterParams, *tpSirHalWowlEnterParams;
+
+#ifdef WLAN_SOFTAP_FEATURE
+
+#define SIR_MAX_NAME_SIZE 64
+#define SIR_MAX_TEXT_SIZE 32
+
+typedef struct sSirName {
+ v_U8_t num_name;
+ v_U8_t name[SIR_MAX_NAME_SIZE];
+} tSirName;
+
+typedef struct sSirText {
+ v_U8_t num_text;
+ v_U8_t text[SIR_MAX_TEXT_SIZE];
+} tSirText;
+
+
+#define SIR_WPS_PROBRSP_VER_PRESENT 0x00000001
+#define SIR_WPS_PROBRSP_STATE_PRESENT 0x00000002
+#define SIR_WPS_PROBRSP_APSETUPLOCK_PRESENT 0x00000004
+#define SIR_WPS_PROBRSP_SELECTEDREGISTRA_PRESENT 0x00000008
+#define SIR_WPS_PROBRSP_DEVICEPASSWORDID_PRESENT 0x00000010
+#define SIR_WPS_PROBRSP_SELECTEDREGISTRACFGMETHOD_PRESENT 0x00000020
+#define SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT 0x00000040
+#define SIR_WPS_PROBRSP_UUIDE_PRESENT 0x00000080
+#define SIR_WPS_PROBRSP_MANUFACTURE_PRESENT 0x00000100
+#define SIR_WPS_PROBRSP_MODELNAME_PRESENT 0x00000200
+#define SIR_WPS_PROBRSP_MODELNUMBER_PRESENT 0x00000400
+#define SIR_WPS_PROBRSP_SERIALNUMBER_PRESENT 0x00000800
+#define SIR_WPS_PROBRSP_PRIMARYDEVICETYPE_PRESENT 0x00001000
+#define SIR_WPS_PROBRSP_DEVICENAME_PRESENT 0x00002000
+#define SIR_WPS_PROBRSP_CONFIGMETHODS_PRESENT 0x00004000
+#define SIR_WPS_PROBRSP_RF_BANDS_PRESENT 0x00008000
+
+
+typedef struct sSirWPSProbeRspIE {
+ v_U32_t FieldPresent;
+ v_U32_t Version; // Version. 0x10 = version 1.0, 0x11 = etc.
+ v_U32_t wpsState; // 1 = unconfigured, 2 = configured.
+ v_BOOL_t APSetupLocked; // Must be included if value is TRUE
+ v_BOOL_t SelectedRegistra; //BOOL: indicates if the user has recently activated a Registrar to add an Enrollee.
+ v_U16_t DevicePasswordID; // Device Password ID
+ v_U16_t SelectedRegistraCfgMethod; // Selected Registrar config method
+ v_U8_t ResponseType; // Response type
+ v_U8_t UUID_E[16]; // Unique identifier of the AP.
+ tSirName Manufacture;
+ tSirText ModelName;
+ tSirText ModelNumber;
+ tSirText SerialNumber;
+ v_U32_t PrimaryDeviceCategory ; // Device Category ID: 1Computer, 2Input Device, ...
+ v_U8_t PrimaryDeviceOUI[4] ; // Vendor specific OUI for Device Sub Category
+ v_U32_t DeviceSubCategory ; // Device Sub Category ID: 1-PC, 2-Server if Device Category ID is computer
+ tSirText DeviceName;
+ v_U16_t ConfigMethod; // Configuaration method
+ v_U8_t RFBand; // RF bands available on the AP
+} tSirWPSProbeRspIE;
+
+#define SIR_WPS_BEACON_VER_PRESENT 0x00000001
+#define SIR_WPS_BEACON_STATE_PRESENT 0x00000002
+#define SIR_WPS_BEACON_APSETUPLOCK_PRESENT 0x00000004
+#define SIR_WPS_BEACON_SELECTEDREGISTRA_PRESENT 0x00000008
+#define SIR_WPS_BEACON_DEVICEPASSWORDID_PRESENT 0x00000010
+#define SIR_WPS_BEACON_SELECTEDREGISTRACFGMETHOD_PRESENT 0x00000020
+#define SIR_WPS_BEACON_UUIDE_PRESENT 0x00000080
+#define SIR_WPS_BEACON_RF_BANDS_PRESENT 0x00000100
+
+typedef struct sSirWPSBeaconIE {
+ v_U32_t FieldPresent;
+ v_U32_t Version; // Version. 0x10 = version 1.0, 0x11 = etc.
+ v_U32_t wpsState; // 1 = unconfigured, 2 = configured.
+ v_BOOL_t APSetupLocked; // Must be included if value is TRUE
+ v_BOOL_t SelectedRegistra; //BOOL: indicates if the user has recently activated a Registrar to add an Enrollee.
+ v_U16_t DevicePasswordID; // Device Password ID
+ v_U16_t SelectedRegistraCfgMethod; // Selected Registrar config method
+ v_U8_t UUID_E[16]; // Unique identifier of the AP.
+ v_U8_t RFBand; // RF bands available on the AP
+} tSirWPSBeaconIE;
+
+#define SIR_WPS_ASSOCRSP_VER_PRESENT 0x00000001
+#define SIR_WPS_ASSOCRSP_RESPONSETYPE_PRESENT 0x00000002
+
+typedef struct sSirWPSAssocRspIE {
+ v_U32_t FieldPresent;
+ v_U32_t Version;
+ v_U8_t ResposeType;
+} tSirWPSAssocRspIE;
+
+typedef struct sSirAPWPSIEs {
+ tSirWPSProbeRspIE SirWPSProbeRspIE; /*WPS Set Probe Respose IE*/
+ tSirWPSBeaconIE SirWPSBeaconIE; /*WPS Set Beacon IE*/
+ tSirWPSAssocRspIE SirWPSAssocRspIE; /*WPS Set Assoc Response IE*/
+} tSirAPWPSIEs, *tpSiriAPWPSIEs;
+
+typedef struct sSirUpdateAPWPSIEsReq
+{
+ tANI_U16 messageType; // eWNI_SME_UPDATE_APWPSIE_REQ
+ tANI_U16 length;
+ tANI_U16 transactionId; //Transaction ID for cmd
+ tSirMacAddr bssId; // BSSID
+ tANI_U8 sessionId; //Session ID
+ tSirAPWPSIEs APWPSIEs;
+} tSirUpdateAPWPSIEsReq, *tpSirUpdateAPWPSIEsReq;
+
+typedef struct sSirUpdateParams
+{
+ tANI_U16 messageType;
+ tANI_U16 length;
+ tANI_U8 sessionId; // Session ID
+ tANI_U8 ssidHidden; // Hide SSID
+} tSirUpdateParams, *tpSirUpdateParams;
+
+#define SIR_WPS_UUID_LEN 16
+#define SIR_WPS_PBC_WALK_TIME 120 // 120 Second
+
+typedef struct sSirWPSPBCSession {
+ struct sSirWPSPBCSession *next;
+ tSirMacAddr addr;
+ tANI_U8 uuid_e[SIR_WPS_UUID_LEN];
+ tANI_TIMESTAMP timestamp;
+} tSirWPSPBCSession;
+
+typedef struct sSirSmeGetWPSPBCSessionsReq
+{
+ tANI_U16 messageType; // eWNI_SME_GET_WPSPBC_SESSION_REQ
+ tANI_U16 length;
+ void *pUsrContext;
+ void *pSapEventCallback;
+ tSirMacAddr bssId; // BSSID
+ tSirMacAddr pRemoveMac; // MAC Address of STA in WPS Session to be removed
+} tSirSmeGetWPSPBCSessionsReq, *tpSirSmeGetWPSPBCSessionsReq;
+
+typedef struct sSirWPSPBCProbeReq
+{
+ tSirMacAddr peerMacAddr;
+ tANI_U16 probeReqIELen;
+ tANI_U8 probeReqIE[512];
+} tSirWPSPBCProbeReq, *tpSirWPSPBCProbeReq;
+
+// probereq from peer, when wsc is enabled
+typedef struct sSirSmeProbeReqInd
+{
+ tANI_U16 messageType; // eWNI_SME_WPS_PBC_PROBE_REQ_IND
+ tANI_U16 length;
+ tANI_U8 sessionId;
+ tSirMacAddr bssId;
+ tSirWPSPBCProbeReq WPSPBCProbeReq;
+} tSirSmeProbeReqInd, *tpSirSmeProbeReqInd;
+
+typedef struct sSirUpdateAPWPARSNIEsReq
+{
+ tANI_U16 messageType; // eWNI_SME_SET_APWPARSNIEs_REQ
+ tANI_U16 length;
+ tANI_U16 transactionId; //Transaction ID for cmd
+ tSirMacAddr bssId; // BSSID
+ tANI_U8 sessionId; //Session ID
+ tSirRSNie APWPARSNIEs;
+} tSirUpdateAPWPARSNIEsReq, *tpSirUpdateAPWPARSNIEsReq;
+
+#endif
+
+// SME -> HAL - This is the host offload request.
+#define SIR_IPV4_ARP_REPLY_OFFLOAD 0
+#define SIR_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD 1
+#define SIR_IPV6_NS_OFFLOAD 2
+#define SIR_OFFLOAD_DISABLE 0
+#define SIR_OFFLOAD_ENABLE 1
+#define SIR_OFFLOAD_BCAST_FILTER_ENABLE 0x2
+#define SIR_OFFLOAD_ARP_AND_BCAST_FILTER_ENABLE (SIR_OFFLOAD_ENABLE|SIR_OFFLOAD_BCAST_FILTER_ENABLE)
+
+#ifdef WLAN_NS_OFFLOAD
+typedef struct sSirNsOffloadReq
+{
+ tANI_U8 srcIPv6Addr[16];
+ tANI_U8 selfIPv6Addr[16];
+ //Only support 2 possible Network Advertisement IPv6 address
+ tANI_U8 targetIPv6Addr[SIR_MAC_NUM_TARGET_IPV6_NS_OFFLOAD_NA][16];
+ tANI_U8 selfMacAddr[6];
+ tANI_U8 srcIPv6AddrValid;
+ tANI_U8 targetIPv6AddrValid[SIR_MAC_NUM_TARGET_IPV6_NS_OFFLOAD_NA];
+} tSirNsOffloadReq, *tpSirNsOffloadReq;
+#endif //WLAN_NS_OFFLOAD
+
+typedef struct sSirHostOffloadReq
+{
+ tANI_U8 offloadType;
+ tANI_U8 enableOrDisable;
+ union
+ {
+ tANI_U8 hostIpv4Addr [4];
+ tANI_U8 hostIpv6Addr [16];
+ } params;
+#ifdef WLAN_NS_OFFLOAD
+ tSirNsOffloadReq nsOffloadInfo;
+#endif //WLAN_NS_OFFLOAD
+} tSirHostOffloadReq, *tpSirHostOffloadReq;
+
+/* Packet Types. */
+#define SIR_KEEP_ALIVE_NULL_PKT 1
+#define SIR_KEEP_ALIVE_UNSOLICIT_ARP_RSP 2
+
+/* Enable or disable offload. */
+#define SIR_KEEP_ALIVE_DISABLE 0
+#define SIR_KEEP_ALIVE_ENABLE 1
+
+/* Keep Alive request. */
+typedef struct sSirKeepAliveReq
+{
+ v_U8_t packetType;
+ v_U32_t timePeriod;
+ tSirIpv4Addr hostIpv4Addr;
+ tSirIpv4Addr destIpv4Addr;
+ tSirMacAddr destMacAddr;
+
+} tSirKeepAliveReq, *tpSirKeepAliveReq;
+
+typedef struct sSirSmeAddStaSelfReq
+{
+ tANI_U16 mesgType;
+ tANI_U16 mesgLen;
+ tSirMacAddr selfMacAddr;
+}tSirSmeAddStaSelfReq, *tpSirSmeAddStaSelfReq;
+
+typedef struct sSirSmeDelStaSelfReq
+{
+ tANI_U16 mesgType;
+ tANI_U16 mesgLen;
+ tSirMacAddr selfMacAddr;
+}tSirSmeDelStaSelfReq, *tpSirSmeDelStaSelfReq;
+
+typedef struct sSirSmeAddStaSelfRsp
+{
+ tANI_U16 mesgType;
+ tANI_U16 mesgLen;
+ tANI_U16 status;
+ tSirMacAddr selfMacAddr;
+}tSirSmeAddStaSelfRsp, *tpSirSmeAddStaSelfRsp;
+
+typedef struct sSirSmeDelStaSelfRsp
+{
+ tANI_U16 mesgType;
+ tANI_U16 mesgLen;
+ tANI_U16 status;
+ tSirMacAddr selfMacAddr;
+}tSirSmeDelStaSelfRsp, *tpSirSmeDelStaSelfRsp;
+
+/* Coex Indication defines -
+ should match WLAN_COEX_IND_DATA_SIZE
+ should match WLAN_COEX_IND_TYPE_DISABLE_HB_MONITOR
+ should match WLAN_COEX_IND_TYPE_ENABLE_HB_MONITOR */
+#define SIR_COEX_IND_DATA_SIZE (4)
+#define SIR_COEX_IND_TYPE_DISABLE_HB_MONITOR (0)
+#define SIR_COEX_IND_TYPE_ENABLE_HB_MONITOR (1)
+
+typedef struct sSirSmeCoexInd
+{
+ tANI_U16 mesgType;
+ tANI_U16 mesgLen;
+ tANI_U32 coexIndType;
+ tANI_U32 coexIndData[SIR_COEX_IND_DATA_SIZE];
+}tSirSmeCoexInd, *tpSirSmeCoexInd;
+
+#ifdef WLAN_FEATURE_P2P
+typedef struct sSirSmeMgmtFrameInd
+{
+ tANI_U16 mesgType;
+ tANI_U16 mesgLen;
+ tANI_U8 sessionId;
+ tANI_U8 frameType;
+ tANI_U32 rxChan;
+ tANI_U8 frameBuf[1]; //variable
+}tSirSmeMgmtFrameInd, *tpSirSmeMgmtFrameInd;
+#endif
+
+#define SIR_IS_FULL_POWER_REASON_DISCONNECTED(eReason) \
+ ( ( eSME_LINK_DISCONNECTED_BY_HDD == (eReason) ) || \
+ ( eSME_LINK_DISCONNECTED_BY_OTHER == (eReason) ) || \
+ (eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH == (eReason)))
+#define SIR_IS_FULL_POWER_NEEDED_BY_HDD(eReason) \
+ ( ( eSME_LINK_DISCONNECTED_BY_HDD == (eReason) ) || ( eSME_FULL_PWR_NEEDED_BY_HDD == (eReason) ) )
+
+/* P2P Power Save Related */
+#ifdef WLAN_FEATURE_P2P
+typedef struct sSirNoAParam
+{
+ tANI_U8 ctWindow:7;
+ tANI_U8 OppPS:1;
+ tANI_U8 count;
+ tANI_U32 duration;
+ tANI_U32 interval;
+ tANI_U32 singleNoADuration;
+ tANI_U8 psSelection;
+}tSirNoAParam, *tpSirNoAParam;
+#endif
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+typedef struct sSirWlanSuspendParam
+{
+ tANI_U8 configuredMcstBcstFilterSetting;
+}tSirWlanSuspendParam,*tpSirWlanSuspendParam;
+
+typedef struct sSirWlanResumeParam
+{
+ tANI_U8 configuredMcstBcstFilterSetting;
+}tSirWlanResumeParam,*tpSirWlanResumeParam;
+
+typedef struct sSirWlanSetRxpFilters
+{
+ tANI_U8 configuredMcstBcstFilterSetting;
+ tANI_U8 setMcstBcstFilter;
+}tSirWlanSetRxpFilters,*tpSirWlanSetRxpFilters;
+#endif
+
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+//
+// PNO Messages
+//
+
+// Set PNO
+#define SIR_PNO_MAX_NETW_CHANNELS 26
+#define SIR_PNO_MAX_SUPP_NETWORKS 16
+#define SIR_PNO_MAX_SCAN_TIMERS 10
+
+/*size based of dot11 declaration without extra IEs as we will not carry those for PNO*/
+#define SIR_PNO_MAX_PB_REQ_SIZE 450
+
+#define SIR_PNO_24G_DEFAULT_CH 1
+#define SIR_PNO_5G_DEFAULT_CH 36
+
+typedef enum
+{
+ SIR_PNO_MODE_IMMEDIATE,
+ SIR_PNO_MODE_ON_SUSPEND,
+ SIR_PNO_MODE_ON_RESUME,
+ SIR_PNO_MODE_MAX
+} eSirPNOMode;
+
+typedef struct
+{
+ tSirMacSSid ssId;
+ tANI_U32 authentication;
+ tANI_U32 encryption;
+ tANI_U32 bcastNetwType;
+ tANI_U8 ucChannelCount;
+ tANI_U8 aChannels[SIR_PNO_MAX_NETW_CHANNELS];
+ tANI_U8 rssiThreshold;
+} tSirNetworkType;
+
+typedef struct
+{
+ tANI_U32 uTimerValue;
+ tANI_U32 uTimerRepeat;
+}tSirScanTimer;
+
+typedef struct
+{
+ tANI_U8 ucScanTimersCount;
+ tSirScanTimer aTimerValues[SIR_PNO_MAX_SCAN_TIMERS];
+} tSirScanTimersType;
+
+typedef struct sSirPNOScanReq
+{
+ tANI_U8 enable;
+ eSirPNOMode modePNO;
+ tANI_U8 ucNetworksCount;
+ tSirNetworkType aNetworks[SIR_PNO_MAX_SUPP_NETWORKS];
+ tSirScanTimersType scanTimers;
+
+ /*added by SME*/
+ tANI_U16 us24GProbeTemplateLen;
+ tANI_U8 p24GProbeTemplate[SIR_PNO_MAX_PB_REQ_SIZE];
+ tANI_U16 us5GProbeTemplateLen;
+ tANI_U8 p5GProbeTemplate[SIR_PNO_MAX_PB_REQ_SIZE];
+} tSirPNOScanReq, *tpSirPNOScanReq;
+
+typedef struct sSirSetRSSIFilterReq
+{
+ tANI_U8 rssiThreshold;
+} tSirSetRSSIFilterReq, *tpSirSetRSSIFilterReq;
+
+
+// Update Scan Params
+typedef struct {
+ tANI_U8 b11dEnabled;
+ tANI_U8 b11dResolved;
+ tANI_U8 ucChannelCount;
+ tANI_U8 aChannels[SIR_PNO_MAX_NETW_CHANNELS];
+ tANI_U16 usPassiveMinChTime;
+ tANI_U16 usPassiveMaxChTime;
+ tANI_U16 usActiveMinChTime;
+ tANI_U16 usActiveMaxChTime;
+ tANI_U8 ucCBState;
+} tSirUpdateScanParams, * tpSirUpdateScanParams;
+
+// Preferred Network Found Indication
+typedef struct
+{
+ tANI_U16 mesgType;
+ tANI_U16 mesgLen;
+ /* Network that was found with the highest RSSI*/
+ tSirMacSSid ssId;
+ /* Indicates the RSSI */
+ tANI_U8 rssi;
+} tSirPrefNetworkFoundInd, *tpSirPrefNetworkFoundInd;
+#endif // FEATURE_WLAN_SCAN_PNO
+
+#define SIR_NOCHANGE_POWER_VALUE 0xFFFFFFFF
+
+//Power Parameters Type
+typedef enum
+{
+ eSIR_IGNORE_DTIM = 1,
+ eSIR_LISTEN_INTERVAL = 2,
+ eSIR_MCAST_BCAST_FILTER = 3,
+ eSIR_ENABLE_BET = 4,
+ eSIR_BET_INTERVAL = 5
+}tPowerParamType;
+
+//Power Parameters Value s
+typedef struct
+{
+ /* Ignore DTIM */
+ tANI_U32 uIgnoreDTIM;
+
+ /* DTIM Period */
+ tANI_U32 uDTIMPeriod;
+
+ /* Listen Interval */
+ tANI_U32 uListenInterval;
+
+ /* Broadcast Multicas Filter */
+ tANI_U32 uBcastMcastFilter;
+
+ /* Beacon Early Termination */
+ tANI_U32 uEnableBET;
+
+ /* Beacon Early Termination Interval */
+ tANI_U32 uBETInterval;
+
+}tSirSetPowerParamsReq, *tpSirSetPowerParamsReq;
+
+typedef struct sSirTxPerTrackingParam
+{
+ tANI_U8 ucTxPerTrackingEnable; /* 0: disable, 1:enable */
+ tANI_U8 ucTxPerTrackingPeriod; /* Check period, unit is sec. Once tx_stat_chk enable, firmware will check PER in this period periodically */
+ tANI_U8 ucTxPerTrackingRatio; /* (Fail TX packet)/(Total TX packet) ratio, the unit is 10%. for example, 5 means 50% TX failed rate, default is 5. If current TX packet failed rate bigger than this ratio then firmware send WLC_E_TX_STAT_ERROR event to driver */
+ tANI_U32 uTxPerTrackingWatermark; /* A watermark of check number, once the tx packet exceed this number, we do the check, default is 5 */
+}tSirTxPerTrackingParam, *tpSirTxPerTrackingParam;
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+/*---------------------------------------------------------------------------
+ Packet Filtering Parameters
+---------------------------------------------------------------------------*/
+#define SIR_IPV4_ADDR_LEN 4
+#define SIR_MAC_ADDR_LEN 6
+#define SIR_MAX_FILTER_TEST_DATA_LEN 8
+#define SIR_MAX_NUM_MULTICAST_ADDRESS 240
+#define SIR_MAX_NUM_FILTERS 20
+#define SIR_MAX_NUM_TESTS_PER_FILTER 10
+
+//
+// Receive Filter Parameters
+//
+typedef enum
+{
+ SIR_RCV_FILTER_TYPE_INVALID,
+ SIR_RCV_FILTER_TYPE_FILTER_PKT,
+ SIR_RCV_FILTER_TYPE_BUFFER_PKT,
+ SIR_RCV_FILTER_TYPE_MAX_ENUM_SIZE
+}eSirReceivePacketFilterType;
+
+typedef enum
+{
+ SIR_FILTER_HDR_TYPE_INVALID,
+ SIR_FILTER_HDR_TYPE_MAC,
+ SIR_FILTER_HDR_TYPE_ARP,
+ SIR_FILTER_HDR_TYPE_IPV4,
+ SIR_FILTER_HDR_TYPE_IPV6,
+ SIR_FILTER_HDR_TYPE_UDP,
+ SIR_FILTER_HDR_TYPE_MAX
+}eSirRcvPktFltProtocolType;
+
+typedef enum
+{
+ SIR_FILTER_CMP_TYPE_INVALID,
+ SIR_FILTER_CMP_TYPE_EQUAL,
+ SIR_FILTER_CMP_TYPE_MASK_EQUAL,
+ SIR_FILTER_CMP_TYPE_NOT_EQUAL,
+ SIR_FILTER_CMP_TYPE_MASK_NOT_EQUAL,
+ SIR_FILTER_CMP_TYPE_MAX
+}eSirRcvPktFltCmpFlagType;
+
+typedef struct sSirRcvPktFilterFieldParams
+{
+ eSirRcvPktFltProtocolType protocolLayer;
+ eSirRcvPktFltCmpFlagType cmpFlag;
+ /* Length of the data to compare */
+ tANI_U16 dataLength;
+ /* from start of the respective frame header */
+ tANI_U8 dataOffset;
+ /* Reserved field */
+ tANI_U8 reserved;
+ /* Data to compare */
+ tANI_U8 compareData[SIR_MAX_FILTER_TEST_DATA_LEN];
+ /* Mask to be applied on the received packet data before compare */
+ tANI_U8 dataMask[SIR_MAX_FILTER_TEST_DATA_LEN];
+}tSirRcvPktFilterFieldParams, *tpSirRcvPktFilterFieldParams;
+
+typedef struct sSirRcvPktFilterCfg
+{
+ tANI_U8 filterId;
+ eSirReceivePacketFilterType filterType;
+ tANI_U32 numFieldParams;
+ tANI_U32 coalesceTime;
+ tSirRcvPktFilterFieldParams paramsData[SIR_MAX_NUM_TESTS_PER_FILTER];
+}tSirRcvPktFilterCfgType, *tpSirRcvPktFilterCfgType;
+
+//
+// Filter Packet Match Count Parameters
+//
+typedef struct sSirRcvFltPktMatchCnt
+{
+ tANI_U8 filterId;
+ tANI_U32 matchCnt;
+} tSirRcvFltPktMatchCnt, tpSirRcvFltPktMatchCnt;
+
+typedef struct sSirRcvFltPktMatchRsp
+{
+ tANI_U16 mesgType;
+ tANI_U16 mesgLen;
+
+ /* Success or Failure */
+ tANI_U32 status;
+ tSirRcvFltPktMatchCnt filterMatchCnt[SIR_MAX_NUM_FILTERS];
+} tSirRcvFltPktMatchRsp, *tpSirRcvFltPktMatchRsp;
+
+//
+// Receive Filter Clear Parameters
+//
+typedef struct sSirRcvFltPktClearParam
+{
+ tANI_U32 status; /* only valid for response message */
+ tANI_U8 filterId;
+}tSirRcvFltPktClearParam, *tpSirRcvFltPktClearParam;
+
+//
+// Multicast Address List Parameters
+//
+typedef struct sSirRcvFltMcAddrList
+{
+ tANI_U32 ulMulticastAddrCnt;
+ tSirMacAddr multicastAddr[SIR_MAX_NUM_MULTICAST_ADDRESS];
+} tSirRcvFltMcAddrList, *tpSirRcvFltMcAddrList;
+#endif // WLAN_FEATURE_PACKET_FILTERING
+
+//
+// Generic version information
+//
+typedef struct
+{
+ tANI_U8 revision;
+ tANI_U8 version;
+ tANI_U8 minor;
+ tANI_U8 major;
+} tSirVersionType;
+
+typedef struct sAniBtAmpLogLinkReq
+{
+ // Common for all types are requests
+ tANI_U16 msgType; // message type is same as the request type
+ tANI_U16 msgLen; // length of the entire request
+ tANI_U8 sessionId; //sme Session Id
+ void *btampHandle; //AMP context
+
+} tAniBtAmpLogLinkReq, *tpAniBtAmpLogLinkReq;
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+/*---------------------------------------------------------------------------
+* WDA_GTK_OFFLOAD_REQ
+*--------------------------------------------------------------------------*/
+typedef struct
+{
+ tANI_U32 ulFlags; /* optional flags */
+ tANI_U8 aKCK[16]; /* Key confirmation key */
+ tANI_U8 aKEK[16]; /* key encryption key */
+ tANI_U64 ullKeyReplayCounter; /* replay counter */
+} tSirGtkOffloadParams, *tpSirGtkOffloadParams;
+
+/*---------------------------------------------------------------------------
+* WDA_GTK_OFFLOAD_GETINFO_REQ
+*--------------------------------------------------------------------------*/
+typedef struct
+{
+ tANI_U16 mesgType;
+ tANI_U16 mesgLen;
+
+ tANI_U32 ulStatus; /* success or failure */
+ tANI_U64 ullKeyReplayCounter; /* current replay counter value */
+ tANI_U32 ulTotalRekeyCount; /* total rekey attempts */
+ tANI_U32 ulGTKRekeyCount; /* successful GTK rekeys */
+ tANI_U32 ulIGTKRekeyCount; /* successful iGTK rekeys */
+} tSirGtkOffloadGetInfoRspParams, *tpSirGtkOffloadGetInfoRspParams;
+#endif // WLAN_FEATURE_GTK_OFFLOAD
+
+#ifdef WLAN_WAKEUP_EVENTS
+/*---------------------------------------------------------------------------
+ tSirWakeReasonInd
+---------------------------------------------------------------------------*/
+typedef struct
+{
+ tANI_U16 mesgType;
+ tANI_U16 mesgLen;
+ tANI_U32 ulReason; /* see tWakeReasonType */
+ tANI_U32 ulReasonArg; /* argument specific to the reason type */
+ tANI_U32 ulStoredDataLen; /* length of optional data stored in this message, in case
+ HAL truncates the data (i.e. data packets) this length
+ will be less than the actual length */
+ tANI_U32 ulActualDataLen; /* actual length of data */
+ tANI_U8 aDataStart[1]; /* variable length start of data (length == storedDataLen)
+ see specific wake type */
+} tSirWakeReasonInd, *tpSirWakeReasonInd;
+#endif // WLAN_WAKEUP_EVENTS
+
+/*---------------------------------------------------------------------------
+ sAniSetTmLevelReq
+---------------------------------------------------------------------------*/
+typedef struct sAniSetTmLevelReq
+{
+ tANI_U16 tmMode;
+ tANI_U16 newTmLevel;
+} tAniSetTmLevelReq, *tpAniSetTmLevelReq;
+
+#endif /* __SIR_API_H */
diff --git a/CORE/MAC/inc/sirMacPropExts.h b/CORE/MAC/inc/sirMacPropExts.h
new file mode 100644
index 0000000..c368e17
--- /dev/null
+++ b/CORE/MAC/inc/sirMacPropExts.h
@@ -0,0 +1,392 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file sirMacPropExts.h contains the MAC protocol
+ * extensions to support ANI feature set.
+ * Author: Chandra Modumudi
+ * Date: 11/27/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+#ifndef __MAC_PROP_EXTS_H
+#define __MAC_PROP_EXTS_H
+
+#include "sirTypes.h"
+#include "sirApi.h"
+#include "aniSystemDefs.h"
+
+/// EID (Element ID) definitions
+
+// Proprietary IEs
+
+// Types definitions used within proprietary IE
+#define SIR_MAC_PROP_EXT_RATES_TYPE 0
+#define SIR_MAC_PROP_AP_NAME_TYPE 1
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+#define SIR_MAC_PROP_HCF_TYPE 2
+#define SIR_MAC_PROP_WDS_TYPE 3
+#define SIR_MAC_PROP_BP_IND_TYPE 4
+#define SIR_MAC_PROP_NEIGHBOR_BSS_TYPE 5
+#endif
+#define SIR_MAC_PROP_LOAD_INFO_TYPE 6
+#define SIR_MAC_PROP_ASSOC_TYPE 7
+#define SIR_MAC_PROP_LOAD_BALANCE_TYPE 8
+#define SIR_MAC_PROP_LL_ATTR_TYPE 9
+#define SIR_MAC_PROP_CAPABILITY 10 // proprietary capabilities
+#define SIR_MAC_PROP_VERSION 11 // version info
+#define SIR_MAC_PROP_EDCAPARAMS 12 // edca params for 11e and wme
+#define SIR_MAC_PROP_SRCMAC 13 // sender's mac address
+#define SIR_MAC_PROP_TITAN 14 // Advertises a TITAN device
+#define SIR_MAC_PROP_CHANNEL_SWITCH 15 // proprietary channel switch info
+#define SIR_MAC_PROP_QUIET_BSS 16 // Broadcast's REQ for Quiet BSS
+#define SIR_MAC_PROP_TRIG_STA_BK_SCAN 17 // trigger station bk scan during quiet bss duration
+#define SIR_MAC_PROP_TAURUS 18 // Advertises a TAURUS device
+
+// capability ie info
+#define SIR_MAC_PROP_CAPABILITY_MIN sizeof(tANI_U16)
+
+// trigger sta scan ie length defines
+#define SIR_MAC_PROP_TRIG_STA_BK_SCAN_EID_MIN 0
+#define SIR_MAC_PROP_TRIG_STA_BK_SCAN_EID_MAX 1
+
+// the bit map is also used as a config enable, setting a bit in the
+// propIE config variable, enables the corresponding capability in the propIE
+// the enables simply result in including the corresponding element in the
+// propIE
+// Ex: setting the capability bit HCF would result in using the capability bit map for
+// hcf instead of including the full HCF element in the IE
+// capabilities bit map - bit offsets
+// setting 11eQos has effect only if QoS is also enabled. then it overrides
+// 11e support and implements it silently (as part of the prop ie)
+#define SIR_MAC_PROP_CAPABILITY_HCF WNI_CFG_PROP_CAPABILITY_HCF
+#define SIR_MAC_PROP_CAPABILITY_11EQOS WNI_CFG_PROP_CAPABILITY_11EQOS
+#define SIR_MAC_PROP_CAPABILITY_WME WNI_CFG_PROP_CAPABILITY_WME
+#define SIR_MAC_PROP_CAPABILITY_WSM WNI_CFG_PROP_CAPABILITY_WSM
+#define SIR_MAC_PROP_CAPABILITY_EXTRATES WNI_CFG_PROP_CAPABILITY_EXTRATES
+// ap->sta only, request STA to stop using prop rates for some time
+#define SIR_MAC_PROP_CAPABILITY_EXTRATE_STOP WNI_CFG_PROP_CAPABILITY_EXTRATE_STOP
+#define SIR_MAC_PROP_CAPABILITY_TITAN WNI_CFG_PROP_CAPABILITY_TITAN
+#define SIR_MAC_PROP_CAPABILITY_TAURUS WNI_CFG_PROP_CAPABILITY_TAURUS
+#define SIR_MAC_PROP_CAPABILITY_ESCORT_PKT WNI_CFG_PROP_CAPABILITY_ESCORT_PKT
+// unused 9-12
+#define SIR_MAC_PROP_CAPABILITY_EDCAPARAMS WNI_CFG_PROP_CAPABILITY_EDCAPARAMS
+#define SIR_MAC_PROP_CAPABILITY_LOADINFO WNI_CFG_PROP_CAPABILITY_LOADINFO
+#define SIR_MAC_PROP_CAPABILITY_VERSION WNI_CFG_PROP_CAPABILITY_VERSION
+#define SIR_MAC_PROP_CAPABILITY_MAXBITOFFSET WNI_CFG_PROP_CAPABILITY_MAXBITOFFSET
+
+// macro to set/get a capability bit, bitname is one of HCF/11EQOS/etc...
+#define PROP_CAPABILITY_SET(bitname, value) \
+ (value) = (value) | ((tANI_U16)(1 << SIR_MAC_PROP_CAPABILITY_ ## bitname))
+
+#define PROP_CAPABILITY_RESET(bitname, value) \
+ (value) = (value) & ~((tANI_U16)(1 << SIR_MAC_PROP_CAPABILITY_ ## bitname))
+
+#define PROP_CAPABILITY_GET(bitname, value) \
+ (((value) >> SIR_MAC_PROP_CAPABILITY_ ## bitname) & 1)
+
+
+#define IS_DOT11_MODE_PROPRIETARY(dot11Mode) \
+ (((dot11Mode == WNI_CFG_DOT11_MODE_POLARIS) || \
+ (dot11Mode == WNI_CFG_DOT11_MODE_TITAN) || \
+ (dot11Mode == WNI_CFG_DOT11_MODE_TAURUS) || \
+ (dot11Mode == WNI_CFG_DOT11_MODE_ALL)) ? TRUE: FALSE)
+
+#ifdef WLAN_SOFTAP_FEATURE
+#define IS_DOT11_MODE_HT(dot11Mode) \
+ (((dot11Mode == WNI_CFG_DOT11_MODE_11N) || \
+ (dot11Mode == WNI_CFG_DOT11_MODE_11N_ONLY) || \
+ (dot11Mode == WNI_CFG_DOT11_MODE_TAURUS) || \
+ (dot11Mode == WNI_CFG_DOT11_MODE_ALL)) ? TRUE: FALSE)
+#else
+#define IS_DOT11_MODE_HT(dot11Mode) \
+ (((dot11Mode == WNI_CFG_DOT11_MODE_11N) || \
+ (dot11Mode == WNI_CFG_DOT11_MODE_TAURUS) || \
+ (dot11Mode == WNI_CFG_DOT11_MODE_ALL)) ? TRUE: FALSE)
+#endif
+ /*
+ * When Titan capabilities can be turned on based on the
+ * Proprietary Extensions CFG, then this macro can be used.
+ * Here Titan capabilities can be turned on for 11G/Gonly/N/NOnly mode also.
+ */
+#define IS_DOT11_MODE_TITAN_ALLOWED(dot11Mode) \
+ (((dot11Mode == WNI_CFG_DOT11_MODE_TITAN) || \
+ (dot11Mode == WNI_CFG_DOT11_MODE_TAURUS) || \
+ (dot11Mode == WNI_CFG_DOT11_MODE_11G) || \
+ (dot11Mode == WNI_CFG_DOT11_MODE_11N) || \
+ (dot11Mode == WNI_CFG_DOT11_MODE_ALL)) ? TRUE: FALSE)
+
+
+ /*
+ * When Taurus capabilities can be turned on based on the
+ * Proprietary Extensions CFG, then this macro can be used.
+ * Here Taurus capabilities can be turned on for 11N/Nonly mode also.
+ */
+#define IS_DOT11_MODE_TAURUS_ALLOWED(dot11Mode) \
+ (((dot11Mode == WNI_CFG_DOT11_MODE_TAURUS) || \
+ (dot11Mode == WNI_CFG_DOT11_MODE_11N) || \
+ (dot11Mode == WNI_CFG_DOT11_MODE_ALL)) ? TRUE: FALSE)
+
+
+
+#define IS_DOT11_MODE_POLARIS(dot11Mode) IS_DOT11_MODE_PROPRIETARY(dot11Mode)
+
+#define IS_DOT11_MODE_11B(dot11Mode) \
+ ((dot11Mode == WNI_CFG_DOT11_MODE_11B) ? TRUE : FALSE)
+
+/// ANI proprietary Status Codes enum
+/// (present in Management response frames)
+typedef enum eSirMacPropStatusCodes
+{
+ dummy
+} tSirMacPropStatusCodes;
+
+/**
+ * ANI proprietary Reason Codes enum
+ * (present in Deauthentication/Disassociation Management frames)
+ */
+typedef enum eSirMacPropReasonCodes
+{
+ eSIR_MAC_ULA_TIMEOUT_REASON=0xFF00
+} tSirMacPropReasonCodes;
+
+
+/// Proprietary IE definition
+typedef struct sSirMacPropIE
+{
+ tANI_U8 elementID; // SIR_MAC_ANI_PROP_IE_EID
+ tANI_U8 length;
+ tANI_U8 oui[3]; // ANI_OUI for Airgo products
+ tANI_U8 info[1];
+} tSirMacPropIE, *tpSirMacPropIE;
+
+
+typedef struct sSirMacPropRateSet
+{
+ tANI_U8 numPropRates;
+ tANI_U8 propRate[8];
+} tSirMacPropRateSet, *tpSirMacPropRateSet;
+
+
+typedef struct sSirMacPropLLSet
+{
+ tANI_U32 deferThreshold;
+} tSirMacPropLLSet, *tpSirMacPropLLSet;
+
+#define SIR_PROP_VERSION_STR_MAX 20
+typedef struct sSirMacPropVersion
+{
+ tANI_U32 chip_rev; // board, chipset info
+ tANI_U8 card_type; // Type of Card
+ tANI_U8 build_version[SIR_PROP_VERSION_STR_MAX]; //build version string
+} tSirMacPropVersion, *tpSirMacPropVersion;
+#define SIR_MAC_PROP_VERSION_MIN (SIR_PROP_VERSION_STR_MAX + sizeof(tANI_U32))
+
+
+// TCID MACRO's
+#define TCID_0 0x01
+#define TCID_1 0x02
+#define TCID_2 0x04
+#define TCID_3 0x08
+#define TCID_4 0x10
+#define TCID_5 0x20
+#define TCID_6 0x40
+#define TCID_7 0x80
+#define TCID_ALL 0xFF
+
+// Get state of Concatenation
+#define GET_CONCAT_STATE(ccBitmap,tcid) \
+ ((ccBitmap) & (tcid))
+
+// Get state of Compression
+#define GET_COMPRESSION_STATE(cpBitmap,tcid) \
+ ((cpBitmap) & (tcid))
+
+// Get/Set state of Channel Bonding
+//
+// The CB bitfield encoding is -
+//
+// b7 b6 b5 b4 b3 b2 b1 b0
+// --------------------------------------
+// |CCA_CB |CCA |ICE | AU|CS|U/D| O | A |
+// --------------------------------------
+//
+#define GET_CB_ADMIN_STATE(cbState) (cbState & 0x01)
+#define GET_CB_OPER_STATE(cbState) ((cbState & 0x02) >> 1)
+#define GET_CB_SEC_CHANNEL(cbState) ((cbState & 0x04) >> 2)
+#define GET_CB_CS_IN_PROGRESS(cbState) ((cbState & 0x08) >> 3)
+#define GET_CB_CS_AUTO_UPDATE(cbState) ((cbState & 0x10) >> 4)
+#define GET_CB_ICE_STATE(cbState) ((cbState & 0x20) >> 5)
+#define GET_CB_CCA_MODE(cbState) ((cbState & 0x40) >> 6)
+#define GET_CB_CCA_CB_STATE(cbState) ((cbState & 0x80) >> 7)
+
+#define SET_CB_STATE_DISABLE(cbState) \
+ ((cbState) = (0x00))
+#define SET_CB_STATE_ENABLE(cbState) \
+ ((cbState) = (0x03))
+#define SET_CB_AU_ENABLE(cbState) \
+ ((cbState) = ((cbState) | 0x10))
+#define SET_CB_AU_DISABLE(cbState) \
+ ((cbState) = ((cbState) & 0xEF))
+#define SET_CB_OPER_STATE(cbState,state) \
+ (((state) == eHAL_CLEAR)? \
+ ((cbState) = (cbState) & (0xfD)): \
+ ((cbState) = (cbState) | (0x02)))
+#define SET_CB_SEC_CHANNEL(cbState,state) \
+ (((state) == eHAL_CLEAR)? \
+ ((cbState) = (cbState) & (0xfB)): \
+ ((cbState) = (cbState) | (0x04)))
+#define SET_CB_ICE_DISABLE(cbState) \
+ ((cbState) = ((cbState) & 0xDF))
+#define SET_CB_ICE_ENABLE(cbState) \
+ ((cbState) = ((cbState) | 0x20))
+#define SET_CB_CCA_MODE_TWENTY(cbState) \
+ ((cbState) = ((cbState) & 0xBF))
+#define SET_CB_CCA_MODE_FOURTY(cbState) \
+ ((cbState) = ((cbState) | 0x40))
+#define SET_CB_CCA_CB_DISABLE(cbState) \
+ ((cbState) = ((cbState) & 0x7F))
+#define SET_CB_CCA_CB_ENABLE(cbState) \
+ ((cbState) = ((cbState) | 0x80))
+
+// Get/Set the state of Reverse FCS
+#define GET_RFCS_OPER_STATE(revFcsState) (revFcsState & 0x01)
+#define GET_RFCS_PATTERN_ID(revFcsState) ((revFcsState & 0x0E) >> 1)
+
+/* STA CB Legacy Bss detect states */
+#define LIM_CB_LEGACY_BSS_DETECT_IDLE 0
+#define LIM_CB_LEGACY_BSS_DETECT_RUNNING 1
+
+/* Default value for gLimRestoreCBNumScanInterval */
+#define LIM_RESTORE_CB_NUM_SCAN_INTERVAL_DEFAULT 2
+
+//
+// Proprietary Quite BSS IE structure
+//
+// Based on the setting of the "Titan" proprietary bit
+// in the tSirPropIEStruct.capability field (bit #6),
+// this IE will be sent appropriately to all the ANI
+// peers in the following management frames -
+// 1) Beacons
+// 2) Probe Rsp
+//
+typedef struct sQuietBssIEStruct
+{
+
+ // Indicates the number of TBTT's until the next beacon
+ // interval during which the next quiet interval will
+ // start
+ // 1 - Quiet Interval will start during the beacon
+ // interval starting at the next TBTT
+ // 0 - Reserved
+ tANI_U8 quietCount;
+
+ // Shall be set to the number of beacon intervals between
+ // the start of regularly scheduled quiet intervals
+ // defined by this Quiet Element
+ // 0 - No periodic quiet interval is defined
+ tANI_U8 quietPeriod;
+
+ // Duration of the quiet interval, expressed in TUs
+ // 1 TU = 1024 microseconds??
+ tANI_U16 quietDuration;
+
+ // Set to the offset of the start of the quiet interval
+ // from the TBTT specified by the quietCount field,
+ // expressed in TUs. The value of this offset field will
+ // be less than one beacon interval
+ // 1 TU = 1024 microseconds??
+ tANI_U16 quietOffset;
+
+} tQuietBssIEStruct, *tpQuietBssIEStruct;
+
+typedef struct sChannelSwitchPropIEStruct
+{
+ tANI_U8 mode;
+ tANI_U8 primaryChannel;
+ tANI_U8 subBand;
+ tANI_U8 channelSwitchCount;
+
+} tChannelSwitchPropIEStruct, *tpChannelSwitchPropIEStruct;
+
+// generic proprietary IE structure definition
+typedef struct sSirPropIEStruct
+{
+ tANI_U8 aniIndicator;
+
+ tANI_U8 propRatesPresent:1;
+ tANI_U8 apNamePresent:1;
+ tANI_U8 loadBalanceInfoPresent:1;
+ tANI_U8 versionPresent:1;
+ tANI_U8 edcaParamPresent:1;
+ tANI_U8 capabilityPresent:1;
+ tANI_U8 titanPresent:1;
+ tANI_U8 taurusPresent:1;
+ tANI_U8 propChannelSwitchPresent:1;
+ tANI_U8 quietBssPresent:1;
+ tANI_U8 triggerStaScanPresent:1;
+ tANI_U8 rsvd:5;
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ tANI_U8 hcfPresent:1;
+ tANI_U8 wdsPresent:1;
+ tANI_U8 neighborListPresent:1;
+ tANI_U8 loadInfoPresent:1;
+ tANI_U8 llsetPresent:1;
+ tANI_U8 bpindPresent:1;
+ tANI_U8 assocTypePresent:1;
+ tANI_U8 rsvd1:1;
+#endif
+
+ tSirMacPropRateSet propRates;
+ tAniApName apName; // used in beacon/probe only
+ tSirAlternateRadioInfo alternateRadio; // used in assoc response only
+ tANI_U16 capability; // capability bit map
+ tSirMacPropVersion version;
+ tSirMacEdcaParamSetIE edca;
+ tChannelSwitchPropIEStruct channelSwitch;
+ tQuietBssIEStruct quietBss;
+ tANI_U8 triggerStaScanEnable;
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ tANI_U8 hcfEnabled;
+ // used in beacon/probe response only
+ tANI_U8 wdsLength;
+ tANI_U8 wdsData[ANI_WDS_INFO_MAX_LENGTH];
+ tSirLoad load;
+ tSirMacPropLLSet llSet;
+ // used in assoc request only
+ tANI_U8 bpIndicator;
+ tANI_U8 bpType;
+ tANI_U8 numBss;
+ tANI_U8 assocType;
+ tpSirNeighborBssInfo pBssList;
+#endif
+
+} tSirPropIEStruct, *tpSirPropIEStruct;
+
+
+
+#endif /* __MAC_PROP_EXTS_H */
diff --git a/CORE/MAC/inc/sirMacProtDef.h b/CORE/MAC/inc/sirMacProtDef.h
new file mode 100644
index 0000000..7f2f1d5
--- /dev/null
+++ b/CORE/MAC/inc/sirMacProtDef.h
@@ -0,0 +1,2586 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file sirMacProtDef.h contains the MAC/PHY protocol
+ * definitions used across various projects.
+ * Author: Chandra Modumudi
+ * Date: 02/27/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+#ifndef __MAC_PROT_DEFS_H
+#define __MAC_PROT_DEFS_H
+
+#include "palTypes.h"
+#include "sirTypes.h"
+#include "wniCfgAp.h"
+#include "aniCompiler.h"
+
+
+///Capability information related
+#define CAPABILITY_INFO_DELAYED_BA_BIT 14
+#define CAPABILITY_INFO_IMMEDIATE_BA_BIT 15
+
+/// 11d MAC defaults
+#define SIR_11B_CHANNEL_ID_BEGIN 1
+#define SIR_TOTAL_NUM_11B_CHANNELS 14
+#define SIR_11B_DEFAULT_MAX_TRANSMIT_POWER 20
+#define SIR_11A_CHANNEL_ID_BEGIN 240
+#define SIR_TOTAL_NUM_11A_CHANNELS 34
+#define SIR_11A_DEFAULT_MAX_TRANSMIT_POWER 16
+
+/// 11h MAC defaults
+#define SIR_11A_CHANNEL_BEGIN 34
+#define SIR_11A_CHANNEL_END 165
+#define SIR_11B_CHANNEL_BEGIN 1
+#define SIR_11B_CHANNEL_END 14
+#define SIR_11A_FREQUENCY_OFFSET 4
+#define SIR_11B_FREQUENCY_OFFSET 1
+
+
+#define PRIM_DEVICE_LEN (8)
+
+/// Maximum fragment size
+#define SIR_MAC_MAX_FRAG_SIZE 2398
+
+// maximum 802.11 PDU size
+#define SIR_MAC_MAX_PDU_SIZE 2346
+
+/// Length of the Frame Check Sum field at the end of every MAC frame
+#define SIR_MAC_FCS_LENGTH 4
+
+// Sizes of control frames
+#define SIR_MAC_ACK_SIZE 14
+#define SIR_MAC_CTS_SIZE 14
+#define SIR_MAC_RTS_SIZE 20
+#define SIR_MAC_BRQ_SIZE 24
+#define SIR_MAC_BACK_SIZE 26
+
+/// Current version of 802.11
+#define SIR_MAC_PROTOCOL_VERSION 0
+
+// Frame Type definitions
+
+#define SIR_MAC_MGMT_FRAME 0x0
+#define SIR_MAC_CTRL_FRAME 0x1
+#define SIR_MAC_DATA_FRAME 0x2
+
+#define SIR_MAC_FRAME_TYPE_START 0x0
+#define SIR_MAC_FRAME_TYPE_END 0x3
+
+// Control frame subtype definitions
+
+#define SIR_MAC_CTRL_RR 4
+#define SIR_MAC_CTRL_BAR 8
+#define SIR_MAC_CTRL_BA 9
+#define SIR_MAC_CTRL_PS_POLL 10
+#define SIR_MAC_CTRL_RTS 11
+#define SIR_MAC_CTRL_CTS 12
+#define SIR_MAC_CTRL_ACK 13
+#define SIR_MAC_CTRL_CF_END 14
+#define SIR_MAC_CTRL_CF_END_ACK 15
+
+#define GEN4_SCAN 1
+#ifdef GEN4_SCAN
+#define SIR_MAC_MAX_DURATION_MICRO_SECONDS 32767
+#endif // GEN4_SCAN
+
+// Data frame subtype definitions
+#define SIR_MAC_DATA_DATA 0
+#define SIR_MAC_DATA_DATA_ACK 1
+#define SIR_MAC_DATA_DATA_POLL 2
+#define SIR_MAC_DATA_DATA_ACK_POLL 3
+#define SIR_MAC_DATA_NULL 4
+#define SIR_MAC_DATA_NULL_ACK 5
+#define SIR_MAC_DATA_NULL_POLL 6
+#define SIR_MAC_DATA_NULL_ACK_POLL 7
+#define SIR_MAC_DATA_QOS_DATA 8
+#define SIR_MAC_DATA_QOS_DATA_ACK 9
+#define SIR_MAC_DATA_QOS_DATA_POLL 10
+#define SIR_MAC_DATA_QOS_DATA_ACK_POLL 11
+#define SIR_MAC_DATA_QOS_NULL 12
+#define SIR_MAC_DATA_QOS_NULL_ACK 13
+#define SIR_MAC_DATA_QOS_NULL_POLL 14
+#define SIR_MAC_DATA_QOS_NULL_ACK_POLL 15
+
+#define SIR_MAC_FRAME_SUBTYPE_START 0
+#define SIR_MAC_FRAME_SUBTYPE_END 16
+
+#define SIR_MAC_DATA_QOS_MASK 8
+#define SIR_MAC_DATA_NULL_MASK 4
+#define SIR_MAC_DATA_POLL_MASK 2
+#define SIR_MAC_DATA_ACK_MASK 1
+
+// Management frame subtype definitions
+
+#define SIR_MAC_MGMT_ASSOC_REQ 0x0
+#define SIR_MAC_MGMT_ASSOC_RSP 0x1
+#define SIR_MAC_MGMT_REASSOC_REQ 0x2
+#define SIR_MAC_MGMT_REASSOC_RSP 0x3
+#define SIR_MAC_MGMT_PROBE_REQ 0x4
+#define SIR_MAC_MGMT_PROBE_RSP 0x5
+#define SIR_MAC_MGMT_BEACON 0x8
+#define SIR_MAC_MGMT_ATIM 0x9
+#define SIR_MAC_MGMT_DISASSOC 0xA
+#define SIR_MAC_MGMT_AUTH 0xB
+#define SIR_MAC_MGMT_DEAUTH 0xC
+#define SIR_MAC_MGMT_ACTION 0xD
+#define SIR_MAC_MGMT_RESERVED15 0xF
+
+// Action frame categories
+
+#define SIR_MAC_ACTION_SPECTRUM_MGMT 0
+#define SIR_MAC_ACTION_QOS_MGMT 1
+#define SIR_MAC_ACTION_DLP 2
+#define SIR_MAC_ACTION_BLKACK 3
+#if defined WLAN_FEATURE_VOWIFI
+#define SIR_MAC_ACTION_RRM 5
+#endif
+#define SIR_MAC_ACTION_HT 7
+#define SIR_MAC_ACTION_WME 17
+#if defined WLAN_FEATURE_P2P
+#define SIR_MAC_ACTION_PUBLIC_USAGE 4
+#endif
+
+// QoS management action codes
+
+#define SIR_MAC_QOS_ADD_TS_REQ 0
+#define SIR_MAC_QOS_ADD_TS_RSP 1
+#define SIR_MAC_QOS_DEL_TS_REQ 2
+#define SIR_MAC_QOS_SCHEDULE 3
+// and these are proprietary
+#define SIR_MAC_QOS_DEF_BA_REQ 4
+#define SIR_MAC_QOS_DEF_BA_RSP 5
+#define SIR_MAC_QOS_DEL_BA_REQ 6
+#define SIR_MAC_QOS_DEL_BA_RSP 7
+
+#ifdef ANI_SUPPORT_11H
+// Spectrum management action codes
+#define SIR_MAC_ACTION_MEASURE_REQUEST_ID 0
+#define SIR_MAC_ACTION_MEASURE_REPORT_ID 1
+#define SIR_MAC_ACTION_TPC_REQUEST_ID 2
+#define SIR_MAC_ACTION_TPC_REPORT_ID 3
+#endif //ANI_SUPPORT_11H
+#define SIR_MAC_ACTION_CHANNEL_SWITCH_ID 4
+
+
+#ifdef ANI_SUPPORT_11H
+// Measurement Request/Report Type
+#define SIR_MAC_BASIC_MEASUREMENT_TYPE 0
+#define SIR_MAC_CCA_MEASUREMENT_TYPE 1
+#define SIR_MAC_RPI_MEASUREMENT_TYPE 2
+#endif //ANI_SUPPORT_11H
+
+//RRM related.
+//Refer IEEE Std 802.11k-2008, Section 7.3.2.21, table 7.29
+#if defined WLAN_FEATURE_VOWIFI
+
+#define SIR_MAC_RRM_CHANNEL_LOAD_TYPE 3
+#define SIR_MAC_RRM_NOISE_HISTOGRAM_BEACON 4
+#define SIR_MAC_RRM_BEACON_TYPE 5
+#define SIR_MAC_RRM_FRAME_TYPE 6
+#define SIR_MAC_RRM_STA_STATISTICS_TYPE 7
+#define SIR_MAC_RRM_LCI_TYPE 8
+#define SIR_MAC_RRM_TSM_TYPE 9
+
+//RRM action codes
+#define SIR_MAC_RRM_RADIO_MEASURE_REQ 0
+#define SIR_MAC_RRM_RADIO_MEASURE_RPT 1
+#define SIR_MAC_RRM_LINK_MEASUREMENT_REQ 2
+#define SIR_MAC_RRM_LINK_MEASUREMENT_RPT 3
+#define SIR_MAC_RRM_NEIGHBOR_REQ 4
+#define SIR_MAC_RRM_NEIGHBOR_RPT 5
+
+#endif
+
+// HT Action Field Codes
+#define SIR_MAC_SM_POWER_SAVE 1
+
+// DLP action frame types
+#define SIR_MAC_DLP_REQ 0
+#define SIR_MAC_DLP_RSP 1
+#define SIR_MAC_DLP_TEARDOWN 2
+
+// block acknowledgement action frame types
+#define SIR_MAC_BLKACK_ADD_REQ 0
+#define SIR_MAC_BLKACK_ADD_RSP 1
+#define SIR_MAC_BLKACK_DEL 2
+#if defined WLAN_FEATURE_P2P
+#define SIR_MAC_ACTION_VENDOR_SPECIFIC 9
+#define SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY 0x7F
+#define SIR_MAC_ACTION_P2P_SUBTYPE_PRESENCE_RSP 2
+#endif
+
+#ifdef WLAN_FEATURE_11W
+//11w SA query request/response action frame category code
+#define SIR_MAC_ACTION_SA_QUERY 8
+#endif
+
+#define SIR_MAC_MAX_RANDOM_LENGTH 2306
+
+//-----------------------------------------------------------------------------
+// EID (Element ID) definitions
+// and their min/max lengths
+//-----------------------------------------------------------------------------
+
+#define SIR_MAC_SSID_EID 0
+#define SIR_MAC_SSID_EID_MIN 0
+#define SIR_MAC_SSID_EID_MAX 32
+#define SIR_MAC_RATESET_EID 1
+#define SIR_MAC_RATESET_EID_MIN 1
+#define SIR_MAC_RATESET_EID_MAX 12
+#define SIR_MAC_FH_PARAM_SET_EID 2
+#define SIR_MAC_FH_PARAM_SET_EID_MIN 5
+#define SIR_MAC_FH_PARAM_SET_EID_MAX 5
+#define SIR_MAC_DS_PARAM_SET_EID 3
+#define SIR_MAC_DS_PARAM_SET_EID_MIN 1
+#define SIR_MAC_DS_PARAM_SET_EID_MAX 1
+#define SIR_MAC_CF_PARAM_SET_EID 4
+#define SIR_MAC_CF_PARAM_SET_EID_MIN 6
+#define SIR_MAC_CF_PARAM_SET_EID_MAX 6
+#define SIR_MAC_TIM_EID 5
+#define SIR_MAC_TIM_EID_MIN 3
+#define SIR_MAC_TIM_EID_MAX 254
+#define SIR_MAC_IBSS_PARAM_SET_EID 6
+#define SIR_MAC_IBSS_PARAM_SET_EID_MIN 2
+#define SIR_MAC_IBSS_PARAM_SET_EID_MAX 2
+#define SIR_MAC_COUNTRY_EID 7
+#define SIR_MAC_COUNTRY_EID_MIN 6
+#define SIR_MAC_COUNTRY_EID_MAX 254
+#define SIR_MAC_FH_PARAMS_EID 8
+#define SIR_MAC_FH_PARAMS_EID_MIN 4
+#define SIR_MAC_FH_PARAMS_EID_MAX 4
+#define SIR_MAC_FH_PATTERN_EID 9
+#define SIR_MAC_FH_PATTERN_EID_MIN 4
+#define SIR_MAC_FH_PATTERN_EID_MAX 254
+#define SIR_MAC_REQUEST_EID 10
+#define SIR_MAC_REQUEST_EID_MIN 1
+#define SIR_MAC_REQUEST_EID_MAX 255
+#define SIR_MAC_QBSS_LOAD_EID 11
+#define SIR_MAC_QBSS_LOAD_EID_MIN 5
+#define SIR_MAC_QBSS_LOAD_EID_MAX 5
+#define SIR_MAC_EDCA_PARAM_SET_EID 12 // EDCA parameter set
+#define SIR_MAC_EDCA_PARAM_SET_EID_MIN 18
+#define SIR_MAC_EDCA_PARAM_SET_EID_MAX 20 // TBD temp - change backto 18
+#define SIR_MAC_TSPEC_EID 13
+#define SIR_MAC_TSPEC_EID_MIN 55
+#define SIR_MAC_TSPEC_EID_MAX 55
+#define SIR_MAC_TCLAS_EID 14
+#define SIR_MAC_TCLAS_EID_MIN 4
+#define SIR_MAC_TCLAS_EID_MAX 255
+#define SIR_MAC_QOS_SCHEDULE_EID 15
+#define SIR_MAC_QOS_SCHEDULE_EID_MIN 14
+#define SIR_MAC_QOS_SCHEDULE_EID_MAX 14
+#define SIR_MAC_CHALLENGE_TEXT_EID 16
+#define SIR_MAC_CHALLENGE_TEXT_EID_MIN 1
+#define SIR_MAC_CHALLENGE_TEXT_EID_MAX 253
+// reserved 17-31
+#define SIR_MAC_PWR_CONSTRAINT_EID 32
+#define SIR_MAC_PWR_CONSTRAINT_EID_MIN 1
+#define SIR_MAC_PWR_CONSTRAINT_EID_MAX 1
+#define SIR_MAC_PWR_CAPABILITY_EID 33
+#define SIR_MAC_PWR_CAPABILITY_EID_MIN 2
+#define SIR_MAC_PWR_CAPABILITY_EID_MAX 2
+#define SIR_MAC_TPC_REQ_EID 34
+#define SIR_MAC_TPC_REQ_EID_MIN 0
+#define SIR_MAC_TPC_REQ_EID_MAX 255
+// SIR_MAC_EXTENDED_CAP_EID 35
+#define SIR_MAC_TPC_RPT_EID 35
+#define SIR_MAC_TPC_RPT_EID_MIN 2
+#define SIR_MAC_TPC_RPT_EID_MAX 2
+#define SIR_MAC_SPRTD_CHNLS_EID 36
+#define SIR_MAC_SPRTD_CHNLS_EID_MIN 2
+#define SIR_MAC_SPRTD_CHNLS_EID_MAX 254
+#define SIR_MAC_CHNL_SWITCH_ANN_EID 37
+#define SIR_MAC_CHNL_SWITCH_ANN_EID_MIN 3
+#define SIR_MAC_CHNL_SWITCH_ANN_EID_MAX 3
+#define SIR_MAC_MEAS_REQ_EID 38
+#define SIR_MAC_MEAS_REQ_EID_MIN 3
+#define SIR_MAC_MEAS_REQ_EID_MAX 255
+#define SIR_MAC_MEAS_RPT_EID 39
+#define SIR_MAC_MEAS_RPT_EID_MIN 3
+#define SIR_MAC_MEAS_RPT_EID_MAX 255
+#define SIR_MAC_QUIET_EID 40
+#define SIR_MAC_QUIET_EID_MIN 6
+#define SIR_MAC_QUIET_EID_MAX 6
+#define SIR_MAC_IBSS_DFS_EID 41
+#define SIR_MAC_IBSS_DFS_EID_MIN 7
+#define SIR_MAC_IBSS_DFS_EID_MAX 255
+#define SIR_MAC_ERP_INFO_EID 42
+#define SIR_MAC_ERP_INFO_EID_MIN 0
+#define SIR_MAC_ERP_INFO_EID_MAX 255
+#define SIR_MAC_TS_DELAY_EID 43
+#define SIR_MAC_TS_DELAY_EID_MIN 4
+#define SIR_MAC_TS_DELAY_EID_MAX 4
+#define SIR_MAC_TCLAS_PROC_EID 44
+#define SIR_MAC_TCLAS_PROC_EID_MIN 1
+#define SIR_MAC_TCLAS_PROC_EID_MAX 1
+#define SIR_MAC_QOS_CAPABILITY_EID 46
+#define SIR_MAC_QOS_CAPABILITY_EID_MIN 1
+#define SIR_MAC_QOS_CAPABILITY_EID_MAX 1
+#define SIR_MAC_RSN_EID 48
+#define SIR_MAC_RSN_EID_MIN 4
+#define SIR_MAC_RSN_EID_MAX 254
+
+//using reserved EID for Qos Action IE for now,
+//need to check 11e spec for the actual EID
+#define SIR_MAC_QOS_ACTION_EID 49
+#define SIR_MAC_QOS_ACTION_EID_MIN 4
+#define SIR_MAC_QOS_ACTION_EID_MAX 255
+#define SIR_MAC_EXTENDED_RATE_EID 50
+#define SIR_MAC_EXTENDED_RATE_EID_MIN 0
+#define SIR_MAC_EXTENDED_RATE_EID_MAX 255
+// reserved 51-220
+#define SIR_MAC_WPA_EID 221
+#define SIR_MAC_WPA_EID_MIN 0
+#define SIR_MAC_WPA_EID_MAX 255
+
+#define SIR_MAC_EID_VENDOR 221
+
+// reserved 222-254
+#define SIR_MAC_HT_CAPABILITIES_EID 45
+#define SIR_MAC_HT_CAPABILITIES_EID_MIN 0
+#define SIR_MAC_HT_CAPABILITIES_EID_MAX 255
+#define SIR_MAC_HT_INFO_EID 61
+#define SIR_MAC_HT_INFO_EID_MIN 0
+#define SIR_MAC_HT_INFO_EID_MAX 255
+
+#define SIR_MAC_MAX_SUPPORTED_MCS_SET 16
+
+/// Workaround IE to change beacon length when it is 4*n+1
+#define SIR_MAC_ANI_WORKAROUND_EID 255
+#define SIR_MAC_ANI_WORKAROUND_EID_MIN 0
+#define SIR_MAC_ANI_WORKAROUND_EID_MAX 255
+
+/// Maximum length of each IE
+#define SIR_MAC_MAX_IE_LENGTH 255
+
+/// Maximum length of each IE
+#define SIR_MAC_RSN_IE_MAX_LENGTH 255
+#define SIR_MAC_WPA_IE_MAX_LENGTH 255
+/// Minimum length of each IE
+#define SIR_MAC_RSN_IE_MIN_LENGTH 2
+#define SIR_MAC_WPA_IE_MIN_LENGTH 6
+
+#ifdef FEATURE_WLAN_CCX
+#define CCX_VERSION_4 4
+#define CCX_VERSION_SUPPORTED CCX_VERSION_4
+
+// When station sends Radio Management Cap.
+// State should be normal=1
+// Mbssid Mask should be 0
+#define RM_STATE_NORMAL 1
+#endif
+
+#define SIR_MAC_OUI_VERSION_1 1
+
+// OUI and type definition for WPA IE in network byte order
+#define SIR_MAC_WPA_OUI 0x01F25000
+#define SIR_MAC_WME_OUI 0x02F25000
+#define SIR_MAC_WSM_OUI SIR_MAC_WME_OUI
+#define SIR_MAC_WSC_OUI "\x00\x50\xf2\x04"
+#define SIR_MAC_WSC_OUI_SIZE 4
+#ifdef WLAN_FEATURE_P2P
+#define SIR_MAC_P2P_OUI "\x50\x6f\x9a\x09"
+#define SIR_MAC_P2P_OUI_SIZE 4
+#define SIR_P2P_NOA_ATTR 12
+#define SIR_MAX_NOA_ATTR_LEN 31
+#define SIR_MAX_NOA_DESCR 2
+#define SIR_P2P_IE_HEADER_LEN 6
+#endif
+
+// min size of wme oui header: oui(3) + type + subtype + version
+#define SIR_MAC_OUI_WME_HDR_MIN 6
+
+// OUI subtype and their lengths
+#define SIR_MAC_OUI_SUBTYPE_WME_INFO 0
+#define SIR_MAC_OUI_WME_INFO_MIN 7
+#define SIR_MAC_OUI_WME_INFO_MAX 7
+
+#define SIR_MAC_OUI_SUBTYPE_WME_PARAM 1
+#define SIR_MAC_OUI_WME_PARAM_MIN 24
+#define SIR_MAC_OUI_WME_PARAM_MAX 24
+
+#define SIR_MAC_OUI_SUBTYPE_WME_TSPEC 2
+#define SIR_MAC_OUI_WME_TSPEC_MIN 61
+#define SIR_MAC_OUI_WME_TSPEC_MAX 61
+
+#define SIR_MAC_OUI_SUBTYPE_WSM_TSPEC 2 // same as WME TSPEC
+#define SIR_MAC_OUI_WSM_TSPEC_MIN 61
+#define SIR_MAC_OUI_WSM_TSPEC_MAX 61
+
+// reserved subtypes 3-4
+// WSM capability
+#define SIR_MAC_OUI_SUBTYPE_WSM_CAPABLE 5
+#define SIR_MAC_OUI_WSM_CAPABLE_MIN 7
+#define SIR_MAC_OUI_WSM_CAPABLE_MAX 7
+// WSM classifier
+#define SIR_MAC_OUI_SUBTYPE_WSM_TCLAS 6
+#define SIR_MAC_OUI_WSM_TCLAS_MIN 10
+#define SIR_MAC_OUI_WSM_TCLAS_MAX 255
+// classifier processing element
+#define SIR_MAC_OUI_SUBTYPE_WSM_TCLASPROC 7
+#define SIR_MAC_OUI_WSM_TCLASPROC_MIN 7
+#define SIR_MAC_OUI_WSM_TCLASPROC_MAX 7
+// tspec delay element
+#define SIR_MAC_OUI_SUBTYPE_WSM_TSDELAY 8
+#define SIR_MAC_OUI_WSM_TSDELAY_MIN 10
+#define SIR_MAC_OUI_WSM_TSDELAY_MAX 10
+// schedule element
+#define SIR_MAC_OUI_SUBTYPE_WSM_SCHEDULE 9
+#define SIR_MAC_OUI_WSM_SCHEDULE_MIN 20
+#define SIR_MAC_OUI_WSM_SCHEDULE_MAX 20
+
+#ifdef WLAN_NS_OFFLOAD
+#define SIR_MAC_NS_OFFLOAD_SIZE 1 //support only one IPv6 offload
+#define SIR_MAC_NUM_TARGET_IPV6_NS_OFFLOAD_NA 2 //Number of target IP in NA frames. It must be at least 2
+#endif //WLAN_NS_OFFLOAD
+#define SIR_MAC_ARP_OFFLOAD_SIZE 1
+
+// total length of an Info element including T/L fields
+#define EID_LEN(eid) (2 + (eid))
+
+// support for radar Detect, Channel Switch
+#define CHANNEL_SWITCH_MAX_FRAME_SIZE 256
+
+
+// Length of Channel Switch related message
+#define SIR_SME_CHANNEL_SWITCH_SIZE (sizeof(tANI_U8) + 2 *sizeof(tANI_U16) + sizeof(tANI_U32) + sizeof(tAniCBSecondaryMode))
+#define SIR_CHANNEL_SWITCH_IE_SIZE EID_LEN(SIR_MAC_CHNL_SWITCH_ANN_EID_MIN)
+
+//Measurement Request/Report messages
+#define SIR_MEAS_REQ_FIELD_SIZE 11
+#define SIR_MEAS_REQ_IE_SIZE (5 + SIR_MEAS_REQ_FIELD_SIZE)
+#define SIR_MEAS_REQ_ACTION_FRAME_SIZE (3 + SIR_MEAS_REQ_IE_SIZE)
+#define SIR_MEAS_MAX_FRAME_SIZE 256
+#define SIR_MEAS_REPORT_MIN_FRAME_SIZE (3 + EID_LEN(SIR_MAC_MEAS_RPT_EID_MIN))
+
+#define SIR_MAC_SET_MEAS_REQ_ENABLE(x) (((tANI_U8) x) | 2)
+#define SIR_MAC_SET_MEAS_REQ_REQUEST(x) (((tANI_U8) x) | 4)
+#define SIR_MAC_SET_MEAS_REQ_REPORT(x) (((tANI_U8) x) | 8)
+
+#define SIR_MAC_SET_MEAS_REPORT_LATE(x) (((tANI_U8) x) | 1)
+#define SIR_MAC_SET_MEAS_REPORT_INCAPABLE(x) (((tANI_U8) x) | 2)
+#define SIR_MAC_SET_MEAS_REPORT_REFUSE(x) (((tANI_U8) x) | 4)
+
+// Length of TPC Request Action Frame
+#define SIR_TPC_REQ_ACTION_FRAME_SIZE (3 + EID_LEN(SIR_MAC_TPC_REQ_EID_MIN))
+#define SIR_TPC_REPORT_ACTION_FRAME_SIZE (3 + EID_LEN(SIR_MAC_TPC_RPT_EID_MIN))
+#define SIR_TPC_MAX_FRAME_SIZE 256
+//-----------------------------------------------------------------------------
+
+// OFFSET definitions for fixed fields in Management frames
+
+// Beacon/Probe Response offsets
+#define SIR_MAC_TS_OFFSET 0
+#define SIR_MAC_BEACON_INT_OFFSET 8 // Beacon Interval offset
+#define SIR_MAC_B_PR_CAPAB_OFFSET 10
+#define SIR_MAC_B_PR_SSID_OFFSET 12
+
+// Association/Reassociation offsets
+#define SIR_MAC_ASSOC_CAPAB_OFFSET 0
+#define SIR_MAC_LISTEN_INT_OFFSET 2 // Listen Interval offset
+#define SIR_MAC_ASSOC_SSID_OFFSET 4
+#define SIR_MAC_CURRENT_AP_OFFSET 4
+#define SIR_MAC_REASSOC_SSID_OFFSET 10
+#define SIR_MAC_ASSOC_STATUS_CODE_OFFSET 2
+#define SIR_MAC_ASSOC_AID_OFFSET 4
+#define SIR_MAC_ASSOC_RSP_RATE_OFFSET 6
+
+// Disassociation/Deauthentication offsets
+#define SIR_MAC_REASON_CODE_OFFSET 0
+
+// Probe Request offset
+#define SIR_MAC_PROBE_REQ_SSID_OFFSET 0
+
+// Authentication offsets
+#define SIR_MAC_AUTH_ALGO_OFFSET 0
+#define SIR_MAC_AUTH_XACT_SEQNUM_OFFSET 2
+#define SIR_MAC_AUTH_STATUS_CODE_OFFSET 4
+#define SIR_MAC_AUTH_CHALLENGE_OFFSET 6
+
+/// Transaction sequence number definitions (used in Authentication frames)
+#define SIR_MAC_AUTH_FRAME_1 1
+#define SIR_MAC_AUTH_FRAME_2 2
+#define SIR_MAC_AUTH_FRAME_3 3
+#define SIR_MAC_AUTH_FRAME_4 4
+
+/// Protocol defined MAX definitions
+#define SIR_MAC_ADDR_LENGTH 6
+#define SIR_MAC_MAX_SSID_LENGTH 32
+#define SIR_MAC_MAX_NUMBER_OF_RATES 12
+#define SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS 4
+#define SIR_MAC_KEY_LENGTH 13 // WEP Maximum key length size
+#define SIR_MAC_AUTH_CHALLENGE_LENGTH 128
+#define SIR_MAC_WEP_IV_LENGTH 4
+#define SIR_MAC_WEP_ICV_LENGTH 4
+
+/// MAX key length when ULA is used
+#define SIR_MAC_MAX_KEY_LENGTH 32
+
+/// Macro definitions for get/set on FC fields
+#define SIR_MAC_GET_PROT_VERSION(x) ((((tANI_U16) x) & 0x0300) >> 8)
+#define SIR_MAC_GET_FRAME_TYPE(x) ((((tANI_U16) x) & 0x0C00) >> 8)
+#define SIR_MAC_GET_FRAME_SUB_TYPE(x) ((((tANI_U16) x) & 0xF000) >> 12)
+#define SIR_MAC_GET_WEP_BIT_IN_FC(x) (((tANI_U16) x) & 0x0040)
+#define SIR_MAC_SET_PROT_VERSION(x) ((tANI_U16) x)
+#define SIR_MAC_SET_FRAME_TYPE(x) (((tANI_U16) x) << 2)
+#define SIR_MAC_SET_FRAME_SUB_TYPE(x) (((tANI_U16) x) << 4)
+#define SIR_MAC_SET_WEP_BIT_IN_FC(x) (((tANI_U16) x) << 14)
+
+/// Macro definitions for get/set on capabilityInfo bits
+#define SIR_MAC_GET_ESS(x) (((tANI_U16) x) & 0x0001)
+#define SIR_MAC_GET_IBSS(x) ((((tANI_U16) x) & 0x0002) >> 1)
+#define SIR_MAC_GET_CF_POLLABLE(x) ((((tANI_U16) x) & 0x0004) >> 2)
+#define SIR_MAC_GET_CF_POLL_REQ(x) ((((tANI_U16) x) & 0x0008) >> 3)
+#define SIR_MAC_GET_PRIVACY(x) ((((tANI_U16) x) & 0x0010) >> 4)
+#define SIR_MAC_GET_SHORT_PREAMBLE(x) ((((tANI_U16) x) & 0x0020) >> 5)
+#define SIR_MAC_GET_SPECTRUM_MGMT(x) ((((tANI_U16) x) & 0x0100) >> 8)
+#define SIR_MAC_GET_QOS(x) ((((tANI_U16) x) & 0x0200) >> 9)
+#define SIR_MAC_GET_SHORT_SLOT_TIME(x) ((((tANI_U16) x) & 0x0400) >> 10)
+#define SIR_MAC_GET_APSD(x) ((((tANI_U16) x) & 0x0800) >> 11)
+#if defined WLAN_FEATURE_VOWIFI
+#define SIR_MAC_GET_RRM(x) ((((tANI_U16) x) & 0x1000) >> 12)
+#endif
+#define SIR_MAC_GET_BLOCK_ACK(x) ((((tANI_U16) x) & 0xc000) >> CAPABILITY_INFO_DELAYED_BA_BIT)
+#define SIR_MAC_SET_ESS(x) (((tANI_U16) x) | 0x0001)
+#define SIR_MAC_SET_IBSS(x) (((tANI_U16) x) | 0x0002)
+#define SIR_MAC_SET_CF_POLLABLE(x) (((tANI_U16) x) | 0x0004)
+#define SIR_MAC_SET_CF_POLL_REQ(x) (((tANI_U16) x) | 0x0008)
+#define SIR_MAC_SET_PRIVACY(x) (((tANI_U16) x) | 0x0010)
+#define SIR_MAC_SET_SHORT_PREAMBLE(x) (((tANI_U16) x) | 0x0020)
+#define SIR_MAC_SET_SPECTRUM_MGMT(x) (((tANI_U16) x) | 0x0100)
+#define SIR_MAC_SET_QOS(x) (((tANI_U16) x) | 0x0200)
+#define SIR_MAC_SET_SHORT_SLOT_TIME(x) (((tANI_U16) x) | 0x0400)
+#define SIR_MAC_SET_APSD(x) (((tANI_U16) x) | 0x0800)
+#if defined WLAN_FEATURE_VOWIFI
+#define SIR_MAC_SET_RRM(x) (((tANI_U16) x) | 0x1000)
+#endif
+#define SIR_MAC_SET_GROUP_ACK(x) (((tANI_U16) x) | 0x4000)
+
+// bitname must be one of the above, eg ESS, CF_POLLABLE, etc.
+#define SIR_MAC_CLEAR_CAPABILITY(u16value, bitname) \
+ (u16value) &= (~(SIR_MAC_SET_##bitname(0)))
+
+/// Status Code (present in Management response frames) enum
+
+typedef enum eSirMacStatusCodes
+{
+ eSIR_MAC_SUCCESS_STATUS = 0, //Reserved
+ eSIR_MAC_UNSPEC_FAILURE_STATUS = 1, //Unspecified reason
+ // 802.11 reserved 2-9
+ /*
+ WMM status codes(standard 1.1 table 9)
+ Table 9 ADDTS Response Status Codes
+ Value Operation
+ 0 Admission accepted
+ 1 Invalid parameters
+ 2 Reserved
+ 3 Refused
+ 4-255 Reserved
+ */
+ eSIR_MAC_WME_INVALID_PARAMS_STATUS = 1, // ??
+ eSIR_MAC_WME_REFUSED_STATUS = 3, // ??
+ eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS = 10, //Cannot support all requested capabilities in the Capability Information field
+ eSIR_MAC_INABLITY_TO_CONFIRM_ASSOC_STATUS = 11, //Reassociation denied due to inability to confirm that association exists
+ eSIR_MAC_OUTSIDE_SCOPE_OF_SPEC_STATUS = 12, //Association denied due to reason outside the scope of this standard
+ eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS = 13, //Responding station does not support the specified authentication algorithm
+ eSIR_MAC_AUTH_FRAME_OUT_OF_SEQ_STATUS = 14, //Received an Authentication frame with authentication transaction sequence number
+ //out of expected sequence
+ eSIR_MAC_CHALLENGE_FAILURE_STATUS = 15, //Authentication rejected because of challenge failure
+ eSIR_MAC_AUTH_RSP_TIMEOUT_STATUS = 16, //Authentication rejected due to timeout waiting for next frame in sequence
+ eSIR_MAC_MAX_ASSOC_STA_REACHED_STATUS = 17, //Association denied because AP is unable to handle additional associated stations
+ eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS = 18, //Association denied due to requesting station not supporting all of the data rates in the
+ //BSSBasicRateSet parameter
+ eSIR_MAC_SHORT_PREAMBLE_NOT_SUPPORTED_STATUS = 19, //Association denied due to requesting station not supporting the short preamble
+ //option
+ eSIR_MAC_PBCC_NOT_SUPPORTED_STATUS = 20, //Association denied due to requesting station not supporting the PBCC modulation
+ //option
+ eSIR_MAC_CHANNEL_AGILITY_NOT_SUPPORTED_STATUS = 21, //Association denied due to requesting station not supporting the Channel Agility
+ //option
+ eSIR_MAC_SPECTRUM_MGMT_REQD_STATUS = 22, //Association request rejected because Spectrum Management capability is required
+ eSIR_MAC_PWR_CAPABILITY_BAD_STATUS = 23, //Association request rejected because the information in the Power Capability
+ //element is unacceptable
+ eSIR_MAC_SPRTD_CHANNELS_BAD_STATUS = 24, //Association request rejected because the information in the Supported Channels
+ //element is unacceptable
+ eSIR_MAC_SHORT_SLOT_NOT_SUPORTED_STATUS = 25, //Association denied due to requesting station not supporting the Short Slot Time
+ //option
+ eSIR_MAC_DSSS_OFDM_NOT_SUPPORTED_STATUS = 26, //Association denied due to requesting station not supporting the DSSS-OFDM option
+ // reserved 27-31
+ eSIR_MAC_QOS_UNSPECIFIED_FAILURE_STATUS = 32, //Unspecified, QoS-related failure
+ eSIR_MAC_QAP_NO_BANDWIDTH_STATUS = 33, //Association denied because QoS AP has insufficient bandwidth to handle another
+ //QoS STA
+ eSIR_MAC_XS_FRAME_LOSS_STATUS = 34, //Association denied due to excessive frame loss rates and/or poor conditions on cur-
+ //rent operating channel
+ eSIR_MAC_STA_QOS_NOT_SUPPORTED_STATUS = 35, //Association (with QoS BSS) denied because the requesting STA does not support the
+ //QoS facility
+ eSIR_MAC_STA_BLK_ACK_NOT_SUPPORTED_STATUS = 36, //Reserved
+ eSIR_MAC_REQ_DECLINED_STATUS = 37, //The request has been declined
+ eSIR_MAC_INVALID_PARAM_STATUS = 38, //The request has not been successful as one or more parameters have invalid values
+ eSIR_MAC_TS_NOT_HONOURED_STATUS = 39, //The TS has not been created because the request cannot be honored; however, a suggested
+ //TSPEC is provided so that the initiating STA may attempt to set another TS
+ //with the suggested changes to the TSPEC
+ eSIR_MAC_INVALID_INFORMATION_ELEMENT_STATUS = 40, //Invalid information element, i.e., an information element defined in this standard for
+ //which the content does not meet the specifications in Clause 7
+ eSIR_MAC_INVALID_GROUP_CIPHER_STATUS = 41, //Invalid group cipher
+ eSIR_MAC_INVALID_PAIRWISE_CIPHER_STATUS = 42, //Invalid pairwise cipher
+ eSIR_MAC_INVALID_AKMP_STATUS = 43, //Invalid AKMP
+ eSIR_MAC_UNSUPPORTED_RSN_IE_VERSION_STATUS = 44, //Unsupported RSN information element version
+ eSIR_MAC_INVALID_RSN_IE_CAPABILITIES_STATUS = 45, //Invalid RSN information element capabilities
+ eSIR_MAC_CIPHER_SUITE_REJECTED_STATUS = 46, //Cipher suite rejected because of security policy
+ eSIR_MAC_TS_NOT_CREATED_STATUS = 47, //The TS has not been created; however, the HC may be capable of creating a TS, in
+ //response to a request, after the time indicated in the TS Delay element
+ eSIR_MAC_DL_NOT_ALLOWED_STATUS = 48, //Direct link is not allowed in the BSS by policy
+ eSIR_MAC_DEST_STA_NOT_KNOWN_STATUS = 49, //The Destination STA is not present within this BSS
+ eSIR_MAC_DEST_STA_NOT_QSTA_STATUS = 50, //The Destination STA is not a QoS STA
+ eSIR_MAC_INVALID_LISTEN_INTERVAL_STATUS = 51, //Association denied because the ListenInterval is too large
+
+ eSIR_MAC_DSSS_CCK_RATE_MUST_SUPPORT_STATUS = 52, //FIXME:
+ eSIR_MAC_DSSS_CCK_RATE_NOT_SUPPORT_STATUS = 53,
+ eSIR_MAC_PSMP_CONTROLLED_ACCESS_ONLY_STATUS = 54,
+#ifdef FEATURE_WLAN_CCX
+ eSIR_MAC_CCX_UNSPECIFIED_QOS_FAILURE_STATUS = 200, //CCX-Unspecified, QoS related failure in (Re)Assoc response frames
+ eSIR_MAC_CCX_TSPEC_REQ_REFUSED_STATUS = 201, //CCX-TSPEC request refused due to AP's policy configuration in AddTs Rsp, (Re)Assoc Rsp.
+ eSIR_MAC_CCX_ASSOC_DENIED_INSUFF_BW_STATUS = 202, //CCX-Assoc denied due to insufficient bandwidth to handle new TS in (Re)Assoc Rsp.
+ eSIR_MAC_CCX_INVALID_PARAMETERS_STATUS = 203, //CCX-Invalid parameters. (Re)Assoc request had one or more TSPEC parameters with
+ //invalid values.
+#endif
+
+} tSirMacStatusCodes;
+
+/**
+ * Reason Code (present in Deauthentication/Disassociation
+ * Management frames) enum
+ */
+typedef enum eSirMacReasonCodes
+{
+ eSIR_MAC_UNSPEC_FAILURE_REASON = 1, //Unspecified reason
+ eSIR_MAC_PREV_AUTH_NOT_VALID_REASON = 2, //Previous authentication no longer valid
+ eSIR_MAC_DEAUTH_LEAVING_BSS_REASON = 3, //Deauthenticated because sending station is leaving (or has left) IBSS or ESS
+ eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON = 4, //Disassociated due to inactivity
+ eSIR_MAC_DISASSOC_DUE_TO_DISABILITY_REASON = 5, //Disassociated because AP is unable to handle all currently associated stations
+ eSIR_MAC_CLASS2_FRAME_FROM_NON_AUTH_STA_REASON = 6, //Class 2 frame received from nonauthenticated station
+ eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON = 7, //Class 3 frame received from nonassociated station
+ eSIR_MAC_DISASSOC_LEAVING_BSS_REASON = 8, //Disassociated because sending station is leaving (or has left) BSS
+ eSIR_MAC_STA_NOT_PRE_AUTHENTICATED_REASON = 9, //Station requesting (re)association is not authenticated with responding station
+ eSIR_MAC_PWR_CAPABILITY_BAD_REASON = 10, //Disassociated because the information in the Power Capability element is unacceptable
+ eSIR_MAC_SPRTD_CHANNELS_BAD_REASON = 11, //Disassociated because the information in the Supported Channels element is unacceptable
+ // reserved 12
+ eSIR_MAC_INVALID_IE_REASON = 13, //Invalid information element, i.e., an information element defined in this standard for
+ //which the content does not meet the specifications in Clause 7
+ eSIR_MAC_MIC_FAILURE_REASON = 14, //Message integrity code (MIC) failure
+ eSIR_MAC_4WAY_HANDSHAKE_TIMEOUT_REASON = 15, //4-Way Handshake timeout
+ eSIR_MAC_GR_KEY_UPDATE_TIMEOUT_REASON = 16, //Group Key Handshake timeout
+ eSIR_MAC_RSN_IE_MISMATCH_REASON = 17, //Information element in 4-Way Handshake different from (Re)Association Request/Probe
+ //Response/Beacon frame
+ eSIR_MAC_INVALID_MC_CIPHER_REASON = 18, //Invalid group cipher
+ eSIR_MAC_INVALID_UC_CIPHER_REASON = 19, //Invalid pairwise cipher
+ eSIR_MAC_INVALID_AKMP_REASON = 20, //Invalid AKMP
+ eSIR_MAC_UNSUPPORTED_RSN_IE_VER_REASON = 21, //Unsupported RSN information element version
+ eSIR_MAC_INVALID_RSN_CAPABILITIES_REASON = 22, //Invalid RSN information element capabilities
+ eSIR_MAC_1X_AUTH_FAILURE_REASON = 23, //IEEE 802.1X authentication failed
+ eSIR_MAC_CIPHER_SUITE_REJECTED_REASON = 24, //Cipher suite rejected because of the security policy
+ // reserved 25 - 31
+ eSIR_MAC_QOS_UNSPECIFIED_REASON = 32, //Disassociated for unspecified, QoS-related reason
+ eSIR_MAC_QAP_NO_BANDWIDTH_REASON = 33, //Disassociated because QoS AP lacks sufficient bandwidth for this QoS STA
+ eSIR_MAC_XS_UNACKED_FRAMES_REASON = 34, //Disassociated because excessive number of frames need to be acknowledged, but are not
+ //acknowledged due to AP transmissions and/or poor channel conditions
+ eSIR_MAC_BAD_TXOP_USE_REASON = 35, //Disassociated because STA is transmitting outside the limits of its TXOPs
+ eSIR_MAC_PEER_STA_REQ_LEAVING_BSS_REASON = 36, //Requested from peer STA as the STA is leaving the BSS (or resetting)
+ eSIR_MAC_PEER_REJECT_MECHANISIM_REASON = 37, //Requested from peer STA as it does not want to use the mechanism
+ eSIR_MAC_MECHANISM_NOT_SETUP_REASON = 38, //Requested from peer STA as the STA received frames using the mechanism for which a
+ //setup is required
+ eSIR_MAC_PEER_TIMEDOUT_REASON = 39, //Requested from peer STA due to timeout
+ eSIR_MAC_CIPHER_NOT_SUPPORTED_REASON = 45, //Peer STA does not support the requested cipher suite
+ eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON = 46, //FT reason
+ //reserved 47 - 65535.
+ eSIR_BEACON_MISSED = 65534, //We invented this to tell beacon missed case
+} tSirMacReasonCodes;
+
+
+typedef enum eSirMacChannelType
+{
+ eSIR_MAC_11A_BAND,
+ eSIR_MAC_11B_BAND,
+ eSIR_MAC_UNKNOWN_BAND
+} tSirMacChannelType;
+
+// BA Initiator v/s Recipient
+typedef enum eBADirection
+{
+ eBA_RECIPIENT,
+ eBA_INITIATOR
+} tBADirection;
+
+// A-MPDU/BA Enable/Disable in Tx/Rx direction
+typedef enum eBAEnable
+{
+ eBA_DISABLE,
+ eBA_ENABLE
+} tBAEnable;
+
+// A-MPDU/BA Policy
+typedef enum eBAPolicy
+{
+ eBA_UNCOMPRESSED,
+ eBA_COMPRESSED
+} tBAPolicy;
+
+// A-MPDU/BA Policy
+typedef enum eBAPolicyType
+{
+ eBA_POLICY_DELAYED,
+ eBA_POLICY_IMMEDIATE
+} tBAPolicyType;
+
+#ifdef WLAN_FEATURE_VOWIFI
+/* Based on table 7-43a from 802.11k Spec */
+typedef enum eRrmNeighborReachability
+{
+ eREACHABILITY_RESERVED,
+ eREACHABILITY_NOT_REACHABLE,
+ eREACHABILITY_UNKNOWN,
+ eREACHABILITY_REACHABLE,
+} tRrmNeighborReachability;
+#endif /* WLAN_FEATURE_VOWIFI */
+
+/// Frame control field format (2 bytes)
+typedef __ani_attr_pre_packed struct sSirMacFrameCtl
+{
+
+#ifndef ANI_LITTLE_BIT_ENDIAN
+
+ tANI_U8 subType :4;
+ tANI_U8 type :2;
+ tANI_U8 protVer :2;
+
+ tANI_U8 order :1;
+ tANI_U8 wep :1;
+ tANI_U8 moreData :1;
+ tANI_U8 powerMgmt :1;
+ tANI_U8 retry :1;
+ tANI_U8 moreFrag :1;
+ tANI_U8 fromDS :1;
+ tANI_U8 toDS :1;
+
+#else
+
+ tANI_U8 protVer :2;
+ tANI_U8 type :2;
+ tANI_U8 subType :4;
+
+ tANI_U8 toDS :1;
+ tANI_U8 fromDS :1;
+ tANI_U8 moreFrag :1;
+ tANI_U8 retry :1;
+ tANI_U8 powerMgmt :1;
+ tANI_U8 moreData :1;
+ tANI_U8 wep :1;
+ tANI_U8 order :1;
+
+#endif
+
+} __ani_attr_packed tSirMacFrameCtl, *tpSirMacFrameCtl;
+
+/// Sequence control field
+typedef __ani_attr_pre_packed struct sSirMacSeqCtl
+{
+
+#ifndef ANI_LITTLE_BIT_ENDIAN
+
+ tANI_U8 seqNumLo : 4;
+ tANI_U8 fragNum : 4;
+
+ tANI_U8 seqNumHi : 8;
+
+#else
+
+ tANI_U8 fragNum : 4;
+ tANI_U8 seqNumLo : 4;
+ tANI_U8 seqNumHi : 8;
+
+#endif
+} __ani_attr_packed tSirMacSeqCtl, *tpSirMacSeqCtl;
+
+// ACK policies
+
+typedef enum eSirMacAckPolicy
+{
+ eSIR_MAC_IMMEDIATE_ACK=0 ,
+ eSIR_MAC_NO_ACK,
+ eSIR_MAC_NO_EXPLICIT_ACK,
+ eSIR_MAC_BURST_ACK
+} tSirMacAckPolicy;
+
+/// QoS control field
+typedef __ani_attr_pre_packed struct sSirMacQosCtl
+{
+
+#ifndef ANI_LITTLE_BIT_ENDIAN
+
+ tANI_U8 rsvd : 1;
+ tANI_U8 ackPolicy : 2;
+ tANI_U8 esop_txopUnit : 1;
+ tANI_U8 tid : 4;
+
+ tANI_U8 txop : 8;
+
+#else
+
+ tANI_U8 tid : 4;
+ tANI_U8 esop_txopUnit : 1;
+ tANI_U8 ackPolicy : 2;
+ tANI_U8 rsvd : 1;
+
+ tANI_U8 txop : 8;
+
+#endif
+} __ani_attr_packed tSirMacQosCtl, *tpSirMacQosCtl;
+
+/// Length (in bytes) of MAC header in 3 address format
+#define SIR_MAC_HDR_LEN_3A 24
+
+/// Length (in bytes) of MAC header in 4 address format
+#define SIR_MAC_HDR_LEN_4A 30
+
+/// Length (in bytes) of the QoS control field in the MAC header
+#define SIR_MAC_QOS_CTL_LEN 2
+
+/// 3 address MAC data header format (24/26 bytes)
+typedef __ani_attr_pre_packed struct sSirMacDot3Hdr
+{
+ tANI_U8 da[6];
+ tANI_U8 sa[6];
+ tANI_U16 length;
+} __ani_attr_packed tSirMacDot3Hdr, *tpSirMacDot3Hdr;
+
+
+/// 3 address MAC data header format (24/26 bytes)
+typedef __ani_attr_pre_packed struct sSirMacDataHdr3a
+{
+ tSirMacFrameCtl fc;
+ tANI_U8 durationLo;
+ tANI_U8 durationHi;
+ tANI_U8 addr1[6];
+ tANI_U8 addr2[6];
+ tANI_U8 addr3[6];
+ tSirMacSeqCtl seqControl;
+ tSirMacQosCtl qosControl;
+} __ani_attr_packed tSirMacDataHdr3a, *tpSirMacDataHdr3a;
+
+/// 4 address MAC data header format (30/32 bytes)
+typedef __ani_attr_pre_packed struct sSirMacDataHdr4a
+{
+ tSirMacFrameCtl fc;
+ tANI_U8 durationLo;
+ tANI_U8 durationHi;
+ tANI_U8 addr1[6];
+ tANI_U8 addr2[6];
+ tANI_U8 addr3[6];
+ tSirMacSeqCtl seqControl;
+ tANI_U8 addr4[6];
+ tSirMacQosCtl qosControl;
+} __ani_attr_packed tSirMacDataHdr4a, *tpSirMacDataHdr4a;
+
+/// Management header format
+typedef __ani_attr_pre_packed struct sSirMacMgmtHdr
+{
+ tSirMacFrameCtl fc;
+ tANI_U8 durationLo;
+ tANI_U8 durationHi;
+ tANI_U8 da[6];
+ tANI_U8 sa[6];
+ tANI_U8 bssId[6];
+ tSirMacSeqCtl seqControl;
+} __ani_attr_packed tSirMacMgmtHdr, *tpSirMacMgmtHdr;
+
+/// PS-poll header format
+typedef __ani_attr_pre_packed struct sSirMacPSpoll
+{
+ tSirMacFrameCtl fc;
+ tANI_U8 aidLo;
+ tANI_U8 aidHi;
+ tANI_U8 bssId[6];
+ tANI_U8 ta[6];
+ tANI_U8 fcs[4];
+} __ani_attr_packed tSirMacPSpoll, *tpSirMacPSpoll;
+
+/// ERP information field
+typedef __ani_attr_pre_packed struct sSirMacErpInfo
+{
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ tANI_U8 reserved:5;
+ tANI_U8 barkerPreambleMode:1;
+ tANI_U8 useProtection:1;
+ tANI_U8 nonErpPresent:1;
+#else
+ tANI_U8 nonErpPresent:1;
+ tANI_U8 useProtection:1;
+ tANI_U8 barkerPreambleMode:1;
+ tANI_U8 reserved:5;
+#endif
+} __ani_attr_packed tSirMacErpInfo, *tpSirMacErpInfo;
+
+/// Capability information field
+typedef __ani_attr_pre_packed struct sSirMacCapabilityInfo
+{
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ tANI_U16 immediateBA:1;
+ tANI_U16 delayedBA:1;
+ tANI_U16 dsssOfdm:1;
+ tANI_U16 rrm:1;
+ tANI_U16 apsd:1;
+ tANI_U16 shortSlotTime:1;
+ tANI_U16 qos:1;
+ tANI_U16 spectrumMgt:1;
+ tANI_U16 channelAgility:1;
+ tANI_U16 pbcc:1;
+ tANI_U16 shortPreamble:1;
+ tANI_U16 privacy:1;
+ tANI_U16 cfPollReq:1;
+ tANI_U16 cfPollable:1;
+ tANI_U16 ibss:1;
+ tANI_U16 ess:1;
+#else
+ tANI_U16 ess:1;
+ tANI_U16 ibss:1;
+ tANI_U16 cfPollable:1;
+ tANI_U16 cfPollReq:1;
+ tANI_U16 privacy:1;
+ tANI_U16 shortPreamble:1;
+ tANI_U16 pbcc:1;
+ tANI_U16 channelAgility:1;
+ tANI_U16 spectrumMgt:1;
+ tANI_U16 qos:1;
+ tANI_U16 shortSlotTime:1;
+ tANI_U16 apsd:1;
+ tANI_U16 rrm:1;
+ tANI_U16 dsssOfdm:1;
+ tANI_U16 delayedBA:1;
+ tANI_U16 immediateBA:1;
+#endif
+} __ani_attr_packed tSirMacCapabilityInfo, *tpSirMacCapabilityInfo;
+
+typedef __ani_attr_pre_packed struct sSirMacCfParamSet
+{
+ tANI_U8 cfpCount;
+ tANI_U8 cfpPeriod;
+ tANI_U16 cfpMaxDuration;
+ tANI_U16 cfpDurRemaining;
+} __ani_attr_packed tSirMacCfParamSet;
+
+typedef __ani_attr_pre_packed struct sSirMacTim
+{
+ tANI_U8 dtimCount;
+ tANI_U8 dtimPeriod;
+ tANI_U8 bitmapControl;
+ tANI_U8 bitmapLength;
+ tANI_U8 bitmap[251];
+} __ani_attr_packed tSirMacTim;
+
+//12 Bytes long because this structure can be used to represent rate
+//and extended rate set IEs
+//The parser assume this to be at least 12
+typedef __ani_attr_pre_packed struct sSirMacRateSet
+{
+ tANI_U8 numRates;
+ tANI_U8 rate[SIR_MAC_RATESET_EID_MAX];
+} __ani_attr_packed tSirMacRateSet;
+
+
+typedef __ani_attr_pre_packed struct sSirMacSSid
+{
+ tANI_U8 length;
+ tANI_U8 ssId[32];
+} __ani_attr_packed tSirMacSSid;
+
+typedef __ani_attr_pre_packed struct sSirMacWpaInfo
+{
+ tANI_U8 length;
+ tANI_U8 info[SIR_MAC_MAX_IE_LENGTH];
+} __ani_attr_packed tSirMacWpaInfo, *tpSirMacWpaInfo, tSirMacRsnInfo, *tpSirMacRsnInfo;
+
+
+/* ----------------
+ * EDCA Profiles
+ * ---------------
+ */
+
+#define EDCA_AC_BE 0
+#define EDCA_AC_BK 1
+#define EDCA_AC_VI 2
+#define EDCA_AC_VO 3
+#define AC_MGMT_LO 4
+#define AC_MGMT_HI 5
+#define MAX_NUM_AC 4
+#define TOT_NUM_AC (MAX_NUM_AC + 2) /* +2 for AC_MGMT_xx */
+
+/*
+#define EDCA_INDEX_0_RSVD 0
+#define EDCA_INDEX_1_BEACON 1
+#define EDCA_INDEX_2_MGMT_PROBERSP 2
+#define EDCA_INDEX_3_MGMT_OTHER 3
+#define EDCA_INDEX_4_AC_VO 4
+#define EDCA_INDEX_5_AC_VI 5
+#define EDCA_INDEX_6_AC_BE 6
+#define EDCA_INDEX_7_AC_BK 7
+*/
+// access categories
+#define SIR_MAC_EDCAACI_BESTEFFORT (EDCA_AC_BE)
+#define SIR_MAC_EDCAACI_BACKGROUND (EDCA_AC_BK)
+#define SIR_MAC_EDCAACI_VIDEO (EDCA_AC_VI)
+#define SIR_MAC_EDCAACI_VOICE (EDCA_AC_VO)
+
+// access category record
+typedef __ani_attr_pre_packed struct sSirMacAciAifsn
+{
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ tANI_U8 rsvd : 1;
+ tANI_U8 aci : 2;
+ tANI_U8 acm : 1;
+ tANI_U8 aifsn : 4;
+#else
+ tANI_U8 aifsn : 4;
+ tANI_U8 acm : 1;
+ tANI_U8 aci : 2;
+ tANI_U8 rsvd : 1;
+#endif
+} __ani_attr_packed tSirMacAciAifsn;
+
+// contention window size
+typedef __ani_attr_pre_packed struct sSirMacCW
+{
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ tANI_U8 max : 4;
+ tANI_U8 min : 4;
+#else
+ tANI_U8 min : 4;
+ tANI_U8 max : 4;
+#endif
+} __ani_attr_packed tSirMacCW;
+
+typedef __ani_attr_pre_packed struct sSirMacEdcaParamRecord
+{
+ tSirMacAciAifsn aci;
+ tSirMacCW cw;
+ tANI_U16 txoplimit;
+} __ani_attr_packed tSirMacEdcaParamRecord;
+
+typedef __ani_attr_pre_packed struct sSirMacQosInfo
+{
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ tANI_U8 uapsd : 1;
+ tANI_U8 txopreq : 1;
+ tANI_U8 qreq : 1;
+ tANI_U8 qack : 1;
+ tANI_U8 count : 4;
+#else
+ tANI_U8 count : 4;
+ tANI_U8 qack : 1;
+ tANI_U8 qreq : 1;
+ tANI_U8 txopreq : 1;
+ tANI_U8 uapsd : 1;
+#endif
+} __ani_attr_packed tSirMacQosInfo;
+
+
+typedef __ani_attr_pre_packed struct sSirMacQosInfoStation
+{
+#ifdef ANI_LITTLE_BIT_ENDIAN
+ tANI_U8 acvo_uapsd:1;
+ tANI_U8 acvi_uapsd:1;
+ tANI_U8 acbk_uapsd:1;
+ tANI_U8 acbe_uapsd:1;
+ tANI_U8 qack:1;
+ tANI_U8 maxSpLen:2;
+ tANI_U8 moreDataAck:1;
+#else
+ tANI_U8 moreDataAck:1;
+ tANI_U8 maxSpLen:2;
+ tANI_U8 qack:1;
+ tANI_U8 acbe_uapsd:1;
+ tANI_U8 acbk_uapsd:1;
+ tANI_U8 acvi_uapsd:1;
+ tANI_U8 acvo_uapsd:1;
+#endif
+} __ani_attr_packed tSirMacQosInfoStation, *tpSirMacQosInfoStation;
+
+
+
+typedef __ani_attr_pre_packed struct sSirMacEdcaParamSetIE
+{
+ tANI_U8 type;
+ tANI_U8 length;
+ tSirMacQosInfo qosInfo;
+ tANI_U8 rsvd;
+ tSirMacEdcaParamRecord acbe; // best effort
+ tSirMacEdcaParamRecord acbk; // background
+ tSirMacEdcaParamRecord acvi; // video
+ tSirMacEdcaParamRecord acvo; // voice
+} __ani_attr_packed tSirMacEdcaParamSetIE;
+
+#if 1
+typedef __ani_attr_pre_packed struct sSirMacQoSParams
+{
+ tANI_U8 count;
+ tANI_U16 limit;
+ tANI_U8 CWmin[8];
+ tANI_U8 AIFS[8];
+} __ani_attr_packed tSirMacQoSParams;
+#endif
+
+typedef __ani_attr_pre_packed struct sSirMacQbssLoadIE
+{
+ tANI_U8 type;
+ tANI_U8 length;
+ tANI_U16 staCount;
+ tANI_U8 chnlUtil;
+ tANI_U16 admitCapacity;
+} __ani_attr_packed tSirMacQbssLoadIE;
+
+// ts info direction field can take any of these values
+#define SIR_MAC_DIRECTION_UPLINK 0
+#define SIR_MAC_DIRECTION_DNLINK 1
+#define SIR_MAC_DIRECTION_DIRECT 2
+#define SIR_MAC_DIRECTION_BIDIR 3
+
+// access policy
+// reserved 0
+#define SIR_MAC_ACCESSPOLICY_EDCA 1
+#define SIR_MAC_ACCESSPOLICY_HCCA 2
+#define SIR_MAC_ACCESSPOLICY_BOTH 3
+
+#define SIR_MAC_HCCA_TSID_MIN 8 // valid HCCA tsid's are 8 or higher
+#define SIR_MAC_TID_MAX 15
+#define MAC_BA_TID_MAX 8
+
+typedef __ani_attr_pre_packed struct sSirMacTSInfoTfc
+{
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ tANI_U8 burstSizeDefn : 1;
+ tANI_U8 reserved :7;
+#else
+ tANI_U8 reserved :7;
+ tANI_U8 burstSizeDefn : 1;
+#endif
+
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ tANI_U16 ackPolicy : 2;
+ tANI_U16 userPrio : 3;
+ tANI_U16 psb : 1;
+ tANI_U16 aggregation : 1;
+ tANI_U16 accessPolicy : 2;
+ tANI_U16 direction : 2;
+ tANI_U16 tsid : 4;
+ tANI_U16 trafficType : 1;
+#else
+ tANI_U16 trafficType : 1;
+ tANI_U16 tsid : 4;
+ tANI_U16 direction : 2;
+ tANI_U16 accessPolicy : 2;
+ tANI_U16 aggregation : 1;
+ tANI_U16 psb : 1;
+ tANI_U16 userPrio : 3;
+ tANI_U16 ackPolicy : 2;
+#endif
+} __ani_attr_packed tSirMacTSInfoTfc;
+
+typedef __ani_attr_pre_packed struct sSirMacTSInfoSch
+{
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ tANI_U8 rsvd : 7;
+ tANI_U8 schedule : 1;
+#else
+ tANI_U8 schedule : 1;
+ tANI_U8 rsvd : 7;
+#endif
+} __ani_attr_packed tSirMacTSInfoSch;
+
+typedef __ani_attr_pre_packed struct sSirMacTSInfo
+{
+ tSirMacTSInfoTfc traffic;
+ tSirMacTSInfoSch schedule;
+} __ani_attr_packed tSirMacTSInfo;
+
+typedef __ani_attr_pre_packed struct sSirMacTspecIE
+{
+ tANI_U8 type;
+ tANI_U8 length;
+ tSirMacTSInfo tsinfo;
+ tANI_U16 nomMsduSz;
+ tANI_U16 maxMsduSz;
+ tANI_U32 minSvcInterval;
+ tANI_U32 maxSvcInterval;
+ tANI_U32 inactInterval;
+ tANI_U32 suspendInterval;
+ tANI_U32 svcStartTime;
+ tANI_U32 minDataRate;
+ tANI_U32 meanDataRate;
+ tANI_U32 peakDataRate;
+ tANI_U32 maxBurstSz;
+ tANI_U32 delayBound;
+ tANI_U32 minPhyRate;
+ tANI_U16 surplusBw;
+ tANI_U16 mediumTime;
+}
+#ifndef LX5280
+__ani_attr_packed
+#else
+__ani_attr_aligned_4 __ani_attr_packed
+#endif
+tSirMacTspecIE;
+
+// max size of the classifier params in the tclas IE
+#define SIR_MAC_CLSPARAM_LEN 253
+
+// frame classifier types
+#define SIR_MAC_TCLASTYPE_ETHERNET 0
+#define SIR_MAC_TCLASTYPE_TCPUDPIP 1
+#define SIR_MAC_TCLASTYPE_8021DQ 2
+// reserved 3-255
+
+#define SIR_MAC_TCLAS_PARAM_ETHERNET_MIN 14
+typedef __ani_attr_pre_packed struct sSirMacTclasParamEthernet
+{
+ tANI_U8 srcAddr[6];
+ tANI_U8 dstAddr[6];
+ tANI_U16 type;
+}__ani_attr_packed tSirMacTclasParamEthernet;
+
+#define SIR_MAC_TCLAS_PARAM_IPV4_MIN 16
+typedef __ani_attr_pre_packed struct sSirMacTclasParamIPv4
+{
+ tANI_U8 version;
+ tANI_U32 srcIpAddr;
+ tANI_U32 dstIpAddr;
+ tANI_U16 srcPort;
+ tANI_U16 dstPort;
+ tANI_U8 dscp;
+ tANI_U8 protocol;
+ tANI_U8 rsvd;
+} __ani_attr_packed tSirMacTclasParamIPv4;
+
+#define SIR_MAC_TCLAS_IPV4 4
+#define SIR_MAC_TCLAS_IPV6 6
+
+#define SIR_MAC_TCLAS_PARAM_IPV6_MIN 40
+typedef __ani_attr_pre_packed struct sSirMacTclasParamIPv6
+{
+ tANI_U8 version;
+ tANI_U8 srcIpAddr[16];
+ tANI_U8 dstIpAddr[16];
+ tANI_U16 srcPort;
+ tANI_U16 dstPort;
+ tANI_U8 flowLabel[3];
+} __ani_attr_packed tSirMacTclasParamIPv6;
+
+#define SIR_MAC_TCLAS_PARAM_8021DQ_MIN 2
+typedef __ani_attr_pre_packed struct sSirMacTclasParam8021dq
+{
+ tANI_U16 tag;
+} __ani_attr_packed tSirMacTclasParam8021dq;
+
+typedef __ani_attr_pre_packed struct sSirMacTclasIE
+{
+ tANI_U8 type;
+ tANI_U8 length;
+ tANI_U8 userPrio;
+ tANI_U8 classifierType;
+ tANI_U8 classifierMask;
+} __ani_attr_packed tSirMacTclasIE;
+
+typedef __ani_attr_pre_packed struct sSirMacTsDelayIE
+{
+ tANI_U8 type;
+ tANI_U8 length;
+ tANI_U32 delay;
+} __ani_attr_packed tSirMacTsDelayIE;
+
+typedef __ani_attr_pre_packed struct sSirMacTclasProcIE
+{
+ tANI_U8 type;
+ tANI_U8 length;
+ tANI_U8 processing;
+} __ani_attr_packed tSirMacTclasProcIE;
+
+typedef __ani_attr_pre_packed struct sSirMacScheduleInfo
+{
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ tANI_U16 rsvd : 9;
+ tANI_U16 direction : 2;
+ tANI_U16 tsid : 4;
+ tANI_U16 aggregation : 1;
+#else
+ tANI_U16 aggregation : 1;
+ tANI_U16 tsid : 4;
+ tANI_U16 direction : 2;
+ tANI_U16 rsvd : 9;
+#endif
+} __ani_attr_packed tSirMacScheduleInfo;
+
+typedef __ani_attr_pre_packed struct sSirMacScheduleIE
+{
+ tANI_U8 type;
+ tANI_U8 length;
+ tSirMacScheduleInfo info;
+ tANI_U32 svcStartTime;
+ tANI_U32 svcInterval;
+ tANI_U16 maxSvcDuration;
+ tANI_U16 specInterval;
+} __ani_attr_packed tSirMacScheduleIE;
+
+typedef __ani_attr_pre_packed struct sSirMacQosCapabilityIE
+{
+ tANI_U8 type;
+ tANI_U8 length;
+ tSirMacQosInfo qosInfo;
+} __ani_attr_packed tSirMacQosCapabilityIE;
+
+typedef __ani_attr_pre_packed struct sSirMacQosCapabilityStaIE
+{
+ tANI_U8 type;
+ tANI_U8 length;
+ tSirMacQosInfoStation qosInfo;
+} __ani_attr_packed tSirMacQosCapabilityStaIE;
+
+
+#define ADDTS
+typedef __ani_attr_pre_packed struct sSirMacQosActionIE
+{
+ tANI_U8 type;
+ tANI_U8 length;
+ tANI_U8 qosAction;
+ tANI_U8 qosBody[1];
+} __ani_attr_packed tSirMacQosActionIE;
+
+typedef tANI_U32 tSirMacTimeStamp[2];
+
+typedef tANI_U16 tSirMacBeaconInterval;
+
+typedef tANI_U16 tSirMacListenInterval;
+
+typedef tANI_U8 tSirMacChanNum;
+
+typedef tANI_U8 tSirMacAddr[6];
+
+
+// IE definitions
+typedef __ani_attr_pre_packed struct sSirMacIE
+{
+ tANI_U8 elementID;
+ tANI_U8 length;
+ tANI_U8 info[1];
+} __ani_attr_packed tSirMacIE;
+
+typedef __ani_attr_pre_packed struct sSirMacSSidIE
+{
+ tANI_U8 type;
+ tSirMacSSid ssId;
+} __ani_attr_packed tSirMacSSidIE;
+
+typedef __ani_attr_pre_packed struct sSirMacRateSetIE
+{
+ tANI_U8 type;
+ tSirMacRateSet supportedRateSet;
+} __ani_attr_packed tSirMacRateSetIE;
+
+typedef __ani_attr_pre_packed struct sSirMacDsParamSetIE
+{
+ tANI_U8 type;
+ tANI_U8 length;
+ tSirMacChanNum channelNumber;
+} __ani_attr_packed tSirMacDsParamSetIE;
+
+typedef __ani_attr_pre_packed struct sSirMacCfParamSetIE
+{
+ tANI_U8 type;
+ tANI_U8 length;
+ tSirMacCfParamSet cfParams;
+} __ani_attr_packed tSirMacCfParamSetIE;
+
+typedef __ani_attr_pre_packed struct sSirMacChanInfo
+{
+ tSirMacChanNum firstChanNum;
+ tANI_U8 numChannels;
+ tANI_S8 maxTxPower;
+} __ani_attr_packed tSirMacChanInfo;
+
+typedef __ani_attr_pre_packed struct sSirMacCountry
+{
+ tANI_U8 countryString[3]; // This from CFG_COUNTRY_STRING
+ tANI_U8 numChanInfo;
+ tSirMacChanInfo chanInfo[1];
+} __ani_attr_packed tSirMacCountry;
+
+typedef __ani_attr_pre_packed struct sSirMacCountryIE
+{
+ tANI_U8 type;
+ tANI_U8 length;
+ tSirMacCountry country;
+} __ani_attr_packed tSirMacCountryIE;
+
+typedef __ani_attr_pre_packed struct sSirMacNonErpPresentIE
+{
+ tANI_U8 type;
+ tANI_U8 length;
+ tANI_U8 erp;
+} __ani_attr_packed tSirMacNonErpPresentIE;
+
+typedef __ani_attr_pre_packed struct sSirMacWpaIE
+{
+ tANI_U8 type;
+ tSirMacWpaInfo wpa;
+} __ani_attr_packed tSirMacWpaIE;
+
+typedef struct sSirMacPowerCapabilityIE
+{
+ tANI_U8 type;
+ tANI_U8 length;
+ tANI_U8 minTxPower;
+ tANI_U8 maxTxPower;
+} tSirMacPowerCapabilityIE;
+
+typedef struct sSirMacSupportedChannelIE
+{
+ tANI_U8 type;
+ tANI_U8 length;
+ tANI_U8 supportedChannels[96];
+} tSirMacSupportedChannelIE;
+
+typedef struct sSirMacMeasReqField
+{
+ tANI_U8 channelNumber;
+ tANI_U8 measStartTime[8];
+ tANI_U16 measDuration;
+} tSirMacMeasReqField, *tpSirMacMeasReqField;
+
+typedef struct sSirMacMeasReqIE
+{
+ tANI_U8 type;
+ tANI_U8 length;
+ tANI_U8 measToken;
+ tANI_U8 measReqMode;
+ tANI_U8 measType;
+ tSirMacMeasReqField measReqField;
+} tSirMacMeasReqIE, *tpSirMacMeasReqIE;
+
+// Basic Measurement Report
+typedef struct sSirMacBasicReport
+{
+ tANI_U8 channelNumber;
+ tANI_U8 measStartTime[8];
+ tANI_U16 measDuration;
+ tANI_U8 mapField;
+} tSirMacBasicReport, *tpSirMacBasicReport;
+
+typedef struct sSirMacBasicReportIE
+{
+ tANI_U8 type;
+ tANI_U8 length;
+ tANI_U8 measToken;
+ tANI_U8 measReportMode;
+ tANI_U8 measType;
+ tSirMacBasicReport basicReport;
+} tSirMacBasicReportIE, *tpSirMacBasicReportIE;
+
+// CCA Measurement Report
+typedef struct sSirMacCcaReport
+{
+ tANI_U8 channelNumber;
+ tANI_U8 measStartTime[8];
+ tANI_U16 measDuration;
+ tANI_U8 ccaBusyFraction;
+} tSirMacCcaReport, *tpSirMacCcaReport;
+
+typedef struct sSirMacCcaReportIE
+{
+ tANI_U8 type;
+ tANI_U8 length;
+ tANI_U8 measToken;
+ tANI_U8 measReportMode;
+ tANI_U8 measType;
+ tSirMacCcaReport ccaReport;
+} tSirMacCcaReportIE, *tpSirMacCcaReportIE;
+
+// RPI Histogram Measurement Report
+typedef struct sSirMacRpiReport
+{
+ tANI_U8 channelNumber;
+ tANI_U8 measStartTime[8];
+ tANI_U16 measDuration;
+ tANI_U8 rpiDensity[8];
+} tSirMacRpiReport, *tpSirMacRpiReport;
+
+typedef struct sSirMacRpiReportIE
+{
+ tANI_U8 type;
+ tANI_U8 length;
+ tANI_U8 measToken;
+ tANI_U8 measReportMode;
+ tANI_U8 measType;
+ tSirMacRpiReport rpiReport;
+} tSirMacRpiReportIE, *tpSirMacRpiReportIE;
+
+
+// HT Cap and HT IE Size defines
+#define HT_CAPABILITY_IE_SIZE 28
+#define HT_INFO_IE_SIZE 24
+
+//
+// Determines the current operating mode of the 802.11n STA
+//
+typedef enum eSirMacHTOperatingMode
+{
+ eSIR_HT_OP_MODE_PURE, // No Protection
+ eSIR_HT_OP_MODE_OVERLAP_LEGACY, // Overlap Legacy device present, protection is optional
+ eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT, // No legacy device, but 20 MHz HT present
+ eSIR_HT_OP_MODE_MIXED // Protetion is required
+} tSirMacHTOperatingMode;
+
+
+// Spatial Multiplexing(SM) Power Save mode
+typedef enum eSirMacHTMIMOPowerSaveState
+{
+ eSIR_HT_MIMO_PS_STATIC = 0, // Static SM Power Save mode
+ eSIR_HT_MIMO_PS_DYNAMIC = 1, // Dynamic SM Power Save mode
+ eSIR_HT_MIMO_PS_NA = 2, // reserved
+ eSIR_HT_MIMO_PS_NO_LIMIT = 3 // SM Power Save disabled
+} tSirMacHTMIMOPowerSaveState;
+
+
+typedef enum eSirMacHTSecondaryChannelOffset
+{
+ eHT_SECONDARY_CHANNEL_OFFSET_NONE = 0,
+ eHT_SECONDARY_CHANNEL_OFFSET_UP = 1,
+ eHT_SECONDARY_CHANNEL_OFFSET_DOWN = 3
+} tSirMacHTSecondaryChannelOffset;
+
+typedef enum eSirMacHTChannelWidth
+{
+ eHT_CHANNEL_WIDTH_20MHZ = 0,
+ eHT_CHANNEL_WIDTH_40MHZ = 1
+} tSirMacHTChannelWidth;
+
+//Packet struct for HT capability
+typedef __ani_attr_pre_packed struct sHtCaps {
+ tANI_U16 advCodingCap: 1;
+ tANI_U16 supportedChannelWidthSet: 1;
+ tANI_U16 mimoPowerSave: 2;
+ tANI_U16 greenField: 1;
+ tANI_U16 shortGI20MHz: 1;
+ tANI_U16 shortGI40MHz: 1;
+ tANI_U16 txSTBC: 1;
+ tANI_U16 rxSTBC: 2;
+ tANI_U16 delayedBA: 1;
+ tANI_U16 maximalAMSDUsize: 1;
+ tANI_U16 dsssCckMode40MHz: 1;
+ tANI_U16 psmp: 1;
+ tANI_U16 stbcControlFrame: 1;
+ tANI_U16 lsigTXOPProtection: 1;
+ tANI_U8 maxRxAMPDUFactor: 2;
+ tANI_U8 mpduDensity: 3;
+ tANI_U8 reserved1: 3;
+ tANI_U8 supportedMCSSet[16];
+ tANI_U16 pco: 1;
+ tANI_U16 transitionTime: 2;
+ tANI_U16 reserved2: 5;
+ tANI_U16 mcsFeedback: 2;
+ tANI_U16 reserved3: 6;
+ tANI_U32 txBF: 1;
+ tANI_U32 rxStaggeredSounding: 1;
+ tANI_U32 txStaggeredSounding: 1;
+ tANI_U32 rxZLF: 1;
+ tANI_U32 txZLF: 1;
+ tANI_U32 implicitTxBF: 1;
+ tANI_U32 calibration: 2;
+ tANI_U32 explicitCSITxBF: 1;
+ tANI_U32 explicitUncompressedSteeringMatrix: 1;
+ tANI_U32 explicitBFCSIFeedback: 3;
+ tANI_U32 explicitUncompressedSteeringMatrixFeedback: 3;
+ tANI_U32 explicitCompressedSteeringMatrixFeedback: 3;
+ tANI_U32 csiNumBFAntennae: 2;
+ tANI_U32 uncompressedSteeringMatrixBFAntennae: 2;
+ tANI_U32 compressedSteeringMatrixBFAntennae: 2;
+ tANI_U32 reserved4: 7;
+ tANI_U8 antennaSelection: 1;
+ tANI_U8 explicitCSIFeedbackTx: 1;
+ tANI_U8 antennaIndicesFeedbackTx: 1;
+ tANI_U8 explicitCSIFeedback: 1;
+ tANI_U8 antennaIndicesFeedback: 1;
+ tANI_U8 rxAS: 1;
+ tANI_U8 txSoundingPPDUs: 1;
+ tANI_U8 reserved5: 1;
+
+} __ani_attr_packed tHtCaps;
+
+/* During 11h channel switch, the AP can indicate if the
+ * STA needs to stop the transmission or continue until the
+ * channel-switch.
+ * eSIR_CHANSW_MODE_NORMAL - STA can continue transmission
+ * eSIR_CHANSW_MODE_SILENT - STA should stop transmission
+ */
+typedef enum eSirMacChanSwMode
+{
+ eSIR_CHANSW_MODE_NORMAL = 0,
+ eSIR_CHANSW_MODE_SILENT = 1
+} tSirMacChanSwitchMode;
+
+
+typedef __ani_attr_pre_packed struct _BarControl {
+
+#ifndef ANI_BIG_BYTE_ENDIAN
+
+ tANI_U16 barAckPolicy:1;
+ tANI_U16 multiTID:1;
+ tANI_U16 bitMap:1;
+ tANI_U16 rsvd:9;
+ tANI_U16 numTID:4;
+
+#else
+ tANI_U16 numTID:4;
+ tANI_U16 rsvd:9;
+ tANI_U16 bitMap:1;
+ tANI_U16 multiTID:1;
+ tANI_U16 barAckPolicy:1;
+
+#endif
+
+}__ani_attr_packed barCtrlType;
+
+typedef __ani_attr_pre_packed struct _BARFrmStruct {
+ tSirMacFrameCtl fc;
+ tANI_U16 duration;
+ tSirMacAddr rxAddr;
+ tSirMacAddr txAddr;
+ barCtrlType barControl;
+ tSirMacSeqCtl ssnCtrl;
+}__ani_attr_packed BARFrmType;
+
+
+#if 0
+// Typedef for HT Capability IE
+// Typedef for HT Capability Info Field
+#define SUPPORT_ADVANCE_CODING_1 1
+#define NOT_SUPPORT_ADVANCE_CODING_0 0
+#define SUPPORT_CHANNEL_WIDTH_SET_20_40_MHZ 1
+#define NOT_SUPPORT_CHANNEL_WIDTH_SET_20_MHZ_ONLY 0
+#define DO_NOT_SEND_MIMO_SEQ_STATIC_POWER_SAVE 0
+#define RTS_PRECEDE_MIMO_SEQ_DYN_POWER_SAVE 1
+#define MIMO_POWER_SAVE_NA 2
+#define NO_LIMIT_ON_MIMO_SEQ 3
+#define DEVICE_IS_ABLE_TO_RCVE_PPDU_WITH_GF_PREAMBLE 1
+#define DEVICE_NOT_ABLE_TO_RCVE_PPDU_WITH_GF_PREAMBLE 0
+#define SUPPORT_SHORT_GI_FOR_20_MHZ 1
+#define NOT_SUPPORT_SHORT_GI_FOR_20_MHZ 0
+#define SUPPORT_SHORT_GI_FOR_40_MHZ 1
+#define NOT_SUPPORT_SHORT_GI_FOR_40_MHZ 0
+#define TRANSMITTER_SUPPORT_STBC 1
+#define TRANSMITTER_NOT_SUPPORT_STBC 0
+#define RX_NOT_SUPPORT_STBC 0
+#define RX_SUPPORT_STBC_ONE_SPATIAL_STREAM 1
+#define RX_SUPPORT_STBC_ONE_AND_TWO_SPATIAL_STREAM 2
+#define RX_SUPPORT_STBC_ONE_TWO_THREE_SPATIAL_STREAM 3
+#define SUPPORT_DELAYED_BA 1
+#define NOT_SUPPORT_DELAYED_BA 0
+#define RECEIVER_MAX_A_MSDU_SIZE_7935 1
+#define RECEIVER_MAX_A_MSDU_SIZE_3839 0
+#define BSS_OR_DEVICE_ALLOW_USE_DSSS_CCK 1
+#define BSS_OR_DEVICE_NOT_ALLOW_USE_DSSS_CCK 0
+#define BSS_OR_DEVICE_SUPPORT_USE_PSMP 1
+#define BSS_OR_DEVICE_NOT_SUPPORT_USE_PSMP 0
+#define BSS_OR_DEVICE_SUPPORT_USE_STBC_CONTROL_FRAME 1
+#define BSS_OR_DEVICE_NOT_SUPPORT_USE_STBC_CONTROL_FRAME 0
+#define SUPPORT_L_SIG_TXOP_PROTECTION 1
+#define NOT_SUPPORT_L_SIG_TXOP_PROTECTION 0
+
+// Typedef for HT Parameters Info Field
+#define MAX_RX_AMPDU_FACTOR_0 0
+#define MAX_RX_AMPDU_FACTOR_1 1
+#define MAX_RX_AMPDU_FACTOR_2 2
+#define MAX_RX_AMPDU_FACTOR_3 3
+#define MPDU_DENSITY_NO_RESTRICTION 0
+#define MPDU_DENSITY_ONE_EIGHTH_USECOND 1
+#define MPDU_DENSITY_ONE_FOURTH_USECOND 2
+#define MPDU_DENSITY_ONE_HALF_USECOND 3
+#define MPDU_DENSITY_ONE_USECOND 4
+#define MPDU_DENSITY_TWO_USECOND 5
+#define MPDU_DENSITY_FOUR_USECOND 6
+#define MPDU_DENSITY_EIGHT_USECOND 7
+#endif
+
+// Supported MCS set
+#define SIZE_OF_SUPPORTED_MCS_SET 16
+#define SIZE_OF_BASIC_MCS_SET 16
+#define VALID_MCS_SIZE 77 //0-76
+#define MCS_RX_HIGHEST_SUPPORTED_RATE_BYTE_OFFSET 10
+// This is not clear, Count 8 based from NV supported MCS count
+#define VALID_MAX_MCS_INDEX 8
+
+#if 0
+// Typedef Extended HT Capability Info Field
+#define SUPPORT_PCO 1
+#define NOT_SUPPORT_PCO 0
+#define TRANSITION_TIME_0 0
+#define STA_DOES_NOT_PROVIDE_MCS_FEEDBACK 0
+#define RESERVE_VALUE_FOR_STA_MCS_FEEDBACK 1
+#define STA_PROVIDE_UNSOLICITED_MCS_FEEDBACK 2
+#define STA_PROVIDE_ON_MRQ_AND_UNSOLICITED_MCS_FEEDBACK 3
+
+// Typedef Transmit Beamforming Capability
+#define TX_BEAMFORMING_CAPABLE 1
+#define TX_BEAMFORMING_INCAPABLE 0
+#define CAPABLE_RECEIVE_STAGGERED_SOUNDING 1
+#define NOT_CAPABLE_RECEIVE_STAGGERED_SOUNDING 0
+#define CAPABLE_TRANSMIT_STAGGERED_SOUNDING 1
+#define NOT_CAPABLE_TRANSMIT_STAGGERED_SOUNDING 0
+#define CAPABLE_RECEIVE_ZLF 1
+#define NOT_CAPABLE_RECEIVE_ZLF 0
+#define CAPABLE_TRANSMIT_ZLF 1
+#define NOT_CAPABLE_TRANSMIT_ZLF 0
+#define CAPABLE_IMPLICIT_TXBF 1
+#define NOT_CAPABLE_IMPLICIT_TXBF 0
+#define INCAPABLE_CALIBRATION 0
+#define LIMITED_CALIBRATION_CANNOT_INITIATE 1
+#define LIMITED_CALIBRATION_CAN_INITIATE 2
+#define FULLT_CAPABLE_CALIBRATION 3
+#define CAPABLE_EXPLICIT_CSI_TXBF 1
+#define INCAPABLE_EXPLICIT_CSI_TXBF 0
+#define CAPABLE_EXPLICIT_UNCOMPRESSED_STEERING_MATRIX 1
+#define INCAPABLE_EXPLICIT_UNCOMPRESSED_STEERING_MATRIX 0
+#define INCAPABLE_EXPLICIT_BFCI_FEEDBACK 0
+#define CAPABLE_UNSOLICITED_BFCI_FEEDBACK 1
+#define CAPABLE_IMMEDIATE_BFCI_FEEDBACK 2
+#define CAPABLE_AGGREGATE_BFCI_FEEDBACK 4
+#define INCAPABLE_EXPLICIT_UNCOMPRESSED_STEERING_MATRIX_FEEDBAC 0
+#define CAPABLE_UNSOLICITED_UNCOMPRESSED_STEERING_MATRIX 1
+#define CAPABLE_IMMEDIATE_UNCOMPRESSED_STEERING_MATRIX 2
+#define CAPABLE_AGGREGATED_UNCOMPRESSED_STEERING_MATRIX 4
+#define INCAPABLE_EXPLICIT_COMPRESSED_STEERING_MATRIX_FEEDBAC 0
+#define CAPABLE_UNSOLICITED_COMPRESSED_STEERING_MATRIX 1
+#define CAPABLE_IMMEDIATE_COMPRESSED_STEERING_MATRIX 2
+#define CAPABLE_AGGREGATED_COMPRESSED_STEERING_MATRIX 4
+#define SUPPORT_CSI_BEAMFORMING_SINGLE_TX_ANTENNA_SOUNDING 0
+#define SUPPORT_CSI_BEAMFORMING_2_TX_ANTENNA_SOUNDING 1
+#define SUPPORT_CSI_BEAMFORMING_3_TX_ANTENNA_SOUNDING 2
+#define SUPPORT_CSI_BEAMFORMING_4_TX_ANTENNA_SOUNDING 3
+#define SUPPORT_UNCOMPRESSED_STEERING_MATRIX_1_TX_ANTENNA_SOUNDING 0
+#define SUPPORT_UNCOMPRESSED_STEERING_MATRIX_2_TX_ANTENNA_SOUNDING 1
+#define SUPPORT_UNCOMPRESSED_STEERING_MATRIX_3_TX_ANTENNA_SOUNDING 2
+#define SUPPORT_UNCOMPRESSED_STEERING_MATRIX_4_TX_ANTENNA_SOUNDING 3
+#define SUPPORT_COMPRESSED_STEERING_MATRIX_1_TX_ANTENNA_SOUNDING 0
+#define SUPPORT_COMPRESSED_STEERING_MATRIX_2_TX_ANTENNA_SOUNDING 1
+#define SUPPORT_COMPRESSED_STEERING_MATRIX_3_TX_ANTENNA_SOUNDING 2
+#define SUPPORT_COMPRESSED_STEERING_MATRIX_4_TX_ANTENNA_SOUNDING 3
+
+// Typedef Antenna Selection Capability
+#define CAPABLE_ANTENNA_SELECTION 1
+#define INCAPABLE_ANTENNA_SELECTION 0
+#define CAPABLE_EXPLICIT_CSI_FEEDBACK_BASED_TX_AS 1
+#define INCAPABLE_EXPLICIT_CSI_FEEDBACK_BASED_TX_AS 0
+#define CAPABLE_ANTENNA_INDICES_FEEDBACK_BASED_TX_AS 1
+#define INCAPABLE_ANTENNA_INDICES_FEEDBACK_BASED_TX_AS 0
+#define CAPABLE_EXPLICIT_CSI_FEEDBACK 1
+#define INCAPABLE_EXPLICIT_CSI_FEEDBACK 0
+#define CAPABLE_ANTENNA_INDICES_FEEDBACK_BASED_TX_AS 1
+#define INCAPABLE_ANTENNA_INDICES_FEEDBACK_BASED_TX_AS 0
+#define CAPABLE_RX_AS 1
+#define INCAPABLE_RX_AS 0
+#define CAPABLE_TRANSMIT_SOUNDING_PPDU 1
+#define INCAPABLE_TRANSMIT_SOUNDING_PPDU 0
+
+// Typedef Additional HT Infomation Elements
+#define CONTROL_CHANNEL_1 1
+
+#define OFFSET_NO_EXTENSION_CHANNEL_IS_PRESENT 0
+#define OFFSET_EXTENSION_CHANNEL_ABOVE_CONTROL_CHANNEL 1
+#define OFFSET_EXTENSION_CHANNEL_BELOW_CONTROL_CHANNEL 3
+#define USE_20_MHZ_CONTROL_CHANNEL 0
+#define USE_ANY_SUPPORTED_CHANNEL_WIDTH 1
+#define USE_RIFS_MODE_PROHIBITED 0
+#define USE_RIFS_MODE_PERMITTED 1
+#define CONTROLLED_ACCESS_NOT_ONLY_PSMP 0
+#define CONTROLLED_ACCESS_ONLY_PSMP 1
+#define SERVICE_INTERVAL_GRANULARITY_5MS 0
+#define SERVICE_INTERVAL_GRANULARITY_10MS 1
+#define SERVICE_INTERVAL_GRANULARITY_15MS 2
+#define SERVICE_INTERVAL_GRANULARITY_20MS 3
+#define SERVICE_INTERVAL_GRANULARITY_25MS 4
+#define SERVICE_INTERVAL_GRANULARITY_30MS 5
+#define SERVICE_INTERVAL_GRANULARITY_35MS 6
+#define SERVICE_INTERVAL_GRANULARITY_40MS 7
+
+#define OPERATION_MODE_PURE_NO_PROTECTION 0
+#define OPERATION_MODE_OPTIONAL_PROTECTION 1
+#define OPERATION_MODE_NO_LEGACY_STA_40MHZ_PROTECTED 2
+#define OPERATION_MODE_MIXED_PROTECTION 3
+
+#define DUAL_CTS_PROTECTION_IS_USED 1
+#define REGULAR_RTS_CTS_IS_USED 0
+#define SECONDARY_BEACON 1
+#define PRIMARY_BEACON 0
+#define LSIG_TXOP_PROTECTION_FULL_SUPPORT 1
+#define LSIG_TXOP_PROTECTION_NOT_FULL_SUPPORT 0
+#define PCO_IS_ACTIVATED_IN_BSS 1
+#define PCO_IS_NOT_ACTIVATED_IN_BSS 0
+#define PCO_PHASE_REQUEST_SWITCH_KEEP_TO_20MHZ 0
+#define PCO_PHASE_REQUEST_SWITCH_KEEP_TO_40MHZ 1
+#endif
+
+//
+// The following enums will be used to get the "current" HT Capabilities of
+// the local STA in a generic fashion. In other words, the following enums
+// identify the HT capabilities that can be queried or set.
+//
+typedef enum eHTCapability
+{
+ eHT_LSIG_TXOP_PROTECTION,
+ eHT_STBC_CONTROL_FRAME,
+ eHT_PSMP,
+ eHT_DSSS_CCK_MODE_40MHZ,
+ eHT_MAX_AMSDU_LENGTH,
+ eHT_DELAYED_BA,
+ eHT_RX_STBC,
+ eHT_TX_STBC,
+ eHT_SHORT_GI_40MHZ,
+ eHT_SHORT_GI_20MHZ,
+ eHT_GREENFIELD,
+ eHT_MIMO_POWER_SAVE,
+ eHT_SUPPORTED_CHANNEL_WIDTH_SET,
+ eHT_ADVANCED_CODING,
+ eHT_MAX_RX_AMPDU_FACTOR,
+ eHT_MPDU_DENSITY,
+ eHT_PCO,
+ eHT_TRANSITION_TIME,
+ eHT_MCS_FEEDBACK,
+ eHT_TX_BEAMFORMING,
+ eHT_ANTENNA_SELECTION,
+ // The following come under Additional HT Capabilities
+ eHT_SI_GRANULARITY,
+ eHT_CONTROLLED_ACCESS,
+ eHT_RIFS_MODE,
+ eHT_RECOMMENDED_TX_WIDTH_SET,
+ eHT_EXTENSION_CHANNEL_OFFSET,
+ eHT_OP_MODE,
+ eHT_BASIC_STBC_MCS,
+ eHT_DUAL_CTS_PROTECTION,
+ eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT,
+ eHT_PCO_ACTIVE,
+ eHT_PCO_PHASE
+} tHTCapability;
+
+// HT Capabilities Info
+typedef __ani_attr_pre_packed struct sSirMacHTCapabilityInfo
+{
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ tANI_U16 lsigTXOPProtection:1; // Dynamic state
+ tANI_U16 stbcControlFrame:1; // Static via CFG
+ tANI_U16 psmp:1; // Static via CFG
+ tANI_U16 dsssCckMode40MHz:1; // Static via CFG
+ tANI_U16 maximalAMSDUsize:1; // Static via CFG
+ tANI_U16 delayedBA:1; // Static via CFG
+ tANI_U16 rxSTBC:2; // Static via CFG
+ tANI_U16 txSTBC:1; // Static via CFG
+ tANI_U16 shortGI40MHz:1; // Static via CFG
+ tANI_U16 shortGI20MHz:1; // Static via CFG
+ tANI_U16 greenField:1; // Static via CFG
+ tANI_U16 mimoPowerSave:2; // Dynamic state
+ tANI_U16 supportedChannelWidthSet:1; // Static via CFG
+ tANI_U16 advCodingCap:1; // Static via CFG
+#else
+ tANI_U16 advCodingCap:1;
+ tANI_U16 supportedChannelWidthSet:1;
+ tANI_U16 mimoPowerSave:2;
+ tANI_U16 greenField:1;
+ tANI_U16 shortGI20MHz:1;
+ tANI_U16 shortGI40MHz:1;
+ tANI_U16 txSTBC:1;
+ tANI_U16 rxSTBC:2;
+ tANI_U16 delayedBA:1;
+ tANI_U16 maximalAMSDUsize:1;
+ tANI_U16 dsssCckMode40MHz:1;
+ tANI_U16 psmp:1;
+ tANI_U16 stbcControlFrame:1;
+ tANI_U16 lsigTXOPProtection:1;
+#endif
+} __ani_attr_packed tSirMacHTCapabilityInfo;
+
+// HT Parameters Info
+typedef __ani_attr_pre_packed struct sSirMacHTParametersInfo
+{
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ tANI_U8 reserved:3;
+ tANI_U8 mpduDensity:3; // Dynamic state
+ tANI_U8 maxRxAMPDUFactor:2; // Dynamic state
+#else
+ tANI_U8 maxRxAMPDUFactor:2;
+ tANI_U8 mpduDensity:3;
+ tANI_U8 reserved:3;
+#endif
+} __ani_attr_packed tSirMacHTParametersInfo;
+
+// Extended HT Capabilities Info
+typedef __ani_attr_pre_packed struct sSirMacExtendedHTCapabilityInfo
+{
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ tANI_U16 reserved2:6;
+ tANI_U16 mcsFeedback:2; // Static via CFG
+ tANI_U16 reserved1:5;
+ tANI_U16 transitionTime:2; // Static via CFG
+ tANI_U16 pco:1; // Static via CFG
+#else
+ tANI_U16 pco:1;
+ tANI_U16 transitionTime:2;
+ tANI_U16 reserved1:5;
+ tANI_U16 mcsFeedback:2;
+ tANI_U16 reserved2:6;
+#endif
+} __ani_attr_packed tSirMacExtendedHTCapabilityInfo;
+
+//IEEE 802.11n/D7.0 - 7.3.2.57.4
+//Part of the "supported MCS set field"
+typedef __ani_attr_pre_packed struct sSirMacRxHighestSupportRate
+{
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ tANI_U16 reserved : 6;
+ tANI_U16 rate : 10;
+#else
+ tANI_U16 rate : 10;
+ tANI_U16 reserved : 6;
+#endif
+} __ani_attr_packed tSirMacRxHighestSupportRate, *tpSirMacRxHighestSupportRate;
+
+
+// Transmit Beam Forming Capabilities Info
+typedef __ani_attr_pre_packed struct sSirMacTxBFCapabilityInfo
+{
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ tANI_U32 reserved:7;
+ tANI_U32 compressedSteeringMatrixBFAntennae:2; // Static via CFG
+ tANI_U32 uncompressedSteeringMatrixBFAntennae:2; // Static via CFG
+ tANI_U32 csiNumBFAntennae:2; // Static via CFG
+ tANI_U32 explicitCompressedSteeringMatrixFeedback:3; // Static via CFG
+ tANI_U32 explicitUncompressedSteeringMatrixFeedback:3; // Static via CFG
+ tANI_U32 explicitBFCSIFeedback:3; // Static via CFG
+ tANI_U32 explicitUncompressedSteeringMatrix:1; // Static via CFG
+ tANI_U32 explicitCSITxBF:1; // Static via CFG
+ tANI_U32 calibration:2; // Static via CFG
+ tANI_U32 implicitTxBF:1; // Static via CFG
+ tANI_U32 txZLF:1; // Static via CFG
+ tANI_U32 rxZLF:1; // Static via CFG
+ tANI_U32 txStaggeredSounding:1; // Static via CFG
+ tANI_U32 rxStaggeredSounding:1; // Static via CFG
+ tANI_U32 txBF:1; // Static via CFG
+#else
+ tANI_U32 txBF:1;
+ tANI_U32 rxStaggeredSounding:1;
+ tANI_U32 txStaggeredSounding:1;
+ tANI_U32 rxZLF:1;
+ tANI_U32 txZLF:1;
+ tANI_U32 implicitTxBF:1;
+ tANI_U32 calibration:2;
+ tANI_U32 explicitCSITxBF:1;
+ tANI_U32 explicitUncompressedSteeringMatrix:1;
+ tANI_U32 explicitBFCSIFeedback:3;
+ tANI_U32 explicitUncompressedSteeringMatrixFeedback:3;
+ tANI_U32 explicitCompressedSteeringMatrixFeedback:3;
+ tANI_U32 csiNumBFAntennae:2;
+ tANI_U32 uncompressedSteeringMatrixBFAntennae:2;
+ tANI_U32 compressedSteeringMatrixBFAntennae:2;
+ tANI_U32 reserved:7;
+#endif
+} __ani_attr_packed tSirMacTxBFCapabilityInfo;
+
+// Antenna Selection Capability Info
+typedef __ani_attr_pre_packed struct sSirMacASCapabilityInfo
+{
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ tANI_U8 reserved2:1;
+ tANI_U8 txSoundingPPDUs:1; // Static via CFG
+ tANI_U8 rxAS:1; // Static via CFG
+ tANI_U8 antennaIndicesFeedback:1; // Static via CFG
+ tANI_U8 explicitCSIFeedback:1; // Static via CFG
+ tANI_U8 antennaIndicesFeedbackTx:1; // Static via CFG
+ tANI_U8 explicitCSIFeedbackTx:1; // Static via CFG
+ tANI_U8 antennaSelection:1; // Static via CFG
+#else
+ tANI_U8 antennaSelection:1;
+ tANI_U8 explicitCSIFeedbackTx:1;
+ tANI_U8 antennaIndicesFeedbackTx:1;
+ tANI_U8 explicitCSIFeedback:1;
+ tANI_U8 antennaIndicesFeedback:1;
+ tANI_U8 rxAS:1;
+ tANI_U8 txSoundingPPDUs:1;
+ tANI_U8 reserved2:1;
+#endif
+} __ani_attr_packed tSirMacASCapabilityInfo;
+
+// Additional HT IE Field1
+typedef __ani_attr_pre_packed struct sSirMacHTInfoField1
+{
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ tANI_U8 serviceIntervalGranularity:3; // Dynamic state
+ tANI_U8 controlledAccessOnly:1; // Static via CFG
+ tANI_U8 rifsMode:1; // Dynamic state
+ tANI_U8 recommendedTxWidthSet:1; // Dynamic state
+ tANI_U8 secondaryChannelOffset:2; // Dynamic state
+#else
+ tANI_U8 secondaryChannelOffset:2;
+ tANI_U8 recommendedTxWidthSet:1;
+ tANI_U8 rifsMode:1;
+ tANI_U8 controlledAccessOnly:1;
+ tANI_U8 serviceIntervalGranularity:3;
+#endif
+} __ani_attr_packed tSirMacHTInfoField1;
+
+// Additional HT IE Field2
+typedef __ani_attr_pre_packed struct sSirMacHTInfoField2
+{
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ tANI_U16 reserved:11;
+ tANI_U16 obssNonHTStaPresent:1; /*added for Obss */
+ tANI_U16 transmitBurstLimit: 1;
+ tANI_U16 nonGFDevicesPresent:1;
+ tANI_U16 opMode:2; // Dynamic state
+#else
+ tANI_U16 opMode:2;
+ tANI_U16 nonGFDevicesPresent:1;
+ tANI_U16 transmitBurstLimit: 1;
+ tANI_U16 obssNonHTStaPresent:1; /*added for Obss */
+ tANI_U16 reserved:11;
+#endif
+} __ani_attr_packed tSirMacHTInfoField2;
+
+// Additional HT IE Field3
+typedef __ani_attr_pre_packed struct sSirMacHTInfoField3
+{
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ tANI_U16 reserved:4;
+ tANI_U16 pcoPhase:1; // Dynamic state
+ tANI_U16 pcoActive:1; // Dynamic state
+ tANI_U16 lsigTXOPProtectionFullSupport:1; // Dynamic state
+ tANI_U16 secondaryBeacon:1; // Dynamic state
+ tANI_U16 dualCTSProtection:1; // Dynamic state
+ tANI_U16 basicSTBCMCS:7; // Dynamic state
+#else
+ tANI_U16 basicSTBCMCS:7;
+ tANI_U16 dualCTSProtection:1;
+ tANI_U16 secondaryBeacon:1;
+ tANI_U16 lsigTXOPProtectionFullSupport:1;
+ tANI_U16 pcoActive:1;
+ tANI_U16 pcoPhase:1;
+ tANI_U16 reserved:4;
+#endif
+} __ani_attr_packed tSirMacHTInfoField3;
+
+typedef __ani_attr_pre_packed struct sSirMacProbeReqFrame
+{
+ tSirMacSSidIE ssIdIE;
+ tSirMacRateSetIE rateSetIE;
+ tSirMacRateSetIE extendedRateSetIE;
+} __ani_attr_packed tSirMacProbeReqFrame, *tpSirMacProbeReqFrame;
+
+typedef __ani_attr_pre_packed struct sSirMacProbeRspFrame
+{
+ tSirMacTimeStamp ts;
+ tSirMacBeaconInterval beaconInterval;
+ tSirMacCapabilityInfo capabilityInfo;
+ tSirMacSSidIE ssIdIE;
+ tSirMacRateSetIE rateSetIE;
+ tSirMacRateSetIE extendedRateSetIE;
+ tSirMacNonErpPresentIE nonErpPresent;
+ tSirMacDsParamSetIE dsParamsIE;
+ tSirMacCfParamSetIE cfParamsIE;
+} __ani_attr_packed tSirMacProbeRspFrame, *tpSirMacProbeRspFrame;
+
+typedef __ani_attr_pre_packed struct sSirMacAuthFrameBody
+{
+ tANI_U16 authAlgoNumber;
+ tANI_U16 authTransactionSeqNumber;
+ tANI_U16 authStatusCode;
+ tANI_U8 type; // = SIR_MAC_CHALLENGE_TEXT_EID
+ tANI_U8 length; // = SIR_MAC_AUTH_CHALLENGE_LENGTH
+ tANI_U8 challengeText[SIR_MAC_AUTH_CHALLENGE_LENGTH];
+} __ani_attr_packed tSirMacAuthFrameBody, *tpSirMacAuthFrameBody;
+
+typedef __ani_attr_pre_packed struct sSirMacAuthenticationFrame
+{
+ tSirMacAuthFrameBody authFrameBody;
+} __ani_attr_packed tSirMacAuthFrame, *tpSirMacAuthFrame;
+
+typedef __ani_attr_pre_packed struct sSirMacAssocReqFrame
+{
+ tSirMacCapabilityInfo capabilityInfo;
+ tANI_U16 listenInterval;
+ tSirMacSSidIE ssIdIE;
+ tSirMacRateSetIE rateSetIE;
+ tSirMacRateSetIE extendedRateSetIE;
+} __ani_attr_packed tSirMacAssocReqFrame, *tpSirMacAssocReqFrame;
+
+typedef __ani_attr_pre_packed struct sSirMacAssocRspFrame
+{
+ tSirMacCapabilityInfo capabilityInfo;
+ tANI_U16 statusCode;
+ tANI_U16 aid;
+ tSirMacRateSetIE supportedRates;
+ tSirMacRateSetIE extendedRateSetIE;
+} __ani_attr_packed tSirMacAssocRspFrame, *tpSirMacAssocRspFrame;
+
+typedef __ani_attr_pre_packed struct sSirMacDisassocFrame
+{
+ tANI_U16 reasonCode;
+} __ani_attr_packed tSirMacDisassocFrame, *tpSirMacDisassocFrame;
+
+typedef __ani_attr_pre_packed struct sDSirMacDeauthFrame
+{
+ tANI_U16 reasonCode;
+} __ani_attr_packed tSirMacDeauthFrame, *tpSirMacDeauthFrame;
+
+/// Common header for all action frames
+typedef __ani_attr_pre_packed struct sSirMacActionFrameHdr
+{
+ tANI_U8 category;
+ tANI_U8 actionID;
+} __ani_attr_packed tSirMacActionFrameHdr, *tpSirMacActionFrameHdr;
+
+#if defined WLAN_FEATURE_P2P
+typedef __ani_attr_pre_packed struct sSirMacVendorSpecificPublicActionFrameHdr
+{
+ tANI_U8 category;
+ tANI_U8 actionID;
+ tANI_U8 Oui[4];
+ tANI_U8 OuiSubType;
+ tANI_U8 dialogToken;
+} __ani_attr_packed tSirMacVendorSpecificPublicActionFrameHdr, *tpSirMacVendorSpecificPublicActionFrameHdr;
+
+typedef __ani_attr_pre_packed struct sSirMacP2PActionFrameHdr
+{
+ tANI_U8 category;
+ tANI_U8 Oui[4];
+ tANI_U8 OuiSubType;
+ tANI_U8 dialogToken;
+} __ani_attr_packed tSirMacP2PActionFrameHdr, *tpSirMacP2PActionFrameHdr;
+
+
+#endif
+
+typedef struct sSirMacMeasActionFrameHdr
+{
+ tANI_U8 category;
+ tANI_U8 actionID;
+ tANI_U8 dialogToken;
+} tSirMacMeasActionFrameHdr, *tpSirMacMeasActionFrameHdr;
+
+
+#ifdef ANI_SUPPORT_11H
+typedef struct sSirMacTpcReqActionFrame
+{
+ tSirMacMeasActionFrameHdr actionHeader;
+ tANI_U8 type;
+ tANI_U8 length;
+} tSirMacTpcReqActionFrame, *tpSirMacTpcReqActionFrame;
+
+typedef struct sSirMacMeasReqActionFrame
+{
+ tSirMacMeasActionFrameHdr actionHeader;
+ tSirMacMeasReqIE measReqIE;
+} tSirMacMeasReqActionFrame, *tpSirMacMeasReqActionFrame;
+#endif
+
+typedef struct sSirMacBasicMeasReportActionFrame
+{
+ tSirMacMeasActionFrameHdr actionHeader;
+ tSirMacBasicReportIE measReportIE;
+} tSirMacBasicMeasReportActionFrame, *tpSirMacBasicMeasReportActionFrame;
+
+typedef struct sSirMacCcaMeasReportActionFrame
+{
+ tSirMacMeasActionFrameHdr actionHeader;
+ tSirMacCcaReportIE measReportIE;
+} tSirMacCcaMeasReportActionFrame, *tpSirMacCcaMeasReportActionFrame;
+
+typedef struct sSirMacRpiMeasReportActionFrame
+{
+ tSirMacMeasActionFrameHdr actionHeader;
+ tSirMacRpiReportIE measReportIE;
+} tSirMacRpiMeasReportActionFrame, *tpSirMacRpiMeasReportActionFrame;
+
+#if defined WLAN_FEATURE_VOWIFI
+
+typedef struct sSirMacNeighborReportReq
+{
+ tANI_U8 dialogToken;
+ tANI_U8 ssid_present;
+ tSirMacSSid ssid;
+} tSirMacNeighborReportReq, *tpSirMacNeighborReportReq;
+
+typedef struct sSirMacLinkReport
+{
+ tANI_U8 dialogToken;
+ tANI_U8 txPower;
+ tANI_U8 rxAntenna;
+ tANI_U8 txAntenna;
+ tANI_U8 rcpi;
+ tANI_U8 rsni;
+} tSirMacLinkReport, *tpSirMacLinkReport;
+
+#define BEACON_REPORT_MAX_IES 224 //Refer IEEE 802.11k-2008, Table 7-31d
+typedef struct sSirMacBeaconReport
+{
+ tANI_U8 regClass;
+ tANI_U8 channel;
+ tANI_U8 measStartTime[8];
+ tANI_U8 measDuration;
+ tANI_U8 phyType;
+ tANI_U8 bcnProbeRsp;
+ tANI_U8 rsni;
+ tANI_U8 rcpi;
+ tSirMacAddr bssid;
+ tANI_U8 antennaId;
+ tANI_U32 parentTSF;
+ tANI_U8 numIes;
+ tANI_U8 Ies[BEACON_REPORT_MAX_IES];
+
+} tSirMacBeaconReport, *tpSirMacBeaconReport;
+
+#define RADIO_REPORTS_MAX_IN_A_FRAME 4
+typedef struct sSirMacRadioMeasureReport
+{
+ tANI_U8 token;
+ tANI_U8 refused;
+ tANI_U8 incapable;
+ tANI_U8 type;
+ union
+ {
+ tSirMacBeaconReport beaconReport;
+ }report;
+
+}tSirMacRadioMeasureReport, *tpSirMacRadioMeasureReport;
+
+#endif
+
+// QOS action frame definitions
+
+// max number of possible tclas elements in any frame
+#define SIR_MAC_TCLASIE_MAXNUM 2
+
+// ADDTS request
+typedef __ani_attr_pre_packed struct sSirMacQosAddtsReqAF
+{
+ tSirMacActionFrameHdr afHdr;
+ tANI_U8 dlgToken;
+ tSirMacTspecIE tspec;
+ tANI_U8 tclas[1]; // variable length element
+} __ani_attr_packed tSirMacQosAddtsReqAF;
+
+// ADDTS response
+typedef __ani_attr_pre_packed struct sSirMacQosAddtsRspAF
+{
+ tSirMacActionFrameHdr afHdr;
+ tANI_U8 dlgToken;
+ tSirMacStatusCodes status;
+ tSirMacTsDelayIE delay;
+ tSirMacTspecIE tspec;
+ tANI_U8 tclas[1];
+} __ani_attr_packed tSirMacQosAddtsRspAF;
+
+// DELTS frame
+typedef __ani_attr_pre_packed struct sSirMacQosDeltsAF
+{
+ tSirMacActionFrameHdr afHdr;
+ tSirMacTSInfo tsinfo;
+} __ani_attr_packed tSirMacQosDeltsAF;
+
+// Schedule frame
+typedef __ani_attr_pre_packed struct sSirMacQosScheduleAF
+{
+ tSirMacActionFrameHdr afHdr;
+ tSirMacScheduleIE schedule;
+} __ani_attr_packed tSirMacQosScheduleAF;
+
+// DLP action frame definitions
+
+// DLP request
+typedef __ani_attr_pre_packed struct sSirMacQosDlpReqAF
+{
+ tSirMacActionFrameHdr afHdr;
+ tANI_U8 dstMAC[6];
+ tANI_U8 srcMAC[6];
+ tSirMacQosCapabilityIE qosCapability;
+ tANI_U16 dlpTimeout;
+ tSirMacRateSetIE supportedRates;
+} __ani_attr_packed tSirMacQosDlpReqAF;
+
+// DLP response
+typedef __ani_attr_pre_packed struct sSirMacQosDlpRspAF
+{
+ tSirMacActionFrameHdr afHdr;
+ tANI_U8 dstMAC[6];
+ tANI_U8 srcMAC[6];
+ tSirMacStatusCodes status;
+ tSirMacQosCapabilityIE qosCapability;
+ tSirMacRateSetIE supportedRates;
+} __ani_attr_packed tSirMacQosDlpRspAF;
+
+// DLP teardown
+typedef __ani_attr_pre_packed struct sSirMacQosDlpTdnAF
+{
+ tSirMacActionFrameHdr afHdr;
+ tANI_U8 dstMAC[6];
+ tANI_U8 srcMAC[6];
+} __ani_attr_packed tSirMacQosDlpTdnAF;
+
+
+
+
+//
+/// Common header for all ANI proprietary action frames
+typedef __ani_attr_pre_packed struct sSirMacAniActionFrame
+{
+ tSirMacActionFrameHdr afHdr;
+ tANI_U8 aniOui[3]; // 00 0A F5
+ tANI_U8 type; // 0 - request; 1 - report; 2 - snr
+} __ani_attr_packed tSirMacAniActionFrame, *tpSirMacAniActionFrame;
+
+
+typedef __ani_attr_pre_packed struct sSirMacLinkTestReqData
+{
+ tSirMacAniActionFrame hdr;
+ tANI_U8 frameStatus; // bit0 - first frame
+ // bit1 - last frame;
+ // if both bit0/1 are on,
+ // intermediate frame
+ // bit2-7 - reserved
+ tANI_U8 rate;
+ tANI_U8 randomData[SIR_MAC_MAX_RANDOM_LENGTH];
+} __ani_attr_packed tSirMacLinkTestReqData, *tpSirMacLinkTestReqData;
+
+/// SNR report specific fields
+typedef __ani_attr_pre_packed struct sSirMacSnrReport
+{
+ tSirMacAniActionFrame hdr;
+ tANI_U32 numSamples;
+ tANI_U32 snr;
+ tANI_U32 snrComp;
+ tANI_U32 sq;
+ tANI_U32 rssi;
+} __ani_attr_packed tSirMacSnrReport, *tpSirMacSnrReport;
+
+typedef __ani_attr_pre_packed struct sSirMacStaCbLegacyBssDetect
+{
+ tSirMacAniActionFrame hdr;
+ tANI_U8 channelNum;
+ tANI_U8 numLegacyBssid;
+ /* Below is declared as a place holder. Don't add anything after it since LegacyBssidList will take up memory after it */
+ tANI_U8 LegacyBssidList[1]; /* Need to declare size 1 cause win build doesn't like size 0 */
+} __ani_attr_packed tSirMacStaCbLegacyBssDetect, *tpSirMacStaCbLegacyBssDetect;
+
+typedef __ani_attr_pre_packed struct sSirMacQoSDefBAReq
+{
+ tSirMacActionFrameHdr hdr;
+
+ tANI_U8 rsvd1;
+
+#ifdef ANI_LITTLE_BIT_ENDIAN
+ tANI_U8 tid: 4;
+ tANI_U8 rsvd2: 4;
+#else
+ tANI_U8 rsvd2: 4;
+ tANI_U8 tid: 4;
+#endif
+} __ani_attr_packed tSirMacQoSDefBAReq, *tpSirMacQoSDefBAReq;
+
+typedef __ani_attr_pre_packed struct sSirMacQoSDefBARsp
+{
+ tSirMacActionFrameHdr hdr;
+
+#ifdef ANI_LITTLE_BIT_ENDIAN
+ tANI_U8 tid: 4;
+ tANI_U8 policy: 1;
+ tANI_U8 reject: 1;
+ tANI_U8 rsvd1: 2;
+#else
+ tANI_U8 rsvd1: 2;
+ tANI_U8 reject: 1;
+ tANI_U8 policy: 1;
+ tANI_U8 tid: 4;
+#endif
+
+ tANI_U8 bufferSize;
+} __ani_attr_packed tSirMacQoSDefBARsp, *tpSirMacQoSDefBARsp;
+
+typedef __ani_attr_pre_packed struct sSirMacQoSDelBAReq
+{
+ tSirMacActionFrameHdr hdr;
+ tANI_U8 rsvd1;
+
+#ifdef ANI_LITTLE_BIT_ENDIAN
+ tANI_U8 rsvd2: 3;
+ tANI_U8 direction: 1;
+ tANI_U8 tid: 4;
+#else
+ tANI_U8 tid: 4;
+ tANI_U8 direction: 1;
+ tANI_U8 rsvd2: 3;
+#endif
+} __ani_attr_packed tSirMacQoSDelBAReq, *tpSirMacQoSDelBAReq;
+
+typedef __ani_attr_pre_packed struct sSirMacQoSDelBARsp
+{
+ tSirMacActionFrameHdr hdr;
+
+#ifdef ANI_LITTLE_BIT_ENDIAN
+ tANI_U8 tid: 4;
+ tANI_U8 policy: 1;
+ tANI_U8 reject: 1;
+ tANI_U8 rsvd1: 2;
+#else
+ tANI_U8 rsvd1: 2;
+ tANI_U8 reject: 1;
+ tANI_U8 policy: 1;
+ tANI_U8 tid: 4;
+#endif
+
+} __ani_attr_packed tSirMacQoSDelBARsp, *tpSirMacQoSDelBARsp;
+
+
+
+// 11b rate encoding in MAC format
+
+#define SIR_MAC_RATE_1 0x02
+#define SIR_MAC_RATE_2 0x04
+#define SIR_MAC_RATE_5_5 0x0B
+#define SIR_MAC_RATE_11 0x16
+
+// 11a/g rate encoding in MAC format
+
+#define SIR_MAC_RATE_6 0x0C
+#define SIR_MAC_RATE_9 0x12
+#define SIR_MAC_RATE_12 0x18
+#define SIR_MAC_RATE_18 0x24
+#define SIR_MAC_RATE_24 0x30
+#define SIR_MAC_RATE_36 0x48
+#define SIR_MAC_RATE_48 0x60
+#define SIR_MAC_RATE_54 0x6C
+
+// ANI legacy supported rates
+#define SIR_MAC_RATE_72 0x01
+#define SIR_MAC_RATE_96 0x03
+#define SIR_MAC_RATE_108 0x05
+
+// ANI enhanced rates
+#define SIR_MAC_RATE_42 1000
+#define SIR_MAC_RATE_84 1001
+#define SIR_MAC_RATE_126 1002
+#define SIR_MAC_RATE_144 1003
+#define SIR_MAC_RATE_168 1004
+#define SIR_MAC_RATE_192 1005
+#define SIR_MAC_RATE_216 1006
+#define SIR_MAC_RATE_240 1007
+
+
+#define sirIsArate(x) ((((tANI_U8)x)==SIR_MAC_RATE_6) || \
+ (((tANI_U8)x)==SIR_MAC_RATE_9) || \
+ (((tANI_U8)x)==SIR_MAC_RATE_12)|| \
+ (((tANI_U8)x)==SIR_MAC_RATE_18)|| \
+ (((tANI_U8)x)==SIR_MAC_RATE_24)|| \
+ (((tANI_U8)x)==SIR_MAC_RATE_36)|| \
+ (((tANI_U8)x)==SIR_MAC_RATE_48)|| \
+ (((tANI_U8)x)==SIR_MAC_RATE_54))
+
+#define sirIsBrate(x) ((((tANI_U8)x)==SIR_MAC_RATE_1) || \
+ (((tANI_U8)x)==SIR_MAC_RATE_2) || \
+ (((tANI_U8)x)==SIR_MAC_RATE_5_5)|| \
+ (((tANI_U8)x)==SIR_MAC_RATE_11))
+
+#define sirIsGrate(x) ((((tANI_U8)x)==SIR_MAC_RATE_1) || \
+ (((tANI_U8)x)==SIR_MAC_RATE_2) || \
+ (((tANI_U8)x)==SIR_MAC_RATE_5_5)|| \
+ (((tANI_U8)x)==SIR_MAC_RATE_11) || \
+ (((tANI_U8)x)==SIR_MAC_RATE_6) || \
+ (((tANI_U8)x)==SIR_MAC_RATE_9) || \
+ (((tANI_U8)x)==SIR_MAC_RATE_12) || \
+ (((tANI_U8)x)==SIR_MAC_RATE_18) || \
+ (((tANI_U8)x)==SIR_MAC_RATE_24) || \
+ (((tANI_U8)x)==SIR_MAC_RATE_36) || \
+ (((tANI_U8)x)==SIR_MAC_RATE_48) || \
+ (((tANI_U8)x)==SIR_MAC_RATE_54))
+
+#define sirIsProprate(x) ((((tANI_U8)x)==SIR_MAC_RATE_72) || \
+ (((tANI_U8)x)==SIR_MAC_RATE_96) || \
+ (((tANI_U8)x)==SIR_MAC_RATE_108))
+
+#define sirIsEnhancedRate(x) \
+ (((x)==SIR_MAC_RATE_42) || \
+ ((x)==SIR_MAC_RATE_84) || \
+ ((x)==SIR_MAC_RATE_126) || \
+ ((x)==SIR_MAC_RATE_144) || \
+ ((x)==SIR_MAC_RATE_168) || \
+ ((x)==SIR_MAC_RATE_192) || \
+ ((x)==SIR_MAC_RATE_216) || \
+ ((x)==SIR_MAC_RATE_240))
+
+/// Table that has MAC<-->PHY rate encodings
+typedef __ani_attr_pre_packed struct sSirMacPhyRates
+{
+ tANI_U8 rateId;
+ tANI_U8 phyRate; // Rate in PHY encoding format
+ tANI_U16 macRate; // Rate in MAC encoding format
+} __ani_attr_packed tSirMacPhyRates, *tpSirMacPhyRates;
+
+
+typedef __ani_attr_pre_packed struct sSirPhy11aHdr
+{
+
+#ifndef ANI_LITTLE_BIT_ENDIAN
+
+ tANI_U8 lengthLo : 3;
+ tANI_U8 reserved : 1;
+ tANI_U8 rate : 4;
+
+ tANI_U8 lengthMid : 8;
+
+ tANI_U8 tail: 6;
+ tANI_U8 parity : 1;
+ tANI_U8 lengthHi : 1;
+
+ tANI_U8 serviceLo;
+ tANI_U8 serviceHi;
+#else
+ tANI_U8 rate : 4;
+ tANI_U8 reserved : 1;
+ tANI_U8 lengthLo : 3;
+
+ tANI_U8 lengthMid : 8;
+
+ tANI_U8 lengthHi : 1;
+ tANI_U8 parity : 1;
+ tANI_U8 tail: 6;
+
+ tANI_U8 serviceLo;
+ tANI_U8 serviceHi;
+#endif
+} __ani_attr_packed tSirPhy11aHdr, *tpSirPhy11aHdr;
+
+#endif /* __MAC_PROT_DEFS_H */
diff --git a/CORE/MAC/inc/sirTypes.h b/CORE/MAC/inc/sirTypes.h
new file mode 100644
index 0000000..467dcc7
--- /dev/null
+++ b/CORE/MAC/inc/sirTypes.h
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file sirTypes.h contains the common types
+ *
+ * Author: V. K. Kandarpa
+ * Date: 04/12/2002
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+
+#ifndef __SIR_TYPES_H
+#define __SIR_TYPES_H
+
+#include "halTypes.h"
+/*
+ typedef unsigned char tANI_U8;
+ typedef unsigned short tANI_U16;
+ typedef unsigned long tANI_U32;
+ typedef signed char tANI_S8;
+ typedef signed short tANI_S16;
+ typedef signed long tANI_S32;
+
+ #ifndef tANI_BOOLEAN
+ #define tANI_BOOLEAN tANI_U8
+ #endif
+*/
+
+
+#if defined( ANI_OS_TYPE_WINDOWS )
+#define inline __inline
+#endif
+
+
+/* ********************************************** *
+ * *
+ * SIRIUS ERROR Codes / Return Codes *
+ * *
+ * ********************************************** */
+
+/// Return status type
+typedef enum eSirRetStatus
+{
+ eSIR_SUCCESS,
+ eSIR_FAILURE,
+
+ /// System Errors
+ eSIR_SYS_ERROR_BASE=0x100,
+ eSIR_SYS_TX_THREAD_CREATE_FAILED,
+ eSIR_SYS_TX_THREAD_RESUME_FAILED,
+ eSIR_SYS_TX_MSG_Q_CREATE_FAILED,
+ eSIR_SYS_TX_Q_SEND_FAILED,
+ eSIR_SYS_TX_Q_RECV_FAILED,
+ eSIR_SYS_TX_TIMER_ACTIVATE_FAILED,
+ eSIR_SYS_TX_TIMER_CHANGE_FAILED,
+ eSIR_SYS_TX_TIMER_CREATE_FAILED,
+ eSIR_MEM_ALLOC_FAILED,
+ eSIR_PCI_ERROR,
+
+ // Driver Return Codes
+ eSIR_HAL_ERROR_BASE=0x1000,
+ eSIR_HAL_STAID_INVALID, // 1
+ eSIR_HAL_TCDESC_INVALID, // 2
+ eSIR_HAL_TX_WQ_NOT_VALID, // 3
+ eSIR_HAL_PREV_BMU_CMD_INCOMPLETE, // 4
+ eSIR_HAL_EEPROM_CRC_FAILED, // 5
+ eSIR_HAL_PCI_REVID_INVALID, // 6
+ eSIR_HAL_STA_TC_ID_INVALID, // 7
+ eSIR_HAL_TXWQ_EMPTY, // 8
+ eSIR_HAL_ROUT_TBL_TYPE_STYPE_INVALID, // 9
+ eSIR_HAL_TFP_ENABLE_FAILED, // a
+ eSIR_HAL_TFP_ABORT_CMD_FAILED, // b
+ eSIR_HAL_TFP_TEMPL_BCNLEN_INVALID, // c
+ eSIR_HAL_TFP_TEMPL_SCHLEN_INVALID, // d
+ eSIR_HAL_TFP_TEMPL_CFENDLEN_INVALID, // e
+ eSIR_HAL_TFP_TEMPL_RRLEN_INVALID, // f
+ eSIR_HAL_TFP_TEMPL_PSPOLLLEN_INVALID, // 10
+ eSIR_HAL_TFP_TEMPL_CTSLEN_INVALID, // 11
+ eSIR_HAL_TFP_TEMPL_CFPOLLLEN_INVALID, // 12
+ eSIR_HAL_TFP_TEMPL_BACKLEN_INVALID, // 13
+ eSIR_HAL_INPUT_INVALID, // 14
+ eSIR_HAL_GET_PDU_FAILED, // 15
+ eSIR_HAL_ADD_STA_ACK_POLICY_INVALID, // 16
+ eSIR_HAL_STA_EXISTS, // 17
+ eSIR_HAL_STA_DOES_NOT_EXIST, // 18
+ eSIR_HAL_MASTER_WQ_ID_INVALID, // 19
+ eSIR_HAL_WQ_NOT_EMPTY, // 1a
+ eSIR_HAL_WQ_EMPTY, // 1b
+ eSIR_HAL_PDUCNT_AND_NEXTPTR_MISMATCH, // 1c
+ eSIR_HAL_ERR_NUM_BYTES_TO_BE_SET_TOO_BIG, // 1d
+ eSIR_HAL_GET_PKT_LENGTH_INVALID, // 1e
+ eSIR_HAL_AS_CNT_INVALID, // 1f
+ eSIR_HAL_RFP_AGE_CMD_SEQFAIL, // 20
+ eSIR_HAL_RFP_AGE_CMD_AGE_CMD_TCFAIL, // 21
+ eSIR_HAL_RFP_AGE_CMD_PASS, // 22
+ eSIR_HAL_RFP_AGE_CMD_TIMEDOUT, // 23
+ eSIR_HAL_RHP_HASH_CMD_TIMEOUT, // 24
+ eSIR_HAL_RHP_ROUTING_TBL_SET_FAILED, // 25
+ eSIR_HAL_RHP_ROUTING_TBL_GET_FAILED, // 26
+
+ eSIR_HAL_CAL_STATUS_CHK_FAILED,
+
+ eSIR_HAL_SYS_ARM_DBG_MODE_SET_FAILED,
+ eSIR_HAL_TFP_BCN_SENT,
+ eSIR_HAL_TFP_BCN_NOT_SENT,
+ eSIR_HAL_TFP_BKOF_ID_INVALID,
+ eSIR_HAL_TFP_CFB_ENABLE_INPUT_INVALID,
+ eSIR_HAL_TFP_EDCF_TXOP_INVALID,
+ eSIR_HAL_TFP_TEMPL_LEN_INVALID,
+ eSIR_HAL_KEY_ID_INVALID,
+ eSIR_HAL_KEY_LEN_INVALID,
+ eSIR_HAL_CHID_INVALID,
+ eSIR_HAL_HIF_BURST_READ_FAILED,
+ eSIR_HAL_HIF_BURST_WRITE_FAILED,
+ eSIR_HAL_HIF_BURST_LEN_REQ_INVALID,
+ eSIR_HAL_HIF_TX_NO_FRAG_DESC,
+
+ eSIR_HAL_INVALID_PRODUCT_ID, // 44
+
+ eSIR_HAL_INVALID_CAPABILITY, // 48
+ eSIR_HAL_CB_NOT_ENABLED, // 49
+ eSIR_HAL_MAC_RATE_INVALID, // 4a
+ eSIR_HAL_RHP_HANG, // 4b
+ eSIR_HAL_UNSUPPORTED, // 4c
+ eSIR_HAL_TSPEC_INVALID, // 4d
+
+ // NIM Return Codes
+ eSIR_NIM_ERROR_BASE=0x2000,
+ eSIR_NIM_ERR_INVALID_EVENT,
+
+
+ // MMH Return Codes
+ eSIR_NIM_MMH_ERROR_BASE=0x2100,
+ eSIR_NIM_MMH_ERR_INV_EVENT,
+ eSIR_NIM_MMH_ERR_MSG_LEN,
+ eSIR_NIM_MMH_ERR_IN_Q_TYPE,
+
+ // MNT Return Codes
+ eSIR_NIM_MNT_ERROR_BASE=0x2140,
+
+ // WDT Errors
+ eSIR_NIM_WDT_ERROR_BASE=0x2180,
+
+ // LIM Return Codes
+ eSIR_LIM_ERROR_BASE=0x2200,
+ eSIR_LIM_IGNORE_BEACON,
+ eSIR_LIM_INVALID_STA,
+ eSIR_LIM_MAX_STA_REACHED_ERROR,
+
+ // SCH Return Codes
+ eSIR_SCH_ERROR_BASE=0x2300,
+
+ // PMM Return Codes
+ eSIR_PMM_ERROR_BASE=0x2400,
+ eSIR_PMM_INVALID_MODE,
+ eSIR_PMM_INVALID_STATE,
+ eSIR_PMM_INVALID_ROLE,
+ eSIR_PMM_STA_NOT_ASSOCIATED,
+ eSIR_PMM_HEART_BEAT_TMOUT,
+ eSIR_PMM_NTH_BEACON_DELIVERY,
+
+ // ARQ Return Codes
+ eSIR_ARQ_ERROR_BASE=0x2500,
+
+ // CFG Return Codes
+ eSIR_CFG_ERROR_BASE=2600,
+ eSIR_CFG_INVALID_ID,
+ eSIR_CFG_INVALID_LEN,
+
+ // parser Return Codes
+ eSIR_PRS_ERROR_BASE=0x2700,
+ eSIR_IGNORE_IE,
+
+ // Put all your return codes above this line
+ eSIR_ERROR_LAST
+
+} tSirRetStatus;
+
+# endif // __SIR_TYPES_H
diff --git a/CORE/MAC/inc/wniApi.h b/CORE/MAC/inc/wniApi.h
new file mode 100644
index 0000000..14dc9b3
--- /dev/null
+++ b/CORE/MAC/inc/wniApi.h
@@ -0,0 +1,650 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file wniApi.h contains message definitions exported by
+ * Sirius software modules.
+ * NOTE: See projects/sirius/include/sirApi.h for structure
+ * definitions of the host/FW messages.
+ *
+ * Author: Chandra Modumudi
+ * Date: 04/11/2002
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+
+#ifndef __WNI_API_H
+#define __WNI_API_H
+
+// DPH return error codes
+#define ANI_DPH_SUCCESS 0
+
+#define ANI_DPH_RX_STA_INVALID 1
+
+#define ANI_DPH_DO_TKIP 2
+
+#define ANI_DPH_PORT_BLOCKED 3
+#define ANI_DPH_TX_PUSH_ERROR 10
+#define ANI_DPH_TX_MAC_HDR_ERROR 11
+#define ANI_DPH_TX_INVALID_PAYLOAD 12
+#define ANI_DPH_TX_STA_INVALID 13
+#define ANI_DPH_TX_HASH_MISS 14
+#define ANI_DPH_TX_UNINITIALIZED 15
+#define ANI_DPH_TX_RADIO_IN_DIAG_MODE 16
+#define ANI_DPH_WMM_DROP 17
+#define ANI_DPH_APSD_DROP 18
+#define ANI_DPH_UNKNOWN_STA 19
+
+/// HDD type for special handling of BDs in the TX pkts
+/// Used in the structure ani_mod_info_t->bd_spl_proc_type
+#define ANI_HDD_NO_SPL_PROC 0
+#define ANI_HDD_DUMMY_PKT_SPL_PROC 1
+#define ANI_HDD_PRE_DUMMY_PKT_SPL_PROC 2
+#define ANI_HDD_WNS_L2_UPDATE_SPL_PROC 3
+#define ANI_HDD_DUMMY_DATA 4
+#ifdef WMM_APSD
+#define ANI_HDD_EOSP_PKT 5
+#endif
+
+/// Message offset for the cmd to enqueue a dummy pkt to HDD TD ring
+#define ANI_DUMMY_PKT_MSG_TYPE_OFFSET 0
+#define ANI_DUMMY_PKT_MSG_LEN_OFFSET 2
+#define ANI_DUMMY_PKT_MAC_ADDR_OFFSET 4
+#define ANI_DUMMY_PKT_STA_ID_OFFSET 10
+#define ANI_DUMMY_PKT_RT_FL_OFFSET 12
+#define ANI_DUMMY_PKT_MSG_LEN 16
+#define ANI_DUMMY_DATA_PAYLOAD_OFFSET 10
+
+/**
+ * Product IDs stored in the EEPROM for the different types of AP radio cards
+ * supported by Polaris
+ */
+#define AGN1323AR_00 4
+#define AGN1323AR_01 5
+#define AGN1223AR_00 6
+#define AGN1223AR_01 7
+#define AGN1223AR_02 8
+#define AGN_EEP_PRODUCT_ID_MAX 8
+
+
+
+
+/// Start of Sirius/Host message types
+#define WNI_HOST_MSG_START 0x1100
+
+enum eWniMsgTypes
+{
+ /// CFG message types
+ eWNI_CFG_MSG_TYPES_BEGIN=WNI_HOST_MSG_START,
+ eWNI_CFG_MSG_TYPES_END=eWNI_CFG_MSG_TYPES_BEGIN+0xFF,
+
+ /// SME message types
+ eWNI_SME_MSG_TYPES_BEGIN=eWNI_CFG_MSG_TYPES_END,
+ eWNI_SME_START_REQ,
+ eWNI_SME_START_RSP,
+ eWNI_SME_SYS_READY_IND,
+ eWNI_SME_SCAN_REQ,
+ eWNI_SME_SCAN_ABORT_IND,
+ eWNI_SME_SCAN_RSP,
+ eWNI_SME_JOIN_REQ,
+ eWNI_SME_JOIN_RSP,
+ eWNI_SME_SETCONTEXT_REQ,
+ eWNI_SME_SETCONTEXT_RSP,
+ eWNI_SME_REASSOC_REQ,
+ eWNI_SME_REASSOC_RSP,
+ eWNI_SME_AUTH_REQ,
+ eWNI_SME_AUTH_RSP,
+ eWNI_SME_DISASSOC_REQ,
+ eWNI_SME_DISASSOC_RSP,
+ eWNI_SME_DISASSOC_IND,
+ eWNI_SME_DISASSOC_CNF,
+ eWNI_SME_DEAUTH_REQ,
+ eWNI_SME_DEAUTH_RSP,
+ eWNI_SME_DEAUTH_IND,
+ eWNI_SME_WM_STATUS_CHANGE_NTF,
+ eWNI_SME_IBSS_NEW_PEER_IND,
+ eWNI_SME_IBSS_PEER_DEPARTED_IND,
+ eWNI_SME_START_BSS_REQ,
+ eWNI_SME_START_BSS_RSP,
+ eWNI_SME_AUTH_IND,
+ eWNI_SME_ASSOC_IND,
+ eWNI_SME_ASSOC_CNF,
+ eWNI_SME_REASSOC_IND,
+ eWNI_SME_REASSOC_CNF,
+ eWNI_SME_SWITCH_CHL_REQ,
+ eWNI_SME_SWITCH_CHL_RSP,
+ eWNI_SME_STOP_BSS_REQ,
+ eWNI_SME_STOP_BSS_RSP,
+ eWNI_SME_DEL_BA_PEER_IND,
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+ eWNI_SME_DEFINE_QOS_REQ,
+ eWNI_SME_DEFINE_QOS_RSP,
+ eWNI_SME_DELETE_QOS_REQ,
+ eWNI_SME_DELETE_QOS_RSP,
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+ eWNI_SME_PROMISCUOUS_MODE_REQ,
+ eWNI_SME_PROMISCUOUS_MODE_RSP,
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+ eWNI_SME_LINK_TEST_START_REQ,
+ eWNI_SME_LINK_TEST_START_RSP,
+ eWNI_SME_LINK_TEST_STOP_REQ,
+ eWNI_SME_LINK_TEST_STOP_RSP,
+ eWNI_SME_LINK_TEST_REPORT_IND,
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+ eWNI_SME_NEIGHBOR_BSS_IND,
+ eWNI_SME_MEASUREMENT_REQ,
+ eWNI_SME_MEASUREMENT_RSP,
+ eWNI_SME_MEASUREMENT_IND,
+ eWNI_SME_SET_WDS_INFO_REQ,
+ eWNI_SME_SET_WDS_INFO_RSP,
+ eWNI_SME_WDS_INFO_IND,
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+ eWNI_SME_SET_POWER_REQ,
+ eWNI_SME_SET_POWER_RSP,
+ eWNI_SME_CLIENT_SIDE_LOAD_BALANCE_REQ,
+ eWNI_SME_CLIENT_SIDE_LOAD_BALANCE_RSP,
+ eWNI_SME_SELECT_CHANNEL_REQ,
+ eWNI_SME_SELECT_CHANNEL_RSP,
+ eWNI_SME_SET_PROPRIETARY_IE_REQ,
+ eWNI_SME_SET_PROPRIETARY_IE_RSP, // #endif
+ eWNI_SME_DISCARD_SKB_NTF, // Used to cleanup SKBs by HDD
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+ eWNI_SME_DEAUTH_CNF,
+ eWNI_SME_MIC_FAILURE_IND,
+ eWNI_SME_ADDTS_REQ,
+ eWNI_SME_ADDTS_RSP,
+ eWNI_SME_ADDTS_CNF,
+ eWNI_SME_ADDTS_IND,
+ eWNI_SME_DELTS_REQ,
+ eWNI_SME_DELTS_RSP,
+ eWNI_SME_DELTS_IND,
+ eWNI_SME_SET_BACKGROUND_SCAN_MODE_REQ,
+ eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ,
+ eWNI_SME_SWITCH_CHL_CB_PRIMARY_RSP,
+ eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ,
+ eWNI_SME_SWITCH_CHL_CB_SECONDARY_RSP,
+ eWNI_SME_PROBE_REQ,
+ eWNI_SME_STA_STAT_REQ,
+ eWNI_SME_STA_STAT_RSP,
+ eWNI_SME_AGGR_STAT_REQ,
+ eWNI_SME_AGGR_STAT_RSP,
+ eWNI_SME_GLOBAL_STAT_REQ,
+ eWNI_SME_GLOBAL_STAT_RSP,
+ eWNI_SME_STAT_SUMM_REQ,
+ eWNI_SME_STAT_SUMM_RSP,
+ eWNI_SME_REMOVEKEY_REQ,
+ eWNI_SME_REMOVEKEY_RSP,
+ eWNI_SME_GET_SCANNED_CHANNEL_REQ,
+ eWNI_SME_GET_SCANNED_CHANNEL_RSP,
+ eWNI_SME_SET_TX_POWER_REQ,
+ eWNI_SME_SET_TX_POWER_RSP,
+ eWNI_SME_GET_TX_POWER_REQ,
+ eWNI_SME_GET_TX_POWER_RSP,
+ eWNI_SME_GET_NOISE_REQ,
+ eWNI_SME_GET_NOISE_RSP,
+ eWNI_SME_LOW_RSSI_IND,
+ eWNI_SME_GET_STATISTICS_REQ,
+ eWNI_SME_GET_STATISTICS_RSP,
+ eWNI_SME_GET_RSSI_REQ,
+#ifdef WLAN_SOFTAP_FEATURE
+ eWNI_SME_GET_ASSOC_STAS_REQ,
+ eWNI_SME_TKIP_CNTR_MEAS_REQ,
+ eWNI_SME_UPDATE_APWPSIE_REQ,
+ eWNI_SME_GET_WPSPBC_SESSION_REQ,
+ eWNI_SME_WPS_PBC_PROBE_REQ_IND,
+ eWNI_SME_SET_APWPARSNIEs_REQ,
+ eWNI_SME_UPPER_LAYER_ASSOC_CNF,
+ eWNI_SME_HIDE_SSID_REQ,
+#endif
+#ifdef WLAN_FEATURE_P2P
+ eWNI_SME_REMAIN_ON_CHANNEL_REQ,
+ eWNI_SME_REMAIN_ON_CHN_IND,
+ eWNI_SME_REMAIN_ON_CHN_RSP,
+ eWNI_SME_MGMT_FRM_IND,
+ eWNI_SME_REMAIN_ON_CHN_RDY_IND,
+ eWNI_SME_SEND_ACTION_FRAME_IND,
+ eWNI_SME_ACTION_FRAME_SEND_CNF,
+ eWNI_SME_ABORT_REMAIN_ON_CHAN_IND,
+ eWNI_SME_UPDATE_NOA,
+#endif
+ eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER,
+ //General Power Save Messages
+ eWNI_PMC_MSG_TYPES_BEGIN,
+ eWNI_PMC_PWR_SAVE_CFG,
+
+ //BMPS Messages
+ eWNI_PMC_ENTER_BMPS_REQ,
+ eWNI_PMC_ENTER_BMPS_RSP,
+ eWNI_PMC_EXIT_BMPS_REQ,
+ eWNI_PMC_EXIT_BMPS_RSP,
+ eWNI_PMC_EXIT_BMPS_IND,
+
+ //IMPS Messages.
+ eWNI_PMC_ENTER_IMPS_REQ,
+ eWNI_PMC_ENTER_IMPS_RSP,
+ eWNI_PMC_EXIT_IMPS_REQ,
+ eWNI_PMC_EXIT_IMPS_RSP,
+
+ //UAPSD Messages
+ eWNI_PMC_ENTER_UAPSD_REQ,
+ eWNI_PMC_ENTER_UAPSD_RSP,
+ eWNI_PMC_EXIT_UAPSD_REQ,
+ eWNI_PMC_EXIT_UAPSD_RSP,
+
+ //WOWL Messages
+ eWNI_PMC_SMPS_STATE_IND,
+
+ //WoWLAN Messages
+ eWNI_PMC_WOWL_ADD_BCAST_PTRN,
+ eWNI_PMC_WOWL_DEL_BCAST_PTRN,
+ eWNI_PMC_ENTER_WOWL_REQ,
+ eWNI_PMC_ENTER_WOWL_RSP,
+ eWNI_PMC_EXIT_WOWL_REQ,
+ eWNI_PMC_EXIT_WOWL_RSP,
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+ eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP,
+#endif // WLAN_FEATURE_PACKET_FILTERING
+
+ eWNI_PMC_MSG_TYPES_END,
+
+#if defined WLAN_FEATURE_VOWIFI
+ eWNI_SME_RRM_MSG_TYPE_BEGIN,
+
+ eWNI_SME_NEIGHBOR_REPORT_REQ_IND,
+ eWNI_SME_NEIGHBOR_REPORT_IND,
+ eWNI_SME_BEACON_REPORT_REQ_IND,
+ eWNI_SME_BEACON_REPORT_RESP_XMIT_IND,
+
+ eWNI_SME_RRM_MSG_TYPE_END,
+
+#endif
+ eWNI_SME_ADD_STA_SELF_REQ,
+ eWNI_SME_ADD_STA_SELF_RSP,
+ eWNI_SME_DEL_STA_SELF_REQ,
+ eWNI_SME_DEL_STA_SELF_RSP,
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+ eWNI_SME_FT_PRE_AUTH_REQ,
+ eWNI_SME_FT_PRE_AUTH_RSP,
+ eWNI_SME_FT_UPDATE_KEY,
+ eWNI_SME_FT_AGGR_QOS_REQ,
+ eWNI_SME_FT_AGGR_QOS_RSP,
+#endif
+
+#if defined FEATURE_WLAN_CCX
+ eWNI_SME_CCX_ADJACENT_AP_REPORT,
+#endif
+
+#ifdef WLAN_FEATURE_P2P
+ eWNI_SME_REGISTER_MGMT_FRAME_REQ,
+#endif
+
+ eWNI_SME_COEX_IND,
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+ eWNI_SME_PREF_NETWORK_FOUND_IND,
+#endif // FEATURE_WLAN_SCAN_PNO
+
+ eWNI_SME_TX_PER_HIT_IND,
+
+ eWNI_SME_CHANGE_COUNTRY_CODE,
+ eWNI_SME_PRE_SWITCH_CHL_IND,
+ eWNI_SME_POST_SWITCH_CHL_IND,
+
+ eWNI_SME_MAX_ASSOC_EXCEEDED,
+
+ eWNI_SME_BTAMP_LOG_LINK_IND,//to serialize the create/accpet LL req from HCI
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+ eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP,
+#endif // WLAN_FEATURE_GTK_OFFLOAD
+
+#ifdef WLAN_WAKEUP_EVENTS
+ eWNI_SME_WAKE_REASON_IND,
+#endif // WLAN_WAKEUP_EVENTS
+
+ eWNI_SME_MSG_TYPES_END
+};
+
+#define WNI_CFG_MSG_TYPES_BEGIN 0x1100
+
+/*---------------------------------------------------------------------*/
+/* CFG Module Definitions */
+/*---------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------*/
+/* CFG message definitions */
+/*---------------------------------------------------------------------*/
+#define WNI_CFG_MSG_HDR_MASK 0xffff0000
+#define WNI_CFG_MSG_LEN_MASK 0x0000ffff
+#define WNI_CFG_MB_HDR_LEN 4
+#define WNI_CFG_MAX_PARAM_NUM 32
+
+
+/*---------------------------------------------------------------------*/
+/* CFG to HDD message types */
+/*---------------------------------------------------------------------*/
+#define WNI_CFG_PARAM_UPDATE_IND (WNI_CFG_MSG_TYPES_BEGIN | 0x00)
+#define WNI_CFG_DNLD_REQ (WNI_CFG_MSG_TYPES_BEGIN | 0x01)
+#define WNI_CFG_DNLD_CNF (WNI_CFG_MSG_TYPES_BEGIN | 0x02)
+#define WNI_CFG_GET_RSP (WNI_CFG_MSG_TYPES_BEGIN | 0x03)
+#define WNI_CFG_SET_CNF (WNI_CFG_MSG_TYPES_BEGIN | 0x04)
+#define WNI_CFG_GET_ATTRIB_RSP (WNI_CFG_MSG_TYPES_BEGIN | 0x05)
+#define WNI_CFG_ADD_GRP_ADDR_CNF (WNI_CFG_MSG_TYPES_BEGIN | 0x06)
+#define WNI_CFG_DEL_GRP_ADDR_CNF (WNI_CFG_MSG_TYPES_BEGIN | 0x07)
+
+#define ANI_CFG_GET_RADIO_STAT_RSP (WNI_CFG_MSG_TYPES_BEGIN | 0x08)
+#define ANI_CFG_GET_PER_STA_STAT_RSP (WNI_CFG_MSG_TYPES_BEGIN | 0x09)
+#define ANI_CFG_GET_AGG_STA_STAT_RSP (WNI_CFG_MSG_TYPES_BEGIN | 0x0a)
+#define ANI_CFG_CLEAR_STAT_RSP (WNI_CFG_MSG_TYPES_BEGIN | 0x0b)
+
+
+/*---------------------------------------------------------------------*/
+/* CFG to HDD message paramter indices */
+/* */
+/* The followings are word indices starting from the message body */
+/* */
+/* WNI_CFG_xxxx_xxxx_xxxx: index of parameter */
+/* */
+/* WNI_CFG_xxxx_xxxx_NUM: number of parameters in message */
+/* */
+/* WNI_CFG_xxxx_xxxx_LEN: byte length of message including */
+/* MB header */
+/* */
+/* WNI_CFG_xxxx_xxxx_PARTIAL_LEN: byte length of message including */
+/* parameters and MB header but */
+/* excluding variable data length */
+/*---------------------------------------------------------------------*/
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+// Parameter update indication
+#define WNI_CFG_PARAM_UPDATE_IND_PID 0
+
+#define WNI_CFG_PARAM_UPDATE_IND_NUM 1
+#define WNI_CFG_PARAM_UPDATE_IND_LEN (WNI_CFG_MB_HDR_LEN + \
+ (WNI_CFG_PARAM_UPDATE_IND_NUM << 2))
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+// Configuration download request
+#define WNI_CFG_DNLD_REQ_NUM 0
+#define WNI_CFG_DNLD_REQ_LEN WNI_CFG_MB_HDR_LEN
+
+// Configuration download confirm
+#define WNI_CFG_DNLD_CNF_RES 0
+
+#define WNI_CFG_DNLD_CNF_NUM 1
+#define WNI_CFG_DNLD_CNF_LEN (WNI_CFG_MB_HDR_LEN + \
+ (WNI_CFG_DNLD_CNF_NUM << 2))
+// Get response
+#define WNI_CFG_GET_RSP_RES 0
+#define WNI_CFG_GET_RSP_PID 1
+#define WNI_CFG_GET_RSP_PLEN 2
+
+#define WNI_CFG_GET_RSP_NUM 3
+#define WNI_CFG_GET_RSP_PARTIAL_LEN (WNI_CFG_MB_HDR_LEN + \
+ (WNI_CFG_GET_RSP_NUM << 2))
+// Set confirm
+#define WNI_CFG_SET_CNF_RES 0
+#define WNI_CFG_SET_CNF_PID 1
+
+#define WNI_CFG_SET_CNF_NUM 2
+#define WNI_CFG_SET_CNF_LEN (WNI_CFG_MB_HDR_LEN + \
+ (WNI_CFG_SET_CNF_NUM << 2))
+// Get attribute response
+#define WNI_CFG_GET_ATTRIB_RSP_RES 0
+#define WNI_CFG_GET_ATTRIB_RSP_PID 1
+#define WNI_CFG_GET_ATTRIB_RSP_TYPE 2
+#define WNI_CFG_GET_ATTRIB_RSP_PLEN 3
+#define WNI_CFG_GET_ATTRIB_RSP_RW 4
+
+#define WNI_CFG_GET_ATTRIB_RSP_NUM 5
+#define WNI_CFG_GET_ATTRIB_RSP_LEN (WNI_CFG_MB_HDR_LEN + \
+ (WNI_CFG_GET_ATTRIB_RSP_NUM << 2))
+
+// Add group address confirm
+#define WNI_CFG_ADD_GRP_ADDR_CNF_RES 0
+
+#define WNI_CFG_ADD_GRP_ADDR_CNF_NUM 1
+#define WNI_CFG_ADD_GRP_ADDR_CNF_LEN (WNI_CFG_MB_HDR_LEN + \
+ (WNI_CFG_ADD_GRP_ADDR_CNF_NUM << 2))
+
+// Delete group address confirm
+#define WNI_CFG_DEL_GRP_ADDR_CNF_RES 0
+
+#define WNI_CFG_DEL_GRP_ADDR_CNF_NUM 1
+#define WNI_CFG_DEL_GRP_ADDR_CNF_LEN (WNI_CFG_MB_HDR_LEN + \
+ (WNI_CFG_DEL_GRP_ADDR_CNF_NUM <<2))
+
+
+#define IS_CFG_MSG(msg) ((msg & 0xff00) == WNI_CFG_MSG_TYPES_BEGIN)
+
+// Clear stats types.
+#define ANI_CLEAR_ALL_STATS 0
+#define ANI_CLEAR_RX_STATS 1
+#define ANI_CLEAR_TX_STATS 2
+#define ANI_CLEAR_PER_STA_STATS 3
+#define ANI_CLEAR_AGGR_PER_STA_STATS 4
+#define ANI_CLEAR_STAT_TYPES_END 5
+
+/*---------------------------------------------------------------------*/
+/* HDD to CFG message types */
+/*---------------------------------------------------------------------*/
+#define WNI_CFG_DNLD_RSP (WNI_CFG_MSG_TYPES_BEGIN | 0x80)
+#define WNI_CFG_GET_REQ (WNI_CFG_MSG_TYPES_BEGIN | 0x81)
+#define WNI_CFG_SET_REQ (WNI_CFG_MSG_TYPES_BEGIN | 0x82)
+#define WNI_CFG_SET_REQ_NO_RSP (WNI_CFG_MSG_TYPES_BEGIN | 0x83) //No RSP for this set
+
+// Shall be removed after stats integration
+
+
+/*---------------------------------------------------------------------*/
+/* HDD to CFG message paramter indices */
+/* */
+/* The followings are word indices starting from the message body */
+/* */
+/* WNI_CFG_xxxx_xxxx_xxxx: index of parameter */
+/* */
+/* WNI_CFG_xxxx_xxxx_NUM: number of parameters in message */
+/* */
+/* WNI_CFG_xxxx_xxxx_LEN: byte length of message including */
+/* MB header */
+/* */
+/* WNI_CFG_xxxx_xxxx_PARTIAL_LEN: byte length of message including */
+/* parameters and MB header but */
+/* excluding variable data length */
+/*---------------------------------------------------------------------*/
+
+// Download response
+#define WNI_CFG_DNLD_RSP_BIN_LEN 0
+
+#define WNI_CFG_DNLD_RSP_NUM 1
+#define WNI_CFG_DNLD_RSP_PARTIAL_LEN (WNI_CFG_MB_HDR_LEN + \
+ (WNI_CFG_DNLD_RSP_NUM << 2))
+
+// Set parameter request
+#define WNI_CFG_SET_REQ_PID 0
+#define WNI_CFG_SET_REQ_PLEN 1
+
+/*
+// Get attribute request
+//#define WNI_CFG_GET_ATTRIB_REQ_PID 0
+
+//#define WNI_CFG_GET_ATTRIB_REQ_NUM 1
+//#define WNI_CFG_GET_ATTRIB_REQ_LEN (WNI_CFG_MB_HDR_LEN + \
+ (WNI_CFG_GET_ATTRIB_REQ_NUM << 2))
+// Add group address request
+#define WNI_CFG_ADD_GRP_ADDR_REQ_MAC_ADDR 0
+
+#define WNI_CFG_ADD_GRP_ADDR_REQ_NUM 1
+#define WNI_CFG_ADD_GRP_ADDR_REQ_LEN (WNI_CFG_MB_HDR_LEN + \
+ (WNI_CFG_ADD_GRP_ADDR_REQ_NUM << 2))
+// Delete group address request
+#define WNI_CFG_DEL_GRP_ADDR_REQ_MAC_ADDR 0
+
+#define WNI_CFG_DEL_GRP_ADDR_REQ_NUM 1
+#define WNI_CFG_DEL_GRP_ADDR_REQ_LEN (WNI_CFG_MB_HDR_LEN + \
+ (WNI_CFG_DEL_GRP_ADDR_REQ_NUM << 2))
+*/
+
+
+/*---------------------------------------------------------------------*/
+/* CFG return values */
+/*---------------------------------------------------------------------*/
+#define WNI_CFG_SUCCESS 1
+#define WNI_CFG_NOT_READY 2
+#define WNI_CFG_INVALID_PID 3
+#define WNI_CFG_INVALID_LEN 4
+#define WNI_CFG_RO_PARAM 5
+#define WNI_CFG_WO_PARAM 6
+#define WNI_CFG_INVALID_STAID 7
+#define WNI_CFG_OTHER_ERROR 8
+#define WNI_CFG_NEED_RESTART 9
+#define WNI_CFG_NEED_RELOAD 10
+
+
+/*---------------------------------------------------------------------*/
+/* CFG definitions */
+/*---------------------------------------------------------------------*/
+#define WNI_CFG_TYPE_STR 0x0000000
+#define WNI_CFG_TYPE_INT 0x0000001
+#define WNI_CFG_HOST_RE 0x0000002
+#define WNI_CFG_HOST_WE 0x0000004
+
+
+// Shall be removed after integration of stats.
+// Get statistic response
+#define WNI_CFG_GET_STAT_RSP_RES 0
+#define WNI_CFG_GET_STAT_RSP_PARAMID 1
+#define WNI_CFG_GET_STAT_RSP_VALUE 2
+
+#define WNI_CFG_GET_STAT_RSP_NUM 3
+#define WNI_CFG_GET_STAT_RSP_LEN (WNI_CFG_MB_HDR_LEN + \
+ (WNI_CFG_GET_STAT_RSP_NUM <<2))
+// Get per station statistic response
+#define WNI_CFG_GET_PER_STA_STAT_RSP_RES 0
+#define WNI_CFG_GET_PER_STA_STAT_RSP_STAID 1
+#define WNI_CFG_GET_PER_STA_STAT_RSP_FIRST_PARAM 2
+
+// Per STA statistic structure
+typedef struct sAniCfgPerStaStatStruct
+{
+ unsigned long sentAesBlksUcastHi;
+ unsigned long sentAesBlksUcastLo;
+
+ unsigned long recvAesBlksUcastHi;
+ unsigned long recvAesBlksUcastLo;
+
+ unsigned long aesFormatErrorUcastCnts;
+
+ unsigned long aesReplaysUcast;
+
+ unsigned long aesDecryptErrUcast;
+
+ unsigned long singleRetryPkts;
+
+ unsigned long failedTxPkts;
+
+ unsigned long ackTimeouts;
+
+ unsigned long multiRetryPkts;
+
+ unsigned long fragTxCntsHi;
+ unsigned long fragTxCntsLo;
+
+ unsigned long transmittedPktsHi;
+ unsigned long transmittedPktsLo;
+
+ unsigned long phyStatHi;
+ unsigned long phyStatLo;
+} tCfgPerStaStatStruct, *tpAniCfgPerStaStatStruct;
+
+#define WNI_CFG_GET_PER_STA_STAT_RSP_NUM 23
+#define WNI_CFG_GET_PER_STA_STAT_RSP_LEN (WNI_CFG_MB_HDR_LEN + \
+ (WNI_CFG_GET_PER_STA_STAT_RSP_NUM << 2))
+
+
+// Shall be removed after integrating stats.
+#define WNI_CFG_GET_STAT_RSP (WNI_CFG_MSG_TYPES_BEGIN | 0x08)
+#define WNI_CFG_GET_PER_STA_STAT_RSP (WNI_CFG_MSG_TYPES_BEGIN | 0x09)
+#define WNI_CFG_GET_AGG_STA_STAT_RSP (WNI_CFG_MSG_TYPES_BEGIN | 0x0a)
+#define WNI_CFG_GET_TX_RATE_CTR_RSP (WNI_CFG_MSG_TYPES_BEGIN | 0x0b)
+
+#define WNI_CFG_GET_AGG_STA_STAT_RSP_NUM 21
+#define WNI_CFG_GET_AGG_STA_STAT_RSP_LEN (WNI_CFG_MB_HDR_LEN + \
+ (WNI_CFG_GET_AGG_STA_STAT_RSP_NUM << 2))
+#define WNI_CFG_GET_AGG_STA_STAT_RSP_RES 0
+
+ // Get TX rate based stats
+#define WNI_CFG_GET_TX_RATE_CTR_RSP_RES 0
+
+typedef struct sAniCfgTxRateCtrs
+{
+// add the rate counters here
+ unsigned long TxFrames_1Mbps;
+ unsigned long TxFrames_2Mbps;
+ unsigned long TxFrames_5_5Mbps;
+ unsigned long TxFrames_6Mbps;
+ unsigned long TxFrames_9Mbps;
+ unsigned long TxFrames_11Mbps;
+ unsigned long TxFrames_12Mbps;
+ unsigned long TxFrames_18Mbps;
+ unsigned long TxFrames_24Mbps;
+ unsigned long TxFrames_36Mbps;
+ unsigned long TxFrames_48Mbps;
+ unsigned long TxFrames_54Mbps;
+ unsigned long TxFrames_72Mbps;
+ unsigned long TxFrames_96Mbps;
+ unsigned long TxFrames_108Mbps;
+
+} tAniCfgTxRateCtrs, *tpAniCfgTxRateCtrs;
+
+
+#define WNI_CFG_GET_STAT_REQ (WNI_CFG_MSG_TYPES_BEGIN | 0x86)
+#define WNI_CFG_GET_PER_STA_STAT_REQ (WNI_CFG_MSG_TYPES_BEGIN | 0x87)
+#define WNI_CFG_GET_AGG_STA_STAT_REQ (WNI_CFG_MSG_TYPES_BEGIN | 0x88)
+#define WNI_CFG_GET_TX_RATE_CTR_REQ (WNI_CFG_MSG_TYPES_BEGIN | 0x89)
+
+// Get statistic request
+#define WNI_CFG_GET_STAT_REQ_PARAMID 0
+
+#define WNI_CFG_GET_STAT_REQ_NUM 1
+#define WNI_CFG_GET_STAT_REQ_LEN (WNI_CFG_MB_HDR_LEN + \
+ (WNI_CFG_GET_STAT_REQ_NUM << 2))
+
+ // Get per station statistic request
+#define WNI_CFG_GET_PER_STA_STAT_REQ_STAID 0
+
+#define WNI_CFG_GET_PER_STA_STAT_REQ_NUM 1
+#define WNI_CFG_GET_PER_STA_STAT_REQ_LEN (WNI_CFG_MB_HDR_LEN + \
+ (WNI_CFG_GET_PER_STA_STAT_REQ_NUM << 2))
+
+
+
+
+#define DYNAMIC_CFG_TYPE_SELECTED_REGISTRAR (0)
+#define DYNAMIC_CFG_TYPE_WPS_STATE (1)
+
+#endif /* __WNI_API_H */
+
diff --git a/CORE/MAC/inc/wniCfgAp.h b/CORE/MAC/inc/wniCfgAp.h
new file mode 100644
index 0000000..dc9f1e7
--- /dev/null
+++ b/CORE/MAC/inc/wniCfgAp.h
@@ -0,0 +1,2112 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copyright (C) 2007-2009 QUALCOMM Incorporated. All rights reserved. Proprietary and Confidential.
+ */
+
+/*
+ * DO NOT EDIT - This file is generated automaticlly
+ */
+
+/*
+ * IMPORTANT: This file is for system that supports both STA and AP mode.
+ */
+
+
+#ifndef __WNICFGAP_H
+#define __WNICFGAP_H
+
+/*
+ * Configuration Parameter ID for STA and AP
+ */
+
+#define WNI_CFG_STA_ID 0
+#define WNI_CFG_CF_POLLABLE 1
+#define WNI_CFG_CFP_PERIOD 2
+#define WNI_CFG_CFP_MAX_DURATION 3
+#define WNI_CFG_SSID 4
+#define WNI_CFG_BEACON_INTERVAL 5
+#define WNI_CFG_DTIM_PERIOD 6
+#define WNI_CFG_WEP_KEY_LENGTH 7
+#define WNI_CFG_WEP_DEFAULT_KEY_TABLE 8
+#define WNI_CFG_WEP_DEFAULT_KEY_TABLE_ROW 4
+#define WNI_CFG_WEP_DEFAULT_KEY_TABLE_COL 1
+#define WNI_CFG_WEP_DEFAULT_KEY_1 8
+#define WNI_CFG_WEP_DEFAULT_KEY_2 9
+#define WNI_CFG_WEP_DEFAULT_KEY_3 10
+#define WNI_CFG_WEP_DEFAULT_KEY_4 11
+#define WNI_CFG_WEP_DEFAULT_KEYID 12
+#define WNI_CFG_EXCLUDE_UNENCRYPTED 13
+#define WNI_CFG_RTS_THRESHOLD 14
+#define WNI_CFG_SHORT_RETRY_LIMIT 15
+#define WNI_CFG_LONG_RETRY_LIMIT 16
+#define WNI_CFG_FRAGMENTATION_THRESHOLD 17
+#define WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME 18
+#define WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME 19
+#define WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME 20
+#define WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME 21
+#define WNI_CFG_JOIN_FAILURE_TIMEOUT 22
+#define WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT 23
+#define WNI_CFG_AUTHENTICATE_RSP_TIMEOUT 24
+#define WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT 25
+#define WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT 26
+#define WNI_CFG_RA_PERIODICITY_TIMEOUT_IN_PS 27
+#define WNI_CFG_PS_ENABLE_BCN_FILTER 28
+#define WNI_CFG_PS_ENABLE_HEART_BEAT 29
+#define WNI_CFG_PS_ENABLE_RSSI_MONITOR 30
+#define WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT 31
+#define WNI_CFG_RF_SETTLING_TIME_CLK 32
+#define WNI_CFG_SUPPORTED_RATES_11B 33
+#define WNI_CFG_SUPPORTED_RATES_11A 34
+#define WNI_CFG_PHY_MODE 35
+#define WNI_CFG_DOT11_MODE 36
+#define WNI_CFG_OPERATIONAL_RATE_SET 37
+#define WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET 38
+#define WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET 39
+#define WNI_CFG_BSSID 40
+#define WNI_CFG_LISTEN_INTERVAL 41
+#define WNI_CFG_VALID_CHANNEL_LIST 42
+#define WNI_CFG_CURRENT_CHANNEL 43
+#define WNI_CFG_DEFAULT_RATE_INDEX_5GHZ 44
+#define WNI_CFG_DEFAULT_RATE_INDEX_24GHZ 45
+#define WNI_CFG_RATE_ADAPTATION_TYPE 46
+#define WNI_CFG_FIXED_RATE 47
+#define WNI_CFG_FIXED_RATE_MULTICAST_24GHZ 48
+#define WNI_CFG_FIXED_RATE_MULTICAST_5GHZ 49
+#define WNI_CFG_RETRYRATE_POLICY 50
+#define WNI_CFG_RETRYRATE_SECONDARY 51
+#define WNI_CFG_RETRYRATE_TERTIARY 52
+#define WNI_CFG_APSD_ENABLED 53
+#define WNI_CFG_SHARED_KEY_AUTH_ENABLE 54
+#define WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE 55
+#define WNI_CFG_AUTHENTICATION_TYPE 56
+#define WNI_CFG_CF_POLL_REQUEST 57
+#define WNI_CFG_PRIVACY_ENABLED 58
+#define WNI_CFG_SHORT_PREAMBLE 59
+#define WNI_CFG_SHORT_SLOT_TIME 60
+#define WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY 61
+#define WNI_CFG_QOS_ENABLED 62
+#define WNI_CFG_HCF_ENABLED 63
+#define WNI_CFG_RSN_ENABLED 64
+#define WNI_CFG_BACKGROUND_SCAN_PERIOD 65
+#define WNI_CFG_MAX_NUM_PRE_AUTH 66
+#define WNI_CFG_PREAUTH_CLNUP_TIMEOUT 67
+#define WNI_CFG_RELEASE_AID_TIMEOUT 68
+#define WNI_CFG_HEART_BEAT_THRESHOLD 69
+#define WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT 70
+#define WNI_CFG_MANUFACTURER_OUI 71
+#define WNI_CFG_MANUFACTURER_NAME 72
+#define WNI_CFG_MODEL_NUMBER 73
+#define WNI_CFG_MODEL_NAME 74
+#define WNI_CFG_MANUFACTURER_PRODUCT_NAME 75
+#define WNI_CFG_MANUFACTURER_PRODUCT_VERSION 76
+#define WNI_CFG_11D_ENABLED 77
+#define WNI_CFG_MAX_TX_POWER_2_4 78
+#define WNI_CFG_MAX_TX_POWER_5 79
+#define WNI_CFG_NETWORK_DENSITY 80
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM 81
+#define WNI_CFG_CURRENT_TX_ANTENNA 82
+#define WNI_CFG_CURRENT_RX_ANTENNA 83
+#define WNI_CFG_CURRENT_TX_POWER_LEVEL 84
+#define WNI_CFG_POWER_STATE_PER_CHAIN 85
+#define WNI_CFG_NEW_BSS_FOUND_IND 86
+#define WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED 87
+#define WNI_CFG_PROPRIETARY_RATES_ENABLED 88
+#define WNI_CFG_AP_NODE_NAME 89
+#define WNI_CFG_COUNTRY_CODE 90
+#define WNI_CFG_11H_ENABLED 91
+#define WNI_CFG_WT_CNF_TIMEOUT 92
+#define WNI_CFG_KEEPALIVE_TIMEOUT 93
+#define WNI_CFG_PROXIMITY 94
+#define WNI_CFG_LOG_LEVEL 95
+#define WNI_CFG_OLBC_DETECT_TIMEOUT 96
+#define WNI_CFG_PROTECTION_ENABLED 97
+#define WNI_CFG_11G_PROTECTION_ALWAYS 98
+#define WNI_CFG_FORCE_POLICY_PROTECTION 99
+#define WNI_CFG_11G_SHORT_PREAMBLE_ENABLED 100
+#define WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED 101
+#define WNI_CFG_CAL_PERIOD 102
+#define WNI_CFG_STATS_PERIOD 103
+#define WNI_CFG_CAL_CONTROL 104
+#define WNI_CFG_11G_ONLY_POLICY 105
+#define WNI_CFG_PACKET_CLASSIFICATION 106
+#define WNI_CFG_WME_ENABLED 107
+#define WNI_CFG_ADDTS_RSP_TIMEOUT 108
+#define WNI_CFG_MAX_SP_LENGTH 109
+#define WNI_CFG_KEEP_ALIVE_STA_LIMIT_THRESHOLD 110
+#define WNI_CFG_SEND_SINGLE_SSID_ALWAYS 111
+#define WNI_CFG_WSM_ENABLED 112
+#define WNI_CFG_PROP_CAPABILITY 113
+#define WNI_CFG_EDCA_PROFILE 114
+#define WNI_CFG_EDCA_ANI_ACBK_LOCAL 115
+#define WNI_CFG_EDCA_ANI_ACBE_LOCAL 116
+#define WNI_CFG_EDCA_ANI_ACVI_LOCAL 117
+#define WNI_CFG_EDCA_ANI_ACVO_LOCAL 118
+#define WNI_CFG_EDCA_ANI_ACBK 119
+#define WNI_CFG_EDCA_ANI_ACBE 120
+#define WNI_CFG_EDCA_ANI_ACVI 121
+#define WNI_CFG_EDCA_ANI_ACVO 122
+#define WNI_CFG_EDCA_WME_ACBK_LOCAL 123
+#define WNI_CFG_EDCA_WME_ACBE_LOCAL 124
+#define WNI_CFG_EDCA_WME_ACVI_LOCAL 125
+#define WNI_CFG_EDCA_WME_ACVO_LOCAL 126
+#define WNI_CFG_EDCA_WME_ACBK 127
+#define WNI_CFG_EDCA_WME_ACBE 128
+#define WNI_CFG_EDCA_WME_ACVI 129
+#define WNI_CFG_EDCA_WME_ACVO 130
+#define WNI_CFG_EDCA_TIT_DEMO_ACBK_LOCAL 131
+#define WNI_CFG_EDCA_TIT_DEMO_ACBE_LOCAL 132
+#define WNI_CFG_EDCA_TIT_DEMO_ACVI_LOCAL 133
+#define WNI_CFG_EDCA_TIT_DEMO_ACVO_LOCAL 134
+#define WNI_CFG_EDCA_TIT_DEMO_ACBK 135
+#define WNI_CFG_EDCA_TIT_DEMO_ACBE 136
+#define WNI_CFG_EDCA_TIT_DEMO_ACVI 137
+#define WNI_CFG_EDCA_TIT_DEMO_ACVO 138
+#define WNI_CFG_RDET_FLAG 139
+#define WNI_CFG_RADAR_CHANNEL_LIST 140
+#define WNI_CFG_LOCAL_POWER_CONSTRAINT 141
+#define WNI_CFG_ADMIT_POLICY 142
+#define WNI_CFG_ADMIT_BWFACTOR 143
+#define WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE 144
+#define WNI_CFG_CHANNEL_BONDING_MODE 145
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE 146
+#define WNI_CFG_DYNAMIC_THRESHOLD_ZERO 147
+#define WNI_CFG_DYNAMIC_THRESHOLD_ONE 148
+#define WNI_CFG_DYNAMIC_THRESHOLD_TWO 149
+#define WNI_CFG_TRIG_STA_BK_SCAN 150
+#define WNI_CFG_DYNAMIC_PROFILE_SWITCHING 151
+#define WNI_CFG_SCAN_CONTROL_LIST 152
+#define WNI_CFG_MIMO_ENABLED 153
+#define WNI_CFG_BLOCK_ACK_ENABLED 154
+#define WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT 155
+#define WNI_CFG_HT_RX_STBC 156
+#define WNI_CFG_HT_CAP_INFO 157
+#define WNI_CFG_HT_AMPDU_PARAMS 158
+#define WNI_CFG_SUPPORTED_MCS_SET 159
+#define WNI_CFG_EXT_HT_CAP_INFO 160
+#define WNI_CFG_TX_BF_CAP 161
+#define WNI_CFG_AS_CAP 162
+#define WNI_CFG_HT_INFO_FIELD1 163
+#define WNI_CFG_HT_INFO_FIELD2 164
+#define WNI_CFG_HT_INFO_FIELD3 165
+#define WNI_CFG_BASIC_MCS_SET 166
+#define WNI_CFG_CURRENT_MCS_SET 167
+#define WNI_CFG_GREENFIELD_CAPABILITY 168
+#define WNI_CFG_MAX_AMSDU_LENGTH 169
+#define WNI_CFG_MPDU_DENSITY 170
+#define WNI_CFG_MAX_RX_AMPDU_FACTOR 171
+#define WNI_CFG_SHORT_GI_20MHZ 172
+#define WNI_CFG_SHORT_GI_40MHZ 173
+#define WNI_CFG_RIFS_ENABLED 174
+#define WNI_CFG_MAX_PS_POLL 175
+#define WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE 176
+#define WNI_CFG_RSSI_FILTER_PERIOD 177
+#define WNI_CFG_FT_RSSI_FILTER_PERIOD 178
+#define WNI_CFG_MIN_RSSI_THRESHOLD 179
+#define WNI_CFG_NTH_BEACON_FILTER 180
+#define WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE 181
+#define WNI_CFG_SCAN_IN_POWERSAVE 182
+#define WNI_CFG_IGNORE_DTIM 183
+#define WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE 184
+#define WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE 185
+#define WNI_CFG_WOWLAN_DEAUTH_ENABLE 186
+#define WNI_CFG_WOWLAN_DISASSOC_ENABLE 187
+#define WNI_CFG_WOWLAN_MAX_MISSED_BEACON 188
+#define WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD 189
+#define WNI_CFG_BA_TIMEOUT 190
+#define WNI_CFG_BA_THRESHOLD_HIGH 191
+#define WNI_CFG_MAX_BA_BUFFERS 192
+#define WNI_CFG_MAX_BA_SESSIONS 193
+#define WNI_CFG_BA_AUTO_SETUP 194
+#define WNI_CFG_ADDBA_REQ_DECLINE 195
+#define WNI_CFG_BG_SCAN_CHANNEL_LIST 196
+#define WNI_CFG_MAX_MEDIUM_TIME 197
+#define WNI_CFG_MAX_MPDUS_IN_AMPDU 198
+#define WNI_CFG_IBSS_AUTO_BSSID 199
+#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG 200
+#define WNI_CFG_PROBE_REQ_ADDNIE_DATA 201
+#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG 202
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA1 203
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA2 204
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA3 205
+#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG 206
+#define WNI_CFG_ASSOC_RSP_ADDNIE_DATA 207
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG 208
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_DATA 209
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG 210
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA 211
+#define WNI_CFG_WPS_ENABLE 212
+#define WNI_CFG_WPS_STATE 213
+#define WNI_CFG_WPS_PROBE_REQ_FLAG 214
+#define WNI_CFG_WPS_VERSION 215
+#define WNI_CFG_WPS_REQUEST_TYPE 216
+#define WNI_CFG_WPS_CFG_METHOD 217
+#define WNI_CFG_WPS_UUID 218
+#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY 219
+#define WNI_CFG_WPS_PIMARY_DEVICE_OUI 220
+#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY 221
+#define WNI_CFG_WPS_ASSOCIATION_STATE 222
+#define WNI_CFG_WPS_CONFIGURATION_ERROR 223
+#define WNI_CFG_WPS_DEVICE_PASSWORD_ID 224
+#define WNI_CFG_WPS_ASSOC_METHOD 225
+#define WNI_CFG_LOW_GAIN_OVERRIDE 226
+#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE 227
+#define WNI_CFG_RPE_POLLING_THRESHOLD 228
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG 229
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG 230
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG 231
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG 232
+#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS 233
+#define WNI_CFG_SINGLE_TID_RC 234
+#define WNI_CFG_RRM_ENABLED 235
+#define WNI_CFG_RRM_OPERATING_CHAN_MAX 236
+#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX 237
+#define WNI_CFG_TX_PWR_CTRL_ENABLE 238
+#define WNI_CFG_MCAST_BCAST_FILTER_SETTING 239
+#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK 240
+#define WNI_CFG_DYNAMIC_PS_POLL_VALUE 241
+#define WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT 242
+#define WNI_CFG_TELE_BCN_WAKEUP_EN 243
+#define WNI_CFG_TELE_BCN_TRANS_LI 244
+#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS 245
+#define WNI_CFG_TELE_BCN_MAX_LI 246
+#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS 247
+#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS 248
+#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD 249
+#define WNI_CFG_ASSOC_STA_LIMIT 250
+#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL 251
+#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL 252
+#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND 253
+#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD 254
+#define WNI_CFG_ENABLE_CLOSE_LOOP 255
+#define WNI_CFG_ENABLE_LTE_COEX 256
+#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT 257
+#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT 258
+
+/*
+ * String parameter lengths
+ */
+
+#define WNI_CFG_STA_ID_LEN 6
+#define WNI_CFG_SSID_LEN 32
+#define WNI_CFG_WEP_DEFAULT_KEY_1_LEN 13
+#define WNI_CFG_WEP_DEFAULT_KEY_2_LEN 13
+#define WNI_CFG_WEP_DEFAULT_KEY_3_LEN 13
+#define WNI_CFG_WEP_DEFAULT_KEY_4_LEN 13
+#define WNI_CFG_SUPPORTED_RATES_11B_LEN 4
+#define WNI_CFG_SUPPORTED_RATES_11A_LEN 8
+#define WNI_CFG_OPERATIONAL_RATE_SET_LEN 12
+#define WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN 8
+#define WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET_LEN 4
+#define WNI_CFG_BSSID_LEN 6
+#define WNI_CFG_VALID_CHANNEL_LIST_LEN 100
+#define WNI_CFG_MANUFACTURER_OUI_LEN 3
+#define WNI_CFG_MANUFACTURER_NAME_LEN 65
+#define WNI_CFG_MODEL_NUMBER_LEN 33
+#define WNI_CFG_MODEL_NAME_LEN 33
+#define WNI_CFG_MANUFACTURER_PRODUCT_NAME_LEN 33
+#define WNI_CFG_MANUFACTURER_PRODUCT_VERSION_LEN 33
+#define WNI_CFG_MAX_TX_POWER_2_4_LEN 128
+#define WNI_CFG_MAX_TX_POWER_5_LEN 128
+#define WNI_CFG_AP_NODE_NAME_LEN 32
+#define WNI_CFG_COUNTRY_CODE_LEN 3
+#define WNI_CFG_EDCA_ANI_ACBK_LOCAL_LEN 20
+#define WNI_CFG_EDCA_ANI_ACBE_LOCAL_LEN 20
+#define WNI_CFG_EDCA_ANI_ACVI_LOCAL_LEN 20
+#define WNI_CFG_EDCA_ANI_ACVO_LOCAL_LEN 20
+#define WNI_CFG_EDCA_ANI_ACBK_LEN 20
+#define WNI_CFG_EDCA_ANI_ACBE_LEN 20
+#define WNI_CFG_EDCA_ANI_ACVI_LEN 20
+#define WNI_CFG_EDCA_ANI_ACVO_LEN 20
+#define WNI_CFG_EDCA_WME_ACBK_LOCAL_LEN 20
+#define WNI_CFG_EDCA_WME_ACBE_LOCAL_LEN 20
+#define WNI_CFG_EDCA_WME_ACVI_LOCAL_LEN 20
+#define WNI_CFG_EDCA_WME_ACVO_LOCAL_LEN 20
+#define WNI_CFG_EDCA_WME_ACBK_LEN 20
+#define WNI_CFG_EDCA_WME_ACBE_LEN 20
+#define WNI_CFG_EDCA_WME_ACVI_LEN 20
+#define WNI_CFG_EDCA_WME_ACVO_LEN 20
+#define WNI_CFG_EDCA_TIT_DEMO_ACBK_LOCAL_LEN 20
+#define WNI_CFG_EDCA_TIT_DEMO_ACBE_LOCAL_LEN 20
+#define WNI_CFG_EDCA_TIT_DEMO_ACVI_LOCAL_LEN 20
+#define WNI_CFG_EDCA_TIT_DEMO_ACVO_LOCAL_LEN 20
+#define WNI_CFG_EDCA_TIT_DEMO_ACBK_LEN 20
+#define WNI_CFG_EDCA_TIT_DEMO_ACBE_LEN 20
+#define WNI_CFG_EDCA_TIT_DEMO_ACVI_LEN 20
+#define WNI_CFG_EDCA_TIT_DEMO_ACVO_LEN 20
+#define WNI_CFG_RADAR_CHANNEL_LIST_LEN 20
+#define WNI_CFG_SCAN_CONTROL_LIST_LEN 128
+#define WNI_CFG_SUPPORTED_MCS_SET_LEN 16
+#define WNI_CFG_BASIC_MCS_SET_LEN 16
+#define WNI_CFG_CURRENT_MCS_SET_LEN 16
+#define WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN 100
+#define WNI_CFG_PROBE_REQ_ADDNIE_DATA_LEN 255
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN 255
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA2_LEN 255
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA3_LEN 255
+#define WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN 255
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_DATA_LEN 255
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN 255
+#define WNI_CFG_WPS_UUID_LEN 16
+
+/*
+ * Integer parameter min/max/default values
+ */
+
+#define WNI_CFG_CF_POLLABLE_APMIN 0
+#define WNI_CFG_CF_POLLABLE_APMAX 1
+#define WNI_CFG_CF_POLLABLE_APDEF 0
+
+#define WNI_CFG_CFP_PERIOD_STAMIN 0
+#define WNI_CFG_CFP_PERIOD_STAMAX 255
+#define WNI_CFG_CFP_PERIOD_STADEF 1
+
+#define WNI_CFG_CFP_PERIOD_APMIN 0
+#define WNI_CFG_CFP_PERIOD_APMAX 255
+#define WNI_CFG_CFP_PERIOD_APDEF 1
+
+#define WNI_CFG_CFP_MAX_DURATION_STAMIN 0
+#define WNI_CFG_CFP_MAX_DURATION_STAMAX 65535
+#define WNI_CFG_CFP_MAX_DURATION_STADEF 30000
+
+#define WNI_CFG_CFP_MAX_DURATION_APMIN 0
+#define WNI_CFG_CFP_MAX_DURATION_APMAX 65535
+#define WNI_CFG_CFP_MAX_DURATION_APDEF 30000
+
+#define WNI_CFG_BEACON_INTERVAL_STAMIN 0
+#define WNI_CFG_BEACON_INTERVAL_STAMAX 65535
+#define WNI_CFG_BEACON_INTERVAL_STADEF 100
+
+#define WNI_CFG_BEACON_INTERVAL_APMIN 0
+#define WNI_CFG_BEACON_INTERVAL_APMAX 65535
+#define WNI_CFG_BEACON_INTERVAL_APDEF 100
+
+#define WNI_CFG_DTIM_PERIOD_STAMIN 0
+#define WNI_CFG_DTIM_PERIOD_STAMAX 65535
+#define WNI_CFG_DTIM_PERIOD_STADEF 1
+
+#define WNI_CFG_DTIM_PERIOD_APMIN 0
+#define WNI_CFG_DTIM_PERIOD_APMAX 65535
+#define WNI_CFG_DTIM_PERIOD_APDEF 1
+
+#define WNI_CFG_WEP_KEY_LENGTH_STAMIN 5
+#define WNI_CFG_WEP_KEY_LENGTH_STAMAX 13
+#define WNI_CFG_WEP_KEY_LENGTH_STADEF 5
+
+#define WNI_CFG_WEP_KEY_LENGTH_APMIN 5
+#define WNI_CFG_WEP_KEY_LENGTH_APMAX 13
+#define WNI_CFG_WEP_KEY_LENGTH_APDEF 5
+
+#define WNI_CFG_WEP_KEY_LENGTH_5 5
+#define WNI_CFG_WEP_KEY_LENGTH_13 13
+
+#define WNI_CFG_WEP_DEFAULT_KEYID_STAMIN 0
+#define WNI_CFG_WEP_DEFAULT_KEYID_STAMAX 3
+#define WNI_CFG_WEP_DEFAULT_KEYID_STADEF 0
+
+#define WNI_CFG_WEP_DEFAULT_KEYID_APMIN 0
+#define WNI_CFG_WEP_DEFAULT_KEYID_APMAX 3
+#define WNI_CFG_WEP_DEFAULT_KEYID_APDEF 0
+
+#define WNI_CFG_WEP_DEFAULT_KEYID_0 0
+#define WNI_CFG_WEP_DEFAULT_KEYID_1 1
+#define WNI_CFG_WEP_DEFAULT_KEYID_2 2
+#define WNI_CFG_WEP_DEFAULT_KEYID_3 3
+
+#define WNI_CFG_EXCLUDE_UNENCRYPTED_STAMIN 0
+#define WNI_CFG_EXCLUDE_UNENCRYPTED_STAMAX 1
+#define WNI_CFG_EXCLUDE_UNENCRYPTED_STADEF 0
+
+#define WNI_CFG_EXCLUDE_UNENCRYPTED_APMIN 0
+#define WNI_CFG_EXCLUDE_UNENCRYPTED_APMAX 1
+#define WNI_CFG_EXCLUDE_UNENCRYPTED_APDEF 0
+
+#define WNI_CFG_RTS_THRESHOLD_STAMIN 0
+#define WNI_CFG_RTS_THRESHOLD_STAMAX 2347
+#define WNI_CFG_RTS_THRESHOLD_STADEF 2347
+
+#define WNI_CFG_RTS_THRESHOLD_APMIN 0
+#define WNI_CFG_RTS_THRESHOLD_APMAX 2347
+#define WNI_CFG_RTS_THRESHOLD_APDEF 2347
+
+#define WNI_CFG_SHORT_RETRY_LIMIT_STAMIN 0
+#define WNI_CFG_SHORT_RETRY_LIMIT_STAMAX 255
+#define WNI_CFG_SHORT_RETRY_LIMIT_STADEF 6
+
+#define WNI_CFG_SHORT_RETRY_LIMIT_APMIN 0
+#define WNI_CFG_SHORT_RETRY_LIMIT_APMAX 255
+#define WNI_CFG_SHORT_RETRY_LIMIT_APDEF 6
+
+#define WNI_CFG_LONG_RETRY_LIMIT_STAMIN 0
+#define WNI_CFG_LONG_RETRY_LIMIT_STAMAX 255
+#define WNI_CFG_LONG_RETRY_LIMIT_STADEF 6
+
+#define WNI_CFG_LONG_RETRY_LIMIT_APMIN 0
+#define WNI_CFG_LONG_RETRY_LIMIT_APMAX 255
+#define WNI_CFG_LONG_RETRY_LIMIT_APDEF 6
+
+#define WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN 256
+#define WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX 8000
+#define WNI_CFG_FRAGMENTATION_THRESHOLD_STADEF 8000
+
+#define WNI_CFG_FRAGMENTATION_THRESHOLD_APMIN 256
+#define WNI_CFG_FRAGMENTATION_THRESHOLD_APMAX 8000
+#define WNI_CFG_FRAGMENTATION_THRESHOLD_APDEF 8000
+
+#define WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME_STAMIN 0
+#define WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME_STAMAX 65535
+#define WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME_STADEF 20
+
+#define WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME_APMIN 0
+#define WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME_APMAX 65535
+#define WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME_APDEF 20
+
+#define WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME_STAMIN 0
+#define WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME_STAMAX 65535
+#define WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME_STADEF 40
+
+#define WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME_APMIN 0
+#define WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME_APMAX 65535
+#define WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME_APDEF 40
+
+#define WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME_STAMIN 0
+#define WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME_STAMAX 65535
+#define WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME_STADEF 60
+
+#define WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME_APMIN 0
+#define WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME_APMAX 65535
+#define WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME_APDEF 60
+
+#define WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME_STAMIN 0
+#define WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME_STAMAX 65535
+#define WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME_STADEF 110
+
+#define WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME_APMIN 0
+#define WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME_APMAX 65535
+#define WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME_APDEF 110
+
+#define WNI_CFG_JOIN_FAILURE_TIMEOUT_STAMIN 0
+#define WNI_CFG_JOIN_FAILURE_TIMEOUT_STAMAX 65535
+#define WNI_CFG_JOIN_FAILURE_TIMEOUT_STADEF 3000
+
+#define WNI_CFG_JOIN_FAILURE_TIMEOUT_APMIN 0
+#define WNI_CFG_JOIN_FAILURE_TIMEOUT_APMAX 65535
+#define WNI_CFG_JOIN_FAILURE_TIMEOUT_APDEF 3000
+
+#define WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT_STAMIN 0
+#define WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT_STAMAX 65535
+#define WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT_STADEF 1000
+
+#define WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT_APMIN 0
+#define WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT_APMAX 65535
+#define WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT_APDEF 1000
+
+#define WNI_CFG_AUTHENTICATE_RSP_TIMEOUT_STAMIN 0
+#define WNI_CFG_AUTHENTICATE_RSP_TIMEOUT_STAMAX 65535
+#define WNI_CFG_AUTHENTICATE_RSP_TIMEOUT_STADEF 1000
+
+#define WNI_CFG_AUTHENTICATE_RSP_TIMEOUT_APMIN 0
+#define WNI_CFG_AUTHENTICATE_RSP_TIMEOUT_APMAX 65535
+#define WNI_CFG_AUTHENTICATE_RSP_TIMEOUT_APDEF 1000
+
+#define WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT_STAMIN 0
+#define WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT_STAMAX 65535
+#define WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT_STADEF 2000
+
+#define WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT_APMIN 0
+#define WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT_APMAX 65535
+#define WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT_APDEF 3000
+
+#define WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT_STAMIN 0
+#define WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT_STAMAX 65535
+#define WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT_STADEF 2000
+
+#define WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT_APMIN 0
+#define WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT_APMAX 65535
+#define WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT_APDEF 3000
+
+#define WNI_CFG_RA_PERIODICITY_TIMEOUT_IN_PS_STAMIN 0
+#define WNI_CFG_RA_PERIODICITY_TIMEOUT_IN_PS_STAMAX 65535
+#define WNI_CFG_RA_PERIODICITY_TIMEOUT_IN_PS_STADEF 1000
+
+#define WNI_CFG_PS_ENABLE_BCN_FILTER_STAMIN 0
+#define WNI_CFG_PS_ENABLE_BCN_FILTER_STAMAX 1
+#define WNI_CFG_PS_ENABLE_BCN_FILTER_STADEF 1
+
+#define WNI_CFG_PS_ENABLE_HEART_BEAT_STAMIN 0
+#define WNI_CFG_PS_ENABLE_HEART_BEAT_STAMAX 1
+#define WNI_CFG_PS_ENABLE_HEART_BEAT_STADEF 1
+
+#define WNI_CFG_PS_ENABLE_RSSI_MONITOR_STAMIN 0
+#define WNI_CFG_PS_ENABLE_RSSI_MONITOR_STAMAX 1
+#define WNI_CFG_PS_ENABLE_RSSI_MONITOR_STADEF 0
+
+#define WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT_STAMIN 1
+#define WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT_STAMAX 255
+#define WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT_STADEF 20
+
+#define WNI_CFG_RF_SETTLING_TIME_CLK_STAMIN 0
+#define WNI_CFG_RF_SETTLING_TIME_CLK_STAMAX 60000
+#define WNI_CFG_RF_SETTLING_TIME_CLK_STADEF 1500
+
+#define WNI_CFG_PHY_MODE_STAMIN 0
+#define WNI_CFG_PHY_MODE_STAMAX 3
+#define WNI_CFG_PHY_MODE_STADEF 0
+
+#define WNI_CFG_PHY_MODE_APMIN 0
+#define WNI_CFG_PHY_MODE_APMAX 3
+#define WNI_CFG_PHY_MODE_APDEF 0
+
+#define WNI_CFG_PHY_MODE_11A 0
+#define WNI_CFG_PHY_MODE_11B 1
+#define WNI_CFG_PHY_MODE_11G 2
+#define WNI_CFG_PHY_MODE_NONE 3
+
+#define WNI_CFG_DOT11_MODE_STAMIN 0
+#define WNI_CFG_DOT11_MODE_STAMAX 9
+#define WNI_CFG_DOT11_MODE_STADEF 0
+
+#define WNI_CFG_DOT11_MODE_APMIN 0
+#define WNI_CFG_DOT11_MODE_APMAX 9
+#define WNI_CFG_DOT11_MODE_APDEF 0
+
+#define WNI_CFG_DOT11_MODE_ALL 0
+#define WNI_CFG_DOT11_MODE_11A 1
+#define WNI_CFG_DOT11_MODE_11B 2
+#define WNI_CFG_DOT11_MODE_11G 3
+#define WNI_CFG_DOT11_MODE_11N 4
+#define WNI_CFG_DOT11_MODE_POLARIS 5
+#define WNI_CFG_DOT11_MODE_TITAN 6
+#define WNI_CFG_DOT11_MODE_TAURUS 7
+#define WNI_CFG_DOT11_MODE_11G_ONLY 8
+#define WNI_CFG_DOT11_MODE_11N_ONLY 9
+
+#define WNI_CFG_LISTEN_INTERVAL_STAMIN 0
+#define WNI_CFG_LISTEN_INTERVAL_STAMAX 65535
+#define WNI_CFG_LISTEN_INTERVAL_STADEF 1
+
+#define WNI_CFG_LISTEN_INTERVAL_APMIN 0
+#define WNI_CFG_LISTEN_INTERVAL_APMAX 65535
+#define WNI_CFG_LISTEN_INTERVAL_APDEF 1
+
+#define WNI_CFG_CURRENT_CHANNEL_STAMIN 0
+#define WNI_CFG_CURRENT_CHANNEL_STAMAX 165
+#define WNI_CFG_CURRENT_CHANNEL_STADEF 1
+
+#define WNI_CFG_CURRENT_CHANNEL_APMIN 0
+#define WNI_CFG_CURRENT_CHANNEL_APMAX 165
+#define WNI_CFG_CURRENT_CHANNEL_APDEF 1
+
+#define WNI_CFG_DEFAULT_RATE_INDEX_5GHZ_STAMIN 0
+#define WNI_CFG_DEFAULT_RATE_INDEX_5GHZ_STAMAX 11
+#define WNI_CFG_DEFAULT_RATE_INDEX_5GHZ_STADEF 5
+
+#define WNI_CFG_DEFAULT_RATE_INDEX_5GHZ_APMIN 0
+#define WNI_CFG_DEFAULT_RATE_INDEX_5GHZ_APMAX 11
+#define WNI_CFG_DEFAULT_RATE_INDEX_5GHZ_APDEF 5
+
+#define WNI_CFG_DEFAULT_RATE_INDEX_24GHZ_STAMIN 0
+#define WNI_CFG_DEFAULT_RATE_INDEX_24GHZ_STAMAX 31
+#define WNI_CFG_DEFAULT_RATE_INDEX_24GHZ_STADEF 1
+
+#define WNI_CFG_DEFAULT_RATE_INDEX_24GHZ_APMIN 0
+#define WNI_CFG_DEFAULT_RATE_INDEX_24GHZ_APMAX 31
+#define WNI_CFG_DEFAULT_RATE_INDEX_24GHZ_APDEF 1
+
+#define WNI_CFG_RATE_ADAPTATION_TYPE_STAMIN 0
+#define WNI_CFG_RATE_ADAPTATION_TYPE_STAMAX 2
+#define WNI_CFG_RATE_ADAPTATION_TYPE_STADEF 1
+
+#define WNI_CFG_RATE_ADAPTATION_TYPE_APMIN 0
+#define WNI_CFG_RATE_ADAPTATION_TYPE_APMAX 2
+#define WNI_CFG_RATE_ADAPTATION_TYPE_APDEF 1
+
+#define WNI_CFG_RATE_ADAPTATION_TYPE_FIXED 0
+#define WNI_CFG_RATE_ADAPTATION_TYPE_AUTO 1
+#define WNI_CFG_RATE_ADAPTATION_TYPE_SNR_BASED 2
+
+#define WNI_CFG_FIXED_RATE_STAMIN 0
+#define WNI_CFG_FIXED_RATE_STAMAX 31
+#define WNI_CFG_FIXED_RATE_STADEF 0
+
+#define WNI_CFG_FIXED_RATE_APMIN 0
+#define WNI_CFG_FIXED_RATE_APMAX 31
+#define WNI_CFG_FIXED_RATE_APDEF 0
+
+#define WNI_CFG_FIXED_RATE_AUTO 0
+#define WNI_CFG_FIXED_RATE_1MBPS 1
+#define WNI_CFG_FIXED_RATE_2MBPS 2
+#define WNI_CFG_FIXED_RATE_5_5MBPS 3
+#define WNI_CFG_FIXED_RATE_11MBPS 4
+#define WNI_CFG_FIXED_RATE_6MBPS 5
+#define WNI_CFG_FIXED_RATE_9MBPS 6
+#define WNI_CFG_FIXED_RATE_12MBPS 7
+#define WNI_CFG_FIXED_RATE_18MBPS 8
+#define WNI_CFG_FIXED_RATE_24MBPS 9
+#define WNI_CFG_FIXED_RATE_36MBPS 10
+#define WNI_CFG_FIXED_RATE_48MBPS 11
+#define WNI_CFG_FIXED_RATE_54MBPS 12
+#define WNI_CFG_FIXED_RATE_6_5MBPS_MCS0_20MHZ_SIMO 13
+#define WNI_CFG_FIXED_RATE_13MBPS_MCS1_20MHZ_SIMO 14
+#define WNI_CFG_FIXED_RATE_19_5MBPS_MCS2_20MHZ_SIMO 15
+#define WNI_CFG_FIXED_RATE_26MBPS_MCS3_20MHZ_SIMO 16
+#define WNI_CFG_FIXED_RATE_39MBPS_MCS4_20MHZ_SIMO 17
+#define WNI_CFG_FIXED_RATE_52MBPS_MCS5_20MHZ_SIMO 18
+#define WNI_CFG_FIXED_RATE_58_5MBPS_MCS6_20MHZ_SIMO 19
+#define WNI_CFG_FIXED_RATE_65MBPS_MCS7_20MHZ_SIMO 20
+#define WNI_CFG_FIXED_RATE_7_2MBPS_MCS0_20MHZ_SIMO_SGI 21
+#define WNI_CFG_FIXED_RATE_14_4MBPS_MCS1_20MHZ_SIMO_SGI 22
+#define WNI_CFG_FIXED_RATE_21_7MBPS_MCS2_20MHZ_SIMO_SGI 23
+#define WNI_CFG_FIXED_RATE_28_9MBPS_MCS3_20MHZ_SIMO_SGI 24
+#define WNI_CFG_FIXED_RATE_43_3MBPS_MCS4_20MHZ_SIMO_SGI 25
+#define WNI_CFG_FIXED_RATE_57_8MBPS_MCS5_20MHZ_SIMO_SGI 26
+#define WNI_CFG_FIXED_RATE_65MBPS_MCS6_20MHZ_SIMO_SGI 27
+#define WNI_CFG_FIXED_RATE_72_2MBPS_MCS7_20MHZ_SIMO_SGI 28
+#define WNI_CFG_FIXED_RATE_0_25MBPS_SLR_20MHZ_SIMO 29
+#define WNI_CFG_FIXED_RATE_0_5MBPS_SLR_20MHZ_SIMO 30
+#define WNI_CFG_FIXED_RATE_68_25MBPS_QC_PROP_20MHZ_SIMO 31
+
+#define WNI_CFG_FIXED_RATE_MULTICAST_24GHZ_STAMIN 0
+#define WNI_CFG_FIXED_RATE_MULTICAST_24GHZ_STAMAX 31
+#define WNI_CFG_FIXED_RATE_MULTICAST_24GHZ_STADEF 1
+
+#define WNI_CFG_FIXED_RATE_MULTICAST_24GHZ_APMIN 0
+#define WNI_CFG_FIXED_RATE_MULTICAST_24GHZ_APMAX 31
+#define WNI_CFG_FIXED_RATE_MULTICAST_24GHZ_APDEF 1
+
+#define WNI_CFG_FIXED_RATE_MULTICAST_5GHZ_STAMIN 0
+#define WNI_CFG_FIXED_RATE_MULTICAST_5GHZ_STAMAX 31
+#define WNI_CFG_FIXED_RATE_MULTICAST_5GHZ_STADEF 5
+
+#define WNI_CFG_FIXED_RATE_MULTICAST_5GHZ_APMIN 0
+#define WNI_CFG_FIXED_RATE_MULTICAST_5GHZ_APMAX 31
+#define WNI_CFG_FIXED_RATE_MULTICAST_5GHZ_APDEF 5
+
+#define WNI_CFG_RETRYRATE_POLICY_STAMIN 0
+#define WNI_CFG_RETRYRATE_POLICY_STAMAX 255
+#define WNI_CFG_RETRYRATE_POLICY_STADEF 4
+
+#define WNI_CFG_RETRYRATE_POLICY_APMIN 0
+#define WNI_CFG_RETRYRATE_POLICY_APMAX 255
+#define WNI_CFG_RETRYRATE_POLICY_APDEF 4
+
+#define WNI_CFG_RETRYRATE_POLICY_MIN_SUPPORTED 0
+#define WNI_CFG_RETRYRATE_POLICY_PRIMARY 1
+#define WNI_CFG_RETRYRATE_POLICY_RESERVED 2
+#define WNI_CFG_RETRYRATE_POLICY_CLOSEST 3
+#define WNI_CFG_RETRYRATE_POLICY_AUTOSELECT 4
+#define WNI_CFG_RETRYRATE_POLICY_MAX 5
+
+#define WNI_CFG_RETRYRATE_SECONDARY_STAMIN 0
+#define WNI_CFG_RETRYRATE_SECONDARY_STAMAX 255
+#define WNI_CFG_RETRYRATE_SECONDARY_STADEF 0
+
+#define WNI_CFG_RETRYRATE_SECONDARY_APMIN 0
+#define WNI_CFG_RETRYRATE_SECONDARY_APMAX 255
+#define WNI_CFG_RETRYRATE_SECONDARY_APDEF 0
+
+#define WNI_CFG_RETRYRATE_TERTIARY_STAMIN 0
+#define WNI_CFG_RETRYRATE_TERTIARY_STAMAX 255
+#define WNI_CFG_RETRYRATE_TERTIARY_STADEF 0
+
+#define WNI_CFG_RETRYRATE_TERTIARY_APMIN 0
+#define WNI_CFG_RETRYRATE_TERTIARY_APMAX 255
+#define WNI_CFG_RETRYRATE_TERTIARY_APDEF 0
+
+#define WNI_CFG_APSD_ENABLED_STAMIN 0
+#define WNI_CFG_APSD_ENABLED_STAMAX 1
+#define WNI_CFG_APSD_ENABLED_STADEF 0
+
+#define WNI_CFG_APSD_ENABLED_APMIN 0
+#define WNI_CFG_APSD_ENABLED_APMAX 1
+#define WNI_CFG_APSD_ENABLED_APDEF 0
+
+#define WNI_CFG_SHARED_KEY_AUTH_ENABLE_STAMIN 0
+#define WNI_CFG_SHARED_KEY_AUTH_ENABLE_STAMAX 1
+#define WNI_CFG_SHARED_KEY_AUTH_ENABLE_STADEF 1
+
+#define WNI_CFG_SHARED_KEY_AUTH_ENABLE_APMIN 0
+#define WNI_CFG_SHARED_KEY_AUTH_ENABLE_APMAX 1
+#define WNI_CFG_SHARED_KEY_AUTH_ENABLE_APDEF 1
+
+#define WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE_STAMIN 0
+#define WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE_STAMAX 1
+#define WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE_STADEF 1
+
+#define WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE_APMIN 0
+#define WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE_APMAX 1
+#define WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE_APDEF 1
+
+#define WNI_CFG_AUTHENTICATION_TYPE_STAMIN 0
+#define WNI_CFG_AUTHENTICATION_TYPE_STAMAX 65535
+#define WNI_CFG_AUTHENTICATION_TYPE_STADEF 0
+
+#define WNI_CFG_AUTHENTICATION_TYPE_APMIN 0
+#define WNI_CFG_AUTHENTICATION_TYPE_APMAX 65535
+#define WNI_CFG_AUTHENTICATION_TYPE_APDEF 0
+
+#define WNI_CFG_CF_POLL_REQUEST_APMIN 0
+#define WNI_CFG_CF_POLL_REQUEST_APMAX 1
+#define WNI_CFG_CF_POLL_REQUEST_APDEF 0
+
+#define WNI_CFG_PRIVACY_ENABLED_STAMIN 0
+#define WNI_CFG_PRIVACY_ENABLED_STAMAX 1
+#define WNI_CFG_PRIVACY_ENABLED_STADEF 0
+
+#define WNI_CFG_PRIVACY_ENABLED_APMIN 0
+#define WNI_CFG_PRIVACY_ENABLED_APMAX 1
+#define WNI_CFG_PRIVACY_ENABLED_APDEF 0
+
+#define WNI_CFG_SHORT_PREAMBLE_STAMIN 0
+#define WNI_CFG_SHORT_PREAMBLE_STAMAX 1
+#define WNI_CFG_SHORT_PREAMBLE_STADEF 1
+
+#define WNI_CFG_SHORT_PREAMBLE_APMIN 0
+#define WNI_CFG_SHORT_PREAMBLE_APMAX 1
+#define WNI_CFG_SHORT_PREAMBLE_APDEF 1
+
+#define WNI_CFG_SHORT_SLOT_TIME_STAMIN 0
+#define WNI_CFG_SHORT_SLOT_TIME_STAMAX 1
+#define WNI_CFG_SHORT_SLOT_TIME_STADEF 1
+
+#define WNI_CFG_SHORT_SLOT_TIME_APMIN 0
+#define WNI_CFG_SHORT_SLOT_TIME_APMAX 1
+#define WNI_CFG_SHORT_SLOT_TIME_APDEF 0
+
+#define WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY_STAMIN 0
+#define WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY_STAMAX 1
+#define WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY_STADEF 0
+
+#define WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY_APMIN 0
+#define WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY_APMAX 1
+#define WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY_APDEF 0
+
+#define WNI_CFG_QOS_ENABLED_STAMIN 0
+#define WNI_CFG_QOS_ENABLED_STAMAX 1
+#define WNI_CFG_QOS_ENABLED_STADEF 0
+
+#define WNI_CFG_QOS_ENABLED_APMIN 0
+#define WNI_CFG_QOS_ENABLED_APMAX 1
+#define WNI_CFG_QOS_ENABLED_APDEF 0
+
+#define WNI_CFG_HCF_ENABLED_STAMIN 0
+#define WNI_CFG_HCF_ENABLED_STAMAX 1
+#define WNI_CFG_HCF_ENABLED_STADEF 0
+
+#define WNI_CFG_HCF_ENABLED_APMIN 0
+#define WNI_CFG_HCF_ENABLED_APMAX 1
+#define WNI_CFG_HCF_ENABLED_APDEF 0
+
+#define WNI_CFG_RSN_ENABLED_STAMIN 0
+#define WNI_CFG_RSN_ENABLED_STAMAX 1
+#define WNI_CFG_RSN_ENABLED_STADEF 0
+
+#define WNI_CFG_RSN_ENABLED_APMIN 0
+#define WNI_CFG_RSN_ENABLED_APMAX 1
+#define WNI_CFG_RSN_ENABLED_APDEF 0
+
+#define WNI_CFG_BACKGROUND_SCAN_PERIOD_STAMIN 0
+#define WNI_CFG_BACKGROUND_SCAN_PERIOD_STAMAX 180000
+#define WNI_CFG_BACKGROUND_SCAN_PERIOD_STADEF 5000
+
+#define WNI_CFG_BACKGROUND_SCAN_PERIOD_APMIN 0
+#define WNI_CFG_BACKGROUND_SCAN_PERIOD_APMAX 18000
+#define WNI_CFG_BACKGROUND_SCAN_PERIOD_APDEF 5000
+
+#define WNI_CFG_MAX_NUM_PRE_AUTH_STAMIN 0
+#define WNI_CFG_MAX_NUM_PRE_AUTH_STAMAX 256
+#define WNI_CFG_MAX_NUM_PRE_AUTH_STADEF 64
+
+#define WNI_CFG_MAX_NUM_PRE_AUTH_APMIN 0
+#define WNI_CFG_MAX_NUM_PRE_AUTH_APMAX 256
+#define WNI_CFG_MAX_NUM_PRE_AUTH_APDEF 64
+
+#define WNI_CFG_PREAUTH_CLNUP_TIMEOUT_APMIN 0
+#define WNI_CFG_PREAUTH_CLNUP_TIMEOUT_APMAX 120000
+#define WNI_CFG_PREAUTH_CLNUP_TIMEOUT_APDEF 30000
+
+#define WNI_CFG_RELEASE_AID_TIMEOUT_APMIN 0
+#define WNI_CFG_RELEASE_AID_TIMEOUT_APMAX 100000
+#define WNI_CFG_RELEASE_AID_TIMEOUT_APDEF 1000
+
+#define WNI_CFG_HEART_BEAT_THRESHOLD_STAMIN 0
+#define WNI_CFG_HEART_BEAT_THRESHOLD_STAMAX 65535
+#define WNI_CFG_HEART_BEAT_THRESHOLD_STADEF 40
+
+#define WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT_STAMIN 10
+#define WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT_STAMAX 10000
+#define WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT_STADEF 40
+
+#define WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT_APMIN 10
+#define WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT_APMAX 10000
+#define WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT_APDEF 40
+
+#define WNI_CFG_11D_ENABLED_STAMIN 0
+#define WNI_CFG_11D_ENABLED_STAMAX 1
+#define WNI_CFG_11D_ENABLED_STADEF 1
+
+#define WNI_CFG_11D_ENABLED_APMIN 0
+#define WNI_CFG_11D_ENABLED_APMAX 1
+#define WNI_CFG_11D_ENABLED_APDEF 0
+
+#define WNI_CFG_NETWORK_DENSITY_STAMIN 0
+#define WNI_CFG_NETWORK_DENSITY_STAMAX 3
+#define WNI_CFG_NETWORK_DENSITY_STADEF 3
+
+#define WNI_CFG_NETWORK_DENSITY_APMIN 0
+#define WNI_CFG_NETWORK_DENSITY_APMAX 3
+#define WNI_CFG_NETWORK_DENSITY_APDEF 0
+
+#define WNI_CFG_NETWORK_DENSITY_LOW 0
+#define WNI_CFG_NETWORK_DENSITY_MEDIUM 1
+#define WNI_CFG_NETWORK_DENSITY_HIGH 2
+#define WNI_CFG_NETWORK_DENSITY_ADAPTIVE 3
+
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_STAMIN 1
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_STAMAX 2
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_STADEF 2
+
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_APMIN 1
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_APMAX 2
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_APDEF 2
+
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_CARRIER 1
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_CORRELATION 2
+
+#define WNI_CFG_CURRENT_TX_ANTENNA_STAMIN 1
+#define WNI_CFG_CURRENT_TX_ANTENNA_STAMAX 1
+#define WNI_CFG_CURRENT_TX_ANTENNA_STADEF 1
+
+#define WNI_CFG_CURRENT_TX_ANTENNA_APMIN 1
+#define WNI_CFG_CURRENT_TX_ANTENNA_APMAX 2
+#define WNI_CFG_CURRENT_TX_ANTENNA_APDEF 2
+
+#define WNI_CFG_CURRENT_RX_ANTENNA_STAMIN 1
+#define WNI_CFG_CURRENT_RX_ANTENNA_STAMAX 2
+#define WNI_CFG_CURRENT_RX_ANTENNA_STADEF 2
+
+#define WNI_CFG_CURRENT_RX_ANTENNA_APMIN 1
+#define WNI_CFG_CURRENT_RX_ANTENNA_APMAX 3
+#define WNI_CFG_CURRENT_RX_ANTENNA_APDEF 3
+
+#define WNI_CFG_CURRENT_TX_POWER_LEVEL_STAMIN 0
+#define WNI_CFG_CURRENT_TX_POWER_LEVEL_STAMAX 128
+#define WNI_CFG_CURRENT_TX_POWER_LEVEL_STADEF 27
+
+#define WNI_CFG_CURRENT_TX_POWER_LEVEL_APMIN 0
+#define WNI_CFG_CURRENT_TX_POWER_LEVEL_APMAX 128
+#define WNI_CFG_CURRENT_TX_POWER_LEVEL_APDEF 27
+
+#define WNI_CFG_POWER_STATE_PER_CHAIN_STAMIN 0
+#define WNI_CFG_POWER_STATE_PER_CHAIN_STAMAX 65535
+#define WNI_CFG_POWER_STATE_PER_CHAIN_STADEF 785
+
+#define WNI_CFG_POWER_STATE_PER_CHAIN_APMIN 0
+#define WNI_CFG_POWER_STATE_PER_CHAIN_APMAX 65535
+#define WNI_CFG_POWER_STATE_PER_CHAIN_APDEF 785
+
+#define WNI_CFG_POWER_STATE_PER_CHAIN_OFF 0
+#define WNI_CFG_POWER_STATE_PER_CHAIN_ON 1
+#define WNI_CFG_POWER_STATE_PER_CHAIN_TX 2
+#define WNI_CFG_POWER_STATE_PER_CHAIN_RX 3
+#define WNI_CFG_POWER_STATE_PER_CHAIN_MASK 15
+#define WNI_CFG_POWER_STATE_PER_CHAIN_CHAIN_0_OFFSET 0
+#define WNI_CFG_POWER_STATE_PER_CHAIN_CHAIN_1_OFFSET 4
+#define WNI_CFG_POWER_STATE_PER_CHAIN_CHAIN_2_OFFSET 8
+
+#define WNI_CFG_NEW_BSS_FOUND_IND_STAMIN 0
+#define WNI_CFG_NEW_BSS_FOUND_IND_STAMAX 1
+#define WNI_CFG_NEW_BSS_FOUND_IND_STADEF 0
+
+#define WNI_CFG_NEW_BSS_FOUND_IND_APMIN 0
+#define WNI_CFG_NEW_BSS_FOUND_IND_APMAX 1
+#define WNI_CFG_NEW_BSS_FOUND_IND_APDEF 0
+
+#define WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED_STAMIN 0
+#define WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED_STAMAX 1
+#define WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED_STADEF 0
+
+#define WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED_APMIN 0
+#define WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED_APMAX 1
+#define WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED_APDEF 0
+
+#define WNI_CFG_PROPRIETARY_RATES_ENABLED_STAMIN 0
+#define WNI_CFG_PROPRIETARY_RATES_ENABLED_STAMAX 1
+#define WNI_CFG_PROPRIETARY_RATES_ENABLED_STADEF 0
+
+#define WNI_CFG_PROPRIETARY_RATES_ENABLED_APMIN 0
+#define WNI_CFG_PROPRIETARY_RATES_ENABLED_APMAX 1
+#define WNI_CFG_PROPRIETARY_RATES_ENABLED_APDEF 0
+
+#define WNI_CFG_11H_ENABLED_STAMIN 0
+#define WNI_CFG_11H_ENABLED_STAMAX 1
+#define WNI_CFG_11H_ENABLED_STADEF 1
+
+#define WNI_CFG_11H_ENABLED_APMIN 0
+#define WNI_CFG_11H_ENABLED_APMAX 1
+#define WNI_CFG_11H_ENABLED_APDEF 1
+
+#define WNI_CFG_WT_CNF_TIMEOUT_STAMIN 10
+#define WNI_CFG_WT_CNF_TIMEOUT_STAMAX 3000
+#define WNI_CFG_WT_CNF_TIMEOUT_STADEF 1000
+
+#define WNI_CFG_WT_CNF_TIMEOUT_APMIN 10
+#define WNI_CFG_WT_CNF_TIMEOUT_APMAX 3000
+#define WNI_CFG_WT_CNF_TIMEOUT_APDEF 1000
+
+#define WNI_CFG_KEEPALIVE_TIMEOUT_STAMIN 0
+#define WNI_CFG_KEEPALIVE_TIMEOUT_STAMAX 3600000
+#define WNI_CFG_KEEPALIVE_TIMEOUT_STADEF 0
+
+#define WNI_CFG_KEEPALIVE_TIMEOUT_APMIN 0
+#define WNI_CFG_KEEPALIVE_TIMEOUT_APMAX 3600000
+#define WNI_CFG_KEEPALIVE_TIMEOUT_APDEF 3000
+
+#define WNI_CFG_PROXIMITY_STAMIN 0
+#define WNI_CFG_PROXIMITY_STAMAX 1
+#define WNI_CFG_PROXIMITY_STADEF 0
+
+#define WNI_CFG_PROXIMITY_APMIN 0
+#define WNI_CFG_PROXIMITY_APMAX 1
+#define WNI_CFG_PROXIMITY_APDEF 0
+
+#define WNI_CFG_PROXIMITY_OFF 0
+#define WNI_CFG_PROXIMITY_ON 1
+
+#define WNI_CFG_LOG_LEVEL_STAMIN 0
+#define WNI_CFG_LOG_LEVEL_STAMAX 7
+#define WNI_CFG_LOG_LEVEL_STADEF 3
+
+#define WNI_CFG_LOG_LEVEL_APMIN 0
+#define WNI_CFG_LOG_LEVEL_APMAX 7
+#define WNI_CFG_LOG_LEVEL_APDEF 3
+
+#define WNI_CFG_OLBC_DETECT_TIMEOUT_STAMIN 1000
+#define WNI_CFG_OLBC_DETECT_TIMEOUT_STAMAX 30000
+#define WNI_CFG_OLBC_DETECT_TIMEOUT_STADEF 10000
+
+#define WNI_CFG_OLBC_DETECT_TIMEOUT_APMIN 1000
+#define WNI_CFG_OLBC_DETECT_TIMEOUT_APMAX 30000
+#define WNI_CFG_OLBC_DETECT_TIMEOUT_APDEF 10000
+
+#define WNI_CFG_PROTECTION_ENABLED_STAMIN 0
+#define WNI_CFG_PROTECTION_ENABLED_STAMAX 65535
+#define WNI_CFG_PROTECTION_ENABLED_STADEF 65535
+
+#define WNI_CFG_PROTECTION_ENABLED_APMIN 0
+#define WNI_CFG_PROTECTION_ENABLED_APMAX 65535
+#define WNI_CFG_PROTECTION_ENABLED_APDEF 65535
+
+#define WNI_CFG_PROTECTION_ENABLED_FROM_llA 0
+#define WNI_CFG_PROTECTION_ENABLED_FROM_llB 1
+#define WNI_CFG_PROTECTION_ENABLED_FROM_llG 2
+#define WNI_CFG_PROTECTION_ENABLED_HT_20 3
+#define WNI_CFG_PROTECTION_ENABLED_NON_GF 4
+#define WNI_CFG_PROTECTION_ENABLED_LSIG_TXOP 5
+#define WNI_CFG_PROTECTION_ENABLED_RIFS 6
+#define WNI_CFG_PROTECTION_ENABLED_OBSS 7
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_FROM_llA 8
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_FROM_llB 9
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_FROM_llG 10
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_HT20 11
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_NON_GF 12
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_LSIG_TXOP 13
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_RIFS 14
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_OBSS 15
+
+#define WNI_CFG_11G_PROTECTION_ALWAYS_STAMIN 0
+#define WNI_CFG_11G_PROTECTION_ALWAYS_STAMAX 1
+#define WNI_CFG_11G_PROTECTION_ALWAYS_STADEF 0
+
+#define WNI_CFG_11G_PROTECTION_ALWAYS_APMIN 0
+#define WNI_CFG_11G_PROTECTION_ALWAYS_APMAX 1
+#define WNI_CFG_11G_PROTECTION_ALWAYS_APDEF 0
+
+#define WNI_CFG_FORCE_POLICY_PROTECTION_STAMIN 0
+#define WNI_CFG_FORCE_POLICY_PROTECTION_STAMAX 5
+#define WNI_CFG_FORCE_POLICY_PROTECTION_STADEF 5
+
+#define WNI_CFG_FORCE_POLICY_PROTECTION_APMIN 0
+#define WNI_CFG_FORCE_POLICY_PROTECTION_APMAX 5
+#define WNI_CFG_FORCE_POLICY_PROTECTION_APDEF 5
+
+#define WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE 0
+#define WNI_CFG_FORCE_POLICY_PROTECTION_CTS 1
+#define WNI_CFG_FORCE_POLICY_PROTECTION_RTS 2
+#define WNI_CFG_FORCE_POLICY_PROTECTION_DUAL_CTS 3
+#define WNI_CFG_FORCE_POLICY_PROTECTION_RTS_ALWAYS 4
+#define WNI_CFG_FORCE_POLICY_PROTECTION_AUTO 5
+
+#define WNI_CFG_11G_SHORT_PREAMBLE_ENABLED_STAMIN 0
+#define WNI_CFG_11G_SHORT_PREAMBLE_ENABLED_STAMAX 1
+#define WNI_CFG_11G_SHORT_PREAMBLE_ENABLED_STADEF 0
+
+#define WNI_CFG_11G_SHORT_PREAMBLE_ENABLED_APMIN 0
+#define WNI_CFG_11G_SHORT_PREAMBLE_ENABLED_APMAX 1
+#define WNI_CFG_11G_SHORT_PREAMBLE_ENABLED_APDEF 0
+
+#define WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED_STAMIN 0
+#define WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED_STAMAX 1
+#define WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED_STADEF 1
+
+#define WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED_APMIN 0
+#define WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED_APMAX 1
+#define WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED_APDEF 1
+
+#define WNI_CFG_CAL_PERIOD_STAMIN 2
+#define WNI_CFG_CAL_PERIOD_STAMAX 10
+#define WNI_CFG_CAL_PERIOD_STADEF 5
+
+#define WNI_CFG_CAL_PERIOD_APMIN 2
+#define WNI_CFG_CAL_PERIOD_APMAX 10
+#define WNI_CFG_CAL_PERIOD_APDEF 5
+
+#define WNI_CFG_STATS_PERIOD_STAMIN 1
+#define WNI_CFG_STATS_PERIOD_STAMAX 10
+#define WNI_CFG_STATS_PERIOD_STADEF 10
+
+#define WNI_CFG_STATS_PERIOD_APMIN 1
+#define WNI_CFG_STATS_PERIOD_APMAX 10
+#define WNI_CFG_STATS_PERIOD_APDEF 10
+
+#define WNI_CFG_CAL_CONTROL_STAMIN 0
+#define WNI_CFG_CAL_CONTROL_STAMAX 1
+#define WNI_CFG_CAL_CONTROL_STADEF 0
+
+#define WNI_CFG_CAL_CONTROL_APMIN 0
+#define WNI_CFG_CAL_CONTROL_APMAX 1
+#define WNI_CFG_CAL_CONTROL_APDEF 0
+
+#define WNI_CFG_CAL_CONTROL_CAL_ON 0
+#define WNI_CFG_CAL_CONTROL_CAL_OFF 1
+
+#define WNI_CFG_11G_ONLY_POLICY_STAMIN 0
+#define WNI_CFG_11G_ONLY_POLICY_STAMAX 1
+#define WNI_CFG_11G_ONLY_POLICY_STADEF 0
+
+#define WNI_CFG_11G_ONLY_POLICY_APMIN 0
+#define WNI_CFG_11G_ONLY_POLICY_APMAX 1
+#define WNI_CFG_11G_ONLY_POLICY_APDEF 0
+
+#define WNI_CFG_PACKET_CLASSIFICATION_STAMIN 0
+#define WNI_CFG_PACKET_CLASSIFICATION_STAMAX 3
+#define WNI_CFG_PACKET_CLASSIFICATION_STADEF 0
+
+#define WNI_CFG_PACKET_CLASSIFICATION_APMIN 0
+#define WNI_CFG_PACKET_CLASSIFICATION_APMAX 3
+#define WNI_CFG_PACKET_CLASSIFICATION_APDEF 0
+
+#define WNI_CFG_PACKET_CLASSIFICATION_DISABLED 0
+#define WNI_CFG_PACKET_CLASSIFICATION_DSCP 1
+#define WNI_CFG_PACKET_CLASSIFICATION_8021P 2
+#define WNI_CFG_PACKET_CLASSIFICATION_ALL 3
+
+#define WNI_CFG_WME_ENABLED_STAMIN 0
+#define WNI_CFG_WME_ENABLED_STAMAX 1
+#define WNI_CFG_WME_ENABLED_STADEF 1
+
+#define WNI_CFG_WME_ENABLED_APMIN 0
+#define WNI_CFG_WME_ENABLED_APMAX 1
+#define WNI_CFG_WME_ENABLED_APDEF 1
+
+#define WNI_CFG_ADDTS_RSP_TIMEOUT_STAMIN 0
+#define WNI_CFG_ADDTS_RSP_TIMEOUT_STAMAX 65535
+#define WNI_CFG_ADDTS_RSP_TIMEOUT_STADEF 1000
+
+#define WNI_CFG_ADDTS_RSP_TIMEOUT_APMIN 0
+#define WNI_CFG_ADDTS_RSP_TIMEOUT_APMAX 65535
+#define WNI_CFG_ADDTS_RSP_TIMEOUT_APDEF 1000
+
+#define WNI_CFG_MAX_SP_LENGTH_STAMIN 0
+#define WNI_CFG_MAX_SP_LENGTH_STAMAX 3
+#define WNI_CFG_MAX_SP_LENGTH_STADEF 0
+
+#define WNI_CFG_MAX_SP_LENGTH_APMIN 0
+#define WNI_CFG_MAX_SP_LENGTH_APMAX 3
+#define WNI_CFG_MAX_SP_LENGTH_APDEF 0
+
+#define WNI_CFG_KEEP_ALIVE_STA_LIMIT_THRESHOLD_APMIN 0
+#define WNI_CFG_KEEP_ALIVE_STA_LIMIT_THRESHOLD_APMAX 32
+#define WNI_CFG_KEEP_ALIVE_STA_LIMIT_THRESHOLD_APDEF 0
+
+#define WNI_CFG_SEND_SINGLE_SSID_ALWAYS_STAMIN 0
+#define WNI_CFG_SEND_SINGLE_SSID_ALWAYS_STAMAX 1
+#define WNI_CFG_SEND_SINGLE_SSID_ALWAYS_STADEF 0
+
+#define WNI_CFG_SEND_SINGLE_SSID_ALWAYS_APMIN 0
+#define WNI_CFG_SEND_SINGLE_SSID_ALWAYS_APMAX 1
+#define WNI_CFG_SEND_SINGLE_SSID_ALWAYS_APDEF 0
+
+#define WNI_CFG_WSM_ENABLED_STAMIN 0
+#define WNI_CFG_WSM_ENABLED_STAMAX 1
+#define WNI_CFG_WSM_ENABLED_STADEF 0
+
+#define WNI_CFG_WSM_ENABLED_APMIN 0
+#define WNI_CFG_WSM_ENABLED_APMAX 1
+#define WNI_CFG_WSM_ENABLED_APDEF 0
+
+#define WNI_CFG_PROP_CAPABILITY_STAMIN 0
+#define WNI_CFG_PROP_CAPABILITY_STAMAX 65535
+#define WNI_CFG_PROP_CAPABILITY_STADEF 57535
+
+#define WNI_CFG_PROP_CAPABILITY_APMIN 0
+#define WNI_CFG_PROP_CAPABILITY_APMAX 65535
+#define WNI_CFG_PROP_CAPABILITY_APDEF 49321
+
+#define WNI_CFG_PROP_CAPABILITY_HCF 0
+#define WNI_CFG_PROP_CAPABILITY_11EQOS 1
+#define WNI_CFG_PROP_CAPABILITY_WME 2
+#define WNI_CFG_PROP_CAPABILITY_WSM 3
+#define WNI_CFG_PROP_CAPABILITY_EXTRATES 4
+#define WNI_CFG_PROP_CAPABILITY_EXTRATE_STOP 5
+#define WNI_CFG_PROP_CAPABILITY_TITAN 6
+#define WNI_CFG_PROP_CAPABILITY_TAURUS 7
+#define WNI_CFG_PROP_CAPABILITY_EDCAPARAMS 13
+#define WNI_CFG_PROP_CAPABILITY_LOADINFO 14
+#define WNI_CFG_PROP_CAPABILITY_VERSION 15
+#define WNI_CFG_PROP_CAPABILITY_MAXBITOFFSET 15
+
+#define WNI_CFG_EDCA_PROFILE_STAMIN 0
+#define WNI_CFG_EDCA_PROFILE_STAMAX 255
+#define WNI_CFG_EDCA_PROFILE_STADEF 1
+
+#define WNI_CFG_EDCA_PROFILE_APMIN 0
+#define WNI_CFG_EDCA_PROFILE_APMAX 255
+#define WNI_CFG_EDCA_PROFILE_APDEF 1
+
+#define WNI_CFG_EDCA_PROFILE_ANI 0
+#define WNI_CFG_EDCA_PROFILE_WMM 1
+#define WNI_CFG_EDCA_PROFILE_TIT_DEMO 2
+#define WNI_CFG_EDCA_PROFILE_MAX 3
+#define WNI_CFG_EDCA_PROFILE_ACM_IDX 0
+#define WNI_CFG_EDCA_PROFILE_AIFSN_IDX 1
+#define WNI_CFG_EDCA_PROFILE_CWMINA_IDX 2
+#define WNI_CFG_EDCA_PROFILE_CWMAXA_IDX 4
+#define WNI_CFG_EDCA_PROFILE_TXOPA_IDX 6
+#define WNI_CFG_EDCA_PROFILE_CWMINB_IDX 7
+#define WNI_CFG_EDCA_PROFILE_CWMAXB_IDX 9
+#define WNI_CFG_EDCA_PROFILE_TXOPB_IDX 11
+#define WNI_CFG_EDCA_PROFILE_CWMING_IDX 12
+#define WNI_CFG_EDCA_PROFILE_CWMAXG_IDX 14
+#define WNI_CFG_EDCA_PROFILE_TXOPG_IDX 16
+
+#define WNI_CFG_RDET_FLAG_STAMIN 0
+#define WNI_CFG_RDET_FLAG_STAMAX 1
+#define WNI_CFG_RDET_FLAG_STADEF 0
+
+#define WNI_CFG_RDET_FLAG_APMIN 0
+#define WNI_CFG_RDET_FLAG_APMAX 1
+#define WNI_CFG_RDET_FLAG_APDEF 0
+
+#define WNI_CFG_RDET_FLAG_ENABLE 1
+#define WNI_CFG_RDET_FLAG_DISABLE 0
+
+#define WNI_CFG_LOCAL_POWER_CONSTRAINT_STAMIN 0
+#define WNI_CFG_LOCAL_POWER_CONSTRAINT_STAMAX 255
+#define WNI_CFG_LOCAL_POWER_CONSTRAINT_STADEF 0
+
+#define WNI_CFG_LOCAL_POWER_CONSTRAINT_APMIN 0
+#define WNI_CFG_LOCAL_POWER_CONSTRAINT_APMAX 255
+#define WNI_CFG_LOCAL_POWER_CONSTRAINT_APDEF 0
+
+#define WNI_CFG_ADMIT_POLICY_STAMIN 0
+#define WNI_CFG_ADMIT_POLICY_STAMAX 2
+#define WNI_CFG_ADMIT_POLICY_STADEF 0
+
+#define WNI_CFG_ADMIT_POLICY_APMIN 0
+#define WNI_CFG_ADMIT_POLICY_APMAX 2
+#define WNI_CFG_ADMIT_POLICY_APDEF 0
+
+#define WNI_CFG_ADMIT_POLICY_ADMIT_ALL 0
+#define WNI_CFG_ADMIT_POLICY_REJECT_ALL 1
+#define WNI_CFG_ADMIT_POLICY_BW_FACTOR 2
+
+#define WNI_CFG_ADMIT_BWFACTOR_STAMIN 0
+#define WNI_CFG_ADMIT_BWFACTOR_STAMAX 100
+#define WNI_CFG_ADMIT_BWFACTOR_STADEF 20
+
+#define WNI_CFG_ADMIT_BWFACTOR_APMIN 0
+#define WNI_CFG_ADMIT_BWFACTOR_APMAX 100
+#define WNI_CFG_ADMIT_BWFACTOR_APDEF 20
+
+#define WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE_STAMIN 0
+#define WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE_STAMAX 256
+#define WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE_STADEF 60
+
+#define WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE_APMIN 0
+#define WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE_APMAX 256
+#define WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE_APDEF 60
+
+#define WNI_CFG_CHANNEL_BONDING_MODE_STAMIN 0
+#define WNI_CFG_CHANNEL_BONDING_MODE_STAMAX 4
+#define WNI_CFG_CHANNEL_BONDING_MODE_STADEF 0
+
+#define WNI_CFG_CHANNEL_BONDING_MODE_APMIN 0
+#define WNI_CFG_CHANNEL_BONDING_MODE_APMAX 4
+#define WNI_CFG_CHANNEL_BONDING_MODE_APDEF 0
+
+#define WNI_CFG_CHANNEL_BONDING_MODE_DISABLE 0
+#define WNI_CFG_CHANNEL_BONDING_MODE_ENABLE 1
+#define WNI_CFG_CHANNEL_BONDING_MODE_IF_NO_LEGACY_BSS 2
+#define WNI_CFG_CHANNEL_BONDING_MODE_IF_NO_LEGACY_ALL 3
+#define WNI_CFG_CHANNEL_BONDING_MODE_INTELLIGENT 4
+
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_STAMIN 0
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_STAMAX 2
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_STADEF 0
+
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_APMIN 0
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_APMAX 2
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_APDEF 0
+
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_NONE 0
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_LOWER 1
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_HIGHER 2
+
+#define WNI_CFG_DYNAMIC_THRESHOLD_ZERO_STAMIN 0
+#define WNI_CFG_DYNAMIC_THRESHOLD_ZERO_STAMAX 255
+#define WNI_CFG_DYNAMIC_THRESHOLD_ZERO_STADEF 2
+
+#define WNI_CFG_DYNAMIC_THRESHOLD_ZERO_APMIN 0
+#define WNI_CFG_DYNAMIC_THRESHOLD_ZERO_APMAX 255
+#define WNI_CFG_DYNAMIC_THRESHOLD_ZERO_APDEF 2
+
+#define WNI_CFG_DYNAMIC_THRESHOLD_ONE_STAMIN 0
+#define WNI_CFG_DYNAMIC_THRESHOLD_ONE_STAMAX 255
+#define WNI_CFG_DYNAMIC_THRESHOLD_ONE_STADEF 4
+
+#define WNI_CFG_DYNAMIC_THRESHOLD_ONE_APMIN 0
+#define WNI_CFG_DYNAMIC_THRESHOLD_ONE_APMAX 255
+#define WNI_CFG_DYNAMIC_THRESHOLD_ONE_APDEF 4
+
+#define WNI_CFG_DYNAMIC_THRESHOLD_TWO_STAMIN 0
+#define WNI_CFG_DYNAMIC_THRESHOLD_TWO_STAMAX 255
+#define WNI_CFG_DYNAMIC_THRESHOLD_TWO_STADEF 6
+
+#define WNI_CFG_DYNAMIC_THRESHOLD_TWO_APMIN 0
+#define WNI_CFG_DYNAMIC_THRESHOLD_TWO_APMAX 255
+#define WNI_CFG_DYNAMIC_THRESHOLD_TWO_APDEF 6
+
+#define WNI_CFG_TRIG_STA_BK_SCAN_STAMIN 0
+#define WNI_CFG_TRIG_STA_BK_SCAN_STAMAX 1
+#define WNI_CFG_TRIG_STA_BK_SCAN_STADEF 0
+
+#define WNI_CFG_TRIG_STA_BK_SCAN_APMIN 0
+#define WNI_CFG_TRIG_STA_BK_SCAN_APMAX 1
+#define WNI_CFG_TRIG_STA_BK_SCAN_APDEF 1
+
+#define WNI_CFG_DYNAMIC_PROFILE_SWITCHING_STAMIN 0
+#define WNI_CFG_DYNAMIC_PROFILE_SWITCHING_STAMAX 255
+#define WNI_CFG_DYNAMIC_PROFILE_SWITCHING_STADEF 255
+
+#define WNI_CFG_DYNAMIC_PROFILE_SWITCHING_APMIN 0
+#define WNI_CFG_DYNAMIC_PROFILE_SWITCHING_APMAX 255
+#define WNI_CFG_DYNAMIC_PROFILE_SWITCHING_APDEF 1
+
+#define WNI_CFG_DYNAMIC_PROFILE_SWITCHING_UNUSED 255
+
+#define WNI_CFG_MIMO_ENABLED_STAMIN 0
+#define WNI_CFG_MIMO_ENABLED_STAMAX 1
+#define WNI_CFG_MIMO_ENABLED_STADEF 1
+
+#define WNI_CFG_MIMO_ENABLED_APMIN 0
+#define WNI_CFG_MIMO_ENABLED_APMAX 1
+#define WNI_CFG_MIMO_ENABLED_APDEF 1
+
+#define WNI_CFG_MIMO_ENABLED_ENABLE 1
+#define WNI_CFG_MIMO_ENABLED_DISABLE 0
+
+#define WNI_CFG_BLOCK_ACK_ENABLED_STAMIN 0
+#define WNI_CFG_BLOCK_ACK_ENABLED_STAMAX 3
+#define WNI_CFG_BLOCK_ACK_ENABLED_STADEF 0
+
+#define WNI_CFG_BLOCK_ACK_ENABLED_APMIN 0
+#define WNI_CFG_BLOCK_ACK_ENABLED_APMAX 3
+#define WNI_CFG_BLOCK_ACK_ENABLED_APDEF 0
+
+#define WNI_CFG_BLOCK_ACK_ENABLED_DELAYED 0
+#define WNI_CFG_BLOCK_ACK_ENABLED_IMMEDIATE 1
+
+#define WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT_STAMIN 0
+#define WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT_STAMAX 65535
+#define WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT_STADEF 1000
+
+#define WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT_APMIN 0
+#define WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT_APMAX 65535
+#define WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT_APDEF 1000
+
+#define WNI_CFG_HT_RX_STBC_STAMIN 0
+#define WNI_CFG_HT_RX_STBC_STAMAX 3
+#define WNI_CFG_HT_RX_STBC_STADEF 1
+
+#define WNI_CFG_HT_RX_STBC_APMIN 0
+#define WNI_CFG_HT_RX_STBC_APMAX 3
+#define WNI_CFG_HT_RX_STBC_APDEF 1
+
+#define WNI_CFG_HT_CAP_INFO_STAMIN 0
+#define WNI_CFG_HT_CAP_INFO_STAMAX 65535
+#define WNI_CFG_HT_CAP_INFO_STADEF 364
+
+#define WNI_CFG_HT_CAP_INFO_APMIN 0
+#define WNI_CFG_HT_CAP_INFO_APMAX 65535
+#define WNI_CFG_HT_CAP_INFO_APDEF 4206
+
+#define WNI_CFG_HT_CAP_INFO_ADVANCE_CODING 0
+#define WNI_CFG_HT_CAP_INFO_SUPPORTED_CHAN_WIDTH_SET 1
+#define WNI_CFG_HT_CAP_INFO_SM_POWER_SAVE 2
+#define WNI_CFG_HT_CAP_INFO_GREEN_FIELD 4
+#define WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ 5
+#define WNI_CFG_HT_CAP_INFO_SHORT_GI_40MHZ 6
+#define WNI_CFG_HT_CAP_INFO_TX_STBC 7
+#define WNI_CFG_HT_CAP_INFO_RX_STBC 8
+#define WNI_CFG_HT_CAP_INFO_DELAYED_BA 10
+#define WNI_CFG_HT_CAP_INFO_MAX_AMSDU_SIZE 11
+#define WNI_CFG_HT_CAP_INFO_DSSS_CCK_MODE_40MHZ 12
+#define WNI_CFG_HT_CAP_INFO_PSMP 13
+#define WNI_CFG_HT_CAP_INFO_STBC_CONTROL_FRAME 14
+#define WNI_CFG_HT_CAP_INFO_LSIG_TXOP_PROTECTION 15
+
+#define WNI_CFG_HT_AMPDU_PARAMS_STAMIN 0
+#define WNI_CFG_HT_AMPDU_PARAMS_STAMAX 255
+#define WNI_CFG_HT_AMPDU_PARAMS_STADEF 0
+
+#define WNI_CFG_HT_AMPDU_PARAMS_APMIN 0
+#define WNI_CFG_HT_AMPDU_PARAMS_APMAX 255
+#define WNI_CFG_HT_AMPDU_PARAMS_APDEF 2
+
+#define WNI_CFG_HT_AMPDU_PARAMS_MAX_RX_AMPDU_FACTOR 0
+#define WNI_CFG_HT_AMPDU_PARAMS_MPDU_DENSITY 2
+#define WNI_CFG_HT_AMPDU_PARAMS_RESERVED 5
+
+#define WNI_CFG_EXT_HT_CAP_INFO_STAMIN 0
+#define WNI_CFG_EXT_HT_CAP_INFO_STAMAX 65535
+#define WNI_CFG_EXT_HT_CAP_INFO_STADEF 1024
+
+#define WNI_CFG_EXT_HT_CAP_INFO_APMIN 0
+#define WNI_CFG_EXT_HT_CAP_INFO_APMAX 65535
+#define WNI_CFG_EXT_HT_CAP_INFO_APDEF 1024
+
+#define WNI_CFG_EXT_HT_CAP_INFO_PCO 0
+#define WNI_CFG_EXT_HT_CAP_INFO_TRANSITION_TIME 1
+#define WNI_CFG_EXT_HT_CAP_INFO_RESERVED1 3
+#define WNI_CFG_EXT_HT_CAP_INFO_MCS_FEEDBACK 8
+#define WNI_CFG_EXT_HT_CAP_INFO_HTC_SUPPORT 10
+#define WNI_CFG_EXT_HT_CAP_INFO_RD_RESPONDER 11
+#define WNI_CFG_EXT_HT_CAP_INFO_RESERVED2 12
+
+#define WNI_CFG_TX_BF_CAP_STAMIN 0
+#define WNI_CFG_TX_BF_CAP_STAMAX 4294967295
+#define WNI_CFG_TX_BF_CAP_STADEF 0
+
+#define WNI_CFG_TX_BF_CAP_APMIN 0
+#define WNI_CFG_TX_BF_CAP_APMAX 4294967295
+#define WNI_CFG_TX_BF_CAP_APDEF 0
+
+#define WNI_CFG_AS_CAP_STAMIN 0
+#define WNI_CFG_AS_CAP_STAMAX 255
+#define WNI_CFG_AS_CAP_STADEF 0
+
+#define WNI_CFG_AS_CAP_APMIN 0
+#define WNI_CFG_AS_CAP_APMAX 255
+#define WNI_CFG_AS_CAP_APDEF 0
+
+#define WNI_CFG_AS_CAP_ANTENNA_SELECTION 0
+#define WNI_CFG_AS_CAP_EXPLICIT_CSI_FEEDBACK_TX 1
+#define WNI_CFG_AS_CAP_ANTENNA_INDICES_FEEDBACK_TX 2
+#define WNI_CFG_AS_CAP_EXPLICIT_CSI_FEEDBACK 3
+#define WNI_CFG_AS_CAP_ANTENNA_INDICES_FEEDBACK 4
+#define WNI_CFG_AS_CAP_RX_AS 5
+#define WNI_CFG_AS_CAP_TX_SOUNDING_PPDUS 6
+#define WNI_CFG_AS_CAP_RESERVED 7
+
+#define WNI_CFG_HT_INFO_FIELD1_STAMIN 0
+#define WNI_CFG_HT_INFO_FIELD1_STAMAX 255
+#define WNI_CFG_HT_INFO_FIELD1_STADEF 15
+
+#define WNI_CFG_HT_INFO_FIELD1_APMIN 0
+#define WNI_CFG_HT_INFO_FIELD1_APMAX 255
+#define WNI_CFG_HT_INFO_FIELD1_APDEF 15
+
+#define WNI_CFG_HT_INFO_FIELD1_SECONDARY_CHANNEL_OFFSET 0
+#define WNI_CFG_HT_INFO_FIELD1_RECOMMENDED_CHANNEL_WIDTH 2
+#define WNI_CFG_HT_INFO_FIELD1_RIFS_MODE 3
+#define WNI_CFG_HT_INFO_FIELD1_PSMP_ACCESS_ONLY 4
+#define WNI_CFG_HT_INFO_FIELD1_SERVICE_INTERVAL_GRANULARITY 5
+
+#define WNI_CFG_HT_INFO_FIELD2_STAMIN 0
+#define WNI_CFG_HT_INFO_FIELD2_STAMAX 65535
+#define WNI_CFG_HT_INFO_FIELD2_STADEF 0
+
+#define WNI_CFG_HT_INFO_FIELD2_APMIN 0
+#define WNI_CFG_HT_INFO_FIELD2_APMAX 65535
+#define WNI_CFG_HT_INFO_FIELD2_APDEF 0
+
+#define WNI_CFG_HT_INFO_FIELD2_OP_MODE 0
+#define WNI_CFG_HT_INFO_FIELD2_NON_GF_DEVICES_PRESENT 2
+#define WNI_CFG_HT_INFO_FIELD2_RESERVED 3
+
+#define WNI_CFG_HT_INFO_FIELD3_STAMIN 0
+#define WNI_CFG_HT_INFO_FIELD3_STAMAX 65535
+#define WNI_CFG_HT_INFO_FIELD3_STADEF 0
+
+#define WNI_CFG_HT_INFO_FIELD3_APMIN 0
+#define WNI_CFG_HT_INFO_FIELD3_APMAX 65535
+#define WNI_CFG_HT_INFO_FIELD3_APDEF 0
+
+#define WNI_CFG_HT_INFO_FIELD3_BASIC_STBC_MCS 0
+#define WNI_CFG_HT_INFO_FIELD3_DUAL_STBC_PROTECTION 7
+#define WNI_CFG_HT_INFO_FIELD3_SECONDARY_BEACON 8
+#define WNI_CFG_HT_INFO_FIELD3_LSIG_TXOP_PROTECTION_FULL_SUPPORT 9
+#define WNI_CFG_HT_INFO_FIELD3_PCO_ACTIVE 10
+#define WNI_CFG_HT_INFO_FIELD3_PCO_PHASE 11
+#define WNI_CFG_HT_INFO_FIELD3_RESERVED 12
+
+#define WNI_CFG_GREENFIELD_CAPABILITY_STAMIN 0
+#define WNI_CFG_GREENFIELD_CAPABILITY_STAMAX 1
+#define WNI_CFG_GREENFIELD_CAPABILITY_STADEF 0
+
+#define WNI_CFG_GREENFIELD_CAPABILITY_APMIN 0
+#define WNI_CFG_GREENFIELD_CAPABILITY_APMAX 1
+#define WNI_CFG_GREENFIELD_CAPABILITY_APDEF 0
+
+#define WNI_CFG_GREENFIELD_CAPABILITY_ENABLE 1
+#define WNI_CFG_GREENFIELD_CAPABILITY_DISABLE 0
+
+#define WNI_CFG_MAX_AMSDU_LENGTH_STAMIN 0
+#define WNI_CFG_MAX_AMSDU_LENGTH_STAMAX 1
+#define WNI_CFG_MAX_AMSDU_LENGTH_STADEF 0
+
+#define WNI_CFG_MAX_AMSDU_LENGTH_APMIN 0
+#define WNI_CFG_MAX_AMSDU_LENGTH_APMAX 1
+#define WNI_CFG_MAX_AMSDU_LENGTH_APDEF 0
+
+#define WNI_CFG_MAX_AMSDU_LENGTH_SHORT_3839_BYTES 0
+#define WNI_CFG_MAX_AMSDU_LENGTH_LONG_7935__BYTES 1
+
+#define WNI_CFG_MPDU_DENSITY_STAMIN 0
+#define WNI_CFG_MPDU_DENSITY_STAMAX 7
+#define WNI_CFG_MPDU_DENSITY_STADEF 0
+
+#define WNI_CFG_MPDU_DENSITY_APMIN 0
+#define WNI_CFG_MPDU_DENSITY_APMAX 7
+#define WNI_CFG_MPDU_DENSITY_APDEF 0
+
+#define WNI_CFG_MAX_RX_AMPDU_FACTOR_STAMIN 0
+#define WNI_CFG_MAX_RX_AMPDU_FACTOR_STAMAX 3
+#define WNI_CFG_MAX_RX_AMPDU_FACTOR_STADEF 3
+
+#define WNI_CFG_MAX_RX_AMPDU_FACTOR_APMIN 0
+#define WNI_CFG_MAX_RX_AMPDU_FACTOR_APMAX 3
+#define WNI_CFG_MAX_RX_AMPDU_FACTOR_APDEF 3
+
+#define WNI_CFG_SHORT_GI_20MHZ_STAMIN 0
+#define WNI_CFG_SHORT_GI_20MHZ_STAMAX 1
+#define WNI_CFG_SHORT_GI_20MHZ_STADEF 1
+
+#define WNI_CFG_SHORT_GI_20MHZ_APMIN 0
+#define WNI_CFG_SHORT_GI_20MHZ_APMAX 1
+#define WNI_CFG_SHORT_GI_20MHZ_APDEF 1
+
+#define WNI_CFG_SHORT_GI_20MHZ_ENABLE 1
+#define WNI_CFG_SHORT_GI_20MHZ_DISABLE 0
+
+#define WNI_CFG_SHORT_GI_40MHZ_STAMIN 0
+#define WNI_CFG_SHORT_GI_40MHZ_STAMAX 1
+#define WNI_CFG_SHORT_GI_40MHZ_STADEF 0
+
+#define WNI_CFG_SHORT_GI_40MHZ_APMIN 0
+#define WNI_CFG_SHORT_GI_40MHZ_APMAX 1
+#define WNI_CFG_SHORT_GI_40MHZ_APDEF 1
+
+#define WNI_CFG_SHORT_GI_40MHZ_ENABLE 1
+#define WNI_CFG_SHORT_GI_40MHZ_DISABLE 0
+
+#define WNI_CFG_RIFS_ENABLED_STAMIN 0
+#define WNI_CFG_RIFS_ENABLED_STAMAX 1
+#define WNI_CFG_RIFS_ENABLED_STADEF 1
+
+#define WNI_CFG_RIFS_ENABLED_APMIN 0
+#define WNI_CFG_RIFS_ENABLED_APMAX 1
+#define WNI_CFG_RIFS_ENABLED_APDEF 1
+
+#define WNI_CFG_RIFS_ENABLED_ENABLE 1
+#define WNI_CFG_RIFS_ENABLED_DISABLE 0
+
+#define WNI_CFG_MAX_PS_POLL_STAMIN 0
+#define WNI_CFG_MAX_PS_POLL_STAMAX 255
+#define WNI_CFG_MAX_PS_POLL_STADEF 0
+
+#define WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE_STAMIN 1
+#define WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE_STAMAX 20
+#define WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE_STADEF 20
+
+#define WNI_CFG_RSSI_FILTER_PERIOD_STAMIN 0
+#define WNI_CFG_RSSI_FILTER_PERIOD_STAMAX 255
+#define WNI_CFG_RSSI_FILTER_PERIOD_STADEF 20
+
+#define WNI_CFG_FT_RSSI_FILTER_PERIOD_STAMIN 0
+#define WNI_CFG_FT_RSSI_FILTER_PERIOD_STAMAX 255
+#define WNI_CFG_FT_RSSI_FILTER_PERIOD_STADEF 5
+
+#define WNI_CFG_MIN_RSSI_THRESHOLD_STAMIN 0
+#define WNI_CFG_MIN_RSSI_THRESHOLD_STAMAX 10
+#define WNI_CFG_MIN_RSSI_THRESHOLD_STADEF 10
+
+#define WNI_CFG_NTH_BEACON_FILTER_STAMIN 0
+#define WNI_CFG_NTH_BEACON_FILTER_STAMAX 255
+#define WNI_CFG_NTH_BEACON_FILTER_STADEF 10
+
+#define WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE_STAMIN 0
+#define WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE_STAMAX 1
+#define WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE_STADEF 0
+
+#define WNI_CFG_SCAN_IN_POWERSAVE_STAMIN 0
+#define WNI_CFG_SCAN_IN_POWERSAVE_STAMAX 1
+#define WNI_CFG_SCAN_IN_POWERSAVE_STADEF 1
+
+#define WNI_CFG_SCAN_IN_POWERSAVE_APMIN 0
+#define WNI_CFG_SCAN_IN_POWERSAVE_APMAX 1
+#define WNI_CFG_SCAN_IN_POWERSAVE_APDEF 1
+
+#define WNI_CFG_IGNORE_DTIM_STAMIN 0
+#define WNI_CFG_IGNORE_DTIM_STAMAX 1
+#define WNI_CFG_IGNORE_DTIM_STADEF 0
+
+#define WNI_CFG_IGNORE_DTIM_APMIN 0
+#define WNI_CFG_IGNORE_DTIM_APMAX 1
+#define WNI_CFG_IGNORE_DTIM_APDEF 0
+
+#define WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE_STAMIN 0
+#define WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE_STAMAX 1
+#define WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE_STADEF 1
+
+#define WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE_STAMIN 0
+#define WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE_STAMAX 1
+#define WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE_STADEF 1
+
+#define WNI_CFG_WOWLAN_DEAUTH_ENABLE_STAMIN 0
+#define WNI_CFG_WOWLAN_DEAUTH_ENABLE_STAMAX 1
+#define WNI_CFG_WOWLAN_DEAUTH_ENABLE_STADEF 1
+
+#define WNI_CFG_WOWLAN_DISASSOC_ENABLE_STAMIN 0
+#define WNI_CFG_WOWLAN_DISASSOC_ENABLE_STAMAX 1
+#define WNI_CFG_WOWLAN_DISASSOC_ENABLE_STADEF 1
+
+#define WNI_CFG_WOWLAN_MAX_MISSED_BEACON_STAMIN 0
+#define WNI_CFG_WOWLAN_MAX_MISSED_BEACON_STAMAX 65535
+#define WNI_CFG_WOWLAN_MAX_MISSED_BEACON_STADEF 40
+
+#define WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD_STAMIN 0
+#define WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD_STAMAX 65535
+#define WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD_STADEF 65535
+
+#define WNI_CFG_BA_TIMEOUT_STAMIN 0
+#define WNI_CFG_BA_TIMEOUT_STAMAX 65535
+#define WNI_CFG_BA_TIMEOUT_STADEF 0
+
+#define WNI_CFG_BA_TIMEOUT_APMIN 0
+#define WNI_CFG_BA_TIMEOUT_APMAX 65535
+#define WNI_CFG_BA_TIMEOUT_APDEF 0
+
+#define WNI_CFG_BA_THRESHOLD_HIGH_STAMIN 0
+#define WNI_CFG_BA_THRESHOLD_HIGH_STAMAX 65535
+#define WNI_CFG_BA_THRESHOLD_HIGH_STADEF 128
+
+#define WNI_CFG_BA_THRESHOLD_HIGH_APMIN 0
+#define WNI_CFG_BA_THRESHOLD_HIGH_APMAX 65535
+#define WNI_CFG_BA_THRESHOLD_HIGH_APDEF 128
+
+#define WNI_CFG_MAX_BA_BUFFERS_STAMIN 0
+#define WNI_CFG_MAX_BA_BUFFERS_STAMAX 2560
+#define WNI_CFG_MAX_BA_BUFFERS_STADEF 2560
+
+#define WNI_CFG_MAX_BA_BUFFERS_APMIN 0
+#define WNI_CFG_MAX_BA_BUFFERS_APMAX 2560
+#define WNI_CFG_MAX_BA_BUFFERS_APDEF 2560
+
+#define WNI_CFG_MAX_BA_SESSIONS_STAMIN 0
+#define WNI_CFG_MAX_BA_SESSIONS_STAMAX 64
+#define WNI_CFG_MAX_BA_SESSIONS_STADEF 40
+
+#define WNI_CFG_MAX_BA_SESSIONS_APMIN 0
+#define WNI_CFG_MAX_BA_SESSIONS_APMAX 64
+#define WNI_CFG_MAX_BA_SESSIONS_APDEF 40
+
+#define WNI_CFG_BA_AUTO_SETUP_STAMIN 0
+#define WNI_CFG_BA_AUTO_SETUP_STAMAX 1
+#define WNI_CFG_BA_AUTO_SETUP_STADEF 1
+
+#define WNI_CFG_BA_AUTO_SETUP_APMIN 0
+#define WNI_CFG_BA_AUTO_SETUP_APMAX 1
+#define WNI_CFG_BA_AUTO_SETUP_APDEF 1
+
+#define WNI_CFG_BA_AUTO_SETUP_ENABLE 1
+#define WNI_CFG_BA_AUTO_SETUP_DISABLE 0
+
+#define WNI_CFG_ADDBA_REQ_DECLINE_STAMIN 0
+#define WNI_CFG_ADDBA_REQ_DECLINE_STAMAX 255
+#define WNI_CFG_ADDBA_REQ_DECLINE_STADEF 0
+
+#define WNI_CFG_ADDBA_REQ_DECLINE_APMIN 0
+#define WNI_CFG_ADDBA_REQ_DECLINE_APMAX 255
+#define WNI_CFG_ADDBA_REQ_DECLINE_APDEF 0
+
+#define WNI_CFG_MAX_MEDIUM_TIME_STAMIN 0
+#define WNI_CFG_MAX_MEDIUM_TIME_STAMAX 65535
+#define WNI_CFG_MAX_MEDIUM_TIME_STADEF 2048
+
+#define WNI_CFG_MAX_MEDIUM_TIME_APMIN 0
+#define WNI_CFG_MAX_MEDIUM_TIME_APMAX 65535
+#define WNI_CFG_MAX_MEDIUM_TIME_APDEF 2048
+
+#define WNI_CFG_MAX_MPDUS_IN_AMPDU_STAMIN 0
+#define WNI_CFG_MAX_MPDUS_IN_AMPDU_STAMAX 65535
+#define WNI_CFG_MAX_MPDUS_IN_AMPDU_STADEF 64
+
+#define WNI_CFG_MAX_MPDUS_IN_AMPDU_APMIN 0
+#define WNI_CFG_MAX_MPDUS_IN_AMPDU_APMAX 65535
+#define WNI_CFG_MAX_MPDUS_IN_AMPDU_APDEF 64
+
+#define WNI_CFG_IBSS_AUTO_BSSID_STAMIN 0
+#define WNI_CFG_IBSS_AUTO_BSSID_STAMAX 1
+#define WNI_CFG_IBSS_AUTO_BSSID_STADEF 1
+
+#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG_STAMIN 0
+#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG_STAMAX 1
+#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG_STADEF 0
+
+#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG_APMIN 0
+#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG_APMAX 1
+#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG_APDEF 0
+
+#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG_STAMIN 0
+#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG_STAMAX 1
+#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG_STADEF 0
+
+#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG_APMIN 0
+#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG_APMAX 1
+#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG_APDEF 0
+
+#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG_STAMIN 0
+#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG_STAMAX 1
+#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG_STADEF 0
+
+#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG_APMIN 0
+#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG_APMAX 1
+#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG_APDEF 0
+
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG_STAMIN 0
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG_STAMAX 1
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG_STADEF 0
+
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG_APMIN 0
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG_APMAX 1
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG_APDEF 0
+
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG_STAMIN 0
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG_STAMAX 1
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG_STADEF 0
+
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG_APMIN 0
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG_APMAX 1
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG_APDEF 0
+
+#define WNI_CFG_WPS_ENABLE_STAMIN 0
+#define WNI_CFG_WPS_ENABLE_STAMAX 255
+#define WNI_CFG_WPS_ENABLE_STADEF 0
+
+#define WNI_CFG_WPS_ENABLE_APMIN 0
+#define WNI_CFG_WPS_ENABLE_APMAX 255
+#define WNI_CFG_WPS_ENABLE_APDEF 0
+
+#define WNI_CFG_WPS_ENABLE_AP 1
+#define WNI_CFG_WPS_ENABLE_STA 2
+
+#define WNI_CFG_WPS_STATE_STAMIN 0
+#define WNI_CFG_WPS_STATE_STAMAX 255
+#define WNI_CFG_WPS_STATE_STADEF 1
+
+#define WNI_CFG_WPS_STATE_APMIN 0
+#define WNI_CFG_WPS_STATE_APMAX 255
+#define WNI_CFG_WPS_STATE_APDEF 1
+
+#define WNI_CFG_WPS_PROBE_REQ_FLAG_STAMIN 0
+#define WNI_CFG_WPS_PROBE_REQ_FLAG_STAMAX 1
+#define WNI_CFG_WPS_PROBE_REQ_FLAG_STADEF 0
+
+#define WNI_CFG_WPS_PROBE_REQ_FLAG_APMIN 0
+#define WNI_CFG_WPS_PROBE_REQ_FLAG_APMAX 1
+#define WNI_CFG_WPS_PROBE_REQ_FLAG_APDEF 0
+
+#define WNI_CFG_WPS_VERSION_STAMIN 0
+#define WNI_CFG_WPS_VERSION_STAMAX 255
+#define WNI_CFG_WPS_VERSION_STADEF 16
+
+#define WNI_CFG_WPS_VERSION_APMIN 0
+#define WNI_CFG_WPS_VERSION_APMAX 255
+#define WNI_CFG_WPS_VERSION_APDEF 16
+
+#define WNI_CFG_WPS_REQUEST_TYPE_STAMIN 0
+#define WNI_CFG_WPS_REQUEST_TYPE_STAMAX 255
+#define WNI_CFG_WPS_REQUEST_TYPE_STADEF 0
+
+#define WNI_CFG_WPS_REQUEST_TYPE_APMIN 0
+#define WNI_CFG_WPS_REQUEST_TYPE_APMAX 255
+#define WNI_CFG_WPS_REQUEST_TYPE_APDEF 3
+
+#define WNI_CFG_WPS_CFG_METHOD_STAMIN 0
+#define WNI_CFG_WPS_CFG_METHOD_STAMAX 4294967295
+#define WNI_CFG_WPS_CFG_METHOD_STADEF 8
+
+#define WNI_CFG_WPS_CFG_METHOD_APMIN 0
+#define WNI_CFG_WPS_CFG_METHOD_APMAX 4294967295
+#define WNI_CFG_WPS_CFG_METHOD_APDEF 25952654
+
+#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY_STAMIN 0
+#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY_STAMAX 65535
+#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY_STADEF 1
+
+#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY_APMIN 0
+#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY_APMAX 65535
+#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY_APDEF 6
+
+#define WNI_CFG_WPS_PIMARY_DEVICE_OUI_STAMIN 0
+#define WNI_CFG_WPS_PIMARY_DEVICE_OUI_STAMAX 4294967295
+#define WNI_CFG_WPS_PIMARY_DEVICE_OUI_STADEF 5304836
+
+#define WNI_CFG_WPS_PIMARY_DEVICE_OUI_APMIN 0
+#define WNI_CFG_WPS_PIMARY_DEVICE_OUI_APMAX 4294967295
+#define WNI_CFG_WPS_PIMARY_DEVICE_OUI_APDEF 5304836
+
+#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY_STAMIN 0
+#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY_STAMAX 65535
+#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY_STADEF 1
+
+#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY_APMIN 0
+#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY_APMAX 65535
+#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY_APDEF 1
+
+#define WNI_CFG_WPS_ASSOCIATION_STATE_STAMIN 0
+#define WNI_CFG_WPS_ASSOCIATION_STATE_STAMAX 65535
+#define WNI_CFG_WPS_ASSOCIATION_STATE_STADEF 0
+
+#define WNI_CFG_WPS_ASSOCIATION_STATE_APMIN 0
+#define WNI_CFG_WPS_ASSOCIATION_STATE_APMAX 65535
+#define WNI_CFG_WPS_ASSOCIATION_STATE_APDEF 0
+
+#define WNI_CFG_WPS_CONFIGURATION_ERROR_STAMIN 0
+#define WNI_CFG_WPS_CONFIGURATION_ERROR_STAMAX 65535
+#define WNI_CFG_WPS_CONFIGURATION_ERROR_STADEF 0
+
+#define WNI_CFG_WPS_CONFIGURATION_ERROR_APMIN 0
+#define WNI_CFG_WPS_CONFIGURATION_ERROR_APMAX 65535
+#define WNI_CFG_WPS_CONFIGURATION_ERROR_APDEF 0
+
+#define WNI_CFG_WPS_DEVICE_PASSWORD_ID_STAMIN 0
+#define WNI_CFG_WPS_DEVICE_PASSWORD_ID_STAMAX 4294967295
+#define WNI_CFG_WPS_DEVICE_PASSWORD_ID_STADEF 0
+
+#define WNI_CFG_WPS_DEVICE_PASSWORD_ID_APMIN 0
+#define WNI_CFG_WPS_DEVICE_PASSWORD_ID_APMAX 4294967295
+#define WNI_CFG_WPS_DEVICE_PASSWORD_ID_APDEF 0
+
+#define WNI_CFG_WPS_ASSOC_METHOD_STAMIN 0
+#define WNI_CFG_WPS_ASSOC_METHOD_STAMAX 65535
+#define WNI_CFG_WPS_ASSOC_METHOD_STADEF 0
+
+#define WNI_CFG_WPS_ASSOC_METHOD_APMIN 0
+#define WNI_CFG_WPS_ASSOC_METHOD_APMAX 65535
+#define WNI_CFG_WPS_ASSOC_METHOD_APDEF 0
+
+#define WNI_CFG_LOW_GAIN_OVERRIDE_STAMIN 0
+#define WNI_CFG_LOW_GAIN_OVERRIDE_STAMAX 1
+#define WNI_CFG_LOW_GAIN_OVERRIDE_STADEF 0
+
+#define WNI_CFG_LOW_GAIN_OVERRIDE_APMIN 0
+#define WNI_CFG_LOW_GAIN_OVERRIDE_APMAX 1
+#define WNI_CFG_LOW_GAIN_OVERRIDE_APDEF 0
+
+#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE_STAMIN 0
+#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE_STAMAX 128
+#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE_STADEF 128
+
+#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE_APMIN 0
+#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE_APMAX 128
+#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE_APDEF 128
+
+#define WNI_CFG_RPE_POLLING_THRESHOLD_STAMIN 0
+#define WNI_CFG_RPE_POLLING_THRESHOLD_STAMAX 65535
+#define WNI_CFG_RPE_POLLING_THRESHOLD_STADEF 10
+
+#define WNI_CFG_RPE_POLLING_THRESHOLD_APMIN 0
+#define WNI_CFG_RPE_POLLING_THRESHOLD_APMAX 65535
+#define WNI_CFG_RPE_POLLING_THRESHOLD_APDEF 10
+
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG_STAMIN 0
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG_STAMAX 65535
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG_STADEF 30
+
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG_APMIN 0
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG_APMAX 65535
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG_APDEF 30
+
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG_STAMIN 0
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG_STAMAX 65535
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG_STADEF 30
+
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG_APMIN 0
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG_APMAX 65535
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG_APDEF 30
+
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG_STAMIN 0
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG_STAMAX 65535
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG_STADEF 30
+
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG_APMIN 0
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG_APMAX 65535
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG_APDEF 30
+
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG_STAMIN 0
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG_STAMAX 65535
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG_STADEF 30
+
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG_APMIN 0
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG_APMAX 65535
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG_APDEF 30
+
+#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS_STAMIN 0
+#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS_STAMAX 2
+#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS_STADEF 1
+
+#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS_APMIN 0
+#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS_APMAX 2
+#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS_APDEF 1
+
+#define WNI_CFG_SINGLE_TID_RC_STAMIN 0
+#define WNI_CFG_SINGLE_TID_RC_STAMAX 1
+#define WNI_CFG_SINGLE_TID_RC_STADEF 1
+
+#define WNI_CFG_SINGLE_TID_RC_APMIN 0
+#define WNI_CFG_SINGLE_TID_RC_APMAX 1
+#define WNI_CFG_SINGLE_TID_RC_APDEF 1
+
+#define WNI_CFG_RRM_ENABLED_STAMIN 0
+#define WNI_CFG_RRM_ENABLED_STAMAX 1
+#define WNI_CFG_RRM_ENABLED_STADEF 0
+
+#define WNI_CFG_RRM_ENABLED_APMIN 0
+#define WNI_CFG_RRM_ENABLED_APMAX 1
+#define WNI_CFG_RRM_ENABLED_APDEF 0
+
+#define WNI_CFG_RRM_OPERATING_CHAN_MAX_STAMIN 0
+#define WNI_CFG_RRM_OPERATING_CHAN_MAX_STAMAX 8
+#define WNI_CFG_RRM_OPERATING_CHAN_MAX_STADEF 0
+
+#define WNI_CFG_RRM_OPERATING_CHAN_MAX_APMIN 0
+#define WNI_CFG_RRM_OPERATING_CHAN_MAX_APMAX 8
+#define WNI_CFG_RRM_OPERATING_CHAN_MAX_APDEF 0
+
+#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX_STAMIN 0
+#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX_STAMAX 8
+#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX_STADEF 0
+
+#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX_APMIN 0
+#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX_APMAX 8
+#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX_APDEF 0
+
+#define WNI_CFG_TX_PWR_CTRL_ENABLE_STAMIN 0
+#define WNI_CFG_TX_PWR_CTRL_ENABLE_STAMAX 1
+#define WNI_CFG_TX_PWR_CTRL_ENABLE_STADEF 1
+
+#define WNI_CFG_TX_PWR_CTRL_ENABLE_APMIN 0
+#define WNI_CFG_TX_PWR_CTRL_ENABLE_APMAX 1
+#define WNI_CFG_TX_PWR_CTRL_ENABLE_APDEF 1
+
+#define WNI_CFG_MCAST_BCAST_FILTER_SETTING_STAMIN 0
+#define WNI_CFG_MCAST_BCAST_FILTER_SETTING_STAMAX 3
+#define WNI_CFG_MCAST_BCAST_FILTER_SETTING_STADEF 0
+
+#define WNI_CFG_MCAST_BCAST_FILTER_SETTING_APMIN 0
+#define WNI_CFG_MCAST_BCAST_FILTER_SETTING_APMAX 3
+#define WNI_CFG_MCAST_BCAST_FILTER_SETTING_APDEF 0
+
+#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK_STAMIN 0
+#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK_STAMAX 255
+#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK_STADEF 0
+
+#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK_APMIN 0
+#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK_APMAX 255
+#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK_APDEF 0
+
+#define WNI_CFG_DYNAMIC_PS_POLL_VALUE_STAMIN 0
+#define WNI_CFG_DYNAMIC_PS_POLL_VALUE_STAMAX 255
+#define WNI_CFG_DYNAMIC_PS_POLL_VALUE_STADEF 0
+
+#define WNI_CFG_DYNAMIC_PS_POLL_VALUE_APMIN 0
+#define WNI_CFG_DYNAMIC_PS_POLL_VALUE_APMAX 255
+#define WNI_CFG_DYNAMIC_PS_POLL_VALUE_APDEF 0
+
+#define WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT_STAMIN 0
+#define WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT_STAMAX 80
+#define WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT_STADEF 0
+
+#define WNI_CFG_TELE_BCN_WAKEUP_EN_STAMIN 0
+#define WNI_CFG_TELE_BCN_WAKEUP_EN_STAMAX 1
+#define WNI_CFG_TELE_BCN_WAKEUP_EN_STADEF 0
+
+#define WNI_CFG_TELE_BCN_WAKEUP_EN_APMIN 0
+#define WNI_CFG_TELE_BCN_WAKEUP_EN_APMAX 1
+#define WNI_CFG_TELE_BCN_WAKEUP_EN_APDEF 0
+
+#define WNI_CFG_TELE_BCN_TRANS_LI_STAMIN 0
+#define WNI_CFG_TELE_BCN_TRANS_LI_STAMAX 7
+#define WNI_CFG_TELE_BCN_TRANS_LI_STADEF 3
+
+#define WNI_CFG_TELE_BCN_TRANS_LI_APMIN 0
+#define WNI_CFG_TELE_BCN_TRANS_LI_APMAX 7
+#define WNI_CFG_TELE_BCN_TRANS_LI_APDEF 3
+
+#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS_STAMIN 5
+#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS_STAMAX 255
+#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS_STADEF 10
+
+#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS_APMIN 5
+#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS_APMAX 255
+#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS_APDEF 10
+
+#define WNI_CFG_TELE_BCN_MAX_LI_STAMIN 0
+#define WNI_CFG_TELE_BCN_MAX_LI_STAMAX 7
+#define WNI_CFG_TELE_BCN_MAX_LI_STADEF 5
+
+#define WNI_CFG_TELE_BCN_MAX_LI_APMIN 0
+#define WNI_CFG_TELE_BCN_MAX_LI_APMAX 7
+#define WNI_CFG_TELE_BCN_MAX_LI_APDEF 5
+
+#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS_STAMIN 5
+#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS_STAMAX 255
+#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS_STADEF 15
+
+#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS_APMIN 5
+#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS_APMAX 255
+#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS_APDEF 15
+
+#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS_STAMIN 0
+#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS_STAMAX 255
+#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS_STADEF 7
+
+#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS_APMIN 0
+#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS_APMAX 255
+#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS_APDEF 7
+
+#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMIN 0
+#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMAX 65535
+#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STADEF 0
+
+#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_APMIN 0
+#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_APMAX 65535
+#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_APDEF 0
+
+#define WNI_CFG_ASSOC_STA_LIMIT_STAMIN 1
+#define WNI_CFG_ASSOC_STA_LIMIT_STAMAX 10
+#define WNI_CFG_ASSOC_STA_LIMIT_STADEF 10
+
+#define WNI_CFG_ASSOC_STA_LIMIT_APMIN 1
+#define WNI_CFG_ASSOC_STA_LIMIT_APMAX 10
+#define WNI_CFG_ASSOC_STA_LIMIT_APDEF 10
+
+#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_STAMIN 1
+#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_STAMAX 252
+#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_STADEF 1
+
+#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_APMIN 1
+#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_APMAX 252
+#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_APDEF 1
+
+#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_STAMIN 1
+#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_STAMAX 252
+#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_STADEF 11
+
+#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_APMIN 1
+#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_APMAX 252
+#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_APDEF 11
+
+#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_STAMIN 0
+#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_STAMAX 4
+#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_STADEF 0
+
+#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_APMIN 0
+#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_APMAX 4
+#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_APDEF 0
+
+#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD_STAMIN 0
+#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD_STAMAX 65535
+#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD_STADEF 5
+
+#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD_APMIN 0
+#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD_APMAX 65535
+#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD_APDEF 5
+
+#define WNI_CFG_ENABLE_CLOSE_LOOP_STAMIN 0
+#define WNI_CFG_ENABLE_CLOSE_LOOP_STAMAX 1
+#define WNI_CFG_ENABLE_CLOSE_LOOP_STADEF 0
+
+#define WNI_CFG_ENABLE_CLOSE_LOOP_APMIN 0
+#define WNI_CFG_ENABLE_CLOSE_LOOP_APMAX 1
+#define WNI_CFG_ENABLE_CLOSE_LOOP_APDEF 0
+
+#define WNI_CFG_ENABLE_LTE_COEX_STAMIN 0
+#define WNI_CFG_ENABLE_LTE_COEX_STAMAX 1
+#define WNI_CFG_ENABLE_LTE_COEX_STADEF 0
+
+#define WNI_CFG_ENABLE_LTE_COEX_APMIN 0
+#define WNI_CFG_ENABLE_LTE_COEX_APMAX 1
+#define WNI_CFG_ENABLE_LTE_COEX_APDEF 0
+
+#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT_STAMIN 1
+#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT_STAMAX 255
+#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT_STADEF 20
+
+#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT_APMIN 1
+#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT_APMAX 255
+#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT_APDEF 20
+
+#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT_STAMIN 1
+#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT_STAMAX 255
+#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT_STADEF 20
+
+#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT_APMIN 1
+#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT_APMAX 255
+#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT_APDEF 20
+
+#define CFG_PARAM_MAX_NUM 259
+#define CFG_AP_IBUF_MAX_SIZE 198
+#define CFG_AP_SBUF_MAX_SIZE 3422
+#define CFG_STA_IBUF_MAX_SIZE 193
+#define CFG_STA_SBUF_MAX_SIZE 3388
+#define CFG_SEM_MAX_NUM 12
+
+#define CFG_STA_MAGIC_DWORD 0xbeefbeef
+
+#define CFG_AP_MAGIC_DWORD 0xdeaddead
+
+
+#endif
diff --git a/CORE/MAC/inc/wniCfgSta.h b/CORE/MAC/inc/wniCfgSta.h
new file mode 100644
index 0000000..bbabd41
--- /dev/null
+++ b/CORE/MAC/inc/wniCfgSta.h
@@ -0,0 +1,1397 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copyright (C) 2007-2009 QUALCOMM Incorporated. All rights reserved. Proprietary and Confidential.
+ */
+
+/*
+ * DO NOT EDIT - This file is generated automaticlly
+ */
+
+/*
+ * IMPORTANT: This file is for system that supports STA mode ONLY.
+ */
+
+
+#ifndef __WNICFGSTA_H
+#define __WNICFGSTA_H
+
+/*
+ * Configuration Parameter ID for STA
+ */
+
+#define WNI_CFG_STA_ID 0
+#define WNI_CFG_CFP_PERIOD 2
+#define WNI_CFG_CFP_MAX_DURATION 3
+#define WNI_CFG_SSID 4
+#define WNI_CFG_BEACON_INTERVAL 5
+#define WNI_CFG_DTIM_PERIOD 6
+#define WNI_CFG_WEP_KEY_LENGTH 7
+#define WNI_CFG_WEP_DEFAULT_KEY_TABLE 8
+#define WNI_CFG_WEP_DEFAULT_KEY_TABLE_ROW 4
+#define WNI_CFG_WEP_DEFAULT_KEY_TABLE_COL 1
+#define WNI_CFG_WEP_DEFAULT_KEY_1 8
+#define WNI_CFG_WEP_DEFAULT_KEY_2 9
+#define WNI_CFG_WEP_DEFAULT_KEY_3 10
+#define WNI_CFG_WEP_DEFAULT_KEY_4 11
+#define WNI_CFG_WEP_DEFAULT_KEYID 12
+#define WNI_CFG_EXCLUDE_UNENCRYPTED 13
+#define WNI_CFG_RTS_THRESHOLD 14
+#define WNI_CFG_SHORT_RETRY_LIMIT 15
+#define WNI_CFG_LONG_RETRY_LIMIT 16
+#define WNI_CFG_FRAGMENTATION_THRESHOLD 17
+#define WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME 18
+#define WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME 19
+#define WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME 20
+#define WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME 21
+#define WNI_CFG_JOIN_FAILURE_TIMEOUT 22
+#define WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT 23
+#define WNI_CFG_AUTHENTICATE_RSP_TIMEOUT 24
+#define WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT 25
+#define WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT 26
+#define WNI_CFG_RA_PERIODICITY_TIMEOUT_IN_PS 27
+#define WNI_CFG_PS_ENABLE_BCN_FILTER 28
+#define WNI_CFG_PS_ENABLE_HEART_BEAT 29
+#define WNI_CFG_PS_ENABLE_RSSI_MONITOR 30
+#define WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT 31
+#define WNI_CFG_RF_SETTLING_TIME_CLK 32
+#define WNI_CFG_SUPPORTED_RATES_11B 33
+#define WNI_CFG_SUPPORTED_RATES_11A 34
+#define WNI_CFG_PHY_MODE 35
+#define WNI_CFG_DOT11_MODE 36
+#define WNI_CFG_OPERATIONAL_RATE_SET 37
+#define WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET 38
+#define WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET 39
+#define WNI_CFG_BSSID 40
+#define WNI_CFG_LISTEN_INTERVAL 41
+#define WNI_CFG_VALID_CHANNEL_LIST 42
+#define WNI_CFG_CURRENT_CHANNEL 43
+#define WNI_CFG_DEFAULT_RATE_INDEX_5GHZ 44
+#define WNI_CFG_DEFAULT_RATE_INDEX_24GHZ 45
+#define WNI_CFG_RATE_ADAPTATION_TYPE 46
+#define WNI_CFG_FIXED_RATE 47
+#define WNI_CFG_FIXED_RATE_MULTICAST_24GHZ 48
+#define WNI_CFG_FIXED_RATE_MULTICAST_5GHZ 49
+#define WNI_CFG_RETRYRATE_POLICY 50
+#define WNI_CFG_RETRYRATE_SECONDARY 51
+#define WNI_CFG_RETRYRATE_TERTIARY 52
+#define WNI_CFG_APSD_ENABLED 53
+#define WNI_CFG_SHARED_KEY_AUTH_ENABLE 54
+#define WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE 55
+#define WNI_CFG_AUTHENTICATION_TYPE 56
+#define WNI_CFG_PRIVACY_ENABLED 58
+#define WNI_CFG_SHORT_PREAMBLE 59
+#define WNI_CFG_SHORT_SLOT_TIME 60
+#define WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY 61
+#define WNI_CFG_QOS_ENABLED 62
+#define WNI_CFG_HCF_ENABLED 63
+#define WNI_CFG_RSN_ENABLED 64
+#define WNI_CFG_BACKGROUND_SCAN_PERIOD 65
+#define WNI_CFG_MAX_NUM_PRE_AUTH 66
+#define WNI_CFG_HEART_BEAT_THRESHOLD 69
+#define WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT 70
+#define WNI_CFG_MANUFACTURER_OUI 71
+#define WNI_CFG_MANUFACTURER_NAME 72
+#define WNI_CFG_MODEL_NUMBER 73
+#define WNI_CFG_MODEL_NAME 74
+#define WNI_CFG_MANUFACTURER_PRODUCT_NAME 75
+#define WNI_CFG_MANUFACTURER_PRODUCT_VERSION 76
+#define WNI_CFG_11D_ENABLED 77
+#define WNI_CFG_MAX_TX_POWER_2_4 78
+#define WNI_CFG_MAX_TX_POWER_5 79
+#define WNI_CFG_NETWORK_DENSITY 80
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM 81
+#define WNI_CFG_CURRENT_TX_ANTENNA 82
+#define WNI_CFG_CURRENT_RX_ANTENNA 83
+#define WNI_CFG_CURRENT_TX_POWER_LEVEL 84
+#define WNI_CFG_POWER_STATE_PER_CHAIN 85
+#define WNI_CFG_NEW_BSS_FOUND_IND 86
+#define WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED 87
+#define WNI_CFG_PROPRIETARY_RATES_ENABLED 88
+#define WNI_CFG_COUNTRY_CODE 90
+#define WNI_CFG_11H_ENABLED 91
+#define WNI_CFG_WT_CNF_TIMEOUT 92
+#define WNI_CFG_KEEPALIVE_TIMEOUT 93
+#define WNI_CFG_PROXIMITY 94
+#define WNI_CFG_LOG_LEVEL 95
+#define WNI_CFG_OLBC_DETECT_TIMEOUT 96
+#define WNI_CFG_PROTECTION_ENABLED 97
+#define WNI_CFG_11G_PROTECTION_ALWAYS 98
+#define WNI_CFG_FORCE_POLICY_PROTECTION 99
+#define WNI_CFG_11G_SHORT_PREAMBLE_ENABLED 100
+#define WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED 101
+#define WNI_CFG_CAL_PERIOD 102
+#define WNI_CFG_STATS_PERIOD 103
+#define WNI_CFG_CAL_CONTROL 104
+#define WNI_CFG_11G_ONLY_POLICY 105
+#define WNI_CFG_PACKET_CLASSIFICATION 106
+#define WNI_CFG_WME_ENABLED 107
+#define WNI_CFG_ADDTS_RSP_TIMEOUT 108
+#define WNI_CFG_MAX_SP_LENGTH 109
+#define WNI_CFG_SEND_SINGLE_SSID_ALWAYS 111
+#define WNI_CFG_WSM_ENABLED 112
+#define WNI_CFG_PROP_CAPABILITY 113
+#define WNI_CFG_EDCA_PROFILE 114
+#define WNI_CFG_EDCA_ANI_ACBK_LOCAL 115
+#define WNI_CFG_EDCA_ANI_ACBE_LOCAL 116
+#define WNI_CFG_EDCA_ANI_ACVI_LOCAL 117
+#define WNI_CFG_EDCA_ANI_ACVO_LOCAL 118
+#define WNI_CFG_EDCA_ANI_ACBK 119
+#define WNI_CFG_EDCA_ANI_ACBE 120
+#define WNI_CFG_EDCA_ANI_ACVI 121
+#define WNI_CFG_EDCA_ANI_ACVO 122
+#define WNI_CFG_EDCA_WME_ACBK_LOCAL 123
+#define WNI_CFG_EDCA_WME_ACBE_LOCAL 124
+#define WNI_CFG_EDCA_WME_ACVI_LOCAL 125
+#define WNI_CFG_EDCA_WME_ACVO_LOCAL 126
+#define WNI_CFG_EDCA_WME_ACBK 127
+#define WNI_CFG_EDCA_WME_ACBE 128
+#define WNI_CFG_EDCA_WME_ACVI 129
+#define WNI_CFG_EDCA_WME_ACVO 130
+#define WNI_CFG_EDCA_TIT_DEMO_ACBK_LOCAL 131
+#define WNI_CFG_EDCA_TIT_DEMO_ACBE_LOCAL 132
+#define WNI_CFG_EDCA_TIT_DEMO_ACVI_LOCAL 133
+#define WNI_CFG_EDCA_TIT_DEMO_ACVO_LOCAL 134
+#define WNI_CFG_EDCA_TIT_DEMO_ACBK 135
+#define WNI_CFG_EDCA_TIT_DEMO_ACBE 136
+#define WNI_CFG_EDCA_TIT_DEMO_ACVI 137
+#define WNI_CFG_EDCA_TIT_DEMO_ACVO 138
+#define WNI_CFG_RDET_FLAG 139
+#define WNI_CFG_RADAR_CHANNEL_LIST 140
+#define WNI_CFG_LOCAL_POWER_CONSTRAINT 141
+#define WNI_CFG_ADMIT_POLICY 142
+#define WNI_CFG_ADMIT_BWFACTOR 143
+#define WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE 144
+#define WNI_CFG_CHANNEL_BONDING_MODE 145
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE 146
+#define WNI_CFG_DYNAMIC_THRESHOLD_ZERO 147
+#define WNI_CFG_DYNAMIC_THRESHOLD_ONE 148
+#define WNI_CFG_DYNAMIC_THRESHOLD_TWO 149
+#define WNI_CFG_TRIG_STA_BK_SCAN 150
+#define WNI_CFG_DYNAMIC_PROFILE_SWITCHING 151
+#define WNI_CFG_SCAN_CONTROL_LIST 152
+#define WNI_CFG_MIMO_ENABLED 153
+#define WNI_CFG_BLOCK_ACK_ENABLED 154
+#define WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT 155
+#define WNI_CFG_HT_RX_STBC 156
+#define WNI_CFG_HT_CAP_INFO 157
+#define WNI_CFG_HT_AMPDU_PARAMS 158
+#define WNI_CFG_SUPPORTED_MCS_SET 159
+#define WNI_CFG_EXT_HT_CAP_INFO 160
+#define WNI_CFG_TX_BF_CAP 161
+#define WNI_CFG_AS_CAP 162
+#define WNI_CFG_HT_INFO_FIELD1 163
+#define WNI_CFG_HT_INFO_FIELD2 164
+#define WNI_CFG_HT_INFO_FIELD3 165
+#define WNI_CFG_BASIC_MCS_SET 166
+#define WNI_CFG_CURRENT_MCS_SET 167
+#define WNI_CFG_GREENFIELD_CAPABILITY 168
+#define WNI_CFG_MAX_AMSDU_LENGTH 169
+#define WNI_CFG_MPDU_DENSITY 170
+#define WNI_CFG_MAX_RX_AMPDU_FACTOR 171
+#define WNI_CFG_SHORT_GI_20MHZ 172
+#define WNI_CFG_SHORT_GI_40MHZ 173
+#define WNI_CFG_RIFS_ENABLED 174
+#define WNI_CFG_MAX_PS_POLL 175
+#define WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE 176
+#define WNI_CFG_RSSI_FILTER_PERIOD 177
+#define WNI_CFG_FT_RSSI_FILTER_PERIOD 178
+#define WNI_CFG_MIN_RSSI_THRESHOLD 179
+#define WNI_CFG_NTH_BEACON_FILTER 180
+#define WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE 181
+#define WNI_CFG_SCAN_IN_POWERSAVE 182
+#define WNI_CFG_IGNORE_DTIM 183
+#define WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE 184
+#define WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE 185
+#define WNI_CFG_WOWLAN_DEAUTH_ENABLE 186
+#define WNI_CFG_WOWLAN_DISASSOC_ENABLE 187
+#define WNI_CFG_WOWLAN_MAX_MISSED_BEACON 188
+#define WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD 189
+#define WNI_CFG_BA_TIMEOUT 190
+#define WNI_CFG_BA_THRESHOLD_HIGH 191
+#define WNI_CFG_MAX_BA_BUFFERS 192
+#define WNI_CFG_MAX_BA_SESSIONS 193
+#define WNI_CFG_BA_AUTO_SETUP 194
+#define WNI_CFG_ADDBA_REQ_DECLINE 195
+#define WNI_CFG_BG_SCAN_CHANNEL_LIST 196
+#define WNI_CFG_MAX_MEDIUM_TIME 197
+#define WNI_CFG_MAX_MPDUS_IN_AMPDU 198
+#define WNI_CFG_IBSS_AUTO_BSSID 199
+#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG 200
+#define WNI_CFG_PROBE_REQ_ADDNIE_DATA 201
+#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG 202
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA1 203
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA2 204
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA3 205
+#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG 206
+#define WNI_CFG_ASSOC_RSP_ADDNIE_DATA 207
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG 208
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_DATA 209
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG 210
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA 211
+#define WNI_CFG_WPS_ENABLE 212
+#define WNI_CFG_WPS_STATE 213
+#define WNI_CFG_WPS_PROBE_REQ_FLAG 214
+#define WNI_CFG_WPS_VERSION 215
+#define WNI_CFG_WPS_REQUEST_TYPE 216
+#define WNI_CFG_WPS_CFG_METHOD 217
+#define WNI_CFG_WPS_UUID 218
+#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY 219
+#define WNI_CFG_WPS_PIMARY_DEVICE_OUI 220
+#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY 221
+#define WNI_CFG_WPS_ASSOCIATION_STATE 222
+#define WNI_CFG_WPS_CONFIGURATION_ERROR 223
+#define WNI_CFG_WPS_DEVICE_PASSWORD_ID 224
+#define WNI_CFG_WPS_ASSOC_METHOD 225
+#define WNI_CFG_LOW_GAIN_OVERRIDE 226
+#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE 227
+#define WNI_CFG_RPE_POLLING_THRESHOLD 228
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG 229
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG 230
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG 231
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG 232
+#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS 233
+#define WNI_CFG_SINGLE_TID_RC 234
+#define WNI_CFG_RRM_ENABLED 235
+#define WNI_CFG_RRM_OPERATING_CHAN_MAX 236
+#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX 237
+#define WNI_CFG_TX_PWR_CTRL_ENABLE 238
+#define WNI_CFG_MCAST_BCAST_FILTER_SETTING 239
+#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK 240
+#define WNI_CFG_DYNAMIC_PS_POLL_VALUE 241
+#define WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT 242
+#define WNI_CFG_TELE_BCN_WAKEUP_EN 243
+#define WNI_CFG_TELE_BCN_TRANS_LI 244
+#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS 245
+#define WNI_CFG_TELE_BCN_MAX_LI 246
+#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS 247
+#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS 248
+#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD 249
+#define WNI_CFG_ASSOC_STA_LIMIT 250
+#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL 251
+#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL 252
+#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND 253
+#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD 254
+#define WNI_CFG_ENABLE_CLOSE_LOOP 255
+#define WNI_CFG_ENABLE_LTE_COEX 256
+#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT 257
+#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT 258
+
+/*
+ * String parameter lengths
+ */
+
+#define WNI_CFG_STA_ID_LEN 6
+#define WNI_CFG_SSID_LEN 32
+#define WNI_CFG_WEP_DEFAULT_KEY_1_LEN 13
+#define WNI_CFG_WEP_DEFAULT_KEY_2_LEN 13
+#define WNI_CFG_WEP_DEFAULT_KEY_3_LEN 13
+#define WNI_CFG_WEP_DEFAULT_KEY_4_LEN 13
+#define WNI_CFG_SUPPORTED_RATES_11B_LEN 4
+#define WNI_CFG_SUPPORTED_RATES_11A_LEN 8
+#define WNI_CFG_OPERATIONAL_RATE_SET_LEN 12
+#define WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN 8
+#define WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET_LEN 4
+#define WNI_CFG_BSSID_LEN 6
+#define WNI_CFG_VALID_CHANNEL_LIST_LEN 100
+#define WNI_CFG_MANUFACTURER_OUI_LEN 3
+#define WNI_CFG_MANUFACTURER_NAME_LEN 65
+#define WNI_CFG_MODEL_NUMBER_LEN 33
+#define WNI_CFG_MODEL_NAME_LEN 33
+#define WNI_CFG_MANUFACTURER_PRODUCT_NAME_LEN 33
+#define WNI_CFG_MANUFACTURER_PRODUCT_VERSION_LEN 33
+#define WNI_CFG_MAX_TX_POWER_2_4_LEN 128
+#define WNI_CFG_MAX_TX_POWER_5_LEN 128
+#define WNI_CFG_COUNTRY_CODE_LEN 3
+#define WNI_CFG_EDCA_ANI_ACBK_LOCAL_LEN 20
+#define WNI_CFG_EDCA_ANI_ACBE_LOCAL_LEN 20
+#define WNI_CFG_EDCA_ANI_ACVI_LOCAL_LEN 20
+#define WNI_CFG_EDCA_ANI_ACVO_LOCAL_LEN 20
+#define WNI_CFG_EDCA_ANI_ACBK_LEN 20
+#define WNI_CFG_EDCA_ANI_ACBE_LEN 20
+#define WNI_CFG_EDCA_ANI_ACVI_LEN 20
+#define WNI_CFG_EDCA_ANI_ACVO_LEN 20
+#define WNI_CFG_EDCA_WME_ACBK_LOCAL_LEN 20
+#define WNI_CFG_EDCA_WME_ACBE_LOCAL_LEN 20
+#define WNI_CFG_EDCA_WME_ACVI_LOCAL_LEN 20
+#define WNI_CFG_EDCA_WME_ACVO_LOCAL_LEN 20
+#define WNI_CFG_EDCA_WME_ACBK_LEN 20
+#define WNI_CFG_EDCA_WME_ACBE_LEN 20
+#define WNI_CFG_EDCA_WME_ACVI_LEN 20
+#define WNI_CFG_EDCA_WME_ACVO_LEN 20
+#define WNI_CFG_EDCA_TIT_DEMO_ACBK_LOCAL_LEN 20
+#define WNI_CFG_EDCA_TIT_DEMO_ACBE_LOCAL_LEN 20
+#define WNI_CFG_EDCA_TIT_DEMO_ACVI_LOCAL_LEN 20
+#define WNI_CFG_EDCA_TIT_DEMO_ACVO_LOCAL_LEN 20
+#define WNI_CFG_EDCA_TIT_DEMO_ACBK_LEN 20
+#define WNI_CFG_EDCA_TIT_DEMO_ACBE_LEN 20
+#define WNI_CFG_EDCA_TIT_DEMO_ACVI_LEN 20
+#define WNI_CFG_EDCA_TIT_DEMO_ACVO_LEN 20
+#define WNI_CFG_RADAR_CHANNEL_LIST_LEN 20
+#define WNI_CFG_SCAN_CONTROL_LIST_LEN 128
+#define WNI_CFG_SUPPORTED_MCS_SET_LEN 16
+#define WNI_CFG_BASIC_MCS_SET_LEN 16
+#define WNI_CFG_CURRENT_MCS_SET_LEN 16
+#define WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN 100
+#define WNI_CFG_PROBE_REQ_ADDNIE_DATA_LEN 255
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN 255
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA2_LEN 255
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA3_LEN 255
+#define WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN 255
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_DATA_LEN 255
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN 255
+#define WNI_CFG_WPS_UUID_LEN 16
+
+/*
+ * Integer parameter min/max/default values
+ */
+
+#define WNI_CFG_CFP_PERIOD_STAMIN 0
+#define WNI_CFG_CFP_PERIOD_STAMAX 255
+#define WNI_CFG_CFP_PERIOD_STADEF 1
+
+#define WNI_CFG_CFP_MAX_DURATION_STAMIN 0
+#define WNI_CFG_CFP_MAX_DURATION_STAMAX 65535
+#define WNI_CFG_CFP_MAX_DURATION_STADEF 30000
+
+#define WNI_CFG_BEACON_INTERVAL_STAMIN 0
+#define WNI_CFG_BEACON_INTERVAL_STAMAX 65535
+#define WNI_CFG_BEACON_INTERVAL_STADEF 100
+
+#define WNI_CFG_DTIM_PERIOD_STAMIN 0
+#define WNI_CFG_DTIM_PERIOD_STAMAX 65535
+#define WNI_CFG_DTIM_PERIOD_STADEF 1
+
+#define WNI_CFG_WEP_KEY_LENGTH_STAMIN 5
+#define WNI_CFG_WEP_KEY_LENGTH_STAMAX 13
+#define WNI_CFG_WEP_KEY_LENGTH_STADEF 5
+
+#define WNI_CFG_WEP_KEY_LENGTH_5 5
+#define WNI_CFG_WEP_KEY_LENGTH_13 13
+
+#define WNI_CFG_WEP_DEFAULT_KEYID_STAMIN 0
+#define WNI_CFG_WEP_DEFAULT_KEYID_STAMAX 3
+#define WNI_CFG_WEP_DEFAULT_KEYID_STADEF 0
+
+#define WNI_CFG_WEP_DEFAULT_KEYID_0 0
+#define WNI_CFG_WEP_DEFAULT_KEYID_1 1
+#define WNI_CFG_WEP_DEFAULT_KEYID_2 2
+#define WNI_CFG_WEP_DEFAULT_KEYID_3 3
+
+#define WNI_CFG_EXCLUDE_UNENCRYPTED_STAMIN 0
+#define WNI_CFG_EXCLUDE_UNENCRYPTED_STAMAX 1
+#define WNI_CFG_EXCLUDE_UNENCRYPTED_STADEF 0
+
+#define WNI_CFG_RTS_THRESHOLD_STAMIN 0
+#define WNI_CFG_RTS_THRESHOLD_STAMAX 2347
+#define WNI_CFG_RTS_THRESHOLD_STADEF 2347
+
+#define WNI_CFG_SHORT_RETRY_LIMIT_STAMIN 0
+#define WNI_CFG_SHORT_RETRY_LIMIT_STAMAX 255
+#define WNI_CFG_SHORT_RETRY_LIMIT_STADEF 6
+
+#define WNI_CFG_LONG_RETRY_LIMIT_STAMIN 0
+#define WNI_CFG_LONG_RETRY_LIMIT_STAMAX 255
+#define WNI_CFG_LONG_RETRY_LIMIT_STADEF 6
+
+#define WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN 256
+#define WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX 8000
+#define WNI_CFG_FRAGMENTATION_THRESHOLD_STADEF 8000
+
+#define WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME_STAMIN 0
+#define WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME_STAMAX 65535
+#define WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME_STADEF 20
+
+#define WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME_STAMIN 0
+#define WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME_STAMAX 65535
+#define WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME_STADEF 40
+
+#define WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME_STAMIN 0
+#define WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME_STAMAX 65535
+#define WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME_STADEF 60
+
+#define WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME_STAMIN 0
+#define WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME_STAMAX 65535
+#define WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME_STADEF 110
+
+#define WNI_CFG_JOIN_FAILURE_TIMEOUT_STAMIN 0
+#define WNI_CFG_JOIN_FAILURE_TIMEOUT_STAMAX 65535
+#define WNI_CFG_JOIN_FAILURE_TIMEOUT_STADEF 3000
+
+#define WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT_STAMIN 0
+#define WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT_STAMAX 65535
+#define WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT_STADEF 1000
+
+#define WNI_CFG_AUTHENTICATE_RSP_TIMEOUT_STAMIN 0
+#define WNI_CFG_AUTHENTICATE_RSP_TIMEOUT_STAMAX 65535
+#define WNI_CFG_AUTHENTICATE_RSP_TIMEOUT_STADEF 1000
+
+#define WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT_STAMIN 0
+#define WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT_STAMAX 65535
+#define WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT_STADEF 2000
+
+#define WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT_STAMIN 0
+#define WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT_STAMAX 65535
+#define WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT_STADEF 2000
+
+#define WNI_CFG_RA_PERIODICITY_TIMEOUT_IN_PS_STAMIN 0
+#define WNI_CFG_RA_PERIODICITY_TIMEOUT_IN_PS_STAMAX 65535
+#define WNI_CFG_RA_PERIODICITY_TIMEOUT_IN_PS_STADEF 1000
+
+#define WNI_CFG_PS_ENABLE_BCN_FILTER_STAMIN 0
+#define WNI_CFG_PS_ENABLE_BCN_FILTER_STAMAX 1
+#define WNI_CFG_PS_ENABLE_BCN_FILTER_STADEF 1
+
+#define WNI_CFG_PS_ENABLE_HEART_BEAT_STAMIN 0
+#define WNI_CFG_PS_ENABLE_HEART_BEAT_STAMAX 1
+#define WNI_CFG_PS_ENABLE_HEART_BEAT_STADEF 1
+
+#define WNI_CFG_PS_ENABLE_RSSI_MONITOR_STAMIN 0
+#define WNI_CFG_PS_ENABLE_RSSI_MONITOR_STAMAX 1
+#define WNI_CFG_PS_ENABLE_RSSI_MONITOR_STADEF 0
+
+#define WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT_STAMIN 1
+#define WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT_STAMAX 255
+#define WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT_STADEF 20
+
+#define WNI_CFG_RF_SETTLING_TIME_CLK_STAMIN 0
+#define WNI_CFG_RF_SETTLING_TIME_CLK_STAMAX 60000
+#define WNI_CFG_RF_SETTLING_TIME_CLK_STADEF 1500
+
+#define WNI_CFG_PHY_MODE_STAMIN 0
+#define WNI_CFG_PHY_MODE_STAMAX 3
+#define WNI_CFG_PHY_MODE_STADEF 0
+
+#define WNI_CFG_PHY_MODE_11A 0
+#define WNI_CFG_PHY_MODE_11B 1
+#define WNI_CFG_PHY_MODE_11G 2
+#define WNI_CFG_PHY_MODE_NONE 3
+
+#define WNI_CFG_DOT11_MODE_STAMIN 0
+#define WNI_CFG_DOT11_MODE_STAMAX 9
+#define WNI_CFG_DOT11_MODE_STADEF 0
+
+#define WNI_CFG_DOT11_MODE_ALL 0
+#define WNI_CFG_DOT11_MODE_11A 1
+#define WNI_CFG_DOT11_MODE_11B 2
+#define WNI_CFG_DOT11_MODE_11G 3
+#define WNI_CFG_DOT11_MODE_11N 4
+#define WNI_CFG_DOT11_MODE_POLARIS 5
+#define WNI_CFG_DOT11_MODE_TITAN 6
+#define WNI_CFG_DOT11_MODE_TAURUS 7
+#define WNI_CFG_DOT11_MODE_11G_ONLY 8
+#define WNI_CFG_DOT11_MODE_11N_ONLY 9
+
+#define WNI_CFG_LISTEN_INTERVAL_STAMIN 0
+#define WNI_CFG_LISTEN_INTERVAL_STAMAX 65535
+#define WNI_CFG_LISTEN_INTERVAL_STADEF 1
+
+#define WNI_CFG_CURRENT_CHANNEL_STAMIN 0
+#define WNI_CFG_CURRENT_CHANNEL_STAMAX 165
+#define WNI_CFG_CURRENT_CHANNEL_STADEF 1
+
+#define WNI_CFG_DEFAULT_RATE_INDEX_5GHZ_STAMIN 0
+#define WNI_CFG_DEFAULT_RATE_INDEX_5GHZ_STAMAX 11
+#define WNI_CFG_DEFAULT_RATE_INDEX_5GHZ_STADEF 5
+
+#define WNI_CFG_DEFAULT_RATE_INDEX_24GHZ_STAMIN 0
+#define WNI_CFG_DEFAULT_RATE_INDEX_24GHZ_STAMAX 31
+#define WNI_CFG_DEFAULT_RATE_INDEX_24GHZ_STADEF 1
+
+#define WNI_CFG_RATE_ADAPTATION_TYPE_STAMIN 0
+#define WNI_CFG_RATE_ADAPTATION_TYPE_STAMAX 2
+#define WNI_CFG_RATE_ADAPTATION_TYPE_STADEF 1
+
+#define WNI_CFG_RATE_ADAPTATION_TYPE_FIXED 0
+#define WNI_CFG_RATE_ADAPTATION_TYPE_AUTO 1
+#define WNI_CFG_RATE_ADAPTATION_TYPE_SNR_BASED 2
+
+#define WNI_CFG_FIXED_RATE_STAMIN 0
+#define WNI_CFG_FIXED_RATE_STAMAX 31
+#define WNI_CFG_FIXED_RATE_STADEF 0
+
+#define WNI_CFG_FIXED_RATE_AUTO 0
+#define WNI_CFG_FIXED_RATE_1MBPS 1
+#define WNI_CFG_FIXED_RATE_2MBPS 2
+#define WNI_CFG_FIXED_RATE_5_5MBPS 3
+#define WNI_CFG_FIXED_RATE_11MBPS 4
+#define WNI_CFG_FIXED_RATE_6MBPS 5
+#define WNI_CFG_FIXED_RATE_9MBPS 6
+#define WNI_CFG_FIXED_RATE_12MBPS 7
+#define WNI_CFG_FIXED_RATE_18MBPS 8
+#define WNI_CFG_FIXED_RATE_24MBPS 9
+#define WNI_CFG_FIXED_RATE_36MBPS 10
+#define WNI_CFG_FIXED_RATE_48MBPS 11
+#define WNI_CFG_FIXED_RATE_54MBPS 12
+#define WNI_CFG_FIXED_RATE_6_5MBPS_MCS0_20MHZ_SIMO 13
+#define WNI_CFG_FIXED_RATE_13MBPS_MCS1_20MHZ_SIMO 14
+#define WNI_CFG_FIXED_RATE_19_5MBPS_MCS2_20MHZ_SIMO 15
+#define WNI_CFG_FIXED_RATE_26MBPS_MCS3_20MHZ_SIMO 16
+#define WNI_CFG_FIXED_RATE_39MBPS_MCS4_20MHZ_SIMO 17
+#define WNI_CFG_FIXED_RATE_52MBPS_MCS5_20MHZ_SIMO 18
+#define WNI_CFG_FIXED_RATE_58_5MBPS_MCS6_20MHZ_SIMO 19
+#define WNI_CFG_FIXED_RATE_65MBPS_MCS7_20MHZ_SIMO 20
+#define WNI_CFG_FIXED_RATE_7_2MBPS_MCS0_20MHZ_SIMO_SGI 21
+#define WNI_CFG_FIXED_RATE_14_4MBPS_MCS1_20MHZ_SIMO_SGI 22
+#define WNI_CFG_FIXED_RATE_21_7MBPS_MCS2_20MHZ_SIMO_SGI 23
+#define WNI_CFG_FIXED_RATE_28_9MBPS_MCS3_20MHZ_SIMO_SGI 24
+#define WNI_CFG_FIXED_RATE_43_3MBPS_MCS4_20MHZ_SIMO_SGI 25
+#define WNI_CFG_FIXED_RATE_57_8MBPS_MCS5_20MHZ_SIMO_SGI 26
+#define WNI_CFG_FIXED_RATE_65MBPS_MCS6_20MHZ_SIMO_SGI 27
+#define WNI_CFG_FIXED_RATE_72_2MBPS_MCS7_20MHZ_SIMO_SGI 28
+#define WNI_CFG_FIXED_RATE_0_25MBPS_SLR_20MHZ_SIMO 29
+#define WNI_CFG_FIXED_RATE_0_5MBPS_SLR_20MHZ_SIMO 30
+#define WNI_CFG_FIXED_RATE_68_25MBPS_QC_PROP_20MHZ_SIMO 31
+
+#define WNI_CFG_FIXED_RATE_MULTICAST_24GHZ_STAMIN 0
+#define WNI_CFG_FIXED_RATE_MULTICAST_24GHZ_STAMAX 31
+#define WNI_CFG_FIXED_RATE_MULTICAST_24GHZ_STADEF 1
+
+#define WNI_CFG_FIXED_RATE_MULTICAST_5GHZ_STAMIN 0
+#define WNI_CFG_FIXED_RATE_MULTICAST_5GHZ_STAMAX 31
+#define WNI_CFG_FIXED_RATE_MULTICAST_5GHZ_STADEF 5
+
+#define WNI_CFG_RETRYRATE_POLICY_STAMIN 0
+#define WNI_CFG_RETRYRATE_POLICY_STAMAX 255
+#define WNI_CFG_RETRYRATE_POLICY_STADEF 4
+
+#define WNI_CFG_RETRYRATE_POLICY_MIN_SUPPORTED 0
+#define WNI_CFG_RETRYRATE_POLICY_PRIMARY 1
+#define WNI_CFG_RETRYRATE_POLICY_RESERVED 2
+#define WNI_CFG_RETRYRATE_POLICY_CLOSEST 3
+#define WNI_CFG_RETRYRATE_POLICY_AUTOSELECT 4
+#define WNI_CFG_RETRYRATE_POLICY_MAX 5
+
+#define WNI_CFG_RETRYRATE_SECONDARY_STAMIN 0
+#define WNI_CFG_RETRYRATE_SECONDARY_STAMAX 255
+#define WNI_CFG_RETRYRATE_SECONDARY_STADEF 0
+
+#define WNI_CFG_RETRYRATE_TERTIARY_STAMIN 0
+#define WNI_CFG_RETRYRATE_TERTIARY_STAMAX 255
+#define WNI_CFG_RETRYRATE_TERTIARY_STADEF 0
+
+#define WNI_CFG_APSD_ENABLED_STAMIN 0
+#define WNI_CFG_APSD_ENABLED_STAMAX 1
+#define WNI_CFG_APSD_ENABLED_STADEF 0
+
+#define WNI_CFG_SHARED_KEY_AUTH_ENABLE_STAMIN 0
+#define WNI_CFG_SHARED_KEY_AUTH_ENABLE_STAMAX 1
+#define WNI_CFG_SHARED_KEY_AUTH_ENABLE_STADEF 1
+
+#define WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE_STAMIN 0
+#define WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE_STAMAX 1
+#define WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE_STADEF 1
+
+#define WNI_CFG_AUTHENTICATION_TYPE_STAMIN 0
+#define WNI_CFG_AUTHENTICATION_TYPE_STAMAX 65535
+#define WNI_CFG_AUTHENTICATION_TYPE_STADEF 0
+
+#define WNI_CFG_PRIVACY_ENABLED_STAMIN 0
+#define WNI_CFG_PRIVACY_ENABLED_STAMAX 1
+#define WNI_CFG_PRIVACY_ENABLED_STADEF 0
+
+#define WNI_CFG_SHORT_PREAMBLE_STAMIN 0
+#define WNI_CFG_SHORT_PREAMBLE_STAMAX 1
+#define WNI_CFG_SHORT_PREAMBLE_STADEF 1
+
+#define WNI_CFG_SHORT_SLOT_TIME_STAMIN 0
+#define WNI_CFG_SHORT_SLOT_TIME_STAMAX 1
+#define WNI_CFG_SHORT_SLOT_TIME_STADEF 1
+
+#define WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY_STAMIN 0
+#define WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY_STAMAX 1
+#define WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY_STADEF 0
+
+#define WNI_CFG_QOS_ENABLED_STAMIN 0
+#define WNI_CFG_QOS_ENABLED_STAMAX 1
+#define WNI_CFG_QOS_ENABLED_STADEF 0
+
+#define WNI_CFG_HCF_ENABLED_STAMIN 0
+#define WNI_CFG_HCF_ENABLED_STAMAX 1
+#define WNI_CFG_HCF_ENABLED_STADEF 0
+
+#define WNI_CFG_RSN_ENABLED_STAMIN 0
+#define WNI_CFG_RSN_ENABLED_STAMAX 1
+#define WNI_CFG_RSN_ENABLED_STADEF 0
+
+#define WNI_CFG_BACKGROUND_SCAN_PERIOD_STAMIN 0
+#define WNI_CFG_BACKGROUND_SCAN_PERIOD_STAMAX 180000
+#define WNI_CFG_BACKGROUND_SCAN_PERIOD_STADEF 5000
+
+#define WNI_CFG_MAX_NUM_PRE_AUTH_STAMIN 0
+#define WNI_CFG_MAX_NUM_PRE_AUTH_STAMAX 256
+#define WNI_CFG_MAX_NUM_PRE_AUTH_STADEF 64
+
+#define WNI_CFG_HEART_BEAT_THRESHOLD_STAMIN 0
+#define WNI_CFG_HEART_BEAT_THRESHOLD_STAMAX 65535
+#define WNI_CFG_HEART_BEAT_THRESHOLD_STADEF 40
+
+#define WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT_STAMIN 10
+#define WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT_STAMAX 10000
+#define WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT_STADEF 40
+
+#define WNI_CFG_11D_ENABLED_STAMIN 0
+#define WNI_CFG_11D_ENABLED_STAMAX 1
+#define WNI_CFG_11D_ENABLED_STADEF 1
+
+#define WNI_CFG_NETWORK_DENSITY_STAMIN 0
+#define WNI_CFG_NETWORK_DENSITY_STAMAX 3
+#define WNI_CFG_NETWORK_DENSITY_STADEF 3
+
+#define WNI_CFG_NETWORK_DENSITY_LOW 0
+#define WNI_CFG_NETWORK_DENSITY_MEDIUM 1
+#define WNI_CFG_NETWORK_DENSITY_HIGH 2
+#define WNI_CFG_NETWORK_DENSITY_ADAPTIVE 3
+
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_STAMIN 1
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_STAMAX 2
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_STADEF 2
+
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_CARRIER 1
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_CORRELATION 2
+
+#define WNI_CFG_CURRENT_TX_ANTENNA_STAMIN 1
+#define WNI_CFG_CURRENT_TX_ANTENNA_STAMAX 1
+#define WNI_CFG_CURRENT_TX_ANTENNA_STADEF 1
+
+#define WNI_CFG_CURRENT_RX_ANTENNA_STAMIN 1
+#define WNI_CFG_CURRENT_RX_ANTENNA_STAMAX 2
+#define WNI_CFG_CURRENT_RX_ANTENNA_STADEF 2
+
+#define WNI_CFG_CURRENT_TX_POWER_LEVEL_STAMIN 0
+#define WNI_CFG_CURRENT_TX_POWER_LEVEL_STAMAX 128
+#define WNI_CFG_CURRENT_TX_POWER_LEVEL_STADEF 27
+
+#define WNI_CFG_POWER_STATE_PER_CHAIN_STAMIN 0
+#define WNI_CFG_POWER_STATE_PER_CHAIN_STAMAX 65535
+#define WNI_CFG_POWER_STATE_PER_CHAIN_STADEF 785
+
+#define WNI_CFG_POWER_STATE_PER_CHAIN_OFF 0
+#define WNI_CFG_POWER_STATE_PER_CHAIN_ON 1
+#define WNI_CFG_POWER_STATE_PER_CHAIN_TX 2
+#define WNI_CFG_POWER_STATE_PER_CHAIN_RX 3
+#define WNI_CFG_POWER_STATE_PER_CHAIN_MASK 15
+#define WNI_CFG_POWER_STATE_PER_CHAIN_CHAIN_0_OFFSET 0
+#define WNI_CFG_POWER_STATE_PER_CHAIN_CHAIN_1_OFFSET 4
+#define WNI_CFG_POWER_STATE_PER_CHAIN_CHAIN_2_OFFSET 8
+
+#define WNI_CFG_NEW_BSS_FOUND_IND_STAMIN 0
+#define WNI_CFG_NEW_BSS_FOUND_IND_STAMAX 1
+#define WNI_CFG_NEW_BSS_FOUND_IND_STADEF 0
+
+#define WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED_STAMIN 0
+#define WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED_STAMAX 1
+#define WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED_STADEF 0
+
+#define WNI_CFG_PROPRIETARY_RATES_ENABLED_STAMIN 0
+#define WNI_CFG_PROPRIETARY_RATES_ENABLED_STAMAX 1
+#define WNI_CFG_PROPRIETARY_RATES_ENABLED_STADEF 0
+
+#define WNI_CFG_11H_ENABLED_STAMIN 0
+#define WNI_CFG_11H_ENABLED_STAMAX 1
+#define WNI_CFG_11H_ENABLED_STADEF 1
+
+#define WNI_CFG_WT_CNF_TIMEOUT_STAMIN 10
+#define WNI_CFG_WT_CNF_TIMEOUT_STAMAX 3000
+#define WNI_CFG_WT_CNF_TIMEOUT_STADEF 1000
+
+#define WNI_CFG_KEEPALIVE_TIMEOUT_STAMIN 0
+#define WNI_CFG_KEEPALIVE_TIMEOUT_STAMAX 3600000
+#define WNI_CFG_KEEPALIVE_TIMEOUT_STADEF 0
+
+#define WNI_CFG_PROXIMITY_STAMIN 0
+#define WNI_CFG_PROXIMITY_STAMAX 1
+#define WNI_CFG_PROXIMITY_STADEF 0
+
+#define WNI_CFG_PROXIMITY_OFF 0
+#define WNI_CFG_PROXIMITY_ON 1
+
+#define WNI_CFG_LOG_LEVEL_STAMIN 0
+#define WNI_CFG_LOG_LEVEL_STAMAX 7
+#define WNI_CFG_LOG_LEVEL_STADEF 3
+
+#define WNI_CFG_OLBC_DETECT_TIMEOUT_STAMIN 1000
+#define WNI_CFG_OLBC_DETECT_TIMEOUT_STAMAX 30000
+#define WNI_CFG_OLBC_DETECT_TIMEOUT_STADEF 10000
+
+#define WNI_CFG_PROTECTION_ENABLED_STAMIN 0
+#define WNI_CFG_PROTECTION_ENABLED_STAMAX 65535
+#define WNI_CFG_PROTECTION_ENABLED_STADEF 65535
+
+#define WNI_CFG_PROTECTION_ENABLED_FROM_llA 0
+#define WNI_CFG_PROTECTION_ENABLED_FROM_llB 1
+#define WNI_CFG_PROTECTION_ENABLED_FROM_llG 2
+#define WNI_CFG_PROTECTION_ENABLED_HT_20 3
+#define WNI_CFG_PROTECTION_ENABLED_NON_GF 4
+#define WNI_CFG_PROTECTION_ENABLED_LSIG_TXOP 5
+#define WNI_CFG_PROTECTION_ENABLED_RIFS 6
+#define WNI_CFG_PROTECTION_ENABLED_OBSS 7
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_FROM_llA 8
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_FROM_llB 9
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_FROM_llG 10
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_HT20 11
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_NON_GF 12
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_LSIG_TXOP 13
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_RIFS 14
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_OBSS 15
+
+#define WNI_CFG_11G_PROTECTION_ALWAYS_STAMIN 0
+#define WNI_CFG_11G_PROTECTION_ALWAYS_STAMAX 1
+#define WNI_CFG_11G_PROTECTION_ALWAYS_STADEF 0
+
+#define WNI_CFG_FORCE_POLICY_PROTECTION_STAMIN 0
+#define WNI_CFG_FORCE_POLICY_PROTECTION_STAMAX 5
+#define WNI_CFG_FORCE_POLICY_PROTECTION_STADEF 5
+
+#define WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE 0
+#define WNI_CFG_FORCE_POLICY_PROTECTION_CTS 1
+#define WNI_CFG_FORCE_POLICY_PROTECTION_RTS 2
+#define WNI_CFG_FORCE_POLICY_PROTECTION_DUAL_CTS 3
+#define WNI_CFG_FORCE_POLICY_PROTECTION_RTS_ALWAYS 4
+#define WNI_CFG_FORCE_POLICY_PROTECTION_AUTO 5
+
+#define WNI_CFG_11G_SHORT_PREAMBLE_ENABLED_STAMIN 0
+#define WNI_CFG_11G_SHORT_PREAMBLE_ENABLED_STAMAX 1
+#define WNI_CFG_11G_SHORT_PREAMBLE_ENABLED_STADEF 0
+
+#define WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED_STAMIN 0
+#define WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED_STAMAX 1
+#define WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED_STADEF 1
+
+#define WNI_CFG_CAL_PERIOD_STAMIN 2
+#define WNI_CFG_CAL_PERIOD_STAMAX 10
+#define WNI_CFG_CAL_PERIOD_STADEF 5
+
+#define WNI_CFG_STATS_PERIOD_STAMIN 1
+#define WNI_CFG_STATS_PERIOD_STAMAX 10
+#define WNI_CFG_STATS_PERIOD_STADEF 10
+
+#define WNI_CFG_CAL_CONTROL_STAMIN 0
+#define WNI_CFG_CAL_CONTROL_STAMAX 1
+#define WNI_CFG_CAL_CONTROL_STADEF 0
+
+#define WNI_CFG_CAL_CONTROL_CAL_ON 0
+#define WNI_CFG_CAL_CONTROL_CAL_OFF 1
+
+#define WNI_CFG_11G_ONLY_POLICY_STAMIN 0
+#define WNI_CFG_11G_ONLY_POLICY_STAMAX 1
+#define WNI_CFG_11G_ONLY_POLICY_STADEF 0
+
+#define WNI_CFG_PACKET_CLASSIFICATION_STAMIN 0
+#define WNI_CFG_PACKET_CLASSIFICATION_STAMAX 3
+#define WNI_CFG_PACKET_CLASSIFICATION_STADEF 0
+
+#define WNI_CFG_PACKET_CLASSIFICATION_DISABLED 0
+#define WNI_CFG_PACKET_CLASSIFICATION_DSCP 1
+#define WNI_CFG_PACKET_CLASSIFICATION_8021P 2
+#define WNI_CFG_PACKET_CLASSIFICATION_ALL 3
+
+#define WNI_CFG_WME_ENABLED_STAMIN 0
+#define WNI_CFG_WME_ENABLED_STAMAX 1
+#define WNI_CFG_WME_ENABLED_STADEF 1
+
+#define WNI_CFG_ADDTS_RSP_TIMEOUT_STAMIN 0
+#define WNI_CFG_ADDTS_RSP_TIMEOUT_STAMAX 65535
+#define WNI_CFG_ADDTS_RSP_TIMEOUT_STADEF 1000
+
+#define WNI_CFG_MAX_SP_LENGTH_STAMIN 0
+#define WNI_CFG_MAX_SP_LENGTH_STAMAX 3
+#define WNI_CFG_MAX_SP_LENGTH_STADEF 0
+
+#define WNI_CFG_SEND_SINGLE_SSID_ALWAYS_STAMIN 0
+#define WNI_CFG_SEND_SINGLE_SSID_ALWAYS_STAMAX 1
+#define WNI_CFG_SEND_SINGLE_SSID_ALWAYS_STADEF 0
+
+#define WNI_CFG_WSM_ENABLED_STAMIN 0
+#define WNI_CFG_WSM_ENABLED_STAMAX 1
+#define WNI_CFG_WSM_ENABLED_STADEF 0
+
+#define WNI_CFG_PROP_CAPABILITY_STAMIN 0
+#define WNI_CFG_PROP_CAPABILITY_STAMAX 65535
+#define WNI_CFG_PROP_CAPABILITY_STADEF 57535
+
+#define WNI_CFG_PROP_CAPABILITY_HCF 0
+#define WNI_CFG_PROP_CAPABILITY_11EQOS 1
+#define WNI_CFG_PROP_CAPABILITY_WME 2
+#define WNI_CFG_PROP_CAPABILITY_WSM 3
+#define WNI_CFG_PROP_CAPABILITY_EXTRATES 4
+#define WNI_CFG_PROP_CAPABILITY_EXTRATE_STOP 5
+#define WNI_CFG_PROP_CAPABILITY_TITAN 6
+#define WNI_CFG_PROP_CAPABILITY_TAURUS 7
+#define WNI_CFG_PROP_CAPABILITY_EDCAPARAMS 13
+#define WNI_CFG_PROP_CAPABILITY_LOADINFO 14
+#define WNI_CFG_PROP_CAPABILITY_VERSION 15
+#define WNI_CFG_PROP_CAPABILITY_MAXBITOFFSET 15
+
+#define WNI_CFG_EDCA_PROFILE_STAMIN 0
+#define WNI_CFG_EDCA_PROFILE_STAMAX 255
+#define WNI_CFG_EDCA_PROFILE_STADEF 1
+
+#define WNI_CFG_EDCA_PROFILE_ANI 0
+#define WNI_CFG_EDCA_PROFILE_WMM 1
+#define WNI_CFG_EDCA_PROFILE_TIT_DEMO 2
+#define WNI_CFG_EDCA_PROFILE_MAX 3
+#define WNI_CFG_EDCA_PROFILE_ACM_IDX 0
+#define WNI_CFG_EDCA_PROFILE_AIFSN_IDX 1
+#define WNI_CFG_EDCA_PROFILE_CWMINA_IDX 2
+#define WNI_CFG_EDCA_PROFILE_CWMAXA_IDX 4
+#define WNI_CFG_EDCA_PROFILE_TXOPA_IDX 6
+#define WNI_CFG_EDCA_PROFILE_CWMINB_IDX 7
+#define WNI_CFG_EDCA_PROFILE_CWMAXB_IDX 9
+#define WNI_CFG_EDCA_PROFILE_TXOPB_IDX 11
+#define WNI_CFG_EDCA_PROFILE_CWMING_IDX 12
+#define WNI_CFG_EDCA_PROFILE_CWMAXG_IDX 14
+#define WNI_CFG_EDCA_PROFILE_TXOPG_IDX 16
+
+#define WNI_CFG_RDET_FLAG_STAMIN 0
+#define WNI_CFG_RDET_FLAG_STAMAX 1
+#define WNI_CFG_RDET_FLAG_STADEF 0
+
+#define WNI_CFG_RDET_FLAG_ENABLE 1
+#define WNI_CFG_RDET_FLAG_DISABLE 0
+
+#define WNI_CFG_LOCAL_POWER_CONSTRAINT_STAMIN 0
+#define WNI_CFG_LOCAL_POWER_CONSTRAINT_STAMAX 255
+#define WNI_CFG_LOCAL_POWER_CONSTRAINT_STADEF 0
+
+#define WNI_CFG_ADMIT_POLICY_STAMIN 0
+#define WNI_CFG_ADMIT_POLICY_STAMAX 2
+#define WNI_CFG_ADMIT_POLICY_STADEF 0
+
+#define WNI_CFG_ADMIT_POLICY_ADMIT_ALL 0
+#define WNI_CFG_ADMIT_POLICY_REJECT_ALL 1
+#define WNI_CFG_ADMIT_POLICY_BW_FACTOR 2
+
+#define WNI_CFG_ADMIT_BWFACTOR_STAMIN 0
+#define WNI_CFG_ADMIT_BWFACTOR_STAMAX 100
+#define WNI_CFG_ADMIT_BWFACTOR_STADEF 20
+
+#define WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE_STAMIN 0
+#define WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE_STAMAX 256
+#define WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE_STADEF 60
+
+#define WNI_CFG_CHANNEL_BONDING_MODE_STAMIN 0
+#define WNI_CFG_CHANNEL_BONDING_MODE_STAMAX 4
+#define WNI_CFG_CHANNEL_BONDING_MODE_STADEF 0
+
+#define WNI_CFG_CHANNEL_BONDING_MODE_DISABLE 0
+#define WNI_CFG_CHANNEL_BONDING_MODE_ENABLE 1
+#define WNI_CFG_CHANNEL_BONDING_MODE_IF_NO_LEGACY_BSS 2
+#define WNI_CFG_CHANNEL_BONDING_MODE_IF_NO_LEGACY_ALL 3
+#define WNI_CFG_CHANNEL_BONDING_MODE_INTELLIGENT 4
+
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_STAMIN 0
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_STAMAX 2
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_STADEF 0
+
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_NONE 0
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_LOWER 1
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_HIGHER 2
+
+#define WNI_CFG_DYNAMIC_THRESHOLD_ZERO_STAMIN 0
+#define WNI_CFG_DYNAMIC_THRESHOLD_ZERO_STAMAX 255
+#define WNI_CFG_DYNAMIC_THRESHOLD_ZERO_STADEF 2
+
+#define WNI_CFG_DYNAMIC_THRESHOLD_ONE_STAMIN 0
+#define WNI_CFG_DYNAMIC_THRESHOLD_ONE_STAMAX 255
+#define WNI_CFG_DYNAMIC_THRESHOLD_ONE_STADEF 4
+
+#define WNI_CFG_DYNAMIC_THRESHOLD_TWO_STAMIN 0
+#define WNI_CFG_DYNAMIC_THRESHOLD_TWO_STAMAX 255
+#define WNI_CFG_DYNAMIC_THRESHOLD_TWO_STADEF 6
+
+#define WNI_CFG_TRIG_STA_BK_SCAN_STAMIN 0
+#define WNI_CFG_TRIG_STA_BK_SCAN_STAMAX 1
+#define WNI_CFG_TRIG_STA_BK_SCAN_STADEF 0
+
+#define WNI_CFG_DYNAMIC_PROFILE_SWITCHING_STAMIN 0
+#define WNI_CFG_DYNAMIC_PROFILE_SWITCHING_STAMAX 255
+#define WNI_CFG_DYNAMIC_PROFILE_SWITCHING_STADEF 255
+
+#define WNI_CFG_DYNAMIC_PROFILE_SWITCHING_UNUSED 255
+
+#define WNI_CFG_MIMO_ENABLED_STAMIN 0
+#define WNI_CFG_MIMO_ENABLED_STAMAX 1
+#define WNI_CFG_MIMO_ENABLED_STADEF 1
+
+#define WNI_CFG_MIMO_ENABLED_ENABLE 1
+#define WNI_CFG_MIMO_ENABLED_DISABLE 0
+
+#define WNI_CFG_BLOCK_ACK_ENABLED_STAMIN 0
+#define WNI_CFG_BLOCK_ACK_ENABLED_STAMAX 3
+#define WNI_CFG_BLOCK_ACK_ENABLED_STADEF 0
+
+#define WNI_CFG_BLOCK_ACK_ENABLED_DELAYED 0
+#define WNI_CFG_BLOCK_ACK_ENABLED_IMMEDIATE 1
+
+#define WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT_STAMIN 0
+#define WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT_STAMAX 65535
+#define WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT_STADEF 1000
+
+#define WNI_CFG_HT_RX_STBC_STAMIN 0
+#define WNI_CFG_HT_RX_STBC_STAMAX 3
+#define WNI_CFG_HT_RX_STBC_STADEF 1
+
+#define WNI_CFG_HT_CAP_INFO_STAMIN 0
+#define WNI_CFG_HT_CAP_INFO_STAMAX 65535
+#define WNI_CFG_HT_CAP_INFO_STADEF 364
+
+#define WNI_CFG_HT_CAP_INFO_ADVANCE_CODING 0
+#define WNI_CFG_HT_CAP_INFO_SUPPORTED_CHAN_WIDTH_SET 1
+#define WNI_CFG_HT_CAP_INFO_SM_POWER_SAVE 2
+#define WNI_CFG_HT_CAP_INFO_GREEN_FIELD 4
+#define WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ 5
+#define WNI_CFG_HT_CAP_INFO_SHORT_GI_40MHZ 6
+#define WNI_CFG_HT_CAP_INFO_TX_STBC 7
+#define WNI_CFG_HT_CAP_INFO_RX_STBC 8
+#define WNI_CFG_HT_CAP_INFO_DELAYED_BA 10
+#define WNI_CFG_HT_CAP_INFO_MAX_AMSDU_SIZE 11
+#define WNI_CFG_HT_CAP_INFO_DSSS_CCK_MODE_40MHZ 12
+#define WNI_CFG_HT_CAP_INFO_PSMP 13
+#define WNI_CFG_HT_CAP_INFO_STBC_CONTROL_FRAME 14
+#define WNI_CFG_HT_CAP_INFO_LSIG_TXOP_PROTECTION 15
+
+#define WNI_CFG_HT_AMPDU_PARAMS_STAMIN 0
+#define WNI_CFG_HT_AMPDU_PARAMS_STAMAX 255
+#define WNI_CFG_HT_AMPDU_PARAMS_STADEF 0
+
+#define WNI_CFG_HT_AMPDU_PARAMS_MAX_RX_AMPDU_FACTOR 0
+#define WNI_CFG_HT_AMPDU_PARAMS_MPDU_DENSITY 2
+#define WNI_CFG_HT_AMPDU_PARAMS_RESERVED 5
+
+#define WNI_CFG_EXT_HT_CAP_INFO_STAMIN 0
+#define WNI_CFG_EXT_HT_CAP_INFO_STAMAX 65535
+#define WNI_CFG_EXT_HT_CAP_INFO_STADEF 1024
+
+#define WNI_CFG_EXT_HT_CAP_INFO_PCO 0
+#define WNI_CFG_EXT_HT_CAP_INFO_TRANSITION_TIME 1
+#define WNI_CFG_EXT_HT_CAP_INFO_RESERVED1 3
+#define WNI_CFG_EXT_HT_CAP_INFO_MCS_FEEDBACK 8
+#define WNI_CFG_EXT_HT_CAP_INFO_HTC_SUPPORT 10
+#define WNI_CFG_EXT_HT_CAP_INFO_RD_RESPONDER 11
+#define WNI_CFG_EXT_HT_CAP_INFO_RESERVED2 12
+
+#define WNI_CFG_TX_BF_CAP_STAMIN 0
+#define WNI_CFG_TX_BF_CAP_STAMAX 4294967295
+#define WNI_CFG_TX_BF_CAP_STADEF 0
+
+#define WNI_CFG_AS_CAP_STAMIN 0
+#define WNI_CFG_AS_CAP_STAMAX 255
+#define WNI_CFG_AS_CAP_STADEF 0
+
+#define WNI_CFG_AS_CAP_ANTENNA_SELECTION 0
+#define WNI_CFG_AS_CAP_EXPLICIT_CSI_FEEDBACK_TX 1
+#define WNI_CFG_AS_CAP_ANTENNA_INDICES_FEEDBACK_TX 2
+#define WNI_CFG_AS_CAP_EXPLICIT_CSI_FEEDBACK 3
+#define WNI_CFG_AS_CAP_ANTENNA_INDICES_FEEDBACK 4
+#define WNI_CFG_AS_CAP_RX_AS 5
+#define WNI_CFG_AS_CAP_TX_SOUNDING_PPDUS 6
+#define WNI_CFG_AS_CAP_RESERVED 7
+
+#define WNI_CFG_HT_INFO_FIELD1_STAMIN 0
+#define WNI_CFG_HT_INFO_FIELD1_STAMAX 255
+#define WNI_CFG_HT_INFO_FIELD1_STADEF 15
+
+#define WNI_CFG_HT_INFO_FIELD1_SECONDARY_CHANNEL_OFFSET 0
+#define WNI_CFG_HT_INFO_FIELD1_RECOMMENDED_CHANNEL_WIDTH 2
+#define WNI_CFG_HT_INFO_FIELD1_RIFS_MODE 3
+#define WNI_CFG_HT_INFO_FIELD1_PSMP_ACCESS_ONLY 4
+#define WNI_CFG_HT_INFO_FIELD1_SERVICE_INTERVAL_GRANULARITY 5
+
+#define WNI_CFG_HT_INFO_FIELD2_STAMIN 0
+#define WNI_CFG_HT_INFO_FIELD2_STAMAX 65535
+#define WNI_CFG_HT_INFO_FIELD2_STADEF 0
+
+#define WNI_CFG_HT_INFO_FIELD2_OP_MODE 0
+#define WNI_CFG_HT_INFO_FIELD2_NON_GF_DEVICES_PRESENT 2
+#define WNI_CFG_HT_INFO_FIELD2_RESERVED 3
+
+#define WNI_CFG_HT_INFO_FIELD3_STAMIN 0
+#define WNI_CFG_HT_INFO_FIELD3_STAMAX 65535
+#define WNI_CFG_HT_INFO_FIELD3_STADEF 0
+
+#define WNI_CFG_HT_INFO_FIELD3_BASIC_STBC_MCS 0
+#define WNI_CFG_HT_INFO_FIELD3_DUAL_STBC_PROTECTION 7
+#define WNI_CFG_HT_INFO_FIELD3_SECONDARY_BEACON 8
+#define WNI_CFG_HT_INFO_FIELD3_LSIG_TXOP_PROTECTION_FULL_SUPPORT 9
+#define WNI_CFG_HT_INFO_FIELD3_PCO_ACTIVE 10
+#define WNI_CFG_HT_INFO_FIELD3_PCO_PHASE 11
+#define WNI_CFG_HT_INFO_FIELD3_RESERVED 12
+
+#define WNI_CFG_GREENFIELD_CAPABILITY_STAMIN 0
+#define WNI_CFG_GREENFIELD_CAPABILITY_STAMAX 1
+#define WNI_CFG_GREENFIELD_CAPABILITY_STADEF 0
+
+#define WNI_CFG_GREENFIELD_CAPABILITY_ENABLE 1
+#define WNI_CFG_GREENFIELD_CAPABILITY_DISABLE 0
+
+#define WNI_CFG_MAX_AMSDU_LENGTH_STAMIN 0
+#define WNI_CFG_MAX_AMSDU_LENGTH_STAMAX 1
+#define WNI_CFG_MAX_AMSDU_LENGTH_STADEF 0
+
+#define WNI_CFG_MAX_AMSDU_LENGTH_SHORT_3839_BYTES 0
+#define WNI_CFG_MAX_AMSDU_LENGTH_LONG_7935__BYTES 1
+
+#define WNI_CFG_MPDU_DENSITY_STAMIN 0
+#define WNI_CFG_MPDU_DENSITY_STAMAX 7
+#define WNI_CFG_MPDU_DENSITY_STADEF 0
+
+#define WNI_CFG_MAX_RX_AMPDU_FACTOR_STAMIN 0
+#define WNI_CFG_MAX_RX_AMPDU_FACTOR_STAMAX 3
+#define WNI_CFG_MAX_RX_AMPDU_FACTOR_STADEF 3
+
+#define WNI_CFG_SHORT_GI_20MHZ_STAMIN 0
+#define WNI_CFG_SHORT_GI_20MHZ_STAMAX 1
+#define WNI_CFG_SHORT_GI_20MHZ_STADEF 1
+
+#define WNI_CFG_SHORT_GI_20MHZ_ENABLE 1
+#define WNI_CFG_SHORT_GI_20MHZ_DISABLE 0
+
+#define WNI_CFG_SHORT_GI_40MHZ_STAMIN 0
+#define WNI_CFG_SHORT_GI_40MHZ_STAMAX 1
+#define WNI_CFG_SHORT_GI_40MHZ_STADEF 0
+
+#define WNI_CFG_SHORT_GI_40MHZ_ENABLE 1
+#define WNI_CFG_SHORT_GI_40MHZ_DISABLE 0
+
+#define WNI_CFG_RIFS_ENABLED_STAMIN 0
+#define WNI_CFG_RIFS_ENABLED_STAMAX 1
+#define WNI_CFG_RIFS_ENABLED_STADEF 1
+
+#define WNI_CFG_RIFS_ENABLED_ENABLE 1
+#define WNI_CFG_RIFS_ENABLED_DISABLE 0
+
+#define WNI_CFG_MAX_PS_POLL_STAMIN 0
+#define WNI_CFG_MAX_PS_POLL_STAMAX 255
+#define WNI_CFG_MAX_PS_POLL_STADEF 0
+
+#define WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE_STAMIN 1
+#define WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE_STAMAX 20
+#define WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE_STADEF 20
+
+#define WNI_CFG_RSSI_FILTER_PERIOD_STAMIN 0
+#define WNI_CFG_RSSI_FILTER_PERIOD_STAMAX 255
+#define WNI_CFG_RSSI_FILTER_PERIOD_STADEF 20
+
+#define WNI_CFG_FT_RSSI_FILTER_PERIOD_STAMIN 0
+#define WNI_CFG_FT_RSSI_FILTER_PERIOD_STAMAX 255
+#define WNI_CFG_FT_RSSI_FILTER_PERIOD_STADEF 5
+
+#define WNI_CFG_MIN_RSSI_THRESHOLD_STAMIN 0
+#define WNI_CFG_MIN_RSSI_THRESHOLD_STAMAX 10
+#define WNI_CFG_MIN_RSSI_THRESHOLD_STADEF 10
+
+#define WNI_CFG_NTH_BEACON_FILTER_STAMIN 0
+#define WNI_CFG_NTH_BEACON_FILTER_STAMAX 255
+#define WNI_CFG_NTH_BEACON_FILTER_STADEF 10
+
+#define WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE_STAMIN 0
+#define WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE_STAMAX 1
+#define WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE_STADEF 0
+
+#define WNI_CFG_SCAN_IN_POWERSAVE_STAMIN 0
+#define WNI_CFG_SCAN_IN_POWERSAVE_STAMAX 1
+#define WNI_CFG_SCAN_IN_POWERSAVE_STADEF 1
+
+#define WNI_CFG_IGNORE_DTIM_STAMIN 0
+#define WNI_CFG_IGNORE_DTIM_STAMAX 1
+#define WNI_CFG_IGNORE_DTIM_STADEF 0
+
+#define WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE_STAMIN 0
+#define WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE_STAMAX 1
+#define WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE_STADEF 1
+
+#define WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE_STAMIN 0
+#define WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE_STAMAX 1
+#define WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE_STADEF 1
+
+#define WNI_CFG_WOWLAN_DEAUTH_ENABLE_STAMIN 0
+#define WNI_CFG_WOWLAN_DEAUTH_ENABLE_STAMAX 1
+#define WNI_CFG_WOWLAN_DEAUTH_ENABLE_STADEF 1
+
+#define WNI_CFG_WOWLAN_DISASSOC_ENABLE_STAMIN 0
+#define WNI_CFG_WOWLAN_DISASSOC_ENABLE_STAMAX 1
+#define WNI_CFG_WOWLAN_DISASSOC_ENABLE_STADEF 1
+
+#define WNI_CFG_WOWLAN_MAX_MISSED_BEACON_STAMIN 0
+#define WNI_CFG_WOWLAN_MAX_MISSED_BEACON_STAMAX 65535
+#define WNI_CFG_WOWLAN_MAX_MISSED_BEACON_STADEF 40
+
+#define WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD_STAMIN 0
+#define WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD_STAMAX 65535
+#define WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD_STADEF 65535
+
+#define WNI_CFG_BA_TIMEOUT_STAMIN 0
+#define WNI_CFG_BA_TIMEOUT_STAMAX 65535
+#define WNI_CFG_BA_TIMEOUT_STADEF 0
+
+#define WNI_CFG_BA_THRESHOLD_HIGH_STAMIN 0
+#define WNI_CFG_BA_THRESHOLD_HIGH_STAMAX 65535
+#define WNI_CFG_BA_THRESHOLD_HIGH_STADEF 128
+
+#define WNI_CFG_MAX_BA_BUFFERS_STAMIN 0
+#define WNI_CFG_MAX_BA_BUFFERS_STAMAX 2560
+#define WNI_CFG_MAX_BA_BUFFERS_STADEF 2560
+
+#define WNI_CFG_MAX_BA_SESSIONS_STAMIN 0
+#define WNI_CFG_MAX_BA_SESSIONS_STAMAX 64
+#define WNI_CFG_MAX_BA_SESSIONS_STADEF 40
+
+#define WNI_CFG_BA_AUTO_SETUP_STAMIN 0
+#define WNI_CFG_BA_AUTO_SETUP_STAMAX 1
+#define WNI_CFG_BA_AUTO_SETUP_STADEF 1
+
+#define WNI_CFG_BA_AUTO_SETUP_ENABLE 1
+#define WNI_CFG_BA_AUTO_SETUP_DISABLE 0
+
+#define WNI_CFG_ADDBA_REQ_DECLINE_STAMIN 0
+#define WNI_CFG_ADDBA_REQ_DECLINE_STAMAX 255
+#define WNI_CFG_ADDBA_REQ_DECLINE_STADEF 0
+
+#define WNI_CFG_MAX_MEDIUM_TIME_STAMIN 0
+#define WNI_CFG_MAX_MEDIUM_TIME_STAMAX 65535
+#define WNI_CFG_MAX_MEDIUM_TIME_STADEF 2048
+
+#define WNI_CFG_MAX_MPDUS_IN_AMPDU_STAMIN 0
+#define WNI_CFG_MAX_MPDUS_IN_AMPDU_STAMAX 65535
+#define WNI_CFG_MAX_MPDUS_IN_AMPDU_STADEF 64
+
+#define WNI_CFG_IBSS_AUTO_BSSID_STAMIN 0
+#define WNI_CFG_IBSS_AUTO_BSSID_STAMAX 1
+#define WNI_CFG_IBSS_AUTO_BSSID_STADEF 1
+
+#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG_STAMIN 0
+#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG_STAMAX 1
+#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG_STADEF 0
+
+#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG_STAMIN 0
+#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG_STAMAX 1
+#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG_STADEF 0
+
+#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG_STAMIN 0
+#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG_STAMAX 1
+#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG_STADEF 0
+
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG_STAMIN 0
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG_STAMAX 1
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG_STADEF 0
+
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG_STAMIN 0
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG_STAMAX 1
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG_STADEF 0
+
+#define WNI_CFG_WPS_ENABLE_STAMIN 0
+#define WNI_CFG_WPS_ENABLE_STAMAX 255
+#define WNI_CFG_WPS_ENABLE_STADEF 0
+
+#define WNI_CFG_WPS_ENABLE_AP 1
+#define WNI_CFG_WPS_ENABLE_STA 2
+
+#define WNI_CFG_WPS_STATE_STAMIN 0
+#define WNI_CFG_WPS_STATE_STAMAX 255
+#define WNI_CFG_WPS_STATE_STADEF 1
+
+#define WNI_CFG_WPS_PROBE_REQ_FLAG_STAMIN 0
+#define WNI_CFG_WPS_PROBE_REQ_FLAG_STAMAX 1
+#define WNI_CFG_WPS_PROBE_REQ_FLAG_STADEF 0
+
+#define WNI_CFG_WPS_VERSION_STAMIN 0
+#define WNI_CFG_WPS_VERSION_STAMAX 255
+#define WNI_CFG_WPS_VERSION_STADEF 16
+
+#define WNI_CFG_WPS_REQUEST_TYPE_STAMIN 0
+#define WNI_CFG_WPS_REQUEST_TYPE_STAMAX 255
+#define WNI_CFG_WPS_REQUEST_TYPE_STADEF 0
+
+#define WNI_CFG_WPS_CFG_METHOD_STAMIN 0
+#define WNI_CFG_WPS_CFG_METHOD_STAMAX 4294967295
+#define WNI_CFG_WPS_CFG_METHOD_STADEF 8
+
+#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY_STAMIN 0
+#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY_STAMAX 65535
+#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY_STADEF 1
+
+#define WNI_CFG_WPS_PIMARY_DEVICE_OUI_STAMIN 0
+#define WNI_CFG_WPS_PIMARY_DEVICE_OUI_STAMAX 4294967295
+#define WNI_CFG_WPS_PIMARY_DEVICE_OUI_STADEF 5304836
+
+#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY_STAMIN 0
+#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY_STAMAX 65535
+#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY_STADEF 1
+
+#define WNI_CFG_WPS_ASSOCIATION_STATE_STAMIN 0
+#define WNI_CFG_WPS_ASSOCIATION_STATE_STAMAX 65535
+#define WNI_CFG_WPS_ASSOCIATION_STATE_STADEF 0
+
+#define WNI_CFG_WPS_CONFIGURATION_ERROR_STAMIN 0
+#define WNI_CFG_WPS_CONFIGURATION_ERROR_STAMAX 65535
+#define WNI_CFG_WPS_CONFIGURATION_ERROR_STADEF 0
+
+#define WNI_CFG_WPS_DEVICE_PASSWORD_ID_STAMIN 0
+#define WNI_CFG_WPS_DEVICE_PASSWORD_ID_STAMAX 4294967295
+#define WNI_CFG_WPS_DEVICE_PASSWORD_ID_STADEF 0
+
+#define WNI_CFG_WPS_ASSOC_METHOD_STAMIN 0
+#define WNI_CFG_WPS_ASSOC_METHOD_STAMAX 65535
+#define WNI_CFG_WPS_ASSOC_METHOD_STADEF 0
+
+#define WNI_CFG_LOW_GAIN_OVERRIDE_STAMIN 0
+#define WNI_CFG_LOW_GAIN_OVERRIDE_STAMAX 1
+#define WNI_CFG_LOW_GAIN_OVERRIDE_STADEF 0
+
+#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE_STAMIN 0
+#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE_STAMAX 128
+#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE_STADEF 128
+
+#define WNI_CFG_RPE_POLLING_THRESHOLD_STAMIN 0
+#define WNI_CFG_RPE_POLLING_THRESHOLD_STAMAX 65535
+#define WNI_CFG_RPE_POLLING_THRESHOLD_STADEF 10
+
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG_STAMIN 0
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG_STAMAX 65535
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG_STADEF 30
+
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG_STAMIN 0
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG_STAMAX 65535
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG_STADEF 30
+
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG_STAMIN 0
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG_STAMAX 65535
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG_STADEF 30
+
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG_STAMIN 0
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG_STAMAX 65535
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG_STADEF 30
+
+#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS_STAMIN 0
+#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS_STAMAX 2
+#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS_STADEF 1
+
+#define WNI_CFG_SINGLE_TID_RC_STAMIN 0
+#define WNI_CFG_SINGLE_TID_RC_STAMAX 1
+#define WNI_CFG_SINGLE_TID_RC_STADEF 1
+
+#define WNI_CFG_RRM_ENABLED_STAMIN 0
+#define WNI_CFG_RRM_ENABLED_STAMAX 1
+#define WNI_CFG_RRM_ENABLED_STADEF 0
+
+#define WNI_CFG_RRM_OPERATING_CHAN_MAX_STAMIN 0
+#define WNI_CFG_RRM_OPERATING_CHAN_MAX_STAMAX 8
+#define WNI_CFG_RRM_OPERATING_CHAN_MAX_STADEF 0
+
+#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX_STAMIN 0
+#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX_STAMAX 8
+#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX_STADEF 0
+
+#define WNI_CFG_TX_PWR_CTRL_ENABLE_STAMIN 0
+#define WNI_CFG_TX_PWR_CTRL_ENABLE_STAMAX 1
+#define WNI_CFG_TX_PWR_CTRL_ENABLE_STADEF 1
+
+#define WNI_CFG_MCAST_BCAST_FILTER_SETTING_STAMIN 0
+#define WNI_CFG_MCAST_BCAST_FILTER_SETTING_STAMAX 3
+#define WNI_CFG_MCAST_BCAST_FILTER_SETTING_STADEF 0
+
+#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK_STAMIN 0
+#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK_STAMAX 255
+#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK_STADEF 0
+
+#define WNI_CFG_DYNAMIC_PS_POLL_VALUE_STAMIN 0
+#define WNI_CFG_DYNAMIC_PS_POLL_VALUE_STAMAX 255
+#define WNI_CFG_DYNAMIC_PS_POLL_VALUE_STADEF 0
+
+#define WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT_STAMIN 0
+#define WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT_STAMAX 80
+#define WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT_STADEF 0
+
+#define WNI_CFG_TELE_BCN_WAKEUP_EN_STAMIN 0
+#define WNI_CFG_TELE_BCN_WAKEUP_EN_STAMAX 1
+#define WNI_CFG_TELE_BCN_WAKEUP_EN_STADEF 0
+
+#define WNI_CFG_TELE_BCN_TRANS_LI_STAMIN 0
+#define WNI_CFG_TELE_BCN_TRANS_LI_STAMAX 7
+#define WNI_CFG_TELE_BCN_TRANS_LI_STADEF 3
+
+#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS_STAMIN 5
+#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS_STAMAX 255
+#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS_STADEF 10
+
+#define WNI_CFG_TELE_BCN_MAX_LI_STAMIN 0
+#define WNI_CFG_TELE_BCN_MAX_LI_STAMAX 7
+#define WNI_CFG_TELE_BCN_MAX_LI_STADEF 5
+
+#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS_STAMIN 5
+#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS_STAMAX 255
+#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS_STADEF 15
+
+#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS_STAMIN 0
+#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS_STAMAX 255
+#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS_STADEF 7
+
+#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMIN 0
+#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMAX 65535
+#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STADEF 0
+
+#define WNI_CFG_ASSOC_STA_LIMIT_STAMIN 1
+#define WNI_CFG_ASSOC_STA_LIMIT_STAMAX 10
+#define WNI_CFG_ASSOC_STA_LIMIT_STADEF 10
+
+#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_STAMIN 1
+#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_STAMAX 252
+#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_STADEF 1
+
+#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_STAMIN 1
+#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_STAMAX 252
+#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_STADEF 11
+
+#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_STAMIN 0
+#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_STAMAX 4
+#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_STADEF 0
+
+#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD_STAMIN 0
+#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD_STAMAX 65535
+#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD_STADEF 5
+
+#define WNI_CFG_ENABLE_CLOSE_LOOP_STAMIN 0
+#define WNI_CFG_ENABLE_CLOSE_LOOP_STAMAX 1
+#define WNI_CFG_ENABLE_CLOSE_LOOP_STADEF 0
+
+#define WNI_CFG_ENABLE_LTE_COEX_STAMIN 0
+#define WNI_CFG_ENABLE_LTE_COEX_STAMAX 1
+#define WNI_CFG_ENABLE_LTE_COEX_STADEF 0
+
+#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT_STAMIN 1
+#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT_STAMAX 255
+#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT_STADEF 20
+
+#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT_STAMIN 1
+#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT_STAMAX 255
+#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT_STADEF 20
+
+#define CFG_PARAM_MAX_NUM 259
+#define CFG_STA_IBUF_MAX_SIZE 193
+#define CFG_STA_SBUF_MAX_SIZE 3388
+#define CFG_SEM_MAX_NUM 12
+
+#define CFG_STA_MAGIC_DWORD 0xbeefbeef
+
+
+#endif
diff --git a/CORE/MAC/inc/wniStat.h b/CORE/MAC/inc/wniStat.h
new file mode 100644
index 0000000..2a6b4bb
--- /dev/null
+++ b/CORE/MAC/inc/wniStat.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file wniStat.h contains statistics related definitions
+ * exported by Sirius software modules.
+ *
+ * Author: Kevin Nguyen
+ * Date: 08/21/2002
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+
+#ifndef _WNISTAT_H
+#define _WNISTAT_H
+
+
+// WNI Statistic Parameter ID
+#define WNI_STAT_RTS_SUCC_CNT 1
+#define WNI_STAT_RTS_FAILED_CNT 2
+#define WNI_STAT_PACKET_CNT 3
+#define WNI_STAT_MULTI_CNT 4
+#define WNI_STAT_DUPL_FRAG_CNT 5
+#define WNI_STAT_TOTAL_BYTE_CNT 6
+#define WNI_STAT_PKT_DROP_CNT 7
+#define WNI_STAT_PKT64_CNT 8
+#define WNI_STAT_PKT127_CNT 9
+#define WNI_STAT_PKT255_CNT 10
+#define WNI_STAT_PKT511_CNT 11
+#define WNI_STAT_PKT1023_CNT 12
+#define WNI_STAT_PKT1518_CNT 13
+#define WNI_STAT_PKT2047_CNT 14
+#define WNI_STAT_PKT4095_CNT 15
+#define WNI_STAT_FRAG_CNT 16
+#define WNI_STAT_FCS_CNT 17
+#define WNI_STAT_BSSID_MISS_CNT 18
+#define WNI_STAT_PDU_ERR_CNT 19
+#define WNI_STAT_DST_MISS_CNT 20
+#define WNI_STAT_DROP_CNT 21
+#define WNI_STAT_ABORT_CNT 22
+#define WNI_STAT_RELAY_CNT 23
+#define WNI_STAT_HASH_MISS_CNT 24
+#define WNI_STAT_PLCP_CRC_ERR_CNT 25
+#define WNI_STAT_PLCP_SIG_ERR_CNT 26
+#define WNI_STAT_PLCP_SVC_ERR_CNT 27
+#define WNI_STAT_BEACONS_RECEIVED_CNT 28
+#define WNI_STAT_BEACONS_TRANSMITTED_CNT 29
+#define WNI_STAT_CURRENT_TX_RATE 30
+
+#define WNI_STAT_LAST_ID WNI_STAT_CURRENT_TX_RATE
+
+
+#endif
+
diff --git a/CORE/MAC/src/cfg/cfgApi.c b/CORE/MAC/src/cfg/cfgApi.c
new file mode 100644
index 0000000..a20d0ec
--- /dev/null
+++ b/CORE/MAC/src/cfg/cfgApi.c
@@ -0,0 +1,1199 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file contains the source code for CFG API functions.
+ *
+ * Author: Kevin Nguyen
+ * Date: 04/09/02
+ * History:-
+ * 04/09/02 Created.
+ * --------------------------------------------------------------------
+ */
+
+#include "palTypes.h"
+#include "cfgPriv.h"
+#include "cfgDebug.h"
+#include "wlan_qct_wda.h"
+
+//---------------------------------------------------------------------
+// Static Variables
+//----------------------------------------------------------------------
+static tCfgCtl __gCfgEntry[CFG_PARAM_MAX_NUM] ;
+static tANI_U32 __gCfgIBufMin[CFG_STA_IBUF_MAX_SIZE] ;
+static tANI_U32 __gCfgIBufMax[CFG_STA_IBUF_MAX_SIZE] ;
+static tANI_U32 __gCfgIBuf[CFG_STA_IBUF_MAX_SIZE] ;
+static tANI_U8 __gCfgSBuf[CFG_STA_SBUF_MAX_SIZE] ;
+static tANI_U8 __gSBuffer[CFG_MAX_STR_LEN] ;
+static tANI_U32 __gParamList[WNI_CFG_MAX_PARAM_NUM +
+ WNI_CFG_GET_PER_STA_STAT_RSP_NUM];
+
+static void Notify(tpAniSirGlobal, tANI_U16, tANI_U32);
+
+
+// ---------------------------------------------------------------------
+tANI_U32 cfgNeedRestart(tpAniSirGlobal pMac, tANI_U16 cfgId)
+{
+ return !!(pMac->cfg.gCfgEntry[cfgId].control & CFG_CTL_RESTART) ;
+}
+
+// ---------------------------------------------------------------------
+tANI_U32 cfgNeedReload(tpAniSirGlobal pMac, tANI_U16 cfgId)
+{
+ return !!(pMac->cfg.gCfgEntry[cfgId].control & CFG_CTL_RELOAD) ;
+}
+
+// ---------------------------------------------------------------------
+/**
+ * wlan_cfgInit()
+ *
+ * FUNCTION:
+ * CFG initialization function.
+ *
+ * LOGIC:
+ * Please see Configuration & Statistic Collection Micro-Architecture
+ * specification for the pseudocode.
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ * This function must be called during system initialization.
+ *
+ * @param None
+ * @return None.
+ */
+
+void
+wlan_cfgInit(tpAniSirGlobal pMac)
+{
+ // Set status to not-ready
+ pMac->cfg.gCfgStatus = CFG_INCOMPLETE;
+
+ // Send CFG_DNLD_REQ to host
+ PELOGW(cfgLog(pMac, LOGW, FL("Sending CFG_DNLD_REQ\n"));)
+ cfgSendHostMsg(pMac, WNI_CFG_DNLD_REQ, WNI_CFG_DNLD_REQ_LEN,
+ WNI_CFG_DNLD_REQ_NUM, 0, 0, 0);
+
+} /*** end wlan_cfgInit() ***/
+
+
+//---------------------------------------------------------------------
+#if (WNI_POLARIS_FW_PRODUCT != AP)
+tSirRetStatus cfgInit(tpAniSirGlobal pMac)
+{
+ pMac->cfg.gCfgIBufMin = __gCfgIBufMin;
+ pMac->cfg.gCfgIBufMax = __gCfgIBufMax;
+ pMac->cfg.gCfgIBuf = __gCfgIBuf;
+ pMac->cfg.gCfgSBuf = __gCfgSBuf;
+ pMac->cfg.gSBuffer = __gSBuffer;
+ pMac->cfg.gCfgEntry = __gCfgEntry;
+ pMac->cfg.gParamList = __gParamList;
+
+ return (eSIR_SUCCESS);
+}
+
+//----------------------------------------------------------------------
+void cfgDeInit(tpAniSirGlobal pMac)
+{
+ pMac->cfg.gCfgIBufMin = NULL;
+ pMac->cfg.gCfgIBufMax = NULL;
+ pMac->cfg.gCfgIBuf = NULL;
+ pMac->cfg.gCfgSBuf = NULL;
+ pMac->cfg.gSBuffer = NULL;
+ pMac->cfg.gCfgEntry = NULL;
+ pMac->cfg.gParamList = NULL;
+}
+#endif
+
+// ---------------------------------------------------------------------
+/**
+ * cfgSetInt()
+ *
+ * FUNCTION:
+ * This function is called to update an integer parameter.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * - Range checking is performed by the calling function. In case this
+ * function call is being triggered by a request from host, then host
+ * is responsible for performing range checking before sending the
+ * request.
+ *
+ * - Host RW permission checking should already be done prior to calling
+ * this function by the message processing function.
+ *
+ * NOTE:
+ *
+ * @param cfgId: 16-bit CFG parameter ID
+ * @param value: 32-bit unsigned value
+ *
+ * @return eSIR_SUCCESS : request completed successfully \n
+ * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID \n
+ */
+
+tSirRetStatus
+cfgSetInt(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U32 value)
+{
+ tANI_U32 index;
+ tANI_U32 control, mask;
+ tSirRetStatus retVal;
+
+ if (cfgId >= CFG_PARAM_MAX_NUM)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d\n"), cfgId);)
+ return eSIR_CFG_INVALID_ID;
+ }
+
+ control = pMac->cfg.gCfgEntry[cfgId].control;
+ index = control & CFG_BUF_INDX_MASK;
+ retVal = eSIR_SUCCESS;
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ if (index >= CFG_AP_IBUF_MAX_SIZE)
+#else
+ if (index >= CFG_STA_IBUF_MAX_SIZE)
+#endif
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("cfg index out of bounds %d\n"), index);)
+ retVal = eSIR_CFG_INVALID_ID;
+ return retVal;
+ }
+
+ // Check if parameter is valid
+ if ((control & CFG_CTL_VALID) == 0)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Not valid cfg id %d\n"), cfgId);)
+ retVal = eSIR_CFG_INVALID_ID;
+ }
+#if 0
+ else if (((control & CFG_CTL_RESTART) && !Restarting(pMac)) ||
+ ((control & CFG_CTL_RELOAD) && !Reloading(pMac)))
+ {
+ cfgLog(pMac, LOGE, FL("Change requires a restart/reload cfg id %d state %d\n"),
+ cfgId, pMac->lim.gLimSmeState);
+ retVal = eSIR_CFG_INVALID_ID;
+ }
+#endif
+ else if ((pMac->cfg.gCfgIBufMin[index] > value) ||
+ (pMac->cfg.gCfgIBufMax[index] < value))
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Value %d out of range [%d,%d] cfg id %d\n"),
+ value, pMac->cfg.gCfgIBufMin[index],
+ pMac->cfg.gCfgIBufMax[index], cfgId);)
+ retVal = eSIR_CFG_INVALID_ID;
+ }
+ else
+ {
+ // Write integer value
+ pMac->cfg.gCfgIBuf[index] = value;
+
+ // Update hardware if necessary
+ mask = control & CFG_CTL_NTF_MASK;
+ if ((mask & CFG_CTL_NTF_HW) != 0)
+ PELOGE(cfgLog(pMac, LOGE, FL("CFG Notify HW not supported!!!\n"));)
+
+ // Notify other modules if necessary
+ if ((mask & CFG_CTL_NTF_MASK) != 0)
+ Notify(pMac, cfgId, mask);
+
+ }
+
+ return (retVal);
+
+} /*** end cfgSetInt ***/
+
+// ---------------------------------------------------------------------
+/**
+ * cfgCheckValid()
+ *
+ * FUNCTION:
+ * This function is called to check if a parameter is valid
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param cfgId: 16-bit CFG parameter ID
+ *
+ * @return eSIR_SUCCESS: request completed successfully
+ * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID
+ */
+
+tSirRetStatus
+cfgCheckValid(tpAniSirGlobal pMac, tANI_U16 cfgId)
+{
+ tANI_U32 control;
+
+ if (cfgId >= CFG_PARAM_MAX_NUM)
+ {
+ PELOG3(cfgLog(pMac, LOG3, FL("Invalid cfg id %d\n"), cfgId);)
+ return(eSIR_CFG_INVALID_ID);
+ }
+
+ control = pMac->cfg.gCfgEntry[cfgId].control;
+
+ // Check if parameter is valid
+ if ((control & CFG_CTL_VALID) == 0)
+ {
+ PELOG3(cfgLog(pMac, LOG3, FL("Not valid cfg id %d\n"), cfgId);)
+ return(eSIR_CFG_INVALID_ID);
+ }
+ else
+ return(eSIR_SUCCESS);
+
+} /*** end cfgCheckValid() ***/
+
+// ---------------------------------------------------------------------
+/**
+ * wlan_cfgGetInt()
+ *
+ * FUNCTION:
+ * This function is called to read an integer parameter.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param cfgId: 16-bit CFG parameter ID
+ * @param pVal: address where parameter value will be written
+ *
+ * @return eSIR_SUCCESS: request completed successfully
+ * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID
+ */
+
+tSirRetStatus
+wlan_cfgGetInt(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U32 *pValue)
+{
+ tANI_U32 index;
+ tANI_U32 control;
+ tSirRetStatus retVal;
+
+ if (cfgId >= CFG_PARAM_MAX_NUM)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d\n"), cfgId);)
+ retVal = eSIR_CFG_INVALID_ID;
+ return retVal;
+ }
+
+ control = pMac->cfg.gCfgEntry[cfgId].control;
+ index = control & CFG_BUF_INDX_MASK;
+ retVal = eSIR_SUCCESS;
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ if (index >= CFG_AP_IBUF_MAX_SIZE)
+#else
+ if (index >= CFG_STA_IBUF_MAX_SIZE)
+#endif
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("cfg index out of bounds %d\n"), index);)
+ retVal = eSIR_CFG_INVALID_ID;
+ return retVal;
+ }
+
+ // Check if parameter is valid
+ if ((control & CFG_CTL_VALID) == 0)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Not valid cfg id %d\n"), cfgId);)
+ retVal = eSIR_CFG_INVALID_ID;
+ }
+ else {
+ // Get integer value
+ if(index < CFG_AP_IBUF_MAX_SIZE)
+ *pValue = pMac->cfg.gCfgIBuf[index];
+ }
+
+ return (retVal);
+
+} /*** end wlan_cfgGetInt() ***/
+
+#ifdef NOT_CURRENTLY_USED
+// ---------------------------------------------------------------------
+/**
+ * cfgIncrementInt()
+ *
+ * FUNCTION:
+ * This function is called to increment an integer parameter by n.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * - No range checking will be performed.
+ * - Host RW permission should be checked prior to calling this
+ * function.
+ *
+ * NOTE:
+ *
+ * @param cfgId: 16-bit CFG parameter ID
+ * @param value: increment value
+ *
+ * @return eSIR_SUCCESS: request completed successfully
+ * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID
+ */
+
+tSirRetStatus
+cfgIncrementInt(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U32 value)
+{
+ tANI_U32 index;
+ tANI_U32 control;
+ tSirRetStatus retVal;
+
+ if (cfgId >= CFG_PARAM_MAX_NUM)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d\n"), cfgId);)
+ retVal = eSIR_CFG_INVALID_ID;
+ }
+
+ control = pMac->cfg.gCfgEntry[cfgId].control;
+ index = control & CFG_BUF_INDX_MASK;
+ retVal = eSIR_SUCCESS;
+
+ // Check if parameter is valid
+ if ((control & CFG_CTL_VALID) == 0)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Not valid cfg id %d\n"), cfgId);)
+ retVal = eSIR_CFG_INVALID_ID;
+ }
+ else
+ {
+ // Increment integer value
+ pMac->cfg.gCfgIBuf[index] += value;
+
+ }
+
+ return (retVal);
+}
+#endif // NOT_CURRENTLY_USED
+
+// ---------------------------------------------------------------------
+/**
+ * cfgSetStr()
+ *
+ * FUNCTION:
+ * This function is called to set a string parameter.
+ *
+ * LOGIC:
+ * This function invokes the cfgSetStrNotify function passing the notify
+ * boolean value set to TRUE. This basically means that HAL needs to be
+ * notified. This is true in the case of non-integrated SOC's or Libra/Volans.
+ * In the case of Prima the cfgSetStrNotify is invoked with the boolean value
+ * set to FALSE.
+ *
+ * ASSUMPTIONS:
+ * - always Notify has to be called
+ *
+ * NOTE:
+ *
+ * @param cfgId: 16-bit CFG parameter ID
+ * @param pStr: address of string data
+ * @param len: string length
+ *
+ * @return eSIR_SUCCESS: request completed successfully
+ * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID
+ * @return eSIR_CFG_INVALID_LEN: invalid parameter length
+ *
+ */
+
+tSirRetStatus cfgSetStr(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U8 *pStr,
+ tANI_U32 length)
+{
+ return cfgSetStrNotify( pMac, cfgId, pStr, length, TRUE );
+}
+
+// ---------------------------------------------------------------------
+/**
+ * cfgSetStrNotify()
+ *
+ * FUNCTION:
+ * This function is called to set a string parameter.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * - No length checking will be performed. Should be done by calling
+ * module.
+ * - Host RW permission should be checked prior to calling this
+ * function.
+ *
+ * NOTE:
+ *
+ * @param cfgId: 16-bit CFG parameter ID
+ * @param pStr: address of string data
+ * @param len: string length
+ * @param notifyMod. Notify respective Module
+ *
+ * @return eSIR_SUCCESS: request completed successfully
+ * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID
+ * @return eSIR_CFG_INVALID_LEN: invalid parameter length
+ *
+ */
+
+tSirRetStatus
+cfgSetStrNotify(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U8 *pStr,
+ tANI_U32 length, int notifyMod)
+{
+ tANI_U8 *pDst, *pDstEnd;
+ tANI_U32 index, paramLen, control, mask;
+ tSirRetStatus retVal;
+
+ if (cfgId >= CFG_PARAM_MAX_NUM)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d\n"), cfgId);)
+ return eSIR_CFG_INVALID_ID;
+ }
+
+ control = pMac->cfg.gCfgEntry[cfgId].control;
+ index = control & CFG_BUF_INDX_MASK;
+ retVal = eSIR_SUCCESS;
+
+ // Check if parameter is valid
+ if ((control & CFG_CTL_VALID) == 0)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d\n"), cfgId);)
+ retVal = eSIR_CFG_INVALID_ID;
+ }
+ else if (index >= CFG_STA_SBUF_MAX_SIZE)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Invalid Sbuf index %d (max size %d)\n"),
+ index, CFG_STA_SBUF_MAX_SIZE);)
+ retVal = eSIR_CFG_INVALID_ID;
+ }
+ else
+ {
+ pDst = &pMac->cfg.gCfgSBuf[index];
+ paramLen = *pDst++;
+ if (length > paramLen)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Invalid length %d (>%d) cfg id %d\n"),
+ length, paramLen, cfgId);)
+ retVal = eSIR_CFG_INVALID_LEN;
+ }
+ else
+ {
+ *pDst++ = (tANI_U8)length;
+ pDstEnd = pDst + length;
+ while (pDst < pDstEnd)
+ {
+ *pDst++ = *pStr++;
+ }
+
+ if(notifyMod)
+ {
+ // Update hardware if necessary
+ mask = control & CFG_CTL_NTF_MASK;
+ if ((mask & CFG_CTL_NTF_HW) != 0)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("CFG Notify HW not supported!!!\n"));)
+ }
+
+ // Notify other modules if necessary
+ if ( (mask & CFG_CTL_NTF_MASK) != 0)
+ {
+ Notify(pMac, cfgId, mask);
+ }
+ }
+ }
+
+ }
+
+ return (retVal);
+
+} /*** end cfgSetStrNotify() ***/
+
+// ---------------------------------------------------------------------
+/**
+ * wlan_cfgGetStr()
+ *
+ * FUNCTION:
+ * This function is called to get a string parameter.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * - Host RW permission should be checked prior to calling this
+ * function.
+ *
+ * NOTE:
+ *
+ * @param cfgId: 16-bit CFG parameter ID
+ * @param pBuf: address of string buffer
+ * @param pLen: address of max buffer length
+ * actual length will be returned at this address
+ *
+ * @return eSIR_SUCCESS: request completed successfully
+ * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID
+ * @return eSIR_CFG_INVALID_LEN: invalid parameter length
+ *
+ */
+
+tSirRetStatus
+wlan_cfgGetStr(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U8 *pBuf, tANI_U32 *pLength)
+{
+ tANI_U8 *pSrc, *pSrcEnd;
+ tANI_U32 index, control;
+ tSirRetStatus retVal;
+
+ if (cfgId >= CFG_PARAM_MAX_NUM)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d\n"), cfgId);)
+ retVal = eSIR_CFG_INVALID_ID;
+ return retVal;
+ }
+
+ control = pMac->cfg.gCfgEntry[cfgId].control;
+ index = control & CFG_BUF_INDX_MASK;
+ retVal = eSIR_SUCCESS;
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ if (index >= CFG_AP_SBUF_MAX_SIZE)
+#else
+ if (index >= CFG_STA_SBUF_MAX_SIZE)
+#endif
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("cfg index out of bounds %d\n"), index);)
+ retVal = eSIR_CFG_INVALID_ID;
+ return retVal;
+ }
+
+ // Check if parameter is valid
+ if ((control & CFG_CTL_VALID) == 0)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Not valid cfg id %d\n"), cfgId);)
+ retVal = eSIR_CFG_INVALID_ID;
+ }
+ else
+ {
+ // Get string
+ pSrc = &pMac->cfg.gCfgSBuf[index];
+ pSrc++; // skip over max length
+ if (*pLength < *pSrc)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Invalid length %d (<%d) cfg id %d\n"),
+ *pLength, *pSrc, cfgId);)
+ retVal = eSIR_CFG_INVALID_LEN;
+ }
+ else
+ {
+ *pLength = *pSrc++; // save parameter length
+ pSrcEnd = pSrc + *pLength;
+ while (pSrc < pSrcEnd)
+ *pBuf++ = *pSrc++;
+ }
+ }
+
+ return (retVal);
+
+} /*** end wlan_cfgGetStr() ***/
+
+// ---------------------------------------------------------------------
+/**
+ * wlan_cfgGetStrMaxLen()
+ *
+ * FUNCTION:
+ * This function is called to get a string maximum length.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * - Host RW permission should be checked prior to calling this
+ * function.
+ *
+ * NOTE:
+ *
+ * @param cfgId: 16-bit CFG parameter ID
+ * @param pLen: maximum length will be returned at this address
+ *
+ * @return eSIR_SUCCESS: request completed successfully
+ * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID
+ *
+ */
+
+tSirRetStatus
+wlan_cfgGetStrMaxLen(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U32 *pLength)
+{
+ tANI_U32 index, control;
+ tSirRetStatus retVal;
+
+ if (cfgId >= CFG_PARAM_MAX_NUM)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d\n"), cfgId);)
+ retVal = eSIR_CFG_INVALID_ID;
+ }
+
+ control = pMac->cfg.gCfgEntry[cfgId].control;
+ index = control & CFG_BUF_INDX_MASK;
+ retVal = eSIR_SUCCESS;
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ if (index >= CFG_AP_SBUF_MAX_SIZE)
+#else
+ if (index >= CFG_STA_SBUF_MAX_SIZE)
+#endif
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("cfg index out of bounds %d\n"), index);)
+ retVal = eSIR_CFG_INVALID_ID;
+ return retVal;
+ }
+
+ // Check if parameter is valid
+ if ((control & CFG_CTL_VALID) == 0)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Not valid cfg id %d\n"), cfgId);)
+ retVal = eSIR_CFG_INVALID_ID;
+ }
+ else
+ {
+ *pLength = pMac->cfg.gCfgSBuf[index];
+ }
+
+ return (retVal);
+
+} /*** end wlan_cfgGetStrMaxLen() ***/
+
+// ---------------------------------------------------------------------
+/**
+ * wlan_cfgGetStrLen()
+ *
+ * FUNCTION:
+ * This function is called to get a string length.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * - Host RW permission should be checked prior to calling this
+ * function.
+ *
+ * NOTE:
+ *
+ * @param cfgId: 16-bit CFG parameter ID
+ * @param pLen: current length will be returned at this address
+ *
+ * @return eSIR_SUCCESS: request completed successfully
+ * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID
+ *
+ */
+
+tSirRetStatus
+wlan_cfgGetStrLen(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U32 *pLength)
+{
+ tANI_U32 index, control;
+ tSirRetStatus retVal;
+
+ if (cfgId >= CFG_PARAM_MAX_NUM)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d\n"), cfgId);)
+ retVal = eSIR_CFG_INVALID_ID;
+ }
+
+ control = pMac->cfg.gCfgEntry[cfgId].control;
+ index = control & CFG_BUF_INDX_MASK;
+ retVal = eSIR_SUCCESS;
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ if (index >= CFG_AP_SBUF_MAX_SIZE-1)
+#else
+ if (index >= CFG_STA_SBUF_MAX_SIZE-1)
+#endif
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("cfg index out of bounds %d\n"), index);)
+ retVal = eSIR_CFG_INVALID_ID;
+ return retVal;
+ }
+
+ // Check if parameter is valid
+ if ((control & CFG_CTL_VALID) == 0)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Not valid cfg id %d\n"), cfgId);)
+ retVal = eSIR_CFG_INVALID_ID;
+ }
+ else
+ {
+ *pLength = pMac->cfg.gCfgSBuf[index+1];
+ }
+
+ return (retVal);
+
+} /*** end wlan_cfgGetStrLen() ***/
+
+
+
+/*-------------------------------------------------------------
+\fn cfgGetDot11dTransmitPower
+\brief This function returns the regulatory max transmit power
+\param pMac
+\return tPowerdBm - Power
+\-------------------------------------------------------------*/
+static tPowerdBm
+cfgGetDot11dTransmitPower(tpAniSirGlobal pMac, tANI_U16 cfgId,
+ tANI_U32 cfgLength, tANI_U8 channel)
+{
+ tANI_U8 *pCountryInfo = NULL;
+ tANI_U8 count = 0;
+ tPowerdBm maxTxPwr = WDA_MAX_TXPOWER_INVALID;
+ eHalStatus status;
+
+ /* At least one element is present */
+ if(cfgLength < sizeof(tSirMacChanInfo))
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Invalid CFGLENGTH %d while getting 11d txpower"), cfgLength);)
+ goto error;
+ }
+
+ status = palAllocateMemory(pMac->hHdd, (void **)&pCountryInfo, cfgLength);
+ if (status != eHAL_STATUS_SUCCESS)
+ {
+ cfgLog(pMac, LOGP, FL(" palAllocateMemory() failed, status = %d"), status);
+ goto error;
+ }
+ /* The CSR will always update this CFG. The contents will be from country IE if regulatory domain
+ * is enabled on AP else will contain EEPROM contents
+ */
+ if (wlan_cfgGetStr(pMac, cfgId, pCountryInfo, &cfgLength) != eSIR_SUCCESS)
+ {
+ palFreeMemory(pMac->hHdd, pCountryInfo);
+ pCountryInfo = NULL;
+
+ cfgLog(pMac, LOGP, FL("Failed to retrieve 11d configuration parameters while retrieving 11d tuples"));
+ goto error;
+ }
+ /* Identify the channel and maxtxpower */
+ while(count <= (cfgLength - (sizeof(tSirMacChanInfo))))
+ {
+ tANI_U8 firstChannel, maxChannels;
+
+ firstChannel = pCountryInfo[count++];
+ maxChannels = pCountryInfo[count++];
+ maxTxPwr = pCountryInfo[count++];
+
+ if((channel >= firstChannel) &&
+ (channel < (firstChannel + maxChannels)))
+ {
+ break;
+ }
+ }
+
+error:
+ if(NULL != pCountryInfo)
+ palFreeMemory(pMac->hHdd, pCountryInfo);
+
+ return maxTxPwr;
+}
+
+
+/**----------------------------------------------------------------------
+\fn cfgGetRegulatoryMaxTransmitPower
+
+\brief Gets regulatory tx power on the current channel.
+
+\param pMac
+\param channel
+\param rfBand
+ -----------------------------------------------------------------------*/
+tPowerdBm cfgGetRegulatoryMaxTransmitPower(tpAniSirGlobal pMac, tANI_U8 channel)
+{
+ tANI_U32 cfgLength = 0;
+ tANI_U16 cfgId = 0;
+ tPowerdBm maxTxPwr;
+ eRfBandMode rfBand = eRF_BAND_UNKNOWN;
+
+ if ((channel >= SIR_11A_CHANNEL_BEGIN) &&
+ (channel <= SIR_11A_CHANNEL_END))
+ rfBand = eRF_BAND_5_GHZ;
+ else
+ rfBand = eRF_BAND_2_4_GHZ;
+
+
+ /* Get the max transmit power for current channel for the current regulatory domain */
+ switch (rfBand)
+ {
+ case eRF_BAND_2_4_GHZ:
+ cfgId = WNI_CFG_MAX_TX_POWER_2_4;
+ cfgLength = WNI_CFG_MAX_TX_POWER_2_4_LEN;
+ PELOG2(cfgLog(pMac, LOG2, FL("HAL: Reading CFG for 2.4 GHz channels to get regulatory max tx power"));)
+ break;
+
+ case eRF_BAND_5_GHZ:
+ cfgId = WNI_CFG_MAX_TX_POWER_5;
+ cfgLength = WNI_CFG_MAX_TX_POWER_5_LEN;
+ PELOG2(cfgLog(pMac, LOG2, FL("HAL: Reading CFG for 5.0 GHz channels to get regulatory max tx power"));)
+ break;
+
+ case eRF_BAND_UNKNOWN:
+ default:
+ PELOG2(cfgLog(pMac, LOG2, FL("HAL: Invalid current working band for the device"));)
+ return WDA_MAX_TXPOWER_INVALID; //Its return, not break.
+ }
+
+ maxTxPwr = cfgGetDot11dTransmitPower(pMac, cfgId, cfgLength, channel);
+
+ return (maxTxPwr);
+}
+
+// ---------------------------------------------------------------------
+/**
+ * cfgGetCapabilityInfo
+ *
+ * FUNCTION:
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param None
+ * @return None
+ */
+
+tSirRetStatus
+cfgGetCapabilityInfo(tpAniSirGlobal pMac, tANI_U16 *pCap,tpPESession sessionEntry)
+{
+ tANI_U32 val = 0;
+ tpSirMacCapabilityInfo pCapInfo;
+ tLimSystemRole systemRole = limGetSystemRole(sessionEntry);
+
+ *pCap = 0;
+ pCapInfo = (tpSirMacCapabilityInfo) pCap;
+
+ if (systemRole == eLIM_STA_IN_IBSS_ROLE)
+ pCapInfo->ibss = 1; // IBSS bit
+ else if ( (systemRole == eLIM_AP_ROLE) ||(systemRole == eLIM_BT_AMP_AP_ROLE)||(systemRole == eLIM_BT_AMP_STA_ROLE) ||
+ (systemRole == eLIM_STA_ROLE) )
+ pCapInfo->ess = 1; // ESS bit
+#if defined WLAN_FEATURE_P2P
+ else if (limGetSystemRole(sessionEntry) == eLIM_P2P_DEVICE_ROLE )
+ {
+ pCapInfo->ess = 0;
+ pCapInfo->ibss = 0;
+ }
+#endif
+ else
+ cfgLog(pMac, LOGP, FL("can't get capability, role is UNKNOWN!!\n"));
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ if( (systemRole == eLIM_AP_ROLE) )
+ {
+ // CF-pollable bit
+ if (wlan_cfgGetInt(pMac, WNI_CFG_CF_POLLABLE, &val) != eSIR_SUCCESS)
+ {
+ cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_CF_POLLABLE failed\n"));
+ return eSIR_FAILURE;
+ }
+ if (val)
+ pCapInfo->cfPollable = 1;
+
+ // CF-poll request bit
+ if (wlan_cfgGetInt(pMac, WNI_CFG_CF_POLL_REQUEST, &val) != eSIR_SUCCESS)
+ {
+ cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_CF_POLL_REQUEST failed\n"));
+ return eSIR_FAILURE;
+ }
+ if (val)
+ pCapInfo->cfPollReq = 1;
+ }
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if(systemRole == eLIM_AP_ROLE)
+ {
+ val = sessionEntry->privacy;
+ }
+ else
+ {
+#endif
+ // PRIVACY bit
+ if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED, &val) != eSIR_SUCCESS)
+ {
+ cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_PRIVACY_ENABLED failed\n"));
+ return eSIR_FAILURE;
+ }
+#ifdef WLAN_SOFTAP_FEATURE
+ }
+#endif
+ if (val)
+ pCapInfo->privacy = 1;
+
+ // Short preamble bit
+ if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
+ {
+ cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_SHORT_PREAMBLE failed\n"));
+ return eSIR_FAILURE;
+ }
+ if (val)
+ pCapInfo->shortPreamble = 1;
+
+
+ // PBCC bit
+ pCapInfo->pbcc = 0;
+
+ // Channel agility bit
+ pCapInfo->channelAgility = 0;
+ //If STA/AP operating in 11B mode, don't set rest of the capability info bits.
+ if(sessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11B)
+ return eSIR_SUCCESS;
+
+
+
+ // Short slot time bit
+ if (systemRole == eLIM_AP_ROLE)
+ {
+ if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, &val)
+ != eSIR_SUCCESS)
+ {
+ cfgLog(pMac, LOGP,
+ FL("cfg get WNI_CFG_SHORT_SLOT_TIME failed\n"));
+ return eSIR_FAILURE;
+ }
+ if (val)
+ pCapInfo->shortSlotTime = 1;
+ }
+ else
+ {
+ if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val)
+ != eSIR_SUCCESS)
+ {
+ cfgLog(pMac, LOGP,
+ FL("cfg get WNI_CFG_11G_SHORT_SLOT_TIME failed\n"));
+ return eSIR_FAILURE;
+ }
+ /* When in STA mode, we need to check if short slot is enabled as well as check if the current operating
+ * mode is short slot time and then decide whether to enable short slot or not. It is safe to check both
+ * cfg values to determine short slot value in this funcn since this funcn is always used after assoc when
+ * these cfg values are already set based on peer's capability. Even in case of IBSS, its value is set to
+ * correct value either in delBSS as part of deleting the previous IBSS or in start BSS as part of coalescing
+ */
+ if (val)
+ {
+ if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, &val)
+ != eSIR_SUCCESS)
+ {
+ cfgLog(pMac, LOGP,
+ FL("cfg get WNI_CFG_SHORT_SLOT_TIME failed\n"));
+ return eSIR_FAILURE;
+ }
+ if (val)
+ pCapInfo->shortSlotTime = 1;
+ }
+ }
+
+ // Spectrum Management bit
+ if((eLIM_STA_IN_IBSS_ROLE != systemRole) &&
+ sessionEntry->lim11hEnable )
+ {
+ if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
+ {
+ cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_11H_ENABLED failed\n"));
+ return eSIR_FAILURE;
+ }
+ if (val)
+ pCapInfo->spectrumMgt = 1;
+ }
+
+ // QoS bit
+ if (wlan_cfgGetInt(pMac, WNI_CFG_QOS_ENABLED, &val) != eSIR_SUCCESS)
+ {
+ cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_QOS_ENABLED failed\n"));
+ return eSIR_FAILURE;
+ }
+ if (val)
+ pCapInfo->qos = 1;
+
+ // APSD bit
+ if (wlan_cfgGetInt(pMac, WNI_CFG_APSD_ENABLED, &val) != eSIR_SUCCESS)
+ {
+ cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_APSD_ENABLED failed\n"));
+ return eSIR_FAILURE;
+ }
+ if (val)
+ pCapInfo->apsd = 1;
+
+#if defined WLAN_FEATURE_VOWIFI
+ if ((limGetSystemRole(sessionEntry) == eLIM_STA_ROLE) )
+ {
+ if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS)
+ {
+ cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_RRM_ENABLED failed\n"));
+ return eSIR_FAILURE;
+ }
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(cfgLog( pMac, LOGE, "RRM = %d\n",val );)
+#endif
+ if (val)
+ pCapInfo->rrm = 1;
+ }
+#endif
+ //DSSS-OFDM
+ //FIXME : no config defined yet.
+
+ // Block ack bit
+ if (wlan_cfgGetInt(pMac, WNI_CFG_BLOCK_ACK_ENABLED, &val) != eSIR_SUCCESS)
+ {
+ cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_BLOCK_ACK_ENABLED failed\n"));
+ return eSIR_FAILURE;
+ }
+ pCapInfo->delayedBA = (tANI_U16)((val >> WNI_CFG_BLOCK_ACK_ENABLED_DELAYED) & 1);
+ pCapInfo->immediateBA = (tANI_U16)((val >> WNI_CFG_BLOCK_ACK_ENABLED_IMMEDIATE) & 1);
+
+ return eSIR_SUCCESS;
+}
+
+// --------------------------------------------------------------------
+/**
+ * cfgSetCapabilityInfo
+ *
+ * FUNCTION:
+ * This function is called on BP based on the capabilities
+ * received in SME_JOIN/REASSOC_REQ message.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE: 1. ESS/IBSS capabilities are based on system role.
+ * 2. Since PBCC, Channel agility and Extended capabilities
+ * are not supported, they're not set at CFG
+ *
+ * @param pMac Pointer to global MAC structure
+ * @param caps 16-bit Capability Info field
+ * @return None
+ */
+
+void
+cfgSetCapabilityInfo(tpAniSirGlobal pMac, tANI_U16 caps)
+{
+#if (defined(ANI_PRODUCT_TYPE_AP))
+
+ if (cfgSetInt(pMac, WNI_CFG_PRIVACY_ENABLED,
+ SIR_MAC_GET_PRIVACY(caps)) != eSIR_SUCCESS)
+ cfgLog(pMac, LOGP, FL("could not set privacy at CFG\n"));
+
+ if (cfgSetInt(pMac, WNI_CFG_SHORT_PREAMBLE,
+ SIR_MAC_GET_SHORT_PREAMBLE(caps)) != eSIR_SUCCESS)
+ cfgLog(pMac, LOGP, FL("could not set short preamble at CFG\n"));
+
+ if (cfgSetInt(pMac, WNI_CFG_QOS_ENABLED,
+ SIR_MAC_GET_QOS(caps)) != eSIR_SUCCESS)
+ cfgLog(pMac, LOGP, FL("could not set qos at CFG\n"));
+
+ if (cfgSetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED,
+ SIR_MAC_GET_SHORT_SLOT_TIME(caps)) != eSIR_SUCCESS)
+ cfgLog(pMac, LOGP, FL("could not set short slot time at CFG\n"));
+
+ if (cfgSetInt(pMac, WNI_CFG_APSD_ENABLED,
+ SIR_MAC_GET_APSD(caps)) != eSIR_SUCCESS)
+ cfgLog(pMac, LOGP, FL("could not set apsd at CFG\n"));
+
+ if (cfgSetInt(pMac, WNI_CFG_BLOCK_ACK_ENABLED,
+ SIR_MAC_GET_BLOCK_ACK(caps)) != eSIR_SUCCESS)
+ cfgLog(pMac, LOGP, FL("could not set BlockAck at CFG\n"));
+#endif
+}
+
+
+// ---------------------------------------------------------------------
+/**
+ * cfgCleanup()
+ *
+ * FUNCTION:
+ * CFG cleanup function.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ * This function must be called during system shutdown.
+ *
+ * @param None
+ *
+ * @return None.
+ *
+ */
+
+void
+cfgCleanup(tpAniSirGlobal pMac)
+{
+ // Set status to not-ready
+ pMac->cfg.gCfgStatus = CFG_INCOMPLETE;
+
+} /*** end CfgCleanup() ***/
+
+// ---------------------------------------------------------------------
+/**
+ * Notify()
+ *
+ * FUNCTION:
+ * This function is called to notify other modules of parameter update.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param cfgId: configuration parameter ID
+ * @param mask: notification mask
+ *
+ * @return None.
+ *
+ */
+
+static void
+Notify(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U32 ntfMask)
+{
+
+ tSirMsgQ mmhMsg;
+
+ mmhMsg.type = SIR_CFG_PARAM_UPDATE_IND;
+ mmhMsg.bodyval = (tANI_U32)cfgId;
+ mmhMsg.bodyptr = NULL;
+
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+
+ if ((ntfMask & CFG_CTL_NTF_SCH) != 0)
+ schPostMessage(pMac, &mmhMsg);
+
+ if ((ntfMask & CFG_CTL_NTF_LIM) != 0)
+ limPostMsgApi(pMac, &mmhMsg);
+
+ if ((ntfMask & CFG_CTL_NTF_HAL) != 0)
+ wdaPostCtrlMsg(pMac, &mmhMsg);
+
+ // Notify ARQ
+
+} /*** end Notify() ***/
+
+// ---------------------------------------------------------------------
+
+
+
+
+
+
+
diff --git a/CORE/MAC/src/cfg/cfgDebug.c b/CORE/MAC/src/cfg/cfgDebug.c
new file mode 100644
index 0000000..6e37c73
--- /dev/null
+++ b/CORE/MAC/src/cfg/cfgDebug.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**=========================================================================
+
+ \file cfgDebug.c
+
+ \brief implementation for log Debug related APIs
+
+ \author Sunit Bhatia
+
+ Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
+
+ Qualcomm Confidential and Proprietary.
+
+ ========================================================================*/
+
+#include "cfgDebug.h"
+
+void cfgLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
+{
+#ifdef WLAN_DEBUG
+ // Verify against current log level
+ if (loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_CFG_MODULE_ID )])
+ return;
+ else
+ {
+ va_list marker;
+
+ va_start( marker, pString ); /* Initialize variable arguments. */
+
+ logDebug(pMac, SIR_CFG_MODULE_ID, loglevel, pString, marker);
+
+ va_end( marker ); /* Reset variable arguments. */
+ }
+#endif
+}
diff --git a/CORE/MAC/src/cfg/cfgDebug.h b/CORE/MAC/src/cfg/cfgDebug.h
new file mode 100644
index 0000000..49d0533
--- /dev/null
+++ b/CORE/MAC/src/cfg/cfgDebug.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * Author: Kevin Nguyen
+ * Date: 04/09/02
+ * History:-
+ * 04/09/02 Created.
+ * --------------------------------------------------------------------
+ */
+
+#ifndef __CFG_DEBUG_H__
+#define __CFG_DEBUG_H__
+
+#include "sirDebug.h"
+#include "utilsApi.h"
+#include "limTrace.h"
+
+
+void cfgLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...) ;
+
+#endif
diff --git a/CORE/MAC/src/cfg/cfgDef.h b/CORE/MAC/src/cfg/cfgDef.h
new file mode 100644
index 0000000..b942f3f
--- /dev/null
+++ b/CORE/MAC/src/cfg/cfgDef.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This is the private header file for CFG module.
+ *
+ * Author: Kevin Nguyen
+ * Date: 03/20/02
+ * History:-
+ * 03/20/02 Created.
+ * --------------------------------------------------------------------
+ *
+ */
+
+#ifndef __CFGDEF_H
+#define __CFGDEF_H
+
+/*
+ * CFG Control Flag definitions
+ */
+#define CFG_CTL_VALID 0x00010000
+#define CFG_CTL_RE 0x00020000
+#define CFG_CTL_WE 0x00040000
+#define CFG_CTL_INT 0x00080000
+#define CFG_CTL_SAVE 0x00100000
+#define CFG_CTL_RESTART 0x00200000
+#define CFG_CTL_RELOAD 0x00400000
+#define CFG_CTL_NTF_PHY 0x00800000
+#define CFG_CTL_NTF_MAC 0x01000000
+#define CFG_CTL_NTF_LOG 0x02000000
+#define CFG_CTL_NTF_HAL 0x04000000
+#define CFG_CTL_NTF_DPH 0x08000000
+#define CFG_CTL_NTF_ARQ 0x10000000
+#define CFG_CTL_NTF_SCH 0x20000000
+#define CFG_CTL_NTF_LIM 0x40000000
+#define CFG_CTL_NTF_HDD 0x80000000
+#define CFG_CTL_NTF_MASK 0xFFE00000
+
+#define CFG_CTL_NTF_TFP CFG_CTL_NTF_MAC
+#define CFG_CTL_NTF_RHP CFG_CTL_NTF_MAC
+#define CFG_CTL_NTF_RFP CFG_CTL_NTF_MAC
+#define CFG_CTL_NTF_SP CFG_CTL_NTF_MAC
+#define CFG_CTL_NTF_HW (CFG_CTL_NTF_MAC | CFG_CTL_NTF_PHY)
+
+#define CFG_BUF_INDX_MASK 0x00000fff
+#define CFG_SEM_INDX_MASK 0x0000f000
+#define CFG_SEM_INDX_SHIFT 12
+
+
+#endif /* __CFGDEF_H */
+
+
+
+
diff --git a/CORE/MAC/src/cfg/cfgParamName.c b/CORE/MAC/src/cfg/cfgParamName.c
new file mode 100644
index 0000000..4704c2b
--- /dev/null
+++ b/CORE/MAC/src/cfg/cfgParamName.c
@@ -0,0 +1,298 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copyright (C) 2007-2009 QUALCOMM Incorporated. All rights reserved. Proprietary and Confidential.
+ */
+
+/*
+ * DO NOT EDIT - This file is generated automaticlly
+ */
+
+/*
+ * IMPORTANT: This file is for system that supports STA mode ONLY.
+ */
+#include "cfgPriv.h"
+
+unsigned char *gCfgParamName[] = {
+ (unsigned char *)"STA_ID",
+ (unsigned char *)"CF_POLLABLE",
+ (unsigned char *)"CFP_PERIOD",
+ (unsigned char *)"CFP_MAX_DURATION",
+ (unsigned char *)"SSID",
+ (unsigned char *)"BEACON_INTERVAL",
+ (unsigned char *)"DTIM_PERIOD",
+ (unsigned char *)"WEP_KEY_LENGTH",
+ (unsigned char *)"WEP_DEFAULT_KEY_1",
+ (unsigned char *)"WEP_DEFAULT_KEY_2",
+ (unsigned char *)"WEP_DEFAULT_KEY_3",
+ (unsigned char *)"WEP_DEFAULT_KEY_4",
+ (unsigned char *)"WEP_DEFAULT_KEYID",
+ (unsigned char *)"EXCLUDE_UNENCRYPTED",
+ (unsigned char *)"RTS_THRESHOLD",
+ (unsigned char *)"SHORT_RETRY_LIMIT",
+ (unsigned char *)"LONG_RETRY_LIMIT",
+ (unsigned char *)"FRAGMENTATION_THRESHOLD",
+ (unsigned char *)"ACTIVE_MINIMUM_CHANNEL_TIME",
+ (unsigned char *)"ACTIVE_MAXIMUM_CHANNEL_TIME",
+ (unsigned char *)"PASSIVE_MINIMUM_CHANNEL_TIME",
+ (unsigned char *)"PASSIVE_MAXIMUM_CHANNEL_TIME",
+ (unsigned char *)"JOIN_FAILURE_TIMEOUT",
+ (unsigned char *)"AUTHENTICATE_FAILURE_TIMEOUT",
+ (unsigned char *)"AUTHENTICATE_RSP_TIMEOUT",
+ (unsigned char *)"ASSOCIATION_FAILURE_TIMEOUT",
+ (unsigned char *)"REASSOCIATION_FAILURE_TIMEOUT",
+ (unsigned char *)"RA_PERIODICITY_TIMEOUT_IN_PS",
+ (unsigned char *)"PS_ENABLE_BCN_FILTER",
+ (unsigned char *)"PS_ENABLE_HEART_BEAT",
+ (unsigned char *)"PS_ENABLE_RSSI_MONITOR",
+ (unsigned char *)"PS_DATA_INACTIVITY_TIMEOUT",
+ (unsigned char *)"RF_SETTLING_TIME_CLK",
+ (unsigned char *)"SUPPORTED_RATES_11B",
+ (unsigned char *)"SUPPORTED_RATES_11A",
+ (unsigned char *)"PHY_MODE",
+ (unsigned char *)"DOT11_MODE",
+ (unsigned char *)"OPERATIONAL_RATE_SET",
+ (unsigned char *)"EXTENDED_OPERATIONAL_RATE_SET",
+ (unsigned char *)"PROPRIETARY_OPERATIONAL_RATE_SET",
+ (unsigned char *)"BSSID",
+ (unsigned char *)"LISTEN_INTERVAL",
+ (unsigned char *)"VALID_CHANNEL_LIST",
+ (unsigned char *)"CURRENT_CHANNEL",
+ (unsigned char *)"DEFAULT_RATE_INDEX_5GHZ",
+ (unsigned char *)"DEFAULT_RATE_INDEX_24GHZ",
+ (unsigned char *)"RATE_ADAPTATION_TYPE",
+ (unsigned char *)"FIXED_RATE",
+ (unsigned char *)"FIXED_RATE_MULTICAST_24GHZ",
+ (unsigned char *)"FIXED_RATE_MULTICAST_5GHZ",
+ (unsigned char *)"RETRYRATE_POLICY",
+ (unsigned char *)"RETRYRATE_SECONDARY",
+ (unsigned char *)"RETRYRATE_TERTIARY",
+ (unsigned char *)"APSD_ENABLED",
+ (unsigned char *)"SHARED_KEY_AUTH_ENABLE",
+ (unsigned char *)"OPEN_SYSTEM_AUTH_ENABLE",
+ (unsigned char *)"AUTHENTICATION_TYPE",
+ (unsigned char *)"CF_POLL_REQUEST",
+ (unsigned char *)"PRIVACY_ENABLED",
+ (unsigned char *)"SHORT_PREAMBLE",
+ (unsigned char *)"SHORT_SLOT_TIME",
+ (unsigned char *)"ACCEPT_SHORT_SLOT_ASSOC_ONLY",
+ (unsigned char *)"QOS_ENABLED",
+ (unsigned char *)"HCF_ENABLED",
+ (unsigned char *)"RSN_ENABLED",
+ (unsigned char *)"BACKGROUND_SCAN_PERIOD",
+ (unsigned char *)"MAX_NUM_PRE_AUTH",
+ (unsigned char *)"PREAUTH_CLNUP_TIMEOUT",
+ (unsigned char *)"RELEASE_AID_TIMEOUT",
+ (unsigned char *)"HEART_BEAT_THRESHOLD",
+ (unsigned char *)"PROBE_AFTER_HB_FAIL_TIMEOUT",
+ (unsigned char *)"MANUFACTURER_OUI",
+ (unsigned char *)"MANUFACTURER_NAME",
+ (unsigned char *)"MODEL_NUMBER",
+ (unsigned char *)"MODEL_NAME",
+ (unsigned char *)"MANUFACTURER_PRODUCT_NAME",
+ (unsigned char *)"MANUFACTURER_PRODUCT_VERSION",
+ (unsigned char *)"11D_ENABLED",
+ (unsigned char *)"MAX_TX_POWER_2_4",
+ (unsigned char *)"MAX_TX_POWER_5",
+ (unsigned char *)"NETWORK_DENSITY",
+ (unsigned char *)"ADAPTIVE_THRESHOLD_ALGORITHM",
+ (unsigned char *)"CURRENT_TX_ANTENNA",
+ (unsigned char *)"CURRENT_RX_ANTENNA",
+ (unsigned char *)"CURRENT_TX_POWER_LEVEL",
+ (unsigned char *)"POWER_STATE_PER_CHAIN",
+ (unsigned char *)"NEW_BSS_FOUND_IND",
+ (unsigned char *)"PROPRIETARY_ANI_FEATURES_ENABLED",
+ (unsigned char *)"PROPRIETARY_RATES_ENABLED",
+ (unsigned char *)"AP_NODE_NAME",
+ (unsigned char *)"COUNTRY_CODE",
+ (unsigned char *)"11H_ENABLED",
+ (unsigned char *)"WT_CNF_TIMEOUT",
+ (unsigned char *)"KEEPALIVE_TIMEOUT",
+ (unsigned char *)"PROXIMITY",
+ (unsigned char *)"LOG_LEVEL",
+ (unsigned char *)"OLBC_DETECT_TIMEOUT",
+ (unsigned char *)"PROTECTION_ENABLED",
+ (unsigned char *)"11G_PROTECTION_ALWAYS",
+ (unsigned char *)"FORCE_POLICY_PROTECTION",
+ (unsigned char *)"11G_SHORT_PREAMBLE_ENABLED",
+ (unsigned char *)"11G_SHORT_SLOT_TIME_ENABLED",
+ (unsigned char *)"CAL_PERIOD",
+ (unsigned char *)"STATS_PERIOD",
+ (unsigned char *)"CAL_CONTROL",
+ (unsigned char *)"11G_ONLY_POLICY",
+ (unsigned char *)"PACKET_CLASSIFICATION",
+ (unsigned char *)"WME_ENABLED",
+ (unsigned char *)"ADDTS_RSP_TIMEOUT",
+ (unsigned char *)"MAX_SP_LENGTH",
+ (unsigned char *)"KEEP_ALIVE_STA_LIMIT_THRESHOLD",
+ (unsigned char *)"SEND_SINGLE_SSID_ALWAYS",
+ (unsigned char *)"WSM_ENABLED",
+ (unsigned char *)"PROP_CAPABILITY",
+ (unsigned char *)"EDCA_PROFILE",
+ (unsigned char *)"EDCA_ANI_ACBK_LOCAL",
+ (unsigned char *)"EDCA_ANI_ACBE_LOCAL",
+ (unsigned char *)"EDCA_ANI_ACVI_LOCAL",
+ (unsigned char *)"EDCA_ANI_ACVO_LOCAL",
+ (unsigned char *)"EDCA_ANI_ACBK",
+ (unsigned char *)"EDCA_ANI_ACBE",
+ (unsigned char *)"EDCA_ANI_ACVI",
+ (unsigned char *)"EDCA_ANI_ACVO",
+ (unsigned char *)"EDCA_WME_ACBK_LOCAL",
+ (unsigned char *)"EDCA_WME_ACBE_LOCAL",
+ (unsigned char *)"EDCA_WME_ACVI_LOCAL",
+ (unsigned char *)"EDCA_WME_ACVO_LOCAL",
+ (unsigned char *)"EDCA_WME_ACBK",
+ (unsigned char *)"EDCA_WME_ACBE",
+ (unsigned char *)"EDCA_WME_ACVI",
+ (unsigned char *)"EDCA_WME_ACVO",
+ (unsigned char *)"EDCA_TIT_DEMO_ACBK_LOCAL",
+ (unsigned char *)"EDCA_TIT_DEMO_ACBE_LOCAL",
+ (unsigned char *)"EDCA_TIT_DEMO_ACVI_LOCAL",
+ (unsigned char *)"EDCA_TIT_DEMO_ACVO_LOCAL",
+ (unsigned char *)"EDCA_TIT_DEMO_ACBK",
+ (unsigned char *)"EDCA_TIT_DEMO_ACBE",
+ (unsigned char *)"EDCA_TIT_DEMO_ACVI",
+ (unsigned char *)"EDCA_TIT_DEMO_ACVO",
+ (unsigned char *)"RDET_FLAG",
+ (unsigned char *)"RADAR_CHANNEL_LIST",
+ (unsigned char *)"LOCAL_POWER_CONSTRAINT",
+ (unsigned char *)"ADMIT_POLICY",
+ (unsigned char *)"ADMIT_BWFACTOR",
+ (unsigned char *)"MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE",
+ (unsigned char *)"CHANNEL_BONDING_MODE",
+ (unsigned char *)"CB_SECONDARY_CHANNEL_STATE",
+ (unsigned char *)"DYNAMIC_THRESHOLD_ZERO",
+ (unsigned char *)"DYNAMIC_THRESHOLD_ONE",
+ (unsigned char *)"DYNAMIC_THRESHOLD_TWO",
+ (unsigned char *)"TRIG_STA_BK_SCAN",
+ (unsigned char *)"DYNAMIC_PROFILE_SWITCHING",
+ (unsigned char *)"SCAN_CONTROL_LIST",
+ (unsigned char *)"MIMO_ENABLED",
+ (unsigned char *)"BLOCK_ACK_ENABLED",
+ (unsigned char *)"BA_ACTIVITY_CHECK_TIMEOUT",
+ (unsigned char *)"HT_RX_STBC",
+ (unsigned char *)"HT_CAP_INFO",
+ (unsigned char *)"HT_AMPDU_PARAMS",
+ (unsigned char *)"SUPPORTED_MCS_SET",
+ (unsigned char *)"EXT_HT_CAP_INFO",
+ (unsigned char *)"TX_BF_CAP",
+ (unsigned char *)"AS_CAP",
+ (unsigned char *)"HT_INFO_FIELD1",
+ (unsigned char *)"HT_INFO_FIELD2",
+ (unsigned char *)"HT_INFO_FIELD3",
+ (unsigned char *)"BASIC_MCS_SET",
+ (unsigned char *)"CURRENT_MCS_SET",
+ (unsigned char *)"GREENFIELD_CAPABILITY",
+ (unsigned char *)"MAX_AMSDU_LENGTH",
+ (unsigned char *)"MPDU_DENSITY",
+ (unsigned char *)"MAX_RX_AMPDU_FACTOR",
+ (unsigned char *)"SHORT_GI_20MHZ",
+ (unsigned char *)"SHORT_GI_40MHZ",
+ (unsigned char *)"RIFS_ENABLED",
+ (unsigned char *)"MAX_PS_POLL",
+ (unsigned char *)"NUM_BEACON_PER_RSSI_AVERAGE",
+ (unsigned char *)"RSSI_FILTER_PERIOD",
+ (unsigned char *)"FT_RSSI_FILTER_PERIOD",
+ (unsigned char *)"MIN_RSSI_THRESHOLD",
+ (unsigned char *)"NTH_BEACON_FILTER",
+ (unsigned char *)"BROADCAST_FRAME_FILTER_ENABLE",
+ (unsigned char *)"SCAN_IN_POWERSAVE",
+ (unsigned char *)"IGNORE_DTIM",
+ (unsigned char *)"WOWLAN_UCAST_PATTERN_FILTER_ENABLE",
+ (unsigned char *)"WOWLAN_CHANNEL_SWITCH_ENABLE",
+ (unsigned char *)"WOWLAN_DEAUTH_ENABLE",
+ (unsigned char *)"WOWLAN_DISASSOC_ENABLE",
+ (unsigned char *)"WOWLAN_MAX_MISSED_BEACON",
+ (unsigned char *)"WOWLAN_MAX_SLEEP_PERIOD",
+ (unsigned char *)"BA_TIMEOUT",
+ (unsigned char *)"BA_THRESHOLD_HIGH",
+ (unsigned char *)"MAX_BA_BUFFERS",
+ (unsigned char *)"MAX_BA_SESSIONS",
+ (unsigned char *)"BA_AUTO_SETUP",
+ (unsigned char *)"ADDBA_REQ_DECLINE",
+ (unsigned char *)"BG_SCAN_CHANNEL_LIST",
+ (unsigned char *)"MAX_MEDIUM_TIME",
+ (unsigned char *)"MAX_MPDUS_IN_AMPDU",
+ (unsigned char *)"IBSS_AUTO_BSSID",
+ (unsigned char *)"PROBE_REQ_ADDNIE_FLAG",
+ (unsigned char *)"PROBE_REQ_ADDNIE_DATA",
+ (unsigned char *)"PROBE_RSP_ADDNIE_FLAG",
+ (unsigned char *)"PROBE_RSP_ADDNIE_DATA1",
+ (unsigned char *)"PROBE_RSP_ADDNIE_DATA2",
+ (unsigned char *)"PROBE_RSP_ADDNIE_DATA3",
+ (unsigned char *)"ASSOC_RSP_ADDNIE_FLAG",
+ (unsigned char *)"ASSOC_RSP_ADDNIE_DATA",
+ (unsigned char *)"PROBE_REQ_ADDNP2PIE_FLAG",
+ (unsigned char *)"PROBE_REQ_ADDNP2PIE_DATA",
+ (unsigned char *)"PROBE_RSP_BCN_ADDNIE_FLAG",
+ (unsigned char *)"PROBE_RSP_BCN_ADDNIE_DATA",
+ (unsigned char *)"WPS_ENABLE",
+ (unsigned char *)"WPS_STATE",
+ (unsigned char *)"WPS_PROBE_REQ_FLAG",
+ (unsigned char *)"WPS_VERSION",
+ (unsigned char *)"WPS_REQUEST_TYPE",
+ (unsigned char *)"WPS_CFG_METHOD",
+ (unsigned char *)"WPS_UUID",
+ (unsigned char *)"WPS_PRIMARY_DEVICE_CATEGORY",
+ (unsigned char *)"WPS_PIMARY_DEVICE_OUI",
+ (unsigned char *)"WPS_DEVICE_SUB_CATEGORY",
+ (unsigned char *)"WPS_ASSOCIATION_STATE",
+ (unsigned char *)"WPS_CONFIGURATION_ERROR",
+ (unsigned char *)"WPS_DEVICE_PASSWORD_ID",
+ (unsigned char *)"WPS_ASSOC_METHOD",
+ (unsigned char *)"LOW_GAIN_OVERRIDE",
+ (unsigned char *)"ENABLE_PHY_AGC_LISTEN_MODE",
+ (unsigned char *)"RPE_POLLING_THRESHOLD",
+ (unsigned char *)"RPE_AGING_THRESHOLD_FOR_AC0_REG",
+ (unsigned char *)"RPE_AGING_THRESHOLD_FOR_AC1_REG",
+ (unsigned char *)"RPE_AGING_THRESHOLD_FOR_AC2_REG",
+ (unsigned char *)"RPE_AGING_THRESHOLD_FOR_AC3_REG",
+ (unsigned char *)"NO_OF_ONCHIP_REORDER_SESSIONS",
+ (unsigned char *)"SINGLE_TID_RC",
+ (unsigned char *)"RRM_ENABLED",
+ (unsigned char *)"RRM_OPERATING_CHAN_MAX",
+ (unsigned char *)"RRM_NON_OPERATING_CHAN_MAX",
+ (unsigned char *)"TX_PWR_CTRL_ENABLE",
+ (unsigned char *)"MCAST_BCAST_FILTER_SETTING",
+ (unsigned char *)"BTC_DHCP_BT_SLOTS_TO_BLOCK",
+ (unsigned char *)"DYNAMIC_PS_POLL_VALUE",
+ (unsigned char *)"PS_NULLDATA_AP_RESP_TIMEOUT",
+ (unsigned char *)"TELE_BCN_WAKEUP_EN",
+ (unsigned char *)"TELE_BCN_TRANS_LI",
+ (unsigned char *)"TELE_BCN_TRANS_LI_IDLE_BCNS",
+ (unsigned char *)"TELE_BCN_MAX_LI",
+ (unsigned char *)"TELE_BCN_MAX_LI_IDLE_BCNS",
+ (unsigned char *)"BTC_A2DP_DHCP_BT_SUB_INTERVALS",
+ (unsigned char *)"INFRA_STA_KEEP_ALIVE_PERIOD",
+ (unsigned char *)"ASSOC_STA_LIMIT",
+ (unsigned char *)"SAP_CHANNEL_SELECT_START_CHANNEL",
+ (unsigned char *)"SAP_CHANNEL_SELECT_END_CHANNEL",
+ (unsigned char *)"SAP_CHANNEL_SELECT_OPERATING_BAND",
+ (unsigned char *)"AP_DATA_AVAIL_POLL_PERIOD",
+ (unsigned char *)"ENABLE_CLOSE_LOOP",
+ (unsigned char *)"ENABLE_LTE_COEX",
+ (unsigned char *)"AP_KEEP_ALIVE_TIMEOUT",
+ (unsigned char *)"GO_KEEP_ALIVE_TIMEOUT",
+};
+
+
+
diff --git a/CORE/MAC/src/cfg/cfgPriv.h b/CORE/MAC/src/cfg/cfgPriv.h
new file mode 100644
index 0000000..b8f3be7
--- /dev/null
+++ b/CORE/MAC/src/cfg/cfgPriv.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This is the private header file for CFG module.
+ *
+ * Author: Kevin Nguyen
+ * Date: 03/20/02
+ * History:-
+ * 03/20/02 Created.
+ * --------------------------------------------------------------------
+ *
+ */
+
+#ifndef __CFGPRIV_H
+#define __CFGPRIV_H
+
+#include <sirCommon.h>
+#include <sirTypes.h>
+#include <sirDebug.h>
+#include <wniStat.h>
+#include <utilsApi.h>
+#include <limApi.h>
+#include <schApi.h>
+#include <cfgApi.h>
+#include "cfgDef.h"
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ #include <wniCfgAp.h>
+#else
+ #include <wniCfgSta.h>
+#endif
+
+/*--------------------------------------------------------------------*/
+/* CFG miscellaneous definition */
+/*--------------------------------------------------------------------*/
+
+// Function index bit mask
+#define CFG_FUNC_INDX_MASK 0x7f
+#define CFG_GET_FUNC_INDX(val) (val & CFG_FUNC_INDX_MASK)
+
+// Macro to convert return code to debug string index
+#define CFG_GET_DBG_INDX(val) (val - eCFG_SUCCESS - 1)
+
+
+/*--------------------------------------------------------------------*/
+/* Binary header structure */
+/*--------------------------------------------------------------------*/
+typedef struct sCfgBinHdr
+{
+ tANI_U32 hdrInfo;
+ tANI_U32 controlSize;
+ tANI_U32 iBufSize;
+ tANI_U32 sBufSize;
+} tCfgBinHdr, *tpCfgBinHdr;
+
+
+/*--------------------------------------------------------------------*/
+/* Polaris HW counter access structure */
+/*--------------------------------------------------------------------*/
+typedef struct
+{
+ tANI_U32 addr;
+ tANI_U32 mask;
+ tANI_U32 shift;
+} tCfgHwCnt;
+
+
+#define CFG_STAT_CNT_LO_MASK 0x0000ffff
+#define CFG_STAT_CNT_HI_MASK 0xffff0000
+#define CFG_STAT_CNT_HI_INCR 0x00010000
+
+/*--------------------------------------------------------------------*/
+/* CFG function prototypes */
+/*--------------------------------------------------------------------*/
+
+extern void cfgSendHostMsg(tpAniSirGlobal, tANI_U16, tANI_U32, tANI_U32, tANI_U32*, tANI_U32, tANI_U32*);
+
+
+
+
+
+
+#endif /* __CFGPRIV_H */
+
+
+
+
diff --git a/CORE/MAC/src/cfg/cfgProcMsg.c b/CORE/MAC/src/cfg/cfgProcMsg.c
new file mode 100644
index 0000000..a93bfe1
--- /dev/null
+++ b/CORE/MAC/src/cfg/cfgProcMsg.c
@@ -0,0 +1,1054 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file contains CFG functions for processing host messages.
+ *
+ * Author: Kevin Nguyen
+ * Date: 04/09/02
+ * History:-
+ * 04/09/02 Created.
+ * --------------------------------------------------------------------
+ */
+#include "palTypes.h"
+#include "aniGlobal.h"
+#include "cfgPriv.h"
+#include "cfgDebug.h"
+#include "wlan_qct_wda.h"
+
+
+/*--------------------------------------------------------------------*/
+/* Static function prototypes */
+/*--------------------------------------------------------------------*/
+static void ProcDnldRsp (tpAniSirGlobal, tANI_U16, tANI_U32*);
+static void ProcGetReq (tpAniSirGlobal, tANI_U16, tANI_U32*);
+static void ProcSetReq (tpAniSirGlobal, tANI_U16, tANI_U32*);
+static void ProcSetReqNoRsp (tpAniSirGlobal, tANI_U16, tANI_U32*);
+
+static tANI_U8 CheckParam(tpAniSirGlobal, tANI_U16, tANI_U32, tANI_U32, tANI_U32*);
+static void GetStrValue(tANI_U8*, tANI_U8*, tANI_U32);
+
+
+/*--------------------------------------------------------------------*/
+/* Module global variables */
+/*--------------------------------------------------------------------*/
+
+// CFG function table
+void (*gCfgFunc[])(tpAniSirGlobal, tANI_U16, tANI_U32*) =
+{ ProcDnldRsp,
+ ProcGetReq,
+ ProcSetReq,
+ ProcSetReqNoRsp
+};
+
+/**---------------------------------------------------------------------
+ * cfgProcessMbMsg()
+ *
+ *FUNCTION:
+ * CFG mailbox message processing function.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * None.
+ *
+ *NOTE:
+ *
+ * @param pMsg Message pointer
+ *
+ * @return None.
+ *
+ */
+void
+cfgProcessMbMsg(tpAniSirGlobal pMac, tSirMbMsg *pMsg)
+{
+ tANI_U16 index;
+ tANI_U16 len;
+ tANI_U32 *pParam;
+
+ // Use type[7:0] as index to function table
+#if defined(ANI_OS_TYPE_LINUX)
+ index = CFG_GET_FUNC_INDX(sirReadU16N((tANI_U8*)pMsg));
+#else
+ index = CFG_GET_FUNC_INDX(pMsg->type);
+#endif
+
+ if (index >= (sizeof(gCfgFunc) / sizeof(gCfgFunc[0])))
+ return;
+#if defined(ANI_OS_TYPE_LINUX)
+ len = sirReadU16N((tANI_U8*)pMsg+2) - WNI_CFG_MB_HDR_LEN;
+#else
+ len = pMsg->msgLen - WNI_CFG_MB_HDR_LEN;
+#endif
+ pParam = ((tANI_U32*)pMsg) + 1;
+
+ // Call processing function
+ gCfgFunc[index](pMac, len, pParam);
+
+ // Free up buffer
+ palFreeMemory( pMac->hHdd, (void*)pMsg);
+
+} /*** end cfgProcessMbMsg() ***/
+
+/**---------------------------------------------------------------------
+ * ProcDnldRsp()
+ *
+ * FUNCTION:
+ * This function processes CFG_DNLD_RSP message from host.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param length: message length
+ * @param pParam: parameter list pointer
+ *
+ * @return None
+ *
+ */
+static void
+ProcDnldRsp(tpAniSirGlobal pMac, tANI_U16 length, tANI_U32 *pParam)
+{
+ tANI_S32 i;
+ #if defined(ANI_PRODUCT_TYPE_AP)
+ tANI_U32 ap;
+ #endif
+
+ tANI_U32 expLen, retVal, bufStart, bufEnd;
+ tANI_U32 *pSrc, *pDst, *pDstEnd;
+ tANI_U32 strSize, j;
+ tANI_U8 pStr[CFG_MAX_STR_LEN];
+ tpCfgBinHdr pHdr;
+ tANI_U32 logLevel;
+ tSirMsgQ mmhMsg;
+
+ // First Dword must contain the AP or STA magic dword
+ PELOGW(cfgLog(pMac, LOGW, FL("CFG size %d bytes MAGIC dword is 0x%x\n"),
+ length, sirReadU32N((tANI_U8*)pParam) );)
+
+ // if the string is not correct, return failure
+#if defined(ANI_PRODUCT_TYPE_AP)
+#if defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_OSX)
+ if (sirReadU32N((tANI_U8*)pParam) == CFG_AP_MAGIC_DWORD)
+#else
+ if (*pParam == CFG_AP_MAGIC_DWORD)
+#endif
+ ap = 1;
+ else
+
+
+#if defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_OSX)
+ if (sirReadU32N((tANI_U8*)pParam) == CFG_STA_MAGIC_DWORD)
+#else
+ if (*pParam == CFG_STA_MAGIC_DWORD)
+#endif
+
+ ap = 0;
+#else /* ANI_PRODUCT_TYPE_AP*/
+ if (*pParam == CFG_STA_MAGIC_DWORD) {}
+
+#endif/* ANI_PRODUCT_TYPE_AP*/
+
+
+
+ else
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Invalid magic dword 0x%x\n"),sirReadU32N((tANI_U8*)pParam) );)
+ retVal = WNI_CFG_INVALID_LEN;
+ goto end;
+ }
+
+ pParam++;
+ length -= 4;
+
+ // Verify message length
+#ifdef ANI_PRODUCT_TYPE_AP
+ if (ap)
+ {
+ pMac->cfg.gCfgMaxIBufSize = CFG_AP_IBUF_MAX_SIZE;
+ pMac->cfg.gCfgMaxSBufSize = CFG_AP_SBUF_MAX_SIZE;
+ }
+ else
+#endif /* (WNI_POLARIS_FW_PRODUCT == AP) */
+ {
+ pMac->cfg.gCfgMaxIBufSize = CFG_STA_IBUF_MAX_SIZE;
+ pMac->cfg.gCfgMaxSBufSize = CFG_STA_SBUF_MAX_SIZE;
+ }
+
+ // Parse the Cfg header
+#if defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_OSX)
+ tCfgBinHdr hdr;
+
+ hdr.hdrInfo = sirReadU32N((tANI_U8*)pParam); pParam++;
+ hdr.controlSize = sirReadU32N((tANI_U8*)pParam); pParam++;
+ hdr.iBufSize = sirReadU32N((tANI_U8*)pParam); pParam++;
+ hdr.sBufSize = sirReadU32N((tANI_U8*)pParam); pParam++;
+ pHdr=&hdr;
+#else
+ pHdr = (tpCfgBinHdr) pParam;
+ pParam += (sizeof(tCfgBinHdr) >> 2);
+#endif
+ PELOGW(cfgLog(pMac, LOGW, FL("CFG hdr totParams %d intParams %d strBufSize %d/%d\n"),
+ pHdr->controlSize, pHdr->iBufSize, pHdr->sBufSize, pMac->cfg.gCfgMaxSBufSize);)
+
+ expLen = ((CFG_PARAM_MAX_NUM + 3 * pMac->cfg.gCfgMaxIBufSize) << 2) +
+ pHdr->sBufSize + sizeof(tCfgBinHdr);
+
+ if (length != expLen)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("<CFG> DNLD_RSP invalid length %d (exp %d)\n"),
+ length, expLen);)
+ retVal = WNI_CFG_INVALID_LEN;
+ goto end;
+ }
+
+
+ if (pHdr->controlSize != CFG_PARAM_MAX_NUM)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("<CFG> Total parameter count mismatch\n"));)
+ retVal = WNI_CFG_INVALID_LEN;
+ goto end;
+ }
+
+ if (pHdr->iBufSize != pMac->cfg.gCfgMaxIBufSize)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("<CFG> Integer parameter count mismatch\n"));)
+ retVal = WNI_CFG_INVALID_LEN;
+ goto end;
+ }
+
+ // Copy control array
+ pDst = (tANI_U32*)pMac->cfg.gCfgEntry;
+ pDstEnd = pDst + CFG_PARAM_MAX_NUM;
+ pSrc = pParam;
+ while (pDst < pDstEnd)
+ {
+#if defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_OSX)
+ *pDst++ = sirReadU32N((tANI_U8*)pSrc);
+ pSrc++;
+#else
+ *pDst++ = *pSrc++;
+#endif
+ }
+ // Copy default values
+ pDst = pMac->cfg.gCfgIBuf;
+ pDstEnd = pDst + pMac->cfg.gCfgMaxIBufSize;
+ while (pDst < pDstEnd)
+ {
+#if defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_OSX)
+ *pDst++ = sirReadU32N((tANI_U8*)pSrc);
+ pSrc++;
+#else
+ *pDst++ = *pSrc++;
+#endif
+ }
+
+ // Copy min values
+ pDst = pMac->cfg.gCfgIBufMin;
+ pDstEnd = pDst + pMac->cfg.gCfgMaxIBufSize;
+ while (pDst < pDstEnd)
+ {
+#if defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_OSX)
+ *pDst++ = sirReadU32N((tANI_U8*)pSrc);
+ pSrc++;
+#else
+ *pDst++ = *pSrc++;
+#endif
+ }
+
+ // Copy max values
+ pDst = pMac->cfg.gCfgIBufMax;
+ pDstEnd = pDst + pMac->cfg.gCfgMaxIBufSize;
+ while (pDst < pDstEnd)
+ {
+#if defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_OSX)
+ *pDst++ = sirReadU32N((tANI_U8*)pSrc);
+ pSrc++;
+#else
+ *pDst++ = *pSrc++;
+#endif
+ }
+
+ for (i=0; i<pMac->cfg.gCfgMaxIBufSize; i++)
+ if (pMac->cfg.gCfgIBuf[i] < pMac->cfg.gCfgIBufMin[i] ||
+ pMac->cfg.gCfgIBuf[i] > pMac->cfg.gCfgIBufMax[i])
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("cfg id %d Invalid def value %d "
+ "min %d max %d\n"),
+ i, pMac->cfg.gCfgIBuf[i], pMac->cfg.gCfgIBufMin[i],
+ pMac->cfg.gCfgIBufMax[i]);)
+ }
+
+ // Calculate max string buffer lengths for all string parameters
+ bufEnd = pMac->cfg.gCfgMaxSBufSize;
+ for (i = CFG_PARAM_MAX_NUM - 1; i >= 0; i--)
+ {
+ if ((pMac->cfg.gCfgEntry[i].control & CFG_CTL_INT) != 0)
+ continue;
+
+ if ((pMac->cfg.gCfgEntry[i].control & CFG_CTL_VALID) == 0)
+ continue;
+
+ bufStart = pMac->cfg.gCfgEntry[i].control & CFG_BUF_INDX_MASK;
+ pMac->cfg.gCfgSBuf[bufStart] = (tANI_U8)(bufEnd - bufStart - 2);
+
+ PELOG1(cfgLog(pMac, LOG1, FL("id %d max %d bufStart %d bufEnd %d\n"),
+ i, pMac->cfg.gCfgSBuf[bufStart], bufStart, bufEnd);)
+
+ bufEnd = bufStart;
+ }
+
+ // Initialize string defaults
+ strSize = pHdr->sBufSize;
+ while (strSize)
+ {
+ tANI_U32 paramId, paramLen, paramLenCeil4;
+
+ if (strSize < 4)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Error parsing str defaults, rem %d bytes\n"), strSize);)
+ retVal = WNI_CFG_INVALID_LEN;
+ goto end;
+ }
+#if defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_OSX)
+ paramId = sirReadU32N((tANI_U8*)pSrc) >> 16;
+ paramLen = sirReadU32N((tANI_U8*)pSrc) & 0xff;
+#else
+ paramId = *pSrc >> 16;
+ paramLen = *pSrc & 0xff;
+#endif
+ pSrc++;
+ strSize -= 4;
+
+ paramLenCeil4 = ((paramLen + 3) >> 2);
+ if (strSize < paramLenCeil4 << 2)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Error parsing str defaults, rem %d bytes\n"), strSize);)
+ PELOGE(cfgLog(pMac, LOGE, FL("param id %d len %d bytes\n"), paramId, paramLen);)
+ retVal = WNI_CFG_INVALID_LEN;
+ goto end;
+ }
+ for (j=0; j < paramLenCeil4; j++)
+ {
+#if defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_OSX)
+ pStr[4*j] = (tANI_U8) ((sirReadU32N((tANI_U8*)pSrc) >> 24) & 0xff);
+ pStr[4*j+1] = (tANI_U8) ((sirReadU32N((tANI_U8*)pSrc) >> 16) & 0xff);
+ pStr[4*j+2] = (tANI_U8) ((sirReadU32N((tANI_U8*)pSrc) >> 8) & 0xff);
+ pStr[4*j+3] = (tANI_U8) (sirReadU32N((tANI_U8*)pSrc) & 0xff);
+#else
+ pStr[4*j] = (tANI_U8) (*pSrc >> 24) & 0xff;
+ pStr[4*j+1] = (tANI_U8) (*pSrc >> 16) & 0xff;
+ pStr[4*j+2] = (tANI_U8) (*pSrc >> 8) & 0xff;
+ pStr[4*j+3] = (tANI_U8) (*pSrc) & 0xff;
+#endif
+
+ pSrc++;
+ strSize -= 4;
+ }
+
+ PELOG1(cfgLog(pMac, LOG1, FL("set str id %d len %d\n"), paramId, paramLen);)
+
+ if (cfgSetStr(pMac, (tANI_U16) paramId, pStr, paramLen) != eSIR_SUCCESS)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Error setting str default param %d len %d\n"), paramId, paramLen);)
+ retVal = WNI_CFG_INVALID_LEN;
+ goto end;
+ }
+ }
+
+ // Set the default log level based on config
+ wlan_cfgGetInt(pMac, WNI_CFG_LOG_LEVEL, &logLevel);
+ for (i = 0; i < LOG_ENTRY_NUM; i++)
+#ifdef LX5280
+ pMac->utils.gLogEvtLevel[i] = pMac->utils.gLogDbgLevel[i] = LOGE;
+#else
+#if defined(ANI_OS_TYPE_WINCE)
+ pMac->utils.gLogEvtLevel[i] = pMac->utils.gLogDbgLevel[i] = LOGE;
+#else //#if defined(ANI_OS_TYPE_WINCE)
+ pMac->utils.gLogEvtLevel[i] = pMac->utils.gLogDbgLevel[i] = logLevel;
+#endif //#if defined(ANI_OS_TYPE_WINCE)
+#endif
+
+ // Set status to READY
+ pMac->cfg.gCfgStatus = CFG_SUCCESS;
+ retVal = WNI_CFG_SUCCESS;
+ PELOG1(cfgLog(pMac, LOG1, "<CFG> Completed successfully\n");)
+
+ end:
+
+ if ( retVal != WNI_CFG_SUCCESS )
+ pMac->cfg.gCfgStatus = CFG_FAILURE;
+
+ // Send response message to host
+#if defined(ANI_OS_TYPE_LINUX)
+ sirStoreU32N((tANI_U8 *) &(pMac->cfg.gParamList[WNI_CFG_DNLD_CNF_RES]), retVal);
+#else
+ pMac->cfg.gParamList[WNI_CFG_DNLD_CNF_RES] = retVal;
+#endif
+ cfgSendHostMsg(pMac, WNI_CFG_DNLD_CNF, WNI_CFG_DNLD_CNF_LEN,
+ WNI_CFG_DNLD_CNF_NUM, pMac->cfg.gParamList, 0, 0);
+
+ // Notify WDA that the config has downloaded
+ mmhMsg.type = SIR_CFG_DOWNLOAD_COMPLETE_IND;
+ mmhMsg.bodyptr = NULL;
+ mmhMsg.bodyval = 0;
+
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ if (wdaPostCtrlMsg(pMac, &mmhMsg) != eSIR_SUCCESS)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("WDAPostMsgApi failed!\n"));)
+ }
+
+} /*** end procDnldRsp() ***/
+
+
+/**---------------------------------------------------------------------
+ * ProcGetReq()
+ *
+ * FUNCTION:
+ * This function processes CFG_GET_REQ message from host.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ * For every parameter ID specified on the list, CFG will send a separate
+ * CFG_GET_RSP back to host.
+ *
+ * @param length: message length
+ * @param pParam: parameter list pointer
+ *
+ * @return None
+ *
+ */
+static void
+ProcGetReq(tpAniSirGlobal pMac, tANI_U16 length, tANI_U32 *pParam)
+{
+ tANI_U16 cfgId, i;
+ tANI_U32 value, valueLen, result;
+ tANI_U32 *pValue;
+
+ PELOG1(cfgLog(pMac, LOG1, FL("Rcvd cfg get request %d bytes\n"), length);)
+ for (i=0; i<length/4; i++)
+ PELOG2(cfgLog(pMac, LOG2, FL("[%2d] 0x%08x\n"), i, pParam[i]);)
+
+ if (!pMac->cfg.gCfgStatus)
+ {
+ cfgId = (tANI_U16)sirReadU32N((tANI_U8*)pParam);
+ PELOGE(cfgLog(pMac, LOGE, FL("CFG not ready, param %d\n"), cfgId);)
+#if defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_OSX)
+ sirStoreU32N((tANI_U8 *) &(pMac->cfg.gParamList[WNI_CFG_GET_RSP_RES]),
+ WNI_CFG_NOT_READY);
+ sirStoreU32N((tANI_U8 *) &(pMac->cfg.gParamList[WNI_CFG_GET_RSP_PID]),
+ cfgId);
+ sirStoreU32N((tANI_U8 *) &(pMac->cfg.gParamList[WNI_CFG_GET_RSP_PLEN]),
+ 0);
+#else
+ pMac->cfg.gParamList[WNI_CFG_GET_RSP_RES] = WNI_CFG_NOT_READY;
+ pMac->cfg.gParamList[WNI_CFG_GET_RSP_PID] = cfgId;
+ pMac->cfg.gParamList[WNI_CFG_GET_RSP_PLEN] = 0;
+#endif
+ cfgSendHostMsg(pMac, WNI_CFG_GET_RSP, WNI_CFG_GET_RSP_PARTIAL_LEN,
+ WNI_CFG_GET_RSP_NUM, pMac->cfg.gParamList, 0, 0);
+ }
+ else
+ {
+ // Process all parameter ID's on the list
+ while (length >= sizeof(tANI_U32))
+ {
+#if defined(ANI_OS_TYPE_LINUX)
+ cfgId = (tANI_U16)sirReadU32N((tANI_U8*) pParam); pParam++;
+#else
+ cfgId = (tANI_U16)*pParam++;
+#endif
+ pValue = 0;
+ valueLen = 0;
+
+ PELOG1(cfgLog(pMac, LOG1, FL("Cfg get param %d\n"), cfgId);)
+
+ // Check for valid parameter ID, etc...
+ if (CheckParam(pMac, cfgId, CFG_CTL_RE, WNI_CFG_WO_PARAM, &result))
+ {
+ if ((pMac->cfg.gCfgEntry[cfgId].control & CFG_CTL_INT) != 0)
+ {
+ // Get integer parameter
+ result = (wlan_cfgGetInt(pMac, cfgId, &value) == eSIR_SUCCESS ?
+ WNI_CFG_SUCCESS : WNI_CFG_OTHER_ERROR);
+ pValue = &value;
+ valueLen = sizeof(tANI_U32);
+ }
+ else
+ {
+ // Get string parameter
+ valueLen = sizeof(pMac->cfg.gSBuffer);
+ result = (wlan_cfgGetStr(pMac, cfgId, pMac->cfg.gSBuffer, &valueLen)
+ == eSIR_SUCCESS ?
+ WNI_CFG_SUCCESS : WNI_CFG_OTHER_ERROR);
+ pValue = (tANI_U32*)pMac->cfg.gSBuffer;
+ }
+ }
+ else
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Check param failed, param %d\n"), cfgId);)
+ result = WNI_CFG_INVALID_LEN;
+ }
+
+ // Send response message to host
+#if defined(ANI_OS_TYPE_LINUX)
+ sirStoreU32N((tANI_U8 *) &(pMac->cfg.gParamList[WNI_CFG_GET_RSP_RES]),
+ result);
+ sirStoreU32N((tANI_U8 *) &(pMac->cfg.gParamList[WNI_CFG_GET_RSP_PID]),
+ cfgId);
+ sirStoreU32N((tANI_U8 *) &(pMac->cfg.gParamList[WNI_CFG_GET_RSP_PLEN]),
+ valueLen);
+#else
+ pMac->cfg.gParamList[WNI_CFG_GET_RSP_RES] = result;
+ pMac->cfg.gParamList[WNI_CFG_GET_RSP_PID] = cfgId;
+ pMac->cfg.gParamList[WNI_CFG_GET_RSP_PLEN] = valueLen;
+#endif
+
+ // We need to round up buffer length to word-increment
+ valueLen = (((valueLen + 3) >> 2) << 2);
+ cfgSendHostMsg(pMac, WNI_CFG_GET_RSP,
+ WNI_CFG_GET_RSP_PARTIAL_LEN + valueLen,
+ WNI_CFG_GET_RSP_NUM, pMac->cfg.gParamList, valueLen, pValue);
+
+ // Decrement length
+ length -= sizeof(tANI_U32);
+ }
+ }
+
+} /*** end procGetReq() ***/
+
+
+
+/**---------------------------------------------------------------------
+ * ProcSetReqInternal()
+ *
+ * FUNCTION:
+ * This function processes CFG_SET_REQ message from host.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * - The message content is coded in TLV format.
+ * - For string parameter, the length field is byte accurate. However,
+ * the next TLV set will begin on the next word boundary.
+ *
+ * NOTE:
+ * - For every parameter ID specified on the list, CFG will send a separate
+ * CFG_SET_RSP back to host.
+ *
+ * @param length: message length
+ * @param pParam: parameter list pointer
+ * @param fRsp: whether to send response to host. TRUE means sending.
+ * @return None
+ *
+ */
+static void
+ProcSetReqInternal(tpAniSirGlobal pMac, tANI_U16 length, tANI_U32 *pParam, tANI_BOOLEAN fRsp)
+{
+ tANI_U16 cfgId, valueLen, valueLenRoundedUp4;
+ tANI_U32 value, result;
+
+ PELOG1(cfgLog(pMac, LOGW, FL("Rcvd cfg set request %d bytes\n"), length);)
+ //for (i=0; i<length/4; i++)
+ // PELOG2(cfgLog(pMac, LOG2, FL("[%2d] 0x%08x\n"), i, pParam[i]);)
+
+ if (!pMac->cfg.gCfgStatus)
+ {
+ cfgId = (tANI_U16)sirReadU32N((tANI_U8*)pParam);
+ PELOGE(cfgLog(pMac, LOGE, FL("CFG not ready, param %d\n"), cfgId);)
+#if defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_OSX)
+ sirStoreU32N((tANI_U8 *) &(pMac->cfg.gParamList[WNI_CFG_SET_CNF_RES]),
+ WNI_CFG_NOT_READY);
+ sirStoreU32N((tANI_U8 *) &(pMac->cfg.gParamList[WNI_CFG_SET_CNF_PID]),
+ cfgId);
+#else
+ pMac->cfg.gParamList[WNI_CFG_SET_CNF_RES] = WNI_CFG_NOT_READY;
+ pMac->cfg.gParamList[WNI_CFG_SET_CNF_PID] = cfgId;
+#endif
+ if( fRsp )
+ {
+ cfgSendHostMsg(pMac, WNI_CFG_SET_CNF, WNI_CFG_SET_CNF_LEN,
+ WNI_CFG_SET_CNF_NUM, pMac->cfg.gParamList, 0, 0);
+ }
+ }
+ else
+ {
+ // Process all TLVs in buffer
+ while (length >= (sizeof(tANI_U32) * 2))
+ {
+#if defined(ANI_OS_TYPE_LINUX)
+ // Get TYPE (cfgID) and LENGTH (length)
+ cfgId = (tANI_U16)sirReadU32N((tANI_U8*)pParam);pParam++;
+ valueLen = (tANI_U16)sirReadU32N((tANI_U8*)pParam);pParam++;
+#else
+ cfgId = (tANI_U16) *pParam++;
+ valueLen = (tANI_U16) *pParam++;
+#endif
+ length -= (sizeof(tANI_U32) * 2);
+ // value length rounded up to a 4 byte multiple
+ valueLenRoundedUp4 = (((valueLen + 3) >> 2) << 2);
+
+ // Check for valid request before proceeding
+ if (CheckParam(pMac, cfgId, CFG_CTL_WE, WNI_CFG_RO_PARAM, &result))
+ {
+ PELOG1(cfgLog(pMac, LOGW, (char *) gCfgParamName[cfgId]);)
+ // Process integer parameter
+ if ((pMac->cfg.gCfgEntry[cfgId].control & CFG_CTL_INT) != 0)
+ {
+ // Set VALUE
+ if (valueLen != sizeof(tANI_U32))
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Invalid value length %d in set param %d (tot %d)\n"),
+ valueLen, cfgId, length);)
+ result = WNI_CFG_INVALID_LEN;
+ }
+ else
+ {
+#if defined(ANI_OS_TYPE_LINUX)
+ value = sirReadU32N((tANI_U8*) pParam);
+#else
+ value = *pParam;
+#endif
+ PELOG1(cfgLog(pMac, LOGW, FL("Cfg set int %d len %d(%d) val %d\n"),
+ cfgId, valueLen, valueLenRoundedUp4, value);)
+ result = (cfgSetInt(pMac, cfgId, value) == eSIR_SUCCESS ?
+ WNI_CFG_SUCCESS : WNI_CFG_OTHER_ERROR);
+ if (result == WNI_CFG_SUCCESS)
+ {
+ if (cfgNeedRestart(pMac, cfgId))
+ {
+ result = WNI_CFG_NEED_RESTART ;
+ }
+ else
+ if (cfgNeedReload(pMac, cfgId))
+ {
+ result = WNI_CFG_NEED_RELOAD ;
+ }
+ }
+ }
+ }
+ // Process string parameter
+ else
+ {
+ if (valueLenRoundedUp4 > length)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Invalid string length %d in set param %d (tot %d)\n"),
+ valueLen, cfgId, length);)
+ result = WNI_CFG_INVALID_LEN;
+ }
+ else
+ {
+ GetStrValue((tANI_U8*)pParam, pMac->cfg.gSBuffer, valueLen);
+ PELOG1(cfgLog(pMac, LOGW, FL("Cfg set str %d len %d(%d) bytes\n"),
+ cfgId, valueLen, valueLenRoundedUp4);)
+ result = (cfgSetStr(pMac, cfgId, pMac->cfg.gSBuffer, valueLen) == eSIR_SUCCESS ?
+ WNI_CFG_SUCCESS : WNI_CFG_OTHER_ERROR);
+ if (result == WNI_CFG_SUCCESS)
+ {
+ if (cfgNeedRestart(pMac, cfgId))
+ {
+ result = WNI_CFG_NEED_RESTART ;
+ }
+ else
+ if (cfgNeedReload(pMac, cfgId))
+ {
+ result = WNI_CFG_NEED_RELOAD ;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Check param failed, param %d\n"), cfgId);)
+ result = WNI_CFG_INVALID_LEN;
+ }
+
+ // Send confirm message to host
+#if defined(ANI_OS_TYPE_LINUX)
+ sirStoreU32N((tANI_U8 *) &(pMac->cfg.gParamList[WNI_CFG_SET_CNF_RES]),
+ result);
+ sirStoreU32N((tANI_U8 *) &(pMac->cfg.gParamList[WNI_CFG_SET_CNF_PID]),
+ cfgId);
+#else
+ pMac->cfg.gParamList[WNI_CFG_SET_CNF_RES] = result;
+ pMac->cfg.gParamList[WNI_CFG_SET_CNF_PID] = cfgId;
+#endif
+ if( fRsp )
+ {
+ cfgSendHostMsg(pMac, WNI_CFG_SET_CNF, WNI_CFG_SET_CNF_LEN,
+ WNI_CFG_SET_CNF_NUM, pMac->cfg.gParamList, 0, 0);
+ }
+ else
+ {
+ PELOGW(cfgLog( pMac, LOGW, " CFGID %d no rsp\n", cfgId);)
+ }
+
+ if (valueLenRoundedUp4 > length)
+ length = 0;
+ else
+ {
+ length -= valueLenRoundedUp4;
+ pParam += (valueLenRoundedUp4 >> 2);
+ }
+ }
+ }
+}
+
+
+
+static void
+ProcSetReq(tpAniSirGlobal pMac, tANI_U16 length, tANI_U32 *pParam)
+{
+ ProcSetReqInternal( pMac, length, pParam, eANI_BOOLEAN_TRUE );
+}
+
+static void
+ProcSetReqNoRsp(tpAniSirGlobal pMac, tANI_U16 length, tANI_U32 *pParam)
+{
+ ProcSetReqInternal( pMac, length, pParam, eANI_BOOLEAN_FALSE );
+}
+
+
+
+/**---------------------------------------------------------------------
+ * CheckParam()
+ *
+ * FUNCTION:
+ * This function is called to perform various check on a parameter.
+ *
+ * LOGIC:
+ * - If cfgId is out of bound or parameter is not valid, result
+ * WNI_CFG_INVALID_PID is returned at address specified in pResult.
+ *
+ * - If specified 'flag' is not set in the parameter control entry,
+ * 'failedResult' is returned at address specified in pResult.
+ *
+ * ASSUMPTIONS:
+ * Since this function is used internally, 'pResult' is always valid.
+ *
+ * NOTE:
+ *
+ * @param None
+ *
+ * @return true: Parameter is valid and matches checked condition \n
+ * @return false: Parameter either is not valid or does not match
+ * checked condition.
+ *
+ */
+static tANI_U8
+CheckParam(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U32 flag, tANI_U32 failedResult, tANI_U32 *pResult)
+{
+ // Check if parameter ID is out of bound
+ if (cfgId >= CFG_PARAM_MAX_NUM)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Invalid param id %d\n"), cfgId);)
+ *pResult = WNI_CFG_INVALID_PID;
+ }
+ else
+ {
+ // Check if parameter is valid
+ if ((pMac->cfg.gCfgEntry[cfgId].control & CFG_CTL_VALID) == 0)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Param id %d not valid\n"), cfgId);)
+ *pResult = WNI_CFG_INVALID_PID;
+ }
+ else
+ {
+ // Check control field against flag
+ if ((pMac->cfg.gCfgEntry[cfgId].control & flag) == 0)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Param id %d wrong permissions %x\n"),
+ cfgId, pMac->cfg.gCfgEntry[cfgId].control);)
+ *pResult = failedResult;
+ }
+ else
+ return(true);
+ }
+ }
+ return(false);
+
+} /*** cfgParamCheck() ***/
+
+
+/**---------------------------------------------------------------------
+ * GetStrValue()
+ *
+ * FUNCTION:
+ * This function copies a string value from the specified buffer.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pBuf: input data buffer
+ * @param pValue: address where data is returned
+ * @param length: number of bytes to copy
+ *
+ * @return None
+ *
+ */
+static void
+GetStrValue(tANI_U8 *pBuf, tANI_U8 *pValue, tANI_U32 length)
+{
+ tANI_U8 *pEnd;
+
+ pEnd = pValue + length;
+ while (pValue < pEnd)
+ *pValue++ = *pBuf++;
+} /*** end GetStrValue() ***/
+
+
+/**---------------------------------------------------------------------
+ * processCfgDownloadReq()
+ *
+ * FUNCTION: This function does the Cfg Download and is invoked
+ * only in the case of Prima or the Integrated SOC
+ * solutions. Not applicable to Volans or Libra
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param length: message length
+ * @param pConfig: parameter list pointer
+ *
+ * @return None
+ *
+ */
+
+void
+processCfgDownloadReq(tpAniSirGlobal pMac, tANI_U16 length,
+ tANI_U32 *pConfig)
+{
+ tANI_S32 i;
+
+ tANI_U32 expLen, retVal, bufStart, bufEnd;
+ tANI_U32 *pSrc, *pDst, *pDstEnd;
+ tANI_U32 strSize, j;
+ tANI_U8 pStr[CFG_MAX_STR_LEN];
+ tpCfgBinHdr pHdr;
+ tANI_U32 logLevel;
+
+ // First Dword must contain the AP or STA magic dword
+ PELOGW(cfgLog(pMac, LOGW, FL("CFG size %d bytes MAGIC dword is 0x%x\n"),
+ length, sirReadU32N((tANI_U8*)pConfig) );)
+
+ // if the string is not correct, return failure
+ if (CFG_STA_MAGIC_DWORD != *pConfig)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Invalid magic dword 0x%x\n"),
+ sirReadU32N((tANI_U8*)pConfig) );)
+ retVal = WNI_CFG_INVALID_LEN;
+ goto end;
+ }
+
+ pConfig++;
+ length -= 4;
+
+ // Verify message length
+ pMac->cfg.gCfgMaxIBufSize = CFG_STA_IBUF_MAX_SIZE;
+ pMac->cfg.gCfgMaxSBufSize = CFG_STA_SBUF_MAX_SIZE;
+
+ // Parse the Cfg header
+ pHdr = (tpCfgBinHdr) pConfig;
+ pConfig += (sizeof(tCfgBinHdr) >> 2);
+
+ PELOGW(cfgLog(pMac, LOGW, FL("CFG hdr totParams %d intParams %d strBufSize %d/%d\n"),
+ pHdr->controlSize,pHdr->iBufSize,
+ pHdr->sBufSize, pMac->cfg.gCfgMaxSBufSize);)
+
+ expLen = ((CFG_PARAM_MAX_NUM + 3 * pMac->cfg.gCfgMaxIBufSize) << 2) +
+ pHdr->sBufSize + sizeof(tCfgBinHdr);
+
+ if (length != expLen)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("<CFG> DNLD_RSP invalid length %d (exp %d)\n"),
+ length, expLen);)
+ retVal = WNI_CFG_INVALID_LEN;
+ goto end;
+ }
+
+
+ if (CFG_PARAM_MAX_NUM != pHdr->controlSize )
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("<CFG> Total parameter count mismatch\n"));)
+ retVal = WNI_CFG_INVALID_LEN;
+ goto end;
+ }
+
+ if (pHdr->iBufSize != pMac->cfg.gCfgMaxIBufSize)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("<CFG> Integer parameter count mismatch\n"));)
+ retVal = WNI_CFG_INVALID_LEN;
+ goto end;
+ }
+
+ // Copy control array
+ pDst = (tANI_U32*)pMac->cfg.gCfgEntry;
+ pDstEnd = pDst + CFG_PARAM_MAX_NUM;
+ pSrc = pConfig;
+ while (pDst < pDstEnd)
+ {
+ *pDst++ = *pSrc++;
+ }
+
+ // Copy default values
+ pDst = pMac->cfg.gCfgIBuf;
+ pDstEnd = pDst + pMac->cfg.gCfgMaxIBufSize;
+ while (pDst < pDstEnd)
+ {
+ *pDst++ = *pSrc++;
+ }
+
+ // Copy min values
+ pDst = pMac->cfg.gCfgIBufMin;
+ pDstEnd = pDst + pMac->cfg.gCfgMaxIBufSize;
+ while (pDst < pDstEnd)
+ {
+ *pDst++ = *pSrc++;
+ }
+
+ // Copy max values
+ pDst = pMac->cfg.gCfgIBufMax;
+ pDstEnd = pDst + pMac->cfg.gCfgMaxIBufSize;
+ while (pDst < pDstEnd)
+ {
+ *pDst++ = *pSrc++;
+ }
+
+ for (i=0; i<pMac->cfg.gCfgMaxIBufSize; i++)
+ {
+ if (pMac->cfg.gCfgIBuf[i] < pMac->cfg.gCfgIBufMin[i] ||
+ pMac->cfg.gCfgIBuf[i] > pMac->cfg.gCfgIBufMax[i])
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("cfg id %d Invalid def value %d "
+ "min %d max %d\n"),
+ i, pMac->cfg.gCfgIBuf[i], pMac->cfg.gCfgIBufMin[i],
+ pMac->cfg.gCfgIBufMax[i]);)
+ }
+ }
+
+ // Calculate max string buffer lengths for all string parameters
+ bufEnd = pMac->cfg.gCfgMaxSBufSize;
+ for (i = CFG_PARAM_MAX_NUM - 1; i >= 0; i--)
+ {
+ if ((pMac->cfg.gCfgEntry[i].control & CFG_CTL_INT) != 0)
+ continue;
+
+ if ((pMac->cfg.gCfgEntry[i].control & CFG_CTL_VALID) == 0)
+ continue;
+
+ bufStart = pMac->cfg.gCfgEntry[i].control & CFG_BUF_INDX_MASK;
+ pMac->cfg.gCfgSBuf[bufStart] = (tANI_U8)(bufEnd - bufStart - 2);
+
+ PELOG1(cfgLog(pMac, LOG1, FL("id %d max %d bufStart %d bufEnd %d\n"),
+ i, pMac->cfg.gCfgSBuf[bufStart], bufStart, bufEnd);)
+
+ bufEnd = bufStart;
+ }
+
+ // Initialize string defaults
+ strSize = pHdr->sBufSize;
+ while (strSize)
+ {
+ tANI_U32 paramId, paramLen, paramLenCeil4;
+
+ if (strSize < 4)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Error parsing str defaults, rem %d bytes\n"),
+ strSize);)
+ retVal = WNI_CFG_INVALID_LEN;
+ goto end;
+ }
+ paramId = *pSrc >> 16;
+ paramLen = *pSrc & 0xff;
+
+ pSrc++;
+ strSize -= 4;
+
+ paramLenCeil4 = ((paramLen + 3) >> 2);
+ if (strSize < paramLenCeil4 << 2)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Error parsing str defaults, rem %d"
+ "bytes\n"), strSize);)
+ PELOGE(cfgLog(pMac, LOGE, FL("param id %d len %d bytes\n"),
+ paramId, paramLen);)
+ retVal = WNI_CFG_INVALID_LEN;
+ goto end;
+ }
+
+ for (j=0; j < paramLenCeil4; j++)
+ {
+ pStr[4*j] = (tANI_U8) (*pSrc >> 24) & 0xff;
+ pStr[4*j+1] = (tANI_U8) (*pSrc >> 16) & 0xff;
+ pStr[4*j+2] = (tANI_U8) (*pSrc >> 8) & 0xff;
+ pStr[4*j+3] = (tANI_U8) (*pSrc) & 0xff;
+
+ pSrc++;
+ strSize -= 4;
+ }
+
+ PELOG1(cfgLog(pMac, LOG1, FL("set str id %d len %d\n"), paramId, paramLen);)
+
+ if (cfgSetStrNotify(pMac, (tANI_U16)paramId, pStr, paramLen, FALSE) != eSIR_SUCCESS)
+ {
+ PELOGE(cfgLog(pMac, LOGE, FL("Error setting str default param %d "
+ "len %d\n"), paramId, paramLen);)
+ retVal = WNI_CFG_INVALID_LEN;
+ goto end;
+ }
+ }
+
+ // Set the default log level based on config
+ wlan_cfgGetInt(pMac, WNI_CFG_LOG_LEVEL, &logLevel);
+ for (i = 0; i < LOG_ENTRY_NUM; i++)
+ pMac->utils.gLogEvtLevel[i] = pMac->utils.gLogDbgLevel[i] = logLevel;
+
+ // Set status to READY
+ pMac->cfg.gCfgStatus = CFG_SUCCESS;
+ retVal = WNI_CFG_SUCCESS;
+ PELOG1(cfgLog(pMac, LOG1, "<CFG> Completed successfully\n");)
+
+end:
+
+ if ( WNI_CFG_SUCCESS != retVal )
+ pMac->cfg.gCfgStatus = CFG_FAILURE;
+
+ pMac->cfg.gParamList[WNI_CFG_DNLD_CNF_RES] = retVal;
+
+} /*** end ProcessDownloadReq() ***/
+
+
+
+
diff --git a/CORE/MAC/src/cfg/cfgSendMsg.c b/CORE/MAC/src/cfg/cfgSendMsg.c
new file mode 100644
index 0000000..469d464
--- /dev/null
+++ b/CORE/MAC/src/cfg/cfgSendMsg.c
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file contains the source code for composing and sending messages
+ * to host.
+ *
+ * Author: Kevin Nguyen
+ * Date: 04/09/02
+ * History:-
+ * 04/09/02 Created.
+ * --------------------------------------------------------------------
+ */
+#include "palTypes.h"
+#include "cfgPriv.h"
+#include "limTrace.h"
+#include "cfgDebug.h"
+
+extern void SysProcessMmhMsg(tpAniSirGlobal pMac, tSirMsgQ* pMsg);
+
+/*--------------------------------------------------------------------*/
+/* ATTENTION: The functions contained in this module are to be used */
+/* by CFG module ONLY. */
+/*--------------------------------------------------------------------*/
+
+
+/**---------------------------------------------------------------------
+ * cfgSendHostMsg()
+ *
+ * FUNCTION:
+ * Send CNF/RSP to host.
+ *
+ * LOGIC:
+ * Please see Configuration & Statistic Collection Micro-Architecture
+ * specification for details.
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param msgType: message type
+ * @param msgLen: message length
+ * @param paramNum: number of parameters
+ * @param pParamList: pointer to parameter list
+ * @param dataLen: data length
+ * @param pData: pointer to additional data
+ *
+ * @return None.
+ *
+ */
+void
+cfgSendHostMsg(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 msgLen, tANI_U32 paramNum, tANI_U32 *pParamList,
+ tANI_U32 dataLen, tANI_U32 *pData)
+{
+ tANI_U32 *pMsg, *pEnd;
+ tSirMsgQ mmhMsg;
+
+ // sanity
+ if ((paramNum > 0) && (NULL == pParamList))
+ {
+ PELOGE(cfgLog(pMac, LOGE,
+ FL("pParamList NULL when paramNum greater than 0!"));)
+ return;
+ }
+ if ((dataLen > 0) && (NULL == pData))
+ {
+ PELOGE(cfgLog(pMac, LOGE,
+ FL("pData NULL when dataLen greater than 0!"));)
+ return;
+ }
+
+ // Allocate message buffer
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMsg, msgLen))
+ {
+ PELOGE(cfgLog(pMac, LOGE,
+ FL("Memory allocation failure!"));)
+ return;
+ }
+
+ // Fill in message details
+ mmhMsg.type = msgType;
+ mmhMsg.bodyptr = pMsg;
+ mmhMsg.bodyval = 0;
+ ((tSirMbMsg*)pMsg)->type = msgType;
+ ((tSirMbMsg*)pMsg)->msgLen = (tANI_U16)msgLen;
+
+ switch (msgType)
+ {
+ case WNI_CFG_GET_RSP:
+ case WNI_CFG_PARAM_UPDATE_IND:
+ case WNI_CFG_DNLD_REQ:
+ case WNI_CFG_DNLD_CNF:
+ case WNI_CFG_SET_CNF:
+ // Fill in parameters
+ pMsg++;
+ if (NULL != pParamList)
+ {
+ pEnd = pMsg + paramNum;
+ while (pMsg < pEnd)
+ {
+ *pMsg++ = *pParamList++;
+ }
+ }
+ // Copy data if there is any
+ if (NULL != pData)
+ {
+ pEnd = pMsg + (dataLen >> 2);
+ while (pMsg < pEnd)
+ {
+ *pMsg++ = *pData++;
+ }
+ }
+ break;
+
+ default:
+ PELOGE(cfgLog(pMac, LOGE,
+ FL("Unknown msg %d!"), (int) msgType);)
+ palFreeMemory( pMac->hHdd, pMsg);
+ return;
+ }
+
+ // Ship it
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ SysProcessMmhMsg(pMac, &mmhMsg);
+
+} /*** end cfgSendHostMsg() ***/
+
+
+
+
diff --git a/CORE/MAC/src/cfg/cfgUtil/cfg.txt b/CORE/MAC/src/cfg/cfgUtil/cfg.txt
new file mode 100644
index 0000000..1c72f98
--- /dev/null
+++ b/CORE/MAC/src/cfg/cfgUtil/cfg.txt
@@ -0,0 +1,3984 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+* wniCfgSta.h - C header file for STA mode only
+* wniCfgAp.h - C header file for both STA and AP
+* wniCfgSta.bin - Control and default values for STA system
+* wniCfgAp.bin - Control and default values for AP system
+*
+* PARAMETER DESCRIPTION:
+* ----------------------
+* For each parameter, the description must be on separate lines and
+* exactly as specified below. [] are comments and should not be included.
+*
+* [Common info] parameter_name type maxLen semIndx
+* [STA flags] valid RW P/NP RESTART/RELOAD
+* [STA_NTF] notification_mask
+* [STA values] min max value [for integer]
+* length byte1 byte2 ... [for string]
+* [AP flags] valid RW/RO/WO P/NP RESTART/RELOAD
+* [AP_NTF] notification_mask
+* [AP values] min max value [for integer]
+* length byte1 byte2 ... [for string]
+*
+* parameter_name:
+* This will be used as the base name for C macro definition.
+* Therefore, C syntax rule must be observed.
+*
+* type:
+* Specifies parameter type
+* S - variable-length string
+* I - integer
+*
+* maxLen:
+* Specifies maximum parameter length in bytes.
+*
+* semIndx:
+* Specifies semaphore index to use for locking this parameter.
+* More than one parameters (those belonging to the same group)
+* can share the same semaphore index.
+*
+* valid:
+* Specifies if this parameter will be valid in current mode.
+* V - Valid
+* NV - Not valid
+*
+* RW:
+* Specifies Read/Write mode.
+* RO - Read only
+* RW - Read/Write
+* WO - Write only
+* XX - Not accessible from host
+*
+* P:
+* Specifies persistent memory option
+* P - Save to persistent memory
+* NP - No save
+*
+* RELOAD:
+* Specifies whether setting this requires reloading the MAC module
+* This attribute can be changed only when SME is in OFFLINE or SUSPEND(OFFLINE) state
+*
+* RESTART:
+* Specifies whether setting this requires (re)assoc at STA and restart at AP
+* This attribute can be changed only when SME is in OFFLINE, SUSPEND(OFFLINE),
+* IDLE or SUSPEND(IDLE) states
+*
+* STA_notification:
+* Lists modules to be notified in STA mode. Valid modules are:
+* HDD, LIM, SCH, ARQ, DPH, NIM, SP, RFP, RHP, TFP. More than one
+* modules can be listed on the same line using space or tab as the
+* separator. If no notification is required, 'NONE' must be specified.
+*
+* AP_notification:
+* Lists module to be notified in AP mode. Valid modules are:
+* HDD, LIM, SCH, ARQ, DPH, NIM, SP, RFP, RHP, TFP. More than one
+* modules can be listed on the same line using space or tab as the
+* separator. If no notification is required, 'NONE' must be specified.
+*
+* STA/AP integer values:
+* min:
+* Specifies minimum value for an integer parameter. This field is
+* ignored if the parameter type is string. However, this field must
+* not be omitted.
+*
+* max:
+* Specifies maximum value for an integer parameter. This field is
+* ignored if the parameter type is string. However, this field must
+* not be omitted.
+*
+* default:
+* Specifies default value for an integer parameter. This field is
+* ignored if the parameter type is string. However, this field must
+* not be omitted.
+*
+* STA/AP string values:
+* len:
+* The actual length of the string
+*
+* bytei:
+* byte i of the string where i varies from 1 to len
+*
+* TABLE GENERATION:
+* -----------------
+* Table can be generated using keywords '#TABLE' and '#END' as below:
+*
+* #TABLE table_name number_of_row
+* WNI_CFG_xxxx
+* .......
+* .......
+* #END
+*
+* The CFG utility will generate the following output:
+* WNI_CFG_table_xxx_ID xxx
+* WNI_CFG_table_xxx_ROW number_of_rows
+* WNI_CFG_table_xxx_COL number_of_columns
+*
+* These will be followed by the parameter definition for each entry in
+* the table. Table is organized in column-major order.
+*
+* #ENTRY_VALUES 1
+* 0 4 1
+* 0 0 0
+* #ENTRY_VALUES 2
+* 0 4 2
+* 0 0 0
+* #ENTRY_VALUES 3
+* 0 4 3
+* 0 0 0
+* #ENTRY_VALUES 4
+* 0 4 4
+* 0 0 0
+*
+*
+* ENUMERATION
+* -----------
+* Enumerations can be define using keyword '#ENUM'
+*
+* #ENUM xxx val
+*
+* The cfg utility will generate the following output in the header file
+* #define paramname_xxx val
+*
+
+
+*
+* Station ID (changing requires restart)
+*
+
+WNI_CFG_STA_ID S 6 1
+V RW NP RELOAD
+HAL
+6 0x22 0x22 0x44 0x44 0x33 0x33
+V RW NP RELOAD
+HAL
+6 0x22 0x22 0x11 0x11 0x33 0x33
+
+*
+* CF Pollable
+*
+
+WNI_CFG_CF_POLLABLE I 4 1
+NV RO NP RESTART
+NONE
+0 0 0
+V RO NP RESTART
+NONE
+0 1 0
+
+*
+* CFP Period
+*
+
+WNI_CFG_CFP_PERIOD I 4 1
+V RO NP
+NONE
+0 255 1
+V RW NP
+SCH
+0 255 1
+
+*
+* CFP Max Duration
+*
+
+WNI_CFG_CFP_MAX_DURATION I 4 1
+V RO NP
+NONE
+0 65535 30000
+V RW NP
+HAL
+0 65535 30000
+
+*
+* SSID (changing requires restart)
+*
+
+WNI_CFG_SSID S 32 1
+V RW NP RESTART
+NONE
+10 1 2 3 4 5 6 7 8 9 0
+V RW NP RESTART
+NONE
+10 1 2 3 4 5 6 7 8 9 0
+
+*
+* Beacon Period
+* Can't be changed on STA in infrastructure, ignore notification at SCH
+*
+
+WNI_CFG_BEACON_INTERVAL I 4 2
+V RW NP
+SCH
+0 65535 100
+V RW NP
+SCH
+0 65535 100
+
+*
+* DTIM Period
+*
+
+WNI_CFG_DTIM_PERIOD I 4 2
+V RO NP
+NONE
+0 65535 1
+V RW NP
+SCH
+0 65535 1
+
+
+*
+* WEP Key Length (5 or 13 bytes)
+*
+
+WNI_CFG_WEP_KEY_LENGTH I 4 5
+V RW NP RESTART
+NONE
+5 13 5
+V RW NP RESTART
+NONE
+5 13 5
+
+#ENUM 5 5
+#ENUM 13 13
+
+*
+* Default Key Table
+*
+
+#TABLE WNI_CFG_WEP_DEFAULT_KEY_TABLE 4
+
+WNI_CFG_WEP_DEFAULT_KEY S 13 4
+V WO NP RESTART
+NONE
+0
+V WO NP RESTART
+NONE
+0
+
+#END
+
+*
+* WEP Default Key id
+*
+
+WNI_CFG_WEP_DEFAULT_KEYID I 4 5
+V RW NP
+LIM
+0 3 0
+V RW NP
+LIM
+0 3 0
+
+#ENUM 0 0
+#ENUM 1 1
+#ENUM 2 2
+#ENUM 3 3
+
+*
+* Exclude unencrypted frames (WEP)
+*
+
+WNI_CFG_EXCLUDE_UNENCRYPTED I 4 5
+V RW NP
+LIM
+0 1 0
+V RW NP
+LIM
+0 1 0
+
+*
+* RTS Threshold
+*
+
+WNI_CFG_RTS_THRESHOLD I 4 6
+V RW NP
+HAL
+0 2347 2347
+V RW NP
+HAL
+0 2347 2347
+
+*
+* Short Retry Limit
+*
+
+WNI_CFG_SHORT_RETRY_LIMIT I 4 6
+V RW NP
+HAL
+0 255 6
+V RW NP
+HAL
+0 255 6
+
+*
+* Long Retry Limit
+*
+
+WNI_CFG_LONG_RETRY_LIMIT I 4 6
+V RW NP
+HAL
+0 255 6
+V RW NP
+HAL
+0 255 6
+
+
+*
+* Fragmentation Threshold
+*
+
+WNI_CFG_FRAGMENTATION_THRESHOLD I 4 6
+V RW NP
+HAL
+256 8000 8000
+V RW NP
+HAL
+256 8000 8000
+
+
+*
+* Minimum Channel Time (TU)
+*
+
+WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME I 4 9
+V RW NP
+NONE
+0 65535 20
+V RW NP
+NONE
+0 65535 20
+
+*
+* Maximum Channel Time (TU)
+*
+
+WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME I 4 9
+V RW NP
+NONE
+0 65535 40
+V RW NP
+NONE
+0 65535 40
+*
+* Minimum Channel Time (TU)
+*
+
+WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME I 4 9
+V RW NP
+NONE
+0 65535 60
+V RW NP
+NONE
+0 65535 60
+
+*
+* Maximum Channel Time (TU)
+*
+
+WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME I 4 9
+V RW NP
+NONE
+0 65535 110
+V RW NP
+NONE
+0 65535 110
+
+*
+* Join Failure Timeout (TU)
+*
+
+WNI_CFG_JOIN_FAILURE_TIMEOUT I 4 7
+V RW NP
+NONE
+0 65535 3000
+V RW NP
+NONE
+0 65535 3000
+
+*
+* Authenticate Failure Timeout (TU)
+*
+
+WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT I 4 7
+V RW NP
+NONE
+0 65535 1000
+V RW NP
+NONE
+0 65535 1000
+
+*
+* Authenticate Response Timeout (TU)
+*
+
+WNI_CFG_AUTHENTICATE_RSP_TIMEOUT I 4 7
+V RW NP
+NONE
+0 65535 1000
+V RW NP
+NONE
+0 65535 1000
+
+*
+* Assocation Failure Timeout (TU)
+*
+
+WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT I 4 8
+V RW NP
+LIM
+0 65535 2000
+V RW NP
+LIM
+0 65535 3000
+
+*
+* Reassociation Failure Timeout (TU)
+*
+
+WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT I 4 7
+V RW NP
+NONE
+0 65535 2000
+V RW NP
+NONE
+0 65535 3000
+
+
+*
+* RA periodicity Timeout (TU)
+*
+
+WNI_CFG_RA_PERIODICITY_TIMEOUT_IN_PS I 4 7
+V RW NP
+HAL
+0 65535 1000
+NV RW NP
+NONE
+0 0 0
+
+*
+* Beacon Filter Enable/Disable (TU)
+*
+
+WNI_CFG_PS_ENABLE_BCN_FILTER I 4 7
+V RW NP
+HAL
+0 1 1
+NV RW NP
+NONE
+0 1 1
+
+*
+* Heart Beat Enable/Disable (TU)
+*
+
+WNI_CFG_PS_ENABLE_HEART_BEAT I 4 7
+V RW NP
+HAL
+0 1 1
+NV RW NP
+NONE
+0 1 1
+
+*
+* RSSI Monitor Enable/Disable (TU)
+*
+
+WNI_CFG_PS_ENABLE_RSSI_MONITOR I 4 7
+V RW NP
+HAL
+0 1 0
+NV RW NP
+NONE
+0 1 0
+
+
+*
+* PS Data InActivity Timeout (TU)
+*
+
+WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT I 4 7
+V RW NP
+HAL
+1 255 20
+NV RW NP
+NONE
+1 255 20
+
+
+*
+* RF Settling Time Clk (In US)
+*
+
+WNI_CFG_RF_SETTLING_TIME_CLK I 4 7
+V RW NP
+HAL
+0 60000 1500
+NV RW NP
+NONE
+0 60000 1500
+
+*
+* Supported Rate Set for 11b
+*
+
+WNI_CFG_SUPPORTED_RATES_11B S 4 2
+V RO NP
+NONE
+4 2 4 11 22
+V RO NP
+NONE
+4 2 4 11 22
+
+*
+* Supported Rate Set for 11a
+*
+
+WNI_CFG_SUPPORTED_RATES_11A S 8 7
+V RO NP
+NONE
+8 12 18 24 36 48 72 96 108
+V RO NP
+NONE
+8 12 18 24 36 48 72 96 108
+
+
+*
+* PHY Mode
+*
+
+WNI_CFG_PHY_MODE I 4 9
+V RW NP RESTART
+NONE
+0 3 0
+V RW NP RESTART
+NONE
+0 3 0
+
+#ENUM 11A 0
+#ENUM 11B 1
+#ENUM 11G 2
+#ENUM NONE 3
+
+
+*
+*The Dot11 mode can change dynamically on STA
+*
+WNI_CFG_DOT11_MODE I 4 9
+V RW NP RESTART
+LIM
+0 9 0
+V RW NP RESTART
+LIM
+0 9 0
+
+#ENUM ALL 0
+#ENUM 11A 1
+#ENUM 11B 2
+#ENUM 11G 3
+#ENUM 11N 4
+#ENUM POLARIS 5
+#ENUM TITAN 6
+#ENUM TAURUS 7
+#ENUM 11G_ONLY 8
+#ENUM 11N_ONLY 9
+
+
+
+
+
+
+*
+* Operational Rate Set (goes in beacon, probe rsp and assoc req)
+*
+
+WNI_CFG_OPERATIONAL_RATE_SET S 12 2
+V RW NP RESTART
+NONE
+0
+V RW NP RESTART
+NONE
+4 0x82 0x84 11 22
+* 8 0x8c 18 24 36 48 72 96 108
+
+*
+* Extended Operational Rate Set (goes in beacon, assoc req)
+* required for 11g
+*
+
+WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET S 8 7
+V RW NP RESTART
+NONE
+0
+V RW NP RESTART
+NONE
+0
+
+*
+* Proprietary Operational Rate Set
+*
+
+WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET S 4 7
+V RW NP RESTART
+NONE
+4 1 3 5 7
+V RW NP RESTART
+NONE
+4 1 3 5 7
+
+*
+* BSSID
+* In IBSS, this can be changed for coalescing, should SME go into IDLE state?
+*
+
+WNI_CFG_BSSID S 6 7
+V RO NP RESTART
+NONE
+6 0x22 0x22 0x11 0x11 0x33 0x33
+V RO NP RESTART
+NONE
+6 0x22 0x22 0x11 0x11 0x33 0x33
+
+
+*
+* Listen Interval
+*
+
+WNI_CFG_LISTEN_INTERVAL I 4 7
+V RW NP RESTART
+NONE
+0 65535 1
+V RO NP
+NONE
+0 65535 1
+
+*
+* Valid Channel List
+*
+
+WNI_CFG_VALID_CHANNEL_LIST S 100 8
+V RW NP RESTART
+LIM
+55 36 40 44 48 52 56 60 64 1 6 11 34 38 42 46 2 3 4 5 7 8 9 10 12 13 14 100 104 108 112 116 120 124 128 132 136 140 149 151 153 155 157 159 161 50 54 58 62 240 242 244 246 248 250 252
+V RW NP RESTART
+LIM
+55 36 40 44 48 52 56 60 64 1 6 11 34 38 42 46 2 3 4 5 7 8 9 10 12 13 14 100 104 108 112 116 120 124 128 132 136 140 149 151 153 155 157 159 161 50 54 58 62 240 242 244 246 248 250 252
+
+*
+* Current Channel
+*
+
+WNI_CFG_CURRENT_CHANNEL I 4 9
+V RO NP
+NONE
+0 165 1
+V RO NP
+NONE
+0 165 1
+
+
+*
+* For 11a or pure 11g, use 6Mbps(rateindex 11)
+* as the default beaconRateIndex and
+* nonBeaconRateIndex.
+*
+WNI_CFG_DEFAULT_RATE_INDEX_5GHZ I 4 9
+V RW NP
+NONE
+0 11 5
+V RW NP
+NONE
+0 11 5
+
+*
+* For 11b/g, use 1Mbps
+* as the default beaconRateIndex and
+* nonBeaconRateIndex.
+*
+WNI_CFG_DEFAULT_RATE_INDEX_24GHZ I 4 9
+V RW NP
+NONE
+0 31 1
+V RW NP
+NONE
+0 31 1
+
+
+* *********************************************************
+*
+* Rate adaptation type
+*
+
+WNI_CFG_RATE_ADAPTATION_TYPE I 4 0
+V RW NP
+SCH
+0 2 1
+V RW NP
+SCH
+0 2 1
+
+#ENUM FIXED 0
+#ENUM AUTO 1
+#ENUM SNR_BASED 2
+
+*
+* Rate adaptation fixed rate
+* Used to determine the rate for all peer stations
+*
+*
+
+WNI_CFG_FIXED_RATE I 4 0
+V RW NP
+HAL
+0 31 0
+V RW NP
+HAL
+0 31 0
+
+#ENUM AUTO 0
+
+#ENUM 1MBPS 1
+#ENUM 2MBPS 2
+#ENUM 5_5MBPS 3
+#ENUM 11MBPS 4
+
+#ENUM 6MBPS 5
+#ENUM 9MBPS 6
+#ENUM 12MBPS 7
+#ENUM 18MBPS 8
+#ENUM 24MBPS 9
+#ENUM 36MBPS 10
+#ENUM 48MBPS 11
+#ENUM 54MBPS 12
+
+#ENUM 6_5MBPS_MCS0_20MHZ_SIMO 13
+#ENUM 13MBPS_MCS1_20MHZ_SIMO 14
+#ENUM 19_5MBPS_MCS2_20MHZ_SIMO 15
+#ENUM 26MBPS_MCS3_20MHZ_SIMO 16
+#ENUM 39MBPS_MCS4_20MHZ_SIMO 17
+#ENUM 52MBPS_MCS5_20MHZ_SIMO 18
+#ENUM 58_5MBPS_MCS6_20MHZ_SIMO 19
+#ENUM 65MBPS_MCS7_20MHZ_SIMO 20
+
+#ENUM 7_2MBPS_MCS0_20MHZ_SIMO_SGI 21
+#ENUM 14_4MBPS_MCS1_20MHZ_SIMO_SGI 22
+#ENUM 21_7MBPS_MCS2_20MHZ_SIMO_SGI 23
+#ENUM 28_9MBPS_MCS3_20MHZ_SIMO_SGI 24
+#ENUM 43_3MBPS_MCS4_20MHZ_SIMO_SGI 25
+#ENUM 57_8MBPS_MCS5_20MHZ_SIMO_SGI 26
+#ENUM 65MBPS_MCS6_20MHZ_SIMO_SGI 27
+#ENUM 72_2MBPS_MCS7_20MHZ_SIMO_SGI 28
+
+#ENUM 0_25MBPS_SLR_20MHZ_SIMO 29
+#ENUM 0_5MBPS_SLR_20MHZ_SIMO 30
+
+#ENUM 68_25MBPS_QC_PROP_20MHZ_SIMO 31
+
+* *********************************************************
+*
+* Broadcast/mutlicast rates for 2.4GHZ
+* uses the same rate indices definition as WNI_CFG_FIXED_RATE
+* default value corresponds to 1M
+
+WNI_CFG_FIXED_RATE_MULTICAST_24GHZ I 4 8
+V RW NP
+HAL
+0 31 1
+V RW NP
+HAL
+0 31 1
+
+* *********************************************************
+*
+* Broadcast/mutlicast rates for 5 GHZ
+* uses the same rate indices definition as WNI_CFG_FIXED_RATE
+* default value corresponds to 6M
+
+WNI_CFG_FIXED_RATE_MULTICAST_5GHZ I 4 8
+V RW NP
+HAL
+0 31 5
+V RW NP
+HAL
+0 31 5
+
+*
+* retry rate selection policy
+* 0 => use the minimum supported rate
+* 1 => use the same rate as the chosen primary rate
+* 2 => use the rate specified in RETRYRATE_SECONDARY
+* 3 => use the rate closest to the primary
+* 4 => autoselect the retry rate based on RA algorithm
+*
+
+WNI_CFG_RETRYRATE_POLICY I 4 0
+V RW NP
+HAL
+0 255 4
+V RW NP
+HAL
+0 255 4
+
+#ENUM MIN_SUPPORTED 0
+#ENUM PRIMARY 1
+#ENUM RESERVED 2
+#ENUM CLOSEST 3
+#ENUM AUTOSELECT 4
+#ENUM MAX 5
+
+*
+* the following two CFG's are
+* used only if the retryrate policy == 2
+* These should be set to one of the values used
+* for configuring fixed rates (see enumerated rates)
+*
+
+WNI_CFG_RETRYRATE_SECONDARY I 4 0
+V RW NP
+HAL
+0 255 0
+V RW NP
+HAL
+0 255 0
+
+WNI_CFG_RETRYRATE_TERTIARY I 4 0
+V RW NP
+HAL
+0 255 0
+V RW NP
+HAL
+0 255 0
+
+* *********************************************************
+*
+* Automatic Power Save Delivery capability
+*
+
+WNI_CFG_APSD_ENABLED I 4 0
+V RW NP
+NONE
+0 1 0
+V RW NP
+NONE
+0 1 0
+
+*
+* Shared key authentication supported
+*
+
+WNI_CFG_SHARED_KEY_AUTH_ENABLE I 4 8
+V RW NP
+NONE
+0 1 1
+V RW NP
+NONE
+0 1 1
+
+*
+* Open system authentication supported
+*
+
+WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE I 4 8
+V RW NP
+NONE
+0 1 1
+V RW NP
+NONE
+0 1 1
+
+*
+* Authentication Type (change requires restart)
+*
+
+WNI_CFG_AUTHENTICATION_TYPE I 4 8
+V RW NP RESTART
+NONE
+0 65535 0
+V RW NP RESTART
+NONE
+0 65535 0
+
+*
+* CF Poll Request (change requires restart)
+*
+
+WNI_CFG_CF_POLL_REQUEST I 4 8
+NV RW NP RESTART
+NONE
+0 1 0
+V RW NP RESTART
+NONE
+0 1 0
+
+*
+* Privacy Enabled (change requires restart)
+*
+
+WNI_CFG_PRIVACY_ENABLED I 4 8
+V RW NP RESTART
+NONE
+0 1 0
+V RW NP RESTART
+NONE
+0 1 0
+
+*
+* Short Preamble (change requires restart)
+*
+
+WNI_CFG_SHORT_PREAMBLE I 4 8
+V RW NP RESTART
+NONE
+0 1 1
+V RW NP RESTART
+NONE
+0 1 1
+
+*
+* Short Slot time
+* This is the operational state of the BSS
+
+WNI_CFG_SHORT_SLOT_TIME I 4 8
+V RW NP
+NONE
+0 1 1
+V RW NP
+NONE
+0 1 0
+
+
+*
+* ACCEPT Short Slot Association only
+*
+* 1: If AP supports shortSlot, then AP will accept
+* association only from stations that supports
+* supports short slot
+* 0: AP supports shortSlot, but AP will accept association
+* from stations regardless of whether station supports
+* short slot or long slot
+*
+WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY I 4 9
+V RW NP RESTART
+NONE
+0 1 0
+V RW NP RESTART
+NONE
+0 1 0
+
+
+*
+* QOS Enabled (change requires restart)
+*
+
+WNI_CFG_QOS_ENABLED I 4 8
+V RW NP RESTART
+NONE
+0 1 0
+V RW NP RESTART
+NONE
+0 1 0
+
+*
+* HCF Enabled (change requires restart)
+*
+
+WNI_CFG_HCF_ENABLED I 4 8
+V RW NP RESTART
+NONE
+0 1 0
+V RW NP RESTART
+NONE
+0 1 0
+
+*
+* RSN (11i/WPA) Enabled
+*
+
+WNI_CFG_RSN_ENABLED I 4 8
+V RW NP RESTART
+NONE
+0 1 0
+V RW NP RESTART
+NONE
+0 1 0
+
+*
+* Background scanning periodicity (kilo usec)
+*
+
+WNI_CFG_BACKGROUND_SCAN_PERIOD I 4 8
+V RW NP
+LIM
+0 180000 5000
+V RW NP
+LIM
+0 18000 5000
+
+*
+* Max number of Preauthentication
+*
+
+WNI_CFG_MAX_NUM_PRE_AUTH I 4 8
+V RW NP RESTART
+NONE
+0 256 64
+V RW NP RESTART
+NONE
+0 256 64
+
+*
+* Preauthentication Cleanup Timeout (kilo usec)
+*
+
+WNI_CFG_PREAUTH_CLNUP_TIMEOUT I 4 8
+NV XX NP
+NONE
+0 0 0
+V RW NP
+LIM
+0 120000 30000
+
+*
+* Release AID Timeout
+*
+
+WNI_CFG_RELEASE_AID_TIMEOUT I 4 8
+NV XX NP
+NONE
+0 0 0
+V RW NP
+LIM
+0 100000 1000
+*
+* Heartbeat Threshold
+*
+
+WNI_CFG_HEART_BEAT_THRESHOLD I 4 8
+V RW NP
+LIM
+0 65535 40
+NV RW NP
+NONE
+0 65535 40
+
+*
+* Probe response wait time out after heartbeat failure
+*
+
+WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT I 4 8
+V RW NP
+NONE
+10 10000 40
+V RW NP
+NONE
+10 10000 40
+
+*
+* Manufacturer OUI (from eeprom)
+*
+
+WNI_CFG_MANUFACTURER_OUI S 3 8
+V RO NP
+NONE
+3 0x0 0xa 0xf5
+V RO NP
+NONE
+3 0x0 0xa 0xf5
+
+*
+* Manufacture Name (from eeprom)
+*
+
+WNI_CFG_MANUFACTURER_NAME S 65 8
+V RO NP
+NONE
+8 0x51 0x75 0x61 0x6c 0x63 0x6f 0x6D 0x6D
+V RO NP
+NONE
+8 0x51 0x75 0x61 0x6c 0x63 0x6f 0x6D 0x6D
+
+*
+* Model Number (from eeprom)
+*
+
+WNI_CFG_MODEL_NUMBER S 33 8
+V RO NP
+NONE
+6 0x4d 0x4e 0x31 0x32 0x33 0x34
+V RO NP
+NONE
+6 0x4d 0x4e 0x31 0x32 0x33 0x34
+
+
+
+*
+* Model Name (from eeprom)
+* WFR4031
+*
+
+WNI_CFG_MODEL_NAME S 33 8
+V RO NP
+NONE
+7 0x57 0x46 0x52 0x34 0x30 0x33 0x31
+V RO NP
+NONE
+7 0x57 0x46 0x52 0x34 0x30 0x33 0x31
+
+
+
+
+*
+* Manufacture Product Name (from eeprom)
+*
+
+WNI_CFG_MANUFACTURER_PRODUCT_NAME S 33 8
+V RO NP
+NONE
+6 0x31 0x31 0x6e 0x2D 0x41 0x50
+V RO NP
+NONE
+6 0x31 0x31 0x6e 0x2D 0x41 0x50
+
+
+*
+* Manufacture Product Version (from eeprom)
+*
+
+WNI_CFG_MANUFACTURER_PRODUCT_VERSION S 33 8
+V RO NP
+NONE
+6 0x53 0x4e 0x31 0x32 0x33 0x34
+V RO NP
+NONE
+6 0x53 0x4e 0x31 0x32 0x33 0x34
+
+*
+* Multi Domain Capability (11d) Enable
+*
+
+WNI_CFG_11D_ENABLED I 4 9
+V RW NP RESTART
+NONE
+0 1 1
+V RW NP RESTART
+NONE
+0 1 0
+
+*
+* per channel Max power transmit (in dBm)
+* this parameter correspond to the MAX_COUNTRY_EID
+* table of (Channel Number/num channel/max tx power)
+*
+* There is one table for 5GHz channels and one table for 2.4GHz channels
+*
+
+WNI_CFG_MAX_TX_POWER_2_4 S 128 8
+V RW NP
+NONE
+3 1 14 20
+V RW NP
+NONE
+3 1 14 20
+
+WNI_CFG_MAX_TX_POWER_5 S 128 8
+V RW NP
+NONE
+3 36 126 14
+V RW NP
+NONE
+3 36 126 14
+
+*
+* Cell size configurations. These are canned configurations for a specified
+* cell size.
+*
+WNI_CFG_NETWORK_DENSITY I 4 9
+V RW NP
+HAL
+0 3 3
+V RW NP
+HAL
+0 3 0
+
+#ENUM LOW 0
+#ENUM MEDIUM 1
+#ENUM HIGH 2
+#ENUM ADAPTIVE 3
+
+
+*
+* Adaptive Threshold Algorithm
+*
+WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM I 4 9
+V RW NP
+HAL
+1 2 2
+V RW NP
+HAL
+1 2 2
+
+#ENUM CARRIER 1
+#ENUM CORRELATION 2
+
+
+
+*
+* Current TX Antenna
+*
+
+WNI_CFG_CURRENT_TX_ANTENNA I 4 9
+V RW NP
+HAL
+1 1 1
+V RW NP
+HAL
+1 2 2
+
+*
+* Current RX Antenna
+*
+
+WNI_CFG_CURRENT_RX_ANTENNA I 4 9
+V RW NP
+HAL
+1 2 2
+V RW NP
+HAL
+1 3 3
+
+*
+* Current TX Power Level
+*
+
+WNI_CFG_CURRENT_TX_POWER_LEVEL I 4 9
+V RO NP
+NONE
+0 128 27
+V RO NP
+NONE
+0 128 27
+
+
+*
+* Radio Power State for each Chain
+*
+* This CFG is invoked when user issues the Apple setPower()
+* command, which configures the power state for each chain. Currently,
+* Taurus supports up to three chains, and each chain can be configured
+* to one of the 4 following possible power states:
+* POWER_OFF = 0x0
+* POWER_ON = 0x1
+* POWER_TX = 0x2
+* POWER_RX = 0x3
+*
+* The power state of each chain is expressed in nibble:
+* bit[0:3] - chain 0
+* bit[4:7] - chain 1
+* bit[8:11] - chain 2
+* bit[12:15] - not used at the moment
+*
+* Examples:
+* 0x001 - 1x1 (chain 1 is for both tx and rcv. chain 1,2 are turned off)
+* 0x031 - 1x2 (chain 0 is for both tx and rcv. chain 1 is rcv only. chain 2 is turned off)
+* 0x011 - 2x2 (chain 0,1 are used for both tx and rcv)
+* 0x311 - 2x3 (chain 0,1 are used for both tx and rcv. chain 2 is for rcv only)
+* 0x333 - all 3 chains are set to RX
+*
+
+WNI_CFG_POWER_STATE_PER_CHAIN I 4 9
+V RW NP
+HAL
+0 0xffff 0x311
+V RW NP
+HAL
+0 0xffff 0x311
+
+#ENUM OFF 0
+#ENUM ON 1
+#ENUM TX 2
+#ENUM RX 3
+#ENUM MASK 0xf
+#ENUM CHAIN_0_OFFSET 0
+#ENUM CHAIN_1_OFFSET 4
+#ENUM CHAIN_2_OFFSET 8
+
+
+*
+* Parameter to indicate or not new BSS found
+*
+
+WNI_CFG_NEW_BSS_FOUND_IND I 4 9
+V RW NP
+NONE
+0 1 0
+V RW NP
+NONE
+0 1 0
+
+*
+* Proprietary ANI features enable/disable
+*
+
+WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED I 4 12
+V RW NP RESTART
+NONE
+0 1 0
+V RW NP RESTART
+NONE
+0 1 0
+
+
+*
+* Qualcomm Prop Rates are disabled by default
+*
+WNI_CFG_PROPRIETARY_RATES_ENABLED I 4 12
+V RW NP RESTART
+NONE
+0 1 0
+V RW NP RESTART
+NONE
+0 1 0
+
+
+*
+* AP node Name
+*
+
+WNI_CFG_AP_NODE_NAME S 32 8
+NV RO NP
+NONE
+0
+V RW NP RESTART
+NONE
+0
+
+*
+* Country code (from EEPROM)
+*
+
+WNI_CFG_COUNTRY_CODE S 3 8
+V RW NP
+NONE
+0
+V RW NP
+NONE
+3 0x11 0x22 0x33
+
+*
+* Spectrum Management (11h) enable/disable
+*
+
+WNI_CFG_11H_ENABLED I 4 12
+V RW NP RESTART
+NONE
+0 1 1
+V RW NP RESTART
+NONE
+0 1 1
+
+
+*
+* Wait for CNF Timeout. CNF include (RE)ASSOC, DISASSOC, AUTH, DEAUTH,
+* DUMMY packet
+*
+
+WNI_CFG_WT_CNF_TIMEOUT I 4 12
+V RW NP
+NONE
+10 3000 1000
+V RW NP
+NONE
+10 3000 1000
+
+*
+* Keepalive Timeout. A Null data frame is sent out every timeout.
+* Applicable to both AP and STA
+*
+
+WNI_CFG_KEEPALIVE_TIMEOUT I 4 12
+V RW NP
+NONE
+0 3600000 0
+V RW NP
+NONE
+0 3600000 3000
+
+*
+* Proximity, set it for very short distances
+* Proxmity setting is applied via halPhySetNwDensity()
+*
+* close proximity off = densityOn is true. network density config applies.
+* close proximity on = densityOn is false. Don't care about network density config.
+*
+
+WNI_CFG_PROXIMITY I 4 12
+V RW NP
+HAL
+0 1 0
+V RW NP
+HAL
+0 1 0
+
+#ENUM OFF 0
+#ENUM ON 1
+
+*
+* Default LOG level
+*
+
+WNI_CFG_LOG_LEVEL I 4 12
+V RW NP
+NONE
+0 7 3
+V RW NP
+NONE
+0 7 3
+
+*
+* OLBC detection timeout
+*
+
+WNI_CFG_OLBC_DETECT_TIMEOUT I 4 12
+V RW NP
+NONE
+1000 30000 10000
+V RW NP
+NONE
+1000 30000 10000
+
+**********************************
+* Protection Enable
+*
+*LOWER byte for associated stations
+*UPPER byte for overlapping stations.
+*11g ==> protection from 11g
+*11b ==> protection from 11b
+*each byte will have the following info
+*bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
+*reserved reserved RIFS Lsig n-GF ht20 11g 11b
+**********************************
+WNI_CFG_PROTECTION_ENABLED I 4 9
+V RW NP RESTART
+LIM
+0 0xffff 0xffff
+V RW NP RESTART
+LIM
+0 0xffff 0xffff
+
+#ENUM FROM_llA 0
+#ENUM FROM_llB 1
+#ENUM FROM_llG 2
+#ENUM HT_20 3
+#ENUM NON_GF 4
+#ENUM LSIG_TXOP 5
+#ENUM RIFS 6
+#ENUM OBSS 7
+#ENUM OLBC_FROM_llA 8
+#ENUM OLBC_FROM_llB 9
+#ENUM OLBC_FROM_llG 10
+#ENUM OLBC_HT20 11
+#ENUM OLBC_NON_GF 12
+#ENUM OLBC_LSIG_TXOP 13
+#ENUM OLBC_RIFS 14
+#ENUM OLBC_OBSS 15
+
+
+* ****************************************
+*
+* 11G Protection Enable Always
+* Valid only if protection is enabled
+* forces uses of protection regardless of legacy stations
+*
+
+WNI_CFG_11G_PROTECTION_ALWAYS I 4 9
+V RW NP RESTART
+NONE
+0 1 0
+V RW NP RESTART
+NONE
+0 1 0
+
+*********************************************
+* Force protection
+* 0 : disable protection
+* 1 : CTS
+* 2 : RTS by threshold (threshold nonzero)
+* 3 : dual CTS (not supported right now)
+* 4 : RTS (threshold 0)
+* 5 : auto
+
+WNI_CFG_FORCE_POLICY_PROTECTION I 4 9
+V RW NP RESTART
+HAL
+0 5 5
+V RW NP RESTART
+HAL
+0 5 5
+
+#ENUM DISABLE 0
+#ENUM CTS 1
+#ENUM RTS 2
+#ENUM DUAL_CTS 3
+#ENUM RTS_ALWAYS 4
+#ENUM AUTO 5
+
+
+
+
+
+
+********************************************
+* 11G Short Preamble Enable
+*
+
+WNI_CFG_11G_SHORT_PREAMBLE_ENABLED I 4 9
+V RW NP RESTART
+NONE
+0 1 0
+V RW NP RESTART
+NONE
+0 1 0
+
+*
+* 11G Short Slot Time Enable (change requires restart)
+* This is the admin state of short slot support.
+
+WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED I 4 9
+V RW NP RESTART
+NONE
+0 1 1
+V RW NP RESTART
+NONE
+0 1 1
+
+*
+* Calibration periodicity (minutes)
+*
+
+WNI_CFG_CAL_PERIOD I 4 12
+V RW NP
+HAL
+2 10 5
+V RW NP
+HAL
+2 10 5
+
+*
+* Statistics collection periodicity (seconds)
+*
+
+WNI_CFG_STATS_PERIOD I 4 12
+V RW NP
+HAL
+1 10 10
+V RW NP
+HAL
+1 10 10
+
+*
+* Calibration on/off control
+*
+
+WNI_CFG_CAL_CONTROL I 4 12
+V RW NP
+HAL
+0 1 0
+V RW NP
+HAL
+0 1 0
+
+#ENUM CAL_ON 0
+#ENUM CAL_OFF 1
+
+
+*
+* Parameter to allow 11g only STAs while operating in 11g mode
+*
+
+WNI_CFG_11G_ONLY_POLICY I 4 12
+V RW NP
+NONE
+0 1 0
+V RW NP
+NONE
+0 1 0
+
+*
+* Packet Classification
+* This flag is a bitmask used to indicate which
+* frame classifier to be enabled:
+* b0: DSCP
+* b1: 802.1P
+*
+
+WNI_CFG_PACKET_CLASSIFICATION I 4 12
+V RW NP
+HAL
+0 3 0
+V RW NP
+HAL
+0 3 0
+
+#ENUM DISABLED 0
+#ENUM DSCP 1
+#ENUM 8021P 2
+#ENUM ALL 3
+
+*
+* WME Enabled (change requires restart)
+*
+
+WNI_CFG_WME_ENABLED I 4 8
+V RW NP RESTART
+NONE
+0 1 1
+V RW NP RESTART
+NONE
+0 1 1
+
+*
+* ADDTS response timeout (in ms)
+*
+
+WNI_CFG_ADDTS_RSP_TIMEOUT I 4 8
+V RW NP
+NONE
+0 65535 1000
+V RW NP
+NONE
+0 65535 1000
+
+
+ * Max SP Length indicates the max number of
+ * total buffered MSDUs and MMPDUs the WMM AP
+ * may deliver to WMM STA during any service period
+ * triggered by WMM STA.
+ * 1) If AP sends WMM IE with the UAPSD bit 0, max_sp_length=0
+ * 2) If WMM STA's all 4 UAPSD flag are set to 0, max_sp_length=0
+ * 3) If AP sends WMM IE with UAPSD=1, and at least one of stations
+ * UAPSD flag is set to 1, then max_sp_length can be set to:
+ * [b5:b6]=0x00: WMM AP may deliver all buffered frames
+ * [b5:b6]=0x10: WMM AP may deliver max 2 buffered frames
+ * [b5:b6]=0x01: WMM AP may deliver max 4 buffered frames
+ * [b5:b6]=0x11: WMM AP may deliver max 6 buffered frames
+
+WNI_CFG_MAX_SP_LENGTH I 4 8
+V RW NP
+NONE
+0 3 0
+V RW NP
+NONE
+0 3 0
+
+
+*
+* KEEP ALIVE STA Limit Threshold , used in AP to delete the STA
+* from Station Table which didn't respond to Probe Response Messages
+*
+
+WNI_CFG_KEEP_ALIVE_STA_LIMIT_THRESHOLD I 4 8
+NV RW NP
+NONE
+0 32 0
+V RW NP
+NONE
+0 32 0
+
+*
+* Parameter that specifies whether to send SSID
+* in Probe Response when SSID is suppressed
+*
+
+WNI_CFG_SEND_SINGLE_SSID_ALWAYS I 4 12
+V RW NP
+NONE
+0 1 0
+V RW NP
+NONE
+0 1 0
+
+*
+* WSM Enabled (change requires restart)
+* Takes effect only if WME is also enabled
+*
+
+WNI_CFG_WSM_ENABLED I 4 8
+V RW NP
+NONE
+0 1 0
+V RW NP
+NONE
+0 1 0
+
+* ****************************************
+*
+* Proprietary IE capability enable
+* bit mapped:
+* 0:HCF 1:11eQos 2:WME 3:WSM 4:EXT_RATES
+* 5:EXTRATE_STOP
+* 6:Titan device 7:Taurus Device
+* 13:EDCA 14:LOADINFO 15:VERSION
+*
+
+WNI_CFG_PROP_CAPABILITY I 4 8
+V RW NP
+NONE
+0 0xffff 0xe0bf
+V RW NP
+NONE
+0 0xffff 0xc0a9
+
+#ENUM HCF 0
+#ENUM 11EQOS 1
+#ENUM WME 2
+#ENUM WSM 3
+#ENUM EXTRATES 4
+#ENUM EXTRATE_STOP 5
+#ENUM TITAN 6
+#ENUM TAURUS 7
+#ENUM EDCAPARAMS 13
+#ENUM LOADINFO 14
+#ENUM VERSION 15
+#ENUM MAXBITOFFSET 15
+
+* ****************************************
+*
+* Background Channel List
+* Contains pairs of {channelNumber, scanType}
+* where scanType = 0 indicates active scan and
+* = 1 indicates passive scan
+*
+*
+*WNI_CFG_BACKGROUND_SCAN_LIST S 128 8
+*V RW NP RESTART
+*LIM
+*60 36 0 40 0 44 0 48 0 52 0 56 0 60 0 64 0 1 0 6 0 11 0 34 0 38 0 42 0 46 0 2 0 3 0 4 0 5 0 7 0 8 0 9 0 10 0 12 0 13 0 14 0 149 0 153 0 157 0 161 0
+*V RW NP RESTART
+*LIM
+*60 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 34 0 36 0 38 0 40 0 42 0 44 0 46 0 48 0 52 0 56 0 60 0 64 0 149 0 153 0 157 0 161 0
+*
+
+* ****************************************
+* EDCA paramters are contained in profiles - each profile contains
+* the parameters [ACM, AIFSN, CWmin, CWmax, TxOp] for four
+* access categories (i.e., four sets). Two such sets of four parameters
+* make a single profile: One set is used locally by the AP, the other set
+* is broadcast for use by stations.
+*
+* Cwmin and Cwmax are two bytes each, MSB first. So Cwmin of [3 255] is
+* equivalent to 0x3ff, i.e. 3*256+255=1023
+*
+* The profile to use is selected based on the valus of the profile select param
+* See ENUMs below for definitions of profile values
+*
+
+WNI_CFG_EDCA_PROFILE I 4 8
+V RW NP
+SCH
+0 255 1
+V RW NP
+SCH
+0 255 1
+
+#ENUM ANI 0
+#ENUM WMM 1
+#ENUM TIT_DEMO 2
+#ENUM MAX 3
+
+#ENUM ACM_IDX 0
+#ENUM AIFSN_IDX 1
+#ENUM CWMINA_IDX 2
+#ENUM CWMAXA_IDX 4
+#ENUM TXOPA_IDX 6
+#ENUM CWMINB_IDX 7
+#ENUM CWMAXB_IDX 9
+#ENUM TXOPB_IDX 11
+#ENUM CWMING_IDX 12
+#ENUM CWMAXG_IDX 14
+#ENUM TXOPG_IDX 16
+
+
+* ****************************************
+* Profile 0 (Airgo) parameters - AC_BK Local
+* ACM, AIFSN, [CWminH, CWminL, CWmaxH, CWmaxL, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_ANI_ACBK_LOCAL S 20 8
+V RW NP RESTART
+NONE
+17 0 7 0 15 3 255 0 0 31 3 255 0 0 15 3 255 0
+V RW NP RESTART
+NONE
+17 0 7 0 15 3 255 0 0 31 3 255 0 0 15 3 255 0
+
+*
+* Profile 0 (Airgo) parameters AC_BE Local
+* ACM, AIFSN, [CWmin, CWmax, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_ANI_ACBE_LOCAL S 20 8
+V RW NP RESTART
+NONE
+17 0 2 0 15 3 255 100 0 31 3 255 100 0 15 3 255 100
+V RW NP RESTART
+NONE
+17 0 2 0 15 3 255 100 0 31 3 255 100 0 15 3 255 100
+
+*
+* Profile 0 (Airgo) parameters AC_VI Local
+* ACM, AIFSN, [CWmin, CWmax, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_ANI_ACVI_LOCAL S 20 8
+V RW NP RESTART
+NONE
+17 0 2 0 7 0 15 200 0 15 0 31 188 0 7 0 15 200
+V RW NP RESTART
+NONE
+17 0 2 0 7 0 15 200 0 15 0 31 188 0 7 0 15 200
+
+*
+* Profile 0 (Airgo) parameters AC_VO Local
+* ACM, AIFSN, [CWmin, CWmax, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_ANI_ACVO_LOCAL S 20 8
+V RW NP RESTART
+NONE
+17 0 2 0 3 0 7 100 0 7 0 15 102 0 3 0 7 100
+V RW NP RESTART
+NONE
+17 0 2 0 3 0 7 100 0 7 0 15 102 0 3 0 7 100
+
+*
+* Profile 0 (Airgo) parameters - AC_BK Broadcast
+* ACM, AIFSN, [CWmin, CWmax, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_ANI_ACBK S 20 8
+V RW NP RESTART
+NONE
+17 0 7 0 15 3 255 0 0 31 3 255 0 0 15 3 255 0
+V RW NP RESTART
+NONE
+17 0 7 0 15 3 255 0 0 31 3 255 0 0 15 3 255 0
+
+*
+* Profile 0 (Airgo) parameters AC_BE Broadcast
+* ACM, AIFSN, [CWmin, CWmax, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_ANI_ACBE S 20 8
+V RW NP RESTART
+NONE
+17 0 2 0 15 3 255 100 0 31 3 255 100 0 15 3 255 100
+V RW NP RESTART
+NONE
+17 0 2 0 15 3 255 100 0 31 3 255 100 0 15 3 255 100
+
+*
+* Profile 0 (Airgo) parameters AC_VI Broadcast
+* ACM, AIFSN, [CWmin, CWmax, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_ANI_ACVI S 20 8
+V RW NP RESTART
+NONE
+17 0 2 0 7 0 15 200 0 15 0 31 188 0 7 0 15 200
+V RW NP RESTART
+NONE
+17 0 2 0 7 0 15 200 0 15 0 31 188 0 7 0 15 200
+
+*
+* Profile 0 (Airgo) parameters AC_VO Broadcast
+* ACM, AIFSN, [CWmin, CWmax, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_ANI_ACVO S 20 8
+V RW NP RESTART
+NONE
+17 0 2 0 3 0 7 100 0 7 0 15 102 0 3 0 7 100
+V RW NP RESTART
+NONE
+17 0 2 0 3 0 7 100 0 7 0 15 102 0 3 0 7 100
+
+
+* ****************************************
+* Profile 1 (WME) parameters - AC_BK Local
+* ACM, AIFSN, [CWmin, CWmax, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_WME_ACBK_LOCAL S 20 8
+V RW NP RESTART
+NONE
+17 0 7 0 15 3 255 0 0 31 3 255 0 0 15 3 255 0
+V RW NP RESTART
+NONE
+17 0 7 0 15 3 255 0 0 15 3 255 0 0 15 3 255 0
+
+
+*
+* Profile 1 (WME) parameters AC_BE Local
+* ACM, AIFSN, [CWmin, CWmax, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_WME_ACBE_LOCAL S 20 8
+V RW NP RESTART
+NONE
+17 0 3 0 15 0 63 0 0 31 3 255 0 0 15 0 63 0
+V RW NP RESTART
+NONE
+17 0 3 0 15 0 63 0 0 15 0 63 0 0 15 0 63 0
+
+*
+* Profile 1 (WME) parameters AC_VI Local
+* ACM, AIFSN, [CWmin, CWmax, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_WME_ACVI_LOCAL S 20 8
+V RW NP RESTART
+NONE
+17 0 1 0 7 0 15 94 0 7 0 15 188 0 7 0 15 94
+V RW NP RESTART
+NONE
+17 0 1 0 7 0 15 94 0 7 0 15 188 0 7 0 15 94
+
+*
+* Profile 1 (WME) parameters AC_VO Local
+* ACM, AIFSN, [CWmin, CWmax, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_WME_ACVO_LOCAL S 20 8
+V RW NP RESTART
+NONE
+17 0 1 0 3 0 7 47 0 3 0 7 102 0 3 0 7 47
+V RW NP RESTART
+NONE
+17 0 1 0 3 0 7 47 0 3 0 7 102 0 3 0 7 47
+
+*
+* Profile 1 (WME) parameters - AC_BK Broadcast
+* ACM, AIFSN, [CWmin, CWmax, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_WME_ACBK S 20 8
+V RW NP RESTART
+NONE
+17 0 7 0 15 3 255 0 0 15 3 255 0 0 15 3 255 0
+V RW NP RESTART
+NONE
+17 0 7 0 15 3 255 0 0 15 3 255 0 0 15 3 255 0
+
+*
+* Profile 1 (WME) parameters AC_BE Broadcast
+* ACM, AIFSN, [CWmin, CWmax, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_WME_ACBE S 20 8
+V RW NP RESTART
+NONE
+17 0 3 0 15 3 255 0 0 15 3 255 0 0 15 3 255 0
+V RW NP RESTART
+NONE
+17 0 3 0 15 3 255 0 0 15 3 255 0 0 15 3 255 0
+
+*
+* Profile 1 (WME) parameters AC_VI Broadcast
+* ACM, AIFSN, [CWmin, CWmax, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_WME_ACVI S 20 8
+V RW NP RESTART
+NONE
+17 0 2 0 7 0 15 94 0 7 0 15 188 0 7 0 15 94
+V RW NP RESTART
+NONE
+17 0 2 0 7 0 15 94 0 7 0 15 188 0 7 0 15 94
+
+*
+* Profile 1 (WME) parameters AC_VO Broadcast
+* ACM, AIFSN, [CWmin, CWmax, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_WME_ACVO S 20 8
+V RW NP RESTART
+NONE
+17 0 2 0 3 0 7 47 0 3 0 7 102 0 3 0 7 47
+V RW NP RESTART
+NONE
+17 0 2 0 3 0 7 47 0 3 0 7 102 0 3 0 7 47
+
+* ****************************************
+* Profile 2(Titan Demo) parameters - AC_BK Local
+* ACM, AIFSN, [CWminH, CWminL, CWmaxH, CWmaxL, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_TIT_DEMO_ACBK_LOCAL S 20 8
+V RW NP RESTART
+NONE
+17 0 7 0 8 0 255 200 0 31 0 255 200 0 8 0 255 200
+V RW NP RESTART
+NONE
+17 0 7 0 8 0 255 200 0 31 0 255 200 0 8 0 255 200
+
+*
+* Profile 2(Titan Demo) parameters AC_BE Local
+* ACM, AIFSN, [CWmin, CWmax, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_TIT_DEMO_ACBE_LOCAL S 20 8
+V RW NP RESTART
+NONE
+17 0 2 0 8 0 255 200 0 31 0 255 200 0 8 0 255 200
+V RW NP RESTART
+NONE
+17 0 2 0 8 0 255 200 0 31 0 255 200 0 8 0 255 200
+
+*
+* Profile 2(Titan Demo) parameters AC_VI Local
+* ACM, AIFSN, [CWmin, CWmax, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_TIT_DEMO_ACVI_LOCAL S 20 8
+V RW NP RESTART
+NONE
+17 0 2 0 8 0 255 200 0 8 0 255 200 0 8 0 255 200
+V RW NP RESTART
+NONE
+17 0 2 0 8 0 255 200 0 8 0 255 200 0 8 0 255 200
+
+*
+* Profile 2(Titan Demo) parameters AC_VO Local
+* ACM, AIFSN, [CWmin, CWmax, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_TIT_DEMO_ACVO_LOCAL S 20 8
+V RW NP RESTART
+NONE
+17 0 2 0 8 0 255 200 0 8 0 255 200 0 8 0 255 200
+V RW NP RESTART
+NONE
+17 0 2 0 8 0 255 200 0 8 0 255 200 0 8 0 255 200
+
+*
+* Profile 2(Titan Demo) parameters - AC_BK Broadcast
+* ACM, AIFSN, [CWmin, CWmax, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_TIT_DEMO_ACBK S 20 8
+V RW NP RESTART
+NONE
+17 0 7 0 8 0 255 200 0 8 0 255 200 0 8 0 255 200
+V RW NP RESTART
+NONE
+17 0 7 0 8 0 255 200 0 8 0 255 200 0 8 0 255 200
+
+*
+* Profile 2(Titan Demo) parameters AC_BE Broadcast
+* ACM, AIFSN, [CWmin, CWmax, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_TIT_DEMO_ACBE S 20 8
+V RW NP RESTART
+NONE
+17 0 2 0 8 0 255 200 0 8 0 255 200 0 8 0 255 200
+V RW NP RESTART
+NONE
+17 0 2 0 8 0 255 200 0 8 0 255 200 0 8 0 255 200
+
+*
+* Profile 2(Titan Demo) parameters AC_VI Broadcast
+* ACM, AIFSN, [CWmin, CWmax, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_TIT_DEMO_ACVI S 20 8
+V RW NP RESTART
+NONE
+17 0 2 0 8 0 255 200 0 8 0 255 200 0 8 0 255 200
+V RW NP RESTART
+NONE
+17 0 2 0 8 0 255 200 0 8 0 255 200 0 8 0 255 200
+
+*
+* Profile 2(Titan Demo) parameters AC_VO Broadcast
+* ACM, AIFSN, [CWmin, CWmax, TxOp]-11A/11B/11G
+*
+
+WNI_CFG_EDCA_TIT_DEMO_ACVO S 20 8
+V RW NP RESTART
+NONE
+17 0 2 0 8 0 255 200 0 8 0 255 200 0 8 0 255 200
+V RW NP RESTART
+NONE
+17 0 2 0 8 0 255 200 0 8 0 255 200 0 8 0 255 200
+
+*
+* Radar detector flag enable/disable
+*
+
+WNI_CFG_RDET_FLAG I 4 9
+V RW NP
+NONE
+0 1 0
+V RW NP
+NONE
+0 1 0
+
+#ENUM ENABLE 1
+#ENUM DISABLE 0
+
+WNI_CFG_RADAR_CHANNEL_LIST S 20 8
+V RW NP RESTART
+NONE
+15 52 56 60 64 100 104 108 112 116 120 124 128 132 136 140
+V RW NP RESTART
+NONE
+15 52 56 60 64 100 104 108 112 116 120 124 128 132 136 140
+
+*
+* Local Power Constraint (dBm)
+*
+
+WNI_CFG_LOCAL_POWER_CONSTRAINT I 4 12
+V RW NP RESTART
+NONE
+0 255 0
+V RW NP RESTART
+NONE
+0 255 0
+
+* *********************************************************
+*
+* Admission Control Policy
+* used for admitting tspec's when either edca or hcca are in use
+*
+
+WNI_CFG_ADMIT_POLICY I 4 8
+V RW NP RESTART
+NONE
+0 2 0
+V RW NP
+SCH
+0 2 0
+
+#ENUM ADMIT_ALL 0
+#ENUM REJECT_ALL 1
+#ENUM BW_FACTOR 2
+
+*
+* Oversubscription factor for admission control
+* valid only when admit policy is set to BW_FACTOR
+* units are in terms of 1/10th of available bandwidth
+*
+
+WNI_CFG_ADMIT_BWFACTOR I 4 8
+V RW NP RESTART
+NONE
+0 100 20
+V RW NP
+SCH
+0 100 20
+
+* *********************************************************
+*
+* Number of "consecutive" Background Scan Failure needed
+* before LIM is forced to perform 1 aggressive background scan
+*
+WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE I 4 8
+V RW NP RESTART
+NONE
+0 256 60
+V RW NP RESTART
+NONE
+0 256 60
+
+
+*************************************
+* Feature: Channel Bonding
+*************************************
+*
+* Global flag to enable/disable Channel Bonding
+* 0 - Disable: Force disable channel bonding for all TC-ids
+* 1 - Enable: Force enable channel bonding for all TC-ids
+* 2 - no legacy bss: Enable channel bonding if no legacy BSS are present
+* 3 - no legacy all: Enable channel bonding if no legacy BSS or devices are present
+* 4 - intelligent: Enable channel bonding depending on load level on secondary channel
+*
+WNI_CFG_CHANNEL_BONDING_MODE I 4 12
+V RW NP RESTART
+LIM
+0 4 0
+V RW NP RESTART
+LIM
+0 4 0
+
+#ENUM DISABLE 0
+#ENUM ENABLE 1
+#ENUM IF_NO_LEGACY_BSS 2
+#ENUM IF_NO_LEGACY_ALL 3
+#ENUM INTELLIGENT 4
+
+
+*
+* When the channel is 40MHz wide, this CFG indicates
+* if the secondary channel is located above (at
+* a higher frequency), or located below (at a
+* lower frequency).
+*
+* 0 - There is no secondary channel. The channel is 20Mhz
+* 1 - LOWER: Secondary channel is located below the primary channel
+* 2 - HIGHER: Secondary channel is located above the primary channel
+*
+WNI_CFG_CB_SECONDARY_CHANNEL_STATE I 4 12
+V RW NP
+NONE
+0 2 0
+V RW NP
+NONE
+0 2 0
+
+#ENUM NONE 0
+#ENUM LOWER 1
+#ENUM HIGHER 2
+
+
+*************************************
+* Feature: Dynamic Retry Rates
+*************************************
+*
+* When the short/long retry count reach the
+* adaptive_retry_threshold(0), then the retry0
+* template shall be used
+*
+WNI_CFG_DYNAMIC_THRESHOLD_ZERO I 4 12
+V RW NP
+HAL
+0 255 2
+V RW NP
+HAL
+0 255 2
+
+*
+* When the short/long retry count reach the
+* adaptive_retry_threshold(1), then the retry1
+* template shall be used
+*
+WNI_CFG_DYNAMIC_THRESHOLD_ONE I 4 12
+V RW NP
+HAL
+0 255 4
+V RW NP
+HAL
+0 255 4
+
+*
+* When the short/long retry count reach the
+* adaptive_retry_threshold(2), then the retry2
+* template shall be used
+*
+WNI_CFG_DYNAMIC_THRESHOLD_TWO I 4 12
+V RW NP
+HAL
+0 255 6
+V RW NP
+HAL
+0 255 6
+
+
+*
+* Trigger Station Background Scan Flag
+*
+WNI_CFG_TRIG_STA_BK_SCAN I 4 12
+V RW NP
+LIM
+0 1 0
+V RW NP
+LIM
+0 1 1
+
+* *********************************************************
+* control of dynamic EDCA parameter profile switching
+*
+* OOB, we would like to support WMM standard edca profile
+* However, when Airgo STA's join the BSS, we would like
+* to switch the profile to Airgo high-performance edca parameters
+*
+* This cfg supports that behaviour. It is used only if 11e qos
+* has been enabled and is ignored otherwise.
+*
+* When set to any value (other than unused), it determines the
+* edca profile to switch to when an Airgo STA joins the BSS.
+*
+* By default, we choose to switch to Airgo profile.
+*
+* NOTE: This parameter applies only to an AP
+*
+
+WNI_CFG_DYNAMIC_PROFILE_SWITCHING I 4 8
+V RW NP RESTART
+NONE
+0 255 255
+V RW NP RESTART
+NONE
+0 255 1
+
+#ENUM UNUSED 255
+
+* *********************************************************
+*
+* Scan control list
+* Contains pairs of {channelNumber, activeScanAllowedFlag}
+* where scanType = 1 indicates active scan is allowed, and
+* = 0 indicates passive scan is used
+* If a channel is not on this list, active scan is NOT allowed. So it is
+* sufficient to inlude only those channels where active scan is allowed
+* on this list.
+*
+* The list determines only whether active scan is allowed or not; it does not
+* determine which type of scan is actually performed.
+*
+
+WNI_CFG_SCAN_CONTROL_LIST S 128 8
+V RW NP RESTART
+LIM
+112 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 0 54 0 56 0 58 0 60 0 62 0 64 0 100 0 104 0 108 0 112 0 116 0 120 0 124 0 128 0 132 0 136 0 140 0 149 1 151 1 153 1 155 1 157 1 159 1 161 1 165 1 240 1 242 1 244 1 246 1 248 1 250 1 252 1
+V RW NP RESTART
+LIM
+112 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 0 54 0 56 0 58 0 60 0 62 0 64 0 100 0 104 0 108 0 112 0 116 0 120 0 124 0 128 0 132 0 136 0 140 0 149 1 151 1 153 1 155 1 157 1 159 1 161 1 165 1 240 1 242 1 244 1 246 1 248 1 250 1 252 1
+
+
+* ****************************************
+*
+* MIMO rates enabled (for rate adaptation, to start)
+*
+
+WNI_CFG_MIMO_ENABLED I 4 9
+V RW NP RELOAD
+NONE
+0 1 1
+V RW NP RELOAD
+NIM
+0 1 1
+
+#ENUM ENABLE 1
+#ENUM DISABLE 0
+
+
+
+*
+* BLOCK ACK Enabled (change requires restart)
+* change default to ON
+* bit 0 ==> delayed BA
+* bit 1 ==> immediate BA
+WNI_CFG_BLOCK_ACK_ENABLED I 4 8
+V RW NP RESTART
+LIM
+0 3 0
+V RW NP RESTART
+LIM
+0 3 0
+
+#ENUM DELAYED 0
+#ENUM IMMEDIATE 1
+
+
+*
+*BA Activity check global timer
+*
+WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT I 4 7
+V RW NP
+HAL
+0 65535 1000
+V RW NP
+HAL
+0 65535 1000
+
+
+*
+* Rx STBC support
+*
+WNI_CFG_HT_RX_STBC I 4 7
+V RW NP RESTART
+LIM
+0 3 1
+V RW NP RESTART
+LIM
+0 3 1
+
+
+*
+* 1. HT capabilities Info: 2 bytes size
+*
+* Supported channel Width is set to 1 (40 Mhz)
+* SM Power Save is disabled.
+* GreenField support is enabled.
+* Short GI for 20 and 40Mhz is enabled.
+* Max AMSDU Size is set to 0(3839 Octets)
+* DSSS-CCK Mode is enabled.
+* LSIG TXOP Protection is disabled
+* Rest of the features are not supported at this moment.
+*
+* fedc ba98 7654 3210
+* 0000 0001 0010 0000
+*
+WNI_CFG_HT_CAP_INFO I 4 10
+V RW NP RESTART
+LIM
+0 0xffff 0x016c
+V RW NP RESTART
+LIM
+0 0xffff 0x106e
+
+#ENUM ADVANCE_CODING 0
+#ENUM SUPPORTED_CHAN_WIDTH_SET 1
+#ENUM SM_POWER_SAVE 2
+#ENUM GREEN_FIELD 4
+#ENUM SHORT_GI_20MHZ 5
+#ENUM SHORT_GI_40MHZ 6
+#ENUM TX_STBC 7
+#ENUM RX_STBC 8
+#ENUM DELAYED_BA 10
+#ENUM MAX_AMSDU_SIZE 11
+#ENUM DSSS_CCK_MODE_40MHZ 12
+#ENUM PSMP 13
+#ENUM STBC_CONTROL_FRAME 14
+#ENUM LSIG_TXOP_PROTECTION 15
+
+*
+* 2. HT Parameters Info: 1 byte size
+*
+* Max AMPDU Rx Factor is defined using bit #0 and #1
+* MPDU Density is defined using bit #2 thru #4.
+* The default values are,
+* 7654 3210
+* 0000 0010 --> 2 for RX AMPDU Factor, 0 for MPDU density
+*
+WNI_CFG_HT_AMPDU_PARAMS I 4 7
+V RW NP RESTART
+LIM
+0 0xff 0x00
+V RW NP RESTART
+LIM
+0 0xff 0x02
+
+#ENUM MAX_RX_AMPDU_FACTOR 0
+#ENUM MPDU_DENSITY 2
+#ENUM RESERVED 5
+
+*
+* 3. Supported MCS Set: 16 bytes size
+*
+* MCS #0-15 and #32 is supported.
+*
+WNI_CFG_SUPPORTED_MCS_SET S 16 7
+V RW P RESTART
+LIM
+16 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+V RW P RESTART
+LIM
+16 255 255 0 0 1 0 0 0 0 0 0 0 0 0 0 0
+
+*
+* 4. Extended HT Capabilities Info: 2 bytes size
+*
+* Only HTC Support is enabled, rest all features are not
+* supported at this moment.
+*
+* fedc ba98 7654 3210
+* 0000 0100 0000 0000
+*
+WNI_CFG_EXT_HT_CAP_INFO I 4 10
+V RW P RESTART
+LIM
+0 0xffff 0x0400
+V RW P RESTART
+LIM
+0 0xffff 0x0400
+
+#ENUM PCO 0
+#ENUM TRANSITION_TIME 1
+#ENUM RESERVED1 3
+#ENUM MCS_FEEDBACK 8
+#ENUM HTC_SUPPORT 10
+#ENUM RD_RESPONDER 11
+#ENUM RESERVED2 12
+
+
+*
+* 5. Transmit Beam Forming Capabiliries Info: 4 bytes size
+*
+WNI_CFG_TX_BF_CAP I 4 7
+V RO NP RESTART
+LIM
+0 0xffffffff 0x00000000
+V RO NP RESTART
+LIM
+0 0xffffffff 0x00000000
+
+*
+* 6. Antenna Selection Capabilities: 1 byte size
+*
+WNI_CFG_AS_CAP I 4 7
+V RW P RESTART
+LIM
+0 0xff 0x00
+V RW P RESTART
+LIM
+0 0xff 0x00
+
+#ENUM ANTENNA_SELECTION 0
+#ENUM EXPLICIT_CSI_FEEDBACK_TX 1
+#ENUM ANTENNA_INDICES_FEEDBACK_TX 2
+#ENUM EXPLICIT_CSI_FEEDBACK 3
+#ENUM ANTENNA_INDICES_FEEDBACK 4
+#ENUM RX_AS 5
+#ENUM TX_SOUNDING_PPDUS 6
+#ENUM RESERVED 7
+
+**************************************************
+* Beacon HT (High Through) Info IE
+***************************************************
+*
+* 3. HT Info Field1: 1 byte size.
+*
+* Secondary Channel Offset is set to 3 (Down) by default and will
+* be updated dynamically by DFS algorithm.
+* Channel Width is set to 1 (40 Mhz)
+* RIFS Mode is enabled
+* Rest of the features are not supported at this moment.
+*
+* 7654 3210
+* 0000 1111
+*
+WNI_CFG_HT_INFO_FIELD1 I 4 10
+V RW NP RESTART
+LIM
+0 0xff 0x0f
+V RW NP RESTART
+LIM
+0 0xff 0x0f
+
+#ENUM SECONDARY_CHANNEL_OFFSET 0
+#ENUM RECOMMENDED_CHANNEL_WIDTH 2
+#ENUM RIFS_MODE 3
+#ENUM PSMP_ACCESS_ONLY 4
+#ENUM SERVICE_INTERVAL_GRANULARITY 5
+
+*
+* 4. HT Info Field2: 2 bytes
+*
+* Operation mode is set to 0(Pure, GF) to begin with and
+* will be updated dynamically.
+* 'NonGF Devices present is also set to zero and
+* will be updated dynamically.
+*
+* fedc ba98 7654 3210
+* 0000 0000 0000 0000
+*
+WNI_CFG_HT_INFO_FIELD2 I 4 10
+V RW P
+LIM
+0 0xffff 0x00
+V RW P
+LIM
+0 0xffff 0x00
+
+#ENUM OP_MODE 0
+#ENUM NON_GF_DEVICES_PRESENT 2
+#ENUM RESERVED 3
+
+*
+* 5. HT Info Field3: 2 bytes
+*
+* fedc ba98 7654 3210
+* 0000 0000 0000 0000
+*
+* LSIG TXOP Full Protection will be zero to begin with and
+* updated dynamically.
+* Everything else is not supported at this moment.
+*
+WNI_CFG_HT_INFO_FIELD3 I 4 10
+V RW P
+LIM
+0 0xffff 0x0000
+V RW P
+LIM
+0 0xffff 0x0000
+
+#ENUM BASIC_STBC_MCS 0
+#ENUM DUAL_STBC_PROTECTION 7
+#ENUM SECONDARY_BEACON 8
+#ENUM LSIG_TXOP_PROTECTION_FULL_SUPPORT 9
+#ENUM PCO_ACTIVE 10
+#ENUM PCO_PHASE 11
+#ENUM RESERVED 12
+
+*
+* 6. Basic MCS Set: 16 bytes size
+*
+* For now set this to zero and don't put any restrictions.
+*
+WNI_CFG_BASIC_MCS_SET S 16 7
+V RW P RESTART
+LIM
+16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+V RW P RESTART
+LIM
+16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+
+*
+* 7. Current supported MCS Set: 16 bytes size
+*
+* For now set this to zero and don't put any restrictions.
+*
+WNI_CFG_CURRENT_MCS_SET S 16 7
+V RW P RESTART
+LIM
+16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+V RW P RESTART
+LIM
+16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+
+
+
+*
+* Greenfield Capability
+* By default Greenfield is enabled
+*
+WNI_CFG_GREENFIELD_CAPABILITY I 4 7
+V RW NP RESTART
+LIM
+0 1 0
+V RW NP RESTART
+LIM
+0 1 0
+
+#ENUM ENABLE 1
+#ENUM DISABLE 0
+
+
+*
+* Maximum AMSDU length
+* User can set it to either 3839 or 7935 bytes.
+*
+WNI_CFG_MAX_AMSDU_LENGTH I 4 7
+V RW NP RESTART
+LIM
+0 1 0
+V RW NP RESTART
+LIM
+0 1 0
+
+#ENUM SHORT_3839_BYTES 0
+#ENUM LONG_7935__BYTES 1
+
+
+*
+* Minimum MPDU Start Spacing
+* Determines the minimum time between the start of adjacent MPDUs within an AMPDU.
+* Set to 0 for no restriction
+* Set to 1 for 1/4 s
+* Set to 2 for 1/2 s
+* Set to 3 for 1 s
+* Set to 4 for 2 s
+* Set to 5 for 4 s
+* Set to 6 for 8 s
+* Set to 7 for 16 s
+* default is set to 0
+WNI_CFG_MPDU_DENSITY I 4 7
+V RW NP RESTART
+LIM
+0 7 0
+V RW NP RESTART
+LIM
+0 7 0
+
+
+*
+* Maximum Rx AMPDU Factor
+* Indicates the maximum length of A-MPDU
+* that the STA can receive.
+* The Maximum Rx A-MPDU defined by this field is equal to (2 ^ (13 + MAX RX AMPDU FActor))-1 octets.
+* Maximum Rx A-MPDU Factor is an integer in the range 0 to 3.
+* default is set to 2 for 32K max RX side.
+*
+WNI_CFG_MAX_RX_AMPDU_FACTOR I 4 7
+V RW NP RESTART
+LIM
+0 3 3
+V RW NP RESTART
+LIM
+0 3 3
+
+
+*
+* Short GI support for the reception of 20Mhz packets
+* By default it is enabled
+*
+WNI_CFG_SHORT_GI_20MHZ I 4 7
+V RW NP RESTART
+LIM
+0 1 1
+V RW NP RESTART
+LIM
+0 1 1
+
+
+#ENUM ENABLE 1
+#ENUM DISABLE 0
+
+
+*
+* Short GI support for the reception of 40Mhz packets
+* By default it is enabled
+*
+WNI_CFG_SHORT_GI_40MHZ I 4 7
+V RW NP RESTART
+LIM
+0 1 0
+V RW NP RESTART
+LIM
+0 1 1
+
+
+#ENUM ENABLE 1
+#ENUM DISABLE 0
+
+
+*
+* RIFS support on TX Side
+* on RX side it is always supported, it is mandatory
+*
+WNI_CFG_RIFS_ENABLED I 4 7
+V RW NP RESTART
+NONE
+0 1 1
+V RW NP RESTART
+NONE
+0 1 1
+
+#ENUM ENABLE 1
+#ENUM DISABLE 0
+
+
+* *********************************************************
+*
+* Power Save Configuration
+*
+WNI_CFG_MAX_PS_POLL I 4 5
+V RW NP
+LIM
+0 255 0
+NV RW NP
+LIM
+0 255 0
+
+
+WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE I 4 5
+V RW NP
+LIM
+1 20 20
+NV RW NP
+LIM
+1 20 20
+
+
+*
+* Period for which Firmware will collect the
+* RSSI stats. Its in units of beacon interval.
+* Rssi Filter period should always be >=
+* the num_beacon_per_rssi_average.
+*
+WNI_CFG_RSSI_FILTER_PERIOD I 4 5
+V RW NP
+LIM
+0 255 20
+NV RW NP
+LIM
+0 255 20
+
+*
+* Period for which Firmware will collect the
+* RSSI stats. Its in units of beacon interval.
+* Rssi Filter period should always be >=
+* the num_beacon_per_rssi_average.
+* This value is used ONLY for CCX and 11r Fasttransition
+*
+WNI_CFG_FT_RSSI_FILTER_PERIOD I 4 5
+V RW NP
+LIM
+0 255 5
+NV RW NP
+LIM
+0 255 5
+
+
+WNI_CFG_MIN_RSSI_THRESHOLD I 4 5
+V RW NP
+LIM
+0 10 10
+NV RW NP
+LIM
+0 10 10
+
+
+WNI_CFG_NTH_BEACON_FILTER I 4 5
+V RW NP
+LIM
+0 255 10
+NV RW NP
+LIM
+0 255 10
+
+
+WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE I 4 5
+V RW NP
+LIM
+0 1 0
+NV RW NP
+LIM
+0 1 0
+
+
+WNI_CFG_SCAN_IN_POWERSAVE I 4 5
+V RW NP
+LIM
+0 1 1
+V RW NP
+LIM
+0 1 1
+
+
+*
+* Ignore DTIM support - If disabled(value=0), HAL will
+* try to align the Listen Interval to the DTIM
+* period and the following rules will be applied:
+* 1) If LI=DTIM, then set LI=DTIM
+* 2) If LI<DTIM, then align LI to DTIM
+* 3) If LI>DTIM, then set LI=DTIM
+*
+WNI_CFG_IGNORE_DTIM I 4 5
+V RW NP
+NONE
+0 1 0
+V RW NP
+NONE
+0 1 0
+
+* *********************************************************
+*
+* WoWLAN Configuration The following configurations
+* are valid only when magicPktEnable = 1.
+*
+WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE I 4 5
+V RW NP
+NONE
+0 1 1
+NV RW NP
+NONE
+0 1 0
+
+
+WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE I 4 5
+V RW NP
+NONE
+0 1 1
+NV RW NP
+NONE
+0 1 0
+
+
+WNI_CFG_WOWLAN_DEAUTH_ENABLE I 4 5
+V RW NP
+NONE
+0 1 1
+NV RW NP
+NONE
+0 1 0
+
+
+WNI_CFG_WOWLAN_DISASSOC_ENABLE I 4 5
+V RW NP
+NONE
+0 1 1
+NV RW NP
+NONE
+0 1 0
+
+
+WNI_CFG_WOWLAN_MAX_MISSED_BEACON I 4 5
+V RW NP
+NONE
+0 65535 40
+NV RW NP
+NONE
+0 65535 40
+
+*
+* Timeout value in units of us. It requests
+* hardware to unconditionally wake up after
+* it has stayed in WoWLAN mode for some time.
+*
+WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD I 4 5
+V RW NP
+NONE
+0 65535 65535
+NV RW NP
+NONE
+0 65535 65535
+
+
+*
+* BA timeout in TUs, set to 1 minute = approx 58593 TUs
+* 16 bit wide
+*
+WNI_CFG_BA_TIMEOUT I 4 7
+V RW NP RESTART
+HAL
+0 0xffff 0
+V RW NP
+HAL
+0 0xffff 0
+
+
+*
+* This threshold is registered with a traffic monitoring interface (probably HAL),
+* on a per-STA, per-TID basis. Once this threshold has been reached,
+* HAL will indicate to PE that the threshold has been reached for that TID.
+* PE is then free to negotiate a BA session for that peer
+* defaults to 128
+* 16 bit wide
+*
+WNI_CFG_BA_THRESHOLD_HIGH I 4 7
+V RW NP RESTART
+HAL
+0 0xffff 0x80
+V RW NP
+HAL
+0 0xffff 0x80
+
+
+*
+* MAX BA Buffers to be allocated.
+* This count is system wide.
+* 16 bit wide
+*
+WNI_CFG_MAX_BA_BUFFERS I 4 7
+V RW NP RESTART
+HAL
+0 2560 2560
+V RW NP
+HAL
+0 2560 2560
+
+
+*
+* MAX BA Sessions.
+* This count is system wide.
+* 16 bit wide
+*
+WNI_CFG_MAX_BA_SESSIONS I 4 7
+V RW NP RESTART
+HAL
+0 64 40
+V RW NP
+HAL
+0 64 40
+
+
+*
+* BA setup based on Traffic
+*
+WNI_CFG_BA_AUTO_SETUP I 4 7
+V RW NP RESTART
+HAL
+0 1 1
+V RW NP RESTART
+HAL
+0 1 1
+
+#ENUM ENABLE 1
+#ENUM DISABLE 0
+
+*
+* Decline an ADDBA Request
+*
+WNI_CFG_ADDBA_REQ_DECLINE I 4 7
+V RW NP RESTART
+LIM
+0 0xff 0
+V RW NP RESTART
+LIM
+0 0xff 0
+
+*
+* Valid Channel List
+*
+
+WNI_CFG_BG_SCAN_CHANNEL_LIST S 100 8
+V RW NP
+LIM
+55 36 40 44 48 52 56 60 64 1 6 11 34 38 42 46 2 3 4 5 7 8 9 10 12 13 14 100 104 108 112 116 120 124 128 132 136 140 149 151 153 155 157 159 161 50 54 58 62 240 242 244 246 248 250 252
+V RW NP
+LIM
+55 36 40 44 48 52 56 60 64 1 6 11 34 38 42 46 2 3 4 5 7 8 9 10 12 13 14 100 104 108 112 116 120 124 128 132 136 140 149 151 153 155 157 159 161 50 54 58 62 240 242 244 246 248 250 252
+
+
+*
+* AMPDU default TX medium Time (in us)
+*
+WNI_CFG_MAX_MEDIUM_TIME I 4 8
+V RW NP
+HAL
+0 65535 2048
+V RW NP
+HAL
+0 65535 2048
+
+
+*
+* Maximum number of MPDUs in single A-MPDU.
+*
+WNI_CFG_MAX_MPDUS_IN_AMPDU I 4 8
+V RW NP
+HAL
+0 65535 64
+V RW NP
+HAL
+0 65535 64
+
+
+*
+* Auto BSSID - When set, BSSID is generated automatically in IBSS, else BSSID in cfg will be used.
+*
+
+WNI_CFG_IBSS_AUTO_BSSID I 4 0
+V RW NP
+NONE
+0 1 1
+NV RW NP
+NONE
+0 1 1
+
+*
+* Include Additional IEs in probe request.
+*
+WNI_CFG_PROBE_REQ_ADDNIE_FLAG I 4 0
+V RW NP
+NONE
+0 1 0
+V RW NP
+NONE
+0 1 0
+
+*
+* Include Additional IE in probe request.
+*
+WNI_CFG_PROBE_REQ_ADDNIE_DATA S 255 0
+V RW NP
+NONE
+0 0
+V RW NP
+NONE
+0 0
+
+*
+* Include Additional IEs in probe response.
+*
+WNI_CFG_PROBE_RSP_ADDNIE_FLAG I 4 0
+V RW NP
+NONE
+0 1 0
+V RW NP
+NONE
+0 1 0
+
+*
+* Include Additional IE in probe response.
+*
+WNI_CFG_PROBE_RSP_ADDNIE_DATA1 S 255 0
+V RW NP
+NONE
+0 0
+V RW NP
+NONE
+0 0
+
+*
+* Include Additional IE in probe response.
+*
+WNI_CFG_PROBE_RSP_ADDNIE_DATA2 S 255 0
+V RW NP
+NONE
+0 0
+V RW NP
+NONE
+0 0
+
+*
+* Include Additional IE in probe response.
+*
+WNI_CFG_PROBE_RSP_ADDNIE_DATA3 S 255 0
+V RW NP
+NONE
+0 0
+V RW NP
+NONE
+0 0
+
+*
+* Include Additional IEs in assoc response.
+*
+WNI_CFG_ASSOC_RSP_ADDNIE_FLAG I 4 0
+V RW NP
+NONE
+0 1 0
+V RW NP
+NONE
+0 1 0
+
+*
+* Include Additional IE in assoc response.
+*
+WNI_CFG_ASSOC_RSP_ADDNIE_DATA S 255 0
+V RW NP
+NONE
+0 0
+V RW NP
+NONE
+0 0
+
+*
+* Include Additional P2P IEs in probe request.
+*
+WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG I 4 0
+V RW NP
+NONE
+0 1 0
+V RW NP
+NONE
+0 1 0
+
+*
+* Include Additional P2P IE in probe request.
+*
+WNI_CFG_PROBE_REQ_ADDNP2PIE_DATA S 255 0
+V RW NP
+NONE
+0 0
+V RW NP
+NONE
+0 0
+
+
+*
+* Include Additional IEs in probe response/beacon.
+*
+WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG I 4 0
+V RW NP
+LIM
+0 1 0
+V RW NP
+LIM
+0 1 0
+
+
+*
+* Include Additional IEs in probe response/beacon.
+*
+WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA S 255 0
+V RW NP
+LIM
+0 0
+V RW NP
+LIM
+0 0
+
+
+*
+* wpsApEnable and wpsStaEnable is specified in here
+* wpsApEnable is bit #0 and wpsStaEnable is bit #1
+*
+WNI_CFG_WPS_ENABLE I 4 7
+V RW NP
+LIM
+0 0xff 0
+V RW NP
+LIM
+0 0xff 0
+
+#ENUM AP 1
+#ENUM STA 2
+
+WNI_CFG_WPS_STATE I 4 7
+V RW NP
+LIM
+0 0xff 1
+V RW NP
+LIM
+0 0xff 1
+
+*
+* TRUE => include this information in Probe Requests, FALSE => omit it
+*
+
+WNI_CFG_WPS_PROBE_REQ_FLAG I 4 7
+V RW NP
+LIM
+0 1 0
+V RW NP
+LIM
+0 1 0
+
+*
+* Wi-Fi Protected Setup Version
+*
+* This one-byte field is broken into a four-bit major
+* part using the top MSBs and four-bit minor part
+* using the LSBs. As an example, version 3.2 would be 0x32.
+*
+
+WNI_CFG_WPS_VERSION I 4 7
+V RW NP
+LIM
+0 0xff 0x10
+V RW NP
+LIM
+0 0xff 0x10
+
+*
+* Wi-Fi Protected Setup Request type
+* 0x00: Enrollee, Info only
+* 0x01: Enrollee, open 802.1X
+* 0x02: Registrar
+* 0x03: WLAN Manager Registrar
+
+WNI_CFG_WPS_REQUEST_TYPE I 4 7
+V RW NP
+LIM
+0 0xff 0x00
+V RW NP
+LIM
+0 0xff 0x03
+
+* Configuration Method(s)
+*
+* The Config Methods Data component lists the configuration methods
+* the Enrollee or Registrar supports. The list is a bitwise OR of
+* values from the table below. In addition to Config Methods, APs and
+* STAs that support the UPnP Management Interface must support the
+* Permitted Config Methods attribute, which is used to control the
+* Config Methods that are enabled on that AP.
+*
+* Value Hardware Interface
+* 0x0001 USBA (Flash Drive)
+* 0x0002 Ethernet
+* 0x0004 Label
+* 0x0008 Display
+* 0x0010 External NFC Token
+* 0x0020 Integrated NFC Token
+* 0x0040 NFC Interface
+* 0x0080 PushButton
+* 0x0100 Keypad
+*
+* The bottom 16 bits contain the configuration method(s) when acting
+* as an Enrollee, and the top 16 when acting as a Registrar.
+*
+* QNE-TODO: Merge this with the inappropriately named
+* 'WNI_CFG_WSC_AP_CFG_METHOD'-- this one can serve both puposes.
+*
+
+WNI_CFG_WPS_CFG_METHOD I 4 7
+V RW NP
+LIM
+0 0xFFFFFFFF 0x00000008
+V RW NP
+LIM
+0 0xFFFFFFFF 0x018c018e
+
+* UUID
+* The universally unique identifier (UUID) element is a unique
+* GUID generated by the Enrollee or Registrar. It uniquely identifies
+* an operational device and should survive reboots and resets. The
+* UUID is provided in binary format. If the device also supports UPnP,
+* then the UUID corresponds to the UPnP UUID.
+*
+* QNE-TODO: Re-name their cfg from 'WNI_CFG_UUID'
+
+WNI_CFG_WPS_UUID S 16 8
+V RW NP
+LIM
+6 0xa 0xb 0xc 0xd 0xe 0xf
+V RW NP
+LIM
+6 0xa 0xb 0xc 0xd 0xe 0xf
+
+************************************************************************
+* The following cfgs contains the primary type of the device. Its format
+* follows:
+*
+* 0 1 2 3
+* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+* | Attribute ID | Length |
+* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+* | Category ID | OUI (1-2) |
+* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+* | OUI (3-4) | Sub Category ID |
+* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+*
+* Vendor-specific sub-categories are designated by setting the OUI to the
+* value associated with that vendor. Note that a four-byte subdivided OUI
+* is used. For the predefined values, the Wi-Fi Alliance OUI of 00 50 F2 04
+* is used. The predefined values for Category ID and Sub Category ID are
+* provided in the next table. There is no way to indicate a vendor-specific
+* main device category. The OUI applies only to the interpretation of the
+* Sub Category. If a vendor does not use sub categories for their OUI, the
+* three-byte OUI occupies the first three bytes of the OUI field and the
+* fourth byte is set to zero.
+*
+* Category ID Value Sub Category ID Value
+* Computer 1 PC 1
+* Server 2
+* Media Center 3
+* Input Device 2
+* Printers, Scanners, Printer 1
+* Faxes and Copiers 3 Scanner 2
+* Camera 4 Digital Still Camera 1
+* Storage 5 NAS 1
+* Network AP 1
+* Infrastructure 6 Router 2
+* Switch 3
+* Displays 7 Television 1
+* Electronic Picture Frame 2
+* Projector 3
+* Multimedia Devices 8 DAR 1
+* PVR 2
+* MCX 3
+* Gaming Devices 9 Xbox 1
+* Xbox360 2
+* Playstation 3
+* Telephone 10 Windows Mobile 1
+*
+************************************************************************
+
+* QNE-TODO: Rename their cfg from 'WNI_CFG_PRIM_DEVICE_CATEGORY'
+WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY I 4 7
+V RW NP
+LIM
+0 0xffff 1
+V RW NP
+LIM
+0 0xffff 6
+
+* QNE-TODO: Rename their cfg from 'WNI_CFG_PRIM_DEVICE_OUI'
+WNI_CFG_WPS_PIMARY_DEVICE_OUI I 4 7
+V RW NP
+LIM
+0 0xffffffff 0x0050f204
+V RW NP
+LIM
+0 0xffffffff 0x0050f204
+
+* QNE-TODO: Rename their cfg from 'WNI_CFG_PRIM_DEVICE_SUB_CATEGORY'
+WNI_CFG_WPS_DEVICE_SUB_CATEGORY I 4 7
+V RW NP
+LIM
+0 0xffff 1
+V RW NP
+LIM
+0 0xffff 1
+
+* Association State
+*
+
+* The Association State component shows the configuration and previous
+* association state of the wireless station when sending a Discovery
+* request.
+*
+* Association State Description
+* 0 Not Associated
+* 1 Connection Success
+* 2 Configuration Failure
+* 3 Association Failure
+* 4 IP Failure
+
+WNI_CFG_WPS_ASSOCIATION_STATE I 4 7
+V RW NP
+LIM
+0 0xffff 0
+V RW NP
+LIM
+0 0xffff 0
+
+* Configuration Error
+*
+* The Configuration Error component shows the result of the device
+* attempting to configure itself and to associate with the WLAN.
+*
+* Configuration Error Description
+* 0 No Error
+* 1 OOB Interface Read Error
+* 2 Decryption CRC Failure
+* 3 2.4 channel not supported
+* 4 5.0 channel not supported
+* 5 Signal too weak
+* 6 Network auth failure
+* 7 Network association failure
+* 8 No DHCP response
+* 9 Failed DHCP config
+* 10 IP address conflict
+* 11 Couldnt connect to Registrar
+* 12 Multiple PBC sessions detected
+* 13 Rogue activity suspected
+* 14 Device busy
+* 15 Setup locked
+* 16 Message Timeout
+* 17 Registration Session Timeout
+* 18 Device Password Auth Failure
+*
+* The Device busy error is returned if the sending device is unable to
+* respond to the request due to some internal conflict or resource
+* contention issue. For example, if a device is only capable of
+* performing a single instance of the Registration Protocol at a time,
+* it may return this error in response to attempts to start another
+* instance in the middle of an active session.
+
+WNI_CFG_WPS_CONFIGURATION_ERROR I 4 7
+V RW NP
+LIM
+0 0xffff 0
+V RW NP
+LIM
+0 0xffff 0
+
+* Device Password ID
+*
+
+* This attribute is used to identify a device password. There are six
+* predefined values and ten reserved values. If the Device Password ID is
+* Default, the Enrollee should use its PIN password (from the label or
+* display). This password may correspond to the label, display, or a
+* user-defined password that has been configured to replace the original
+* device password.
+*
+* User-specified indicates that the user has overridden the password with a
+* manually selected value. Machine-specified indicates that the original
+* PIN password has been overridden by a strong, machinegenerated device
+* password value. The Rekey value indicates that the device's 256-bit
+* rekeying password will be used. The PushButton value indicates that the
+* PIN is the all-zero value reserved for the PushButton Configuration
+* method.
+*
+* The Registrar-specified value indicates a PIN that has been obtained from
+* the Registrar (via a display or other out-of-band method). This value may
+* be further augmented with the optional 'Identity' attribute in M1. This
+* augmentation is useful when multiple predefined UserID/PIN pairs have been
+* established by a Registrar such as an authenticator used for Hotspot
+* access. If the Device Password ID in M1 is not one of the predefined or
+* reserved values, it corresponds to a password given to the Registrar as an
+* OOB Device Password.
+*
+* Value Description
+* 0x0000 Default (PIN)
+* 0x0001 User-specified
+* 0x0002 Machine-specified
+* 0x0003 Rekey
+* 0x0004 PushButton
+* 0x0005 Registrar-specified
+* 0x0006 - 0x000F Reserved'
+*
+
+WNI_CFG_WPS_DEVICE_PASSWORD_ID I 4 7
+V RW NP
+LIM
+0 0xffffffff 0
+V RW NP
+LIM
+0 0xffffffff 0
+
+*
+* WPS Association
+*
+* Wi-Fi Protected Setup requires a prospective enrollee to associate to
+* an AP in the network in which the STA would like to enroll. Once
+* associated, the enrollment takes place over an EAPOL conversation
+* (there's actually a new EAP method: EAP-WSC). The STA would
+* presumably send an EAPOL-Start over his new link, to which the AP
+* would respond with an EAP Identity Request. When the STA sends back
+* "WSC-Enrollee-1" as his EAP Identity, the AP knows that he's got a WPS
+* supplicant on his hands, and proceeds to talk EAP-WSC.
+*
+* Toward the end of the specification's development, a problem came up.
+* Microsoft's EAP supplicant on XP SP1 & SP2 will send an EAPOL-Start,
+* no matter what. Even if the AP is beaconing WPA-PSK, say, the MS
+* supplicant will send an EAPOL-Start. If it receives an EAP Identity
+* Request in return, it decides that the AP is really using 802.1x
+* authentication, and proceeds on that assumption.
+*
+* Now, imagine an AP that is configured for WPA-PSK, and is WPS-capable.
+* It receives an association request from some STA, and then sees an
+* EAPOL-Start from the newly joined STA. It naturally sends back an EAP
+* Identity Request to see if the new STA wants to talk EAP-WSC. On
+* Windows XP SP1 & SP2, the supplicant will take that to mean that this
+* AP is using 802.1x authentication, and will never let the user provide
+* the PSK. Consequently, WZC will never be able to associate with this
+* AP.
+*
+* Naturally, Microsoft's solution was to have the world change to
+* accommodate them. After a lot of back & forth, the WFA decided on the
+* following change to the WPS spec: when associating for purposes of WPS
+* enrollment, "A client that intends to use the EAP-WSC method with a
+* WSC enabled AP may include a WSC IE in its 802.11 (re)association
+* request. If a WSC IE is present in the (re)association request, the AP
+* shall engage in EAP-WSC with the station and must not attempt other
+* security handshake. If the client does not include a WSC IE in its
+* 802.11 (re)association request, it must send its 802.11 Authentication
+* frame with Authentication set to open and an 802.11 Association
+* Request frame without an RSN IE or SSN IE, regardless of the network
+* type that is hosted by the AP. On successful association, the client
+* will then send an EAPOL-Start to the AP and wait for
+* EAP-Request/Identity. When the client receives an EAP Request/
+* Identity, it will respond with EAP-Response/Identity and the
+* appropriate WSC string to indicate if it is an Enrollee or Registrar.
+* '
+*
+* This configuration variable contains a bitvector:
+*
+* 0x0001 Incldue the WPS Information Element in Assoc Request frames
+* 0x0002 Elide the the WPA and RSN Information Elements from the
+* Assoc Request frame
+*
+
+WNI_CFG_WPS_ASSOC_METHOD I 4 7
+V RW NP
+LIM
+0 0xffff 0
+V RW NP
+LIM
+0 0xffff 0
+
+*
+* Low gain override
+*
+
+WNI_CFG_LOW_GAIN_OVERRIDE I 4 9
+V RW NP
+HAL
+0 1 0
+V RW NP
+HAL
+0 1 0
+
+*
+* Listen Mode Enable/Disable
+*
+
+WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE I 4 7
+V RW NP
+HAL
+0 128 128
+V RW NP
+HAL
+0 128 128
+
+*
+* On chip reodering polling threshold
+*
+
+WNI_CFG_RPE_POLLING_THRESHOLD I 4 2
+V RW NP
+HAL
+0 65535 10
+V RW NP
+HAL
+0 65535 10
+
+*
+* On chip reodering aging threshold for AC0
+*
+
+WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG I 4 2
+V RW NP
+HAL
+0 65535 30
+V RW NP
+HAL
+0 65535 30
+
+*
+* On chip reodering aging threshold for AC1
+*
+
+WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG I 4 2
+V RW NP
+HAL
+0 65535 30
+V RW NP
+HAL
+0 65535 30
+
+*
+* On chip reodering aging threshold for AC2
+*
+
+WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG I 4 2
+V RW NP
+HAL
+0 65535 30
+V RW NP
+HAL
+0 65535 30
+
+*
+* On chip reodering aging threshold for AC3
+*
+
+WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG I 4 2
+V RW NP
+HAL
+0 65535 30
+V RW NP
+HAL
+0 65535 30
+
+*
+* Number of On-Chip reorder sessions
+*
+
+WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS I 4 2
+V RW NP
+HAL
+0 2 1
+V RW NP
+HAL
+0 2 1
+
+
+*
+* Single RC for all TID
+*
+
+WNI_CFG_SINGLE_TID_RC I 4 7
+V RW NP
+NONE
+0 1 1
+V RW NP
+NONE
+0 1 1
+
+*
+* RRM Enabled
+*
+
+WNI_CFG_RRM_ENABLED I 4 8
+V RW NP
+NONE
+0 1 0
+V RW NP
+NONE
+0 1 0
+
+*
+* RRM measurement max duration. Section 11.10.3 802.11k-2008.
+* Max Duration represented as maxDuration inTUs = 2^(*WNI_CFG_RRM_IN_CHAN_MAX - 4) * bcnIntvl
+* Operating channel max measurement duration.
+*
+
+WNI_CFG_RRM_OPERATING_CHAN_MAX I 4 8
+V RW NP
+NONE
+0 8 0
+V RW NP
+NONE
+0 8 0
+
+*
+* Non-Operating channel max measurement duration.
+*
+
+WNI_CFG_RRM_NON_OPERATING_CHAN_MAX I 4 8
+V RW NP
+NONE
+0 8 0
+V RW NP
+NONE
+0 8 0
+
+*
+* TX power control feature
+*
+
+WNI_CFG_TX_PWR_CTRL_ENABLE I 4 8
+V RW NP
+NONE
+0 1 1
+V RW NP
+NONE
+0 1 1
+
+*
+* MCAST BCAST filter Setting
+* 0: No filter, 1: Block Mcast, 2: Block Bcast, 3: Block Mcast and Bcast
+*
+
+WNI_CFG_MCAST_BCAST_FILTER_SETTING I 4 7
+V RW NP
+HAL
+0 3 0
+V RW NP
+HAL
+0 3 0
+
+*
+* BTC DHCP No of Bt slots to block
+*
+WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK I 4 7
+V RW NP
+HAL
+0 0xFF 0
+V RW NP
+HAL
+0 0xFF 0
+
+*
+* Config parameter to Enable/Disable Dynamic PS-Poll mechanism
+* 0: Disable, x: FW will send x number of NULL frames before switching to PS-Poll mexhanism
+*
+WNI_CFG_DYNAMIC_PS_POLL_VALUE I 4 7
+V RW NP
+HAL
+0 0xFF 0
+V RW NP
+HAL
+0 0xFF 0
+
+*
+* PS Data InActivity Timeout (TU)
+*
+
+WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT I 4 7
+V RW NP
+HAL
+0 80 0
+NV RW NP
+NONE
+0 80 0
+
+*
+* Config parameter to Enable/Disable Telescopic Bcn Wakeups
+* 0: Disable, 1: Enable
+*
+
+WNI_CFG_TELE_BCN_WAKEUP_EN I 4 7
+V RW NP
+HAL
+0 1 0
+V RW NP
+HAL
+0 1 0
+
+
+*
+* Config parameter for Transient LI
+* 0: Disable, x: Transient LI
+*
+
+WNI_CFG_TELE_BCN_TRANS_LI I 4 7
+V RW NP
+HAL
+0 7 3
+V RW NP
+HAL
+0 7 3
+
+*
+* Config parameter for Idle bcns for Transient LI
+* x: Num Idle bcns before switch to trans LI
+*
+
+WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS I 4 7
+V RW NP
+HAL
+5 255 10
+V RW NP
+HAL
+5 255 10
+
+*
+* Config parameter for Max LI
+* 0: Disable, x: Max LI
+*
+
+WNI_CFG_TELE_BCN_MAX_LI I 4 7
+V RW NP
+HAL
+0 7 5
+V RW NP
+HAL
+0 7 5
+
+*
+* Config parameter for Idle bcns for max LI
+* x: Num Idle bcns before switch to max LI
+*
+
+WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS I 4 7
+V RW NP
+HAL
+5 255 15
+V RW NP
+HAL
+5 255 15
+
+*
+* BTC DHCP No of Bt sub interval during DHCP
+*
+WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS I 4 7
+V RW NP
+HAL
+0 0xFF 7
+V RW NP
+HAL
+0 0xFF 7
+
+*
+* Infra STA mode Keep alive period (in secs) for
+* sending keep alive (Qos)Null frames to the AP.
+* 0 = disabled. Recommended values is 30 secs
+*
+WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD I 4 7
+V RW NP
+HAL
+0 65535 0
+V RW NP
+HAL
+0 65535 0
+
+* Limit on number of associated stations
+* (applies to peer stations in IBSS, SoftAP, BT-AMP AP, & P2P-GO modes)
+*
+
+WNI_CFG_ASSOC_STA_LIMIT I 4 8
+V RW NP
+LIM
+1 10 10
+V RW NP
+LIM
+1 10 10
+
+*
+* SAP channel select start channel number
+*
+WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL I 4 7
+V RW NP
+NONE
+1 0xFC 1
+V RW NP
+NONE
+1 0xFC 1
+
+*
+* SAP channel select end channel number
+*
+WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL I 4 7
+V RW NP
+NONE
+1 0xFC 11
+V RW NP
+NONE
+1 0xFC 11
+
+*
+* SAP channel select operating band
+* 0- 2.4GHZ / 1- Low 5GHZ /2-MID /3-HIGH/4-Japan4.9GHZ
+*
+WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND I 4 7
+V RW NP
+NONE
+0 0x4 0
+V RW NP
+NONE
+0 0x4 0
+
+*
+* Softap data available poll period (in milliseconds) for
+* queueing (Qos)Null frames to the station if there
+* is no data available and PS-Poll/Trigger frame is pending.
+* 0 = disabled. Recommended values is 5ms
+*
+WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD I 4 8
+V RW NP
+NONE
+0 65535 5
+V RW NP
+NONE
+0 65535 5
+
+*
+* Close loop power control will be enabled if value is set to 1
+*
+*
+*
+WNI_CFG_ENABLE_CLOSE_LOOP I 4 0
+V RW NP
+NONE
+0 1 0
+V RW NP
+NONE
+0 1 0
+
+*
+* LTE Coexistence will be enabled if value is set to 1
+*
+*
+*
+WNI_CFG_ENABLE_LTE_COEX I 4 0
+V RW NP
+NONE
+0 1 0
+V RW NP
+NONE
+0 1 0
+
+*
+* AP Keep Alive Timeout (TU)
+*
+WNI_CFG_AP_KEEP_ALIVE_TIMEOUT I 4 7
+V RW NP
+HAL
+1 255 20
+V RW NP
+HAL
+1 255 20
+
+*
+* GO Keep Alive Timeout (TU)
+*
+WNI_CFG_GO_KEEP_ALIVE_TIMEOUT I 4 7
+V RW NP
+HAL
+1 255 20
+V RW NP
+HAL
+1 255 20
diff --git a/CORE/MAC/src/cfg/polFile.h b/CORE/MAC/src/cfg/polFile.h
new file mode 100644
index 0000000..68e673c
--- /dev/null
+++ b/CORE/MAC/src/cfg/polFile.h
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+//==================================================================
+//
+// File: polFile.h
+//
+// Description: Structures that define the firmware file format.
+//
+// Author: Larry Cawley
+//
+// Copyright 2002, Woodside Networks, Inc. All rights reserved.
+//
+// Change History:
+// 04/09/2002 - LAC - Initial version.
+//
+//===================================================================
+#if !defined( __polFile_h__ )
+#define __polFile_h__
+
+
+
+
+// File format
+//
+// byte 0 1 2 3
+//
+// +---------+---------+--------+-------+ <----+
+// | Major | Minor | | | |
+// | Version | Version | Suffix | Build | FileVersion |
+// +---------+---------+--------+-------+ |
+// | Major | Minor | | | |
+// | Version | Version | Suffix | Build | HwCapabilities | tPolFileHeader
+// +---------+---------+--------+-------+ |
+// | | |
+// | FileLength | FileLength |
+// +------------------------------------+ |
+// | | |
+// | Number of Directory Entries | NumDirectoryEntries |
+// +------------------------------------+ <----+
+// | | |
+// | Directory Entry 1 Type | DirEntryType |
+// +------------------------------------+ |
+// | | | tPolFileDirEntry 1
+// | Directory Entry 1 File Offset | DirEntryFileOffset |
+// +------------------------------------+ |
+// | | |
+// | Directory Entry 1 Length | DirEntryLength |
+// +------------------------------------+ <----+
+// | . . . | . . .
+// +------------------------------------+ <----+
+// | | |
+// | Directory Entry n Type | |
+// +------------------------------------+ |
+// | | | tpolFileDirEntry n
+// | Directory Entry n File Offset | |
+// +------------------------------------+ |
+// | | |
+// | Directory Entry n Length | |
+// +------------------------------------+ <----+
+// | |
+// | |
+// | File data described by |
+// | directory entry 1 |
+// | |
+// | |
+// +------------------------------------+
+// | . . . |
+// +------------------------------------+
+// | |
+// | |
+// | File data described by |
+// | directory entry n |
+// | |
+// | |
+// +---------+---------+----------------+
+// | |
+// | File Checksum |
+// +---------+---------+
+//
+//
+//
+//
+
+
+#pragma pack( push )
+#pragma pack( 1 )
+
+typedef struct sPolFileVersion {
+
+ unsigned char MajorVersion;
+ unsigned char MinorVersion;
+ unsigned char Suffix;
+ unsigned char Build;
+
+} tPolFileVersion;
+
+
+typedef struct sPolFileHeader {
+
+ tPolFileVersion FileVersion;
+ tPolFileVersion HWCapabilities;
+ unsigned long FileLength;
+ unsigned long NumDirectoryEntries;
+
+} tPolFileHeader;
+
+
+typedef enum ePolFileDirTypes {
+
+ ePOL_DIR_TYPE_BOOTLOADER = 0,
+ ePOL_DIR_TYPE_STA_FIRMWARE,
+ ePOL_DIR_TYPE_AP_FIRMWARE,
+ ePOL_DIR_TYPE_DIAG_FIRMWARE,
+ ePOL_DIR_TYPE_STA_CONFIG,
+ ePOL_DIR_TYPE_AP_CONFIG
+
+} tPolFileDirTypes;
+
+
+typedef struct sPolFileDirEntry {
+
+ unsigned long DirEntryType;
+ unsigned long DirEntryFileOffset;
+ unsigned long DirEntryLength;
+
+} tPolFileDirEntry;
+
+
+#pragma pack( pop )
+
+
+__inline unsigned short polFileChkSum( unsigned short *FileData, unsigned long NumWords )
+{
+ unsigned long Sum;
+
+ for ( Sum = 0; NumWords > 0; NumWords-- ) {
+
+ Sum += *FileData++;
+ }
+
+ Sum = (Sum >> 16) + (Sum & 0xffff); // add carry
+ Sum += (Sum >> 16); // maybe last unsigned short
+
+ return( (unsigned short)( ~Sum ) );
+}
+
+
+
+#endif
+
diff --git a/CORE/MAC/src/dph/dphHashTable.c b/CORE/MAC/src/dph/dphHashTable.c
new file mode 100644
index 0000000..73791f6
--- /dev/null
+++ b/CORE/MAC/src/dph/dphHashTable.c
@@ -0,0 +1,472 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file dphHashTable.cc implements the member functions of
+ * DPH hash table class.
+ *
+ * Author: Sandesh Goel
+ * Date: 02/25/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+#include "palTypes.h"
+#include "cfgApi.h"
+#include "schApi.h"
+#include "dphGlobal.h"
+#include "limDebug.h"
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halCommonApi.h"
+#endif
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#include "halMsgApi.h"
+#endif
+
+// ---------------------------------------------------------------------
+/**
+ * dphHashTableClass()
+ *
+ * FUNCTION:
+ * Constructor function
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param None
+ * @return None
+ */
+
+void dphHashTableClassInit(tpAniSirGlobal pMac, dphHashTableClass* pDphHashTable)
+{
+ tANI_U16 i;
+
+ for (i=0; i<pDphHashTable->size; i++)
+ {
+ pDphHashTable->pHashTable[i] = 0;
+ }
+
+ for (i=0; i<pDphHashTable->size; i++)
+ {
+ pDphHashTable->pDphNodeArray[i].valid = 0;
+ pDphHashTable->pDphNodeArray[i].added = 0;
+ pDphHashTable->pDphNodeArray[i].assocId = i;
+ }
+
+}
+
+// ---------------------------------------------------------------------
+/**
+ * hashFunction
+ *
+ * FUNCTION:
+ * Hashing function
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param staAddr MAC address of the station
+ * @return None
+ */
+
+tANI_U16 hashFunction(tpAniSirGlobal pMac, tANI_U8 staAddr[], tANI_U16 numSta)
+{
+ int i;
+ tANI_U16 sum = 0;
+
+ for (i=0; i<6; i++)
+ sum += staAddr[i];
+
+ return (sum % numSta);
+}
+
+// ---------------------------------------------------------------------
+/**
+ * dphLookupHashEntry
+ *
+ * FUNCTION:
+ * Look up an entry in hash table
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param staAddr MAC address of the station
+ * @param pStaId pointer to the Station ID assigned to the station
+ * @return pointer to STA hash entry if lookup was a success \n
+ * NULL if lookup was a failure
+ */
+
+tpDphHashNode dphLookupHashEntry(tpAniSirGlobal pMac, tANI_U8 staAddr[], tANI_U16 *pAssocId,
+ dphHashTableClass* pDphHashTable)
+{
+ tpDphHashNode ptr = NULL;
+ tANI_U16 index = hashFunction(pMac, staAddr, pDphHashTable->size);
+
+ for (ptr = pDphHashTable->pHashTable[index]; ptr; ptr = ptr->next)
+ {
+ if (dphCompareMacAddr(staAddr, ptr->staAddr))
+ {
+ *pAssocId = ptr->assocId;
+ break;
+ }
+ }
+ return ptr;
+}
+
+// ---------------------------------------------------------------------
+/**
+ * dphGetHashEntry
+ *
+ * FUNCTION:
+ * Get a pointer to the hash node
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param staId Station ID
+ * @return pointer to STA hash entry if lookup was a success \n
+ * NULL if lookup was a failure
+ */
+
+tpDphHashNode dphGetHashEntry(tpAniSirGlobal pMac, tANI_U16 assocId, dphHashTableClass* pDphHashTable)
+{
+ if (assocId < pDphHashTable->size)
+ {
+ if (pDphHashTable->pDphNodeArray[assocId].added)
+ return &pDphHashTable->pDphNodeArray[assocId];
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+
+}
+
+static inline tpDphHashNode getNode(tpAniSirGlobal pMac, tANI_U8 assocId, dphHashTableClass* pDphHashTable)
+{
+ return &pDphHashTable->pDphNodeArray[assocId];
+}
+
+
+
+
+// ---------------------------------------------------------------------
+/**
+ * dphLookupAssocId
+ *
+ * FUNCTION:
+ * This function looks up assocID given the station Id. It traverses the complete table to do this.
+ * Need to find an efficient way to do this.
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pMac pointer to global Mac structure.
+ * @param staIdx station ID
+ * @param *assocId pointer to associd to be returned by this function.
+ * @return pointer to the dph node.
+ */
+tpDphHashNode dphLookupAssocId(tpAniSirGlobal pMac, tANI_U16 staIdx, tANI_U16* assocId, dphHashTableClass* pDphHashTable)
+{
+ tANI_U8 i;
+
+ for(i=0; i<pDphHashTable->size; i++)
+ {
+ if( (pDphHashTable->pDphNodeArray[i].added) &&
+ (pDphHashTable->pDphNodeArray[i].staIndex == staIdx))
+ {
+ *assocId = i;
+ break;
+ }
+
+ }
+ if(i==pDphHashTable->size)
+ return NULL;
+ return &pDphHashTable->pDphNodeArray[i];
+
+}
+
+
+
+
+/** -------------------------------------------------------------
+\fn dphInitStaState
+\brief Initialize STA state. this function saves the staId from the current entry in the DPH table with given assocId
+\ if validStaIdx flag is set. Otherwise it sets the staId to invalid.
+\param tpAniSirGlobal pMac
+\param tSirMacAddr staAddr
+\param tANI_U16 assocId
+\param tANI_U8 validStaIdx - true ==> the staId in the DPH entry with given assocId is valid and restore it back.
+\ false ==> set the staId to invalid.
+\return tpDphHashNode - DPH hash node if found.
+ -------------------------------------------------------------*/
+
+tpDphHashNode dphInitStaState(tpAniSirGlobal pMac, tSirMacAddr staAddr,
+ tANI_U16 assocId, tANI_U8 validStaIdx, dphHashTableClass* pDphHashTable)
+{
+ tANI_U32 val;
+
+ tpDphHashNode pStaDs;
+ tANI_U16 staIdx = HAL_STA_INVALID_IDX;
+
+ if (assocId >= pDphHashTable->size)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Invalid Assoc Id %d\n"), assocId);)
+ return NULL;
+ }
+
+ pStaDs = getNode(pMac, (tANI_U8) assocId, pDphHashTable);
+ staIdx = pStaDs->staIndex;
+
+ PELOG1(limLog(pMac, LOG1, FL("Assoc Id %d, Addr %08X\n"), assocId, pStaDs);)
+
+ // Clear the STA node except for the next pointer (last 4 bytes)
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pStaDs, sizeof(tDphHashNode) - sizeof(tpDphHashNode));
+
+ // Initialize the assocId
+ pStaDs->assocId = assocId;
+ if(true == validStaIdx)
+ pStaDs->staIndex = staIdx;
+ else
+ pStaDs->staIndex = HAL_STA_INVALID_IDX;
+
+ // Initialize STA mac address
+ palCopyMemory( pMac->hHdd, pStaDs->staAddr, staAddr, sizeof(tSirMacAddr));
+
+ // Initialize fragmentation threshold
+ if (wlan_cfgGetInt(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, &val) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("could not retrieve fragmentation threshold\n"));
+ else
+ pStaDs->fragSize = (tANI_U16) val;
+
+ pStaDs->added = 1;
+ pStaDs->encPolicy = HAL_ENC_POLICY_NULL;
+
+#if defined( PLM_WDS)&&defined(LX5280)
+ pStaDs->wdsIndex=pStaDs->wdsPeerBeaconSeen=0;
+#endif
+
+#ifdef WMM_APSD
+ pStaDs->stopQueue = 0;
+ pStaDs->spStatus = 0;
+ pStaDs->apsdMaxSpLen = 0;
+ pStaDs->acMode[0] = pStaDs->acMode[1] = pStaDs->acMode[2] = pStaDs->acMode[3] = 0;
+#endif /* WMM_APSD */
+ pStaDs->valid = 1;
+ return pStaDs;
+}
+
+// ---------------------------------------------------------------------
+/**
+ * dphAddHashEntry
+ *
+ * FUNCTION:
+ * Add entry to hash table
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param staAddr MAC address of the station
+ * @param staId Station ID assigned to the station
+ * @return Pointer to STA hash entry
+ */
+
+tpDphHashNode dphAddHashEntry(tpAniSirGlobal pMac, tSirMacAddr staAddr, tANI_U16 assocId, dphHashTableClass* pDphHashTable)
+{
+ tpDphHashNode ptr, node;
+ tANI_U16 index = hashFunction(pMac, staAddr, pDphHashTable->size);
+
+ PELOG1(limLog(pMac, LOG1, FL("assocId %d index %d STA addr\n"),
+ assocId, index);
+ dphPrintMacAddr(pMac, staAddr, LOG1);)
+
+ if (assocId >= pDphHashTable->size)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("invalid STA id %d\n"), assocId);)
+ return NULL;
+ }
+
+ if (pDphHashTable->pDphNodeArray[assocId].added)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("already added STA %d\n"), assocId);)
+ return NULL;
+ }
+
+ for (ptr = pDphHashTable->pHashTable[index]; ptr; ptr = ptr->next)
+ {
+ if (ptr == ptr->next)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Infinite Loop\n"));)
+ return NULL;
+ }
+
+ if (dphCompareMacAddr(staAddr, ptr->staAddr) || ptr->assocId== assocId)
+ break;
+ }
+
+ if (ptr)
+ {
+ // Duplicate entry
+ limLog(pMac, LOGE, FL("assocId %d hashIndex %d entry exists\n"),
+ assocId, index);
+ return NULL;
+ }
+ else
+ {
+ if (dphInitStaState(pMac, staAddr, assocId, false, pDphHashTable) == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not Init STAid=%d\n"), assocId);)
+ return NULL;
+ }
+
+ // Add the node to the link list
+ pDphHashTable->pDphNodeArray[assocId].next = pDphHashTable->pHashTable[index];
+ pDphHashTable->pHashTable[index] = &pDphHashTable->pDphNodeArray[assocId];
+
+ node = pDphHashTable->pHashTable[index];
+ return node;
+ }
+}
+
+// ---------------------------------------------------------------------
+/**
+ * dphDeleteHashEntry
+ *
+ * FUNCTION:
+ * Delete entry from hash table
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param staAddr MAC address of the station
+ * @param staId Station ID assigned to the station
+ * @return eSIR_SUCCESS if successful,\n
+ * eSIR_FAILURE otherwise
+ */
+
+tSirRetStatus dphDeleteHashEntry(tpAniSirGlobal pMac, tSirMacAddr staAddr, tANI_U16 assocId, dphHashTableClass* pDphHashTable)
+{
+ tpDphHashNode ptr, prev;
+ tANI_U16 index = hashFunction(pMac, staAddr, pDphHashTable->size);
+
+
+ PELOG1(limLog(pMac, LOG1, FL("assocId %d index %d STA addr\n"),
+ assocId, index);
+ dphPrintMacAddr(pMac, staAddr, LOG1);)
+
+ if (assocId >= pDphHashTable->size)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("invalid STA id %d\n"), assocId);)
+ return eSIR_FAILURE;
+ }
+
+ if (pDphHashTable->pDphNodeArray[assocId].added == 0)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("STA %d never added\n"), assocId);)
+ return eSIR_FAILURE;
+ }
+
+
+ for (prev = 0, ptr = pDphHashTable->pHashTable[index];
+ ptr;
+ prev = ptr, ptr = ptr->next)
+ {
+ if (dphCompareMacAddr(staAddr, ptr->staAddr))
+ break;
+ if (prev == ptr)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Infinite Loop\n"));)
+ return eSIR_FAILURE;
+ }
+ }
+
+ if (ptr)
+ {
+ /// Delete the entry after invalidating it
+ ptr->valid = 0;
+ if (prev == 0)
+ pDphHashTable->pHashTable[index] = ptr->next;
+ else
+ prev->next = ptr->next;
+ ptr->added = 0;
+ ptr->next = 0;
+ }
+ else
+ {
+ /// Entry not present
+ PELOGE(limLog(pMac, LOGE, FL("Entry not present STA addr\n"));
+ dphPrintMacAddr(pMac, staAddr, LOGE);)
+ return eSIR_FAILURE;
+ }
+
+ return eSIR_SUCCESS;
+}
+
+// ---------------------------------------------------------------------
+/**
+ * dphPrintMacAddr
+ *
+ * FUNCTION:
+ * Print a MAC address
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param addr MAC address
+ * @return None
+ */
+
+void
+dphPrintMacAddr(tpAniSirGlobal pMac, tANI_U8 addr[], tANI_U32 level)
+{
+ limLog(pMac, (tANI_U16) level, FL("MAC ADDR = %d:%d:%d:%d:%d:%d\n"),
+ addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
+}
+
+// ---------------------------------------------------------------------
diff --git a/CORE/MAC/src/dph/dphHashTable.h b/CORE/MAC/src/dph/dphHashTable.h
new file mode 100644
index 0000000..af40d3b
--- /dev/null
+++ b/CORE/MAC/src/dph/dphHashTable.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file dphHashTable.h contains the definition of the scheduler class.
+ *
+ * Author: Sandesh Goel
+ * Date: 02/25/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#ifndef __DPH_HASH_TABLE_H__
+#define __DPH_HASH_TABLE_H__
+
+#include "aniGlobal.h"
+/// Compare MAC addresses, return true if same
+static inline tANI_U8
+dphCompareMacAddr(tANI_U8 addr1[], tANI_U8 addr2[])
+{
+#if ((defined(ANI_PPC)) && defined(ANI_OS_TYPE_RTAI_LINUX))
+ /*
+ * Optimized comparison to take advantage of unaligned memory accesses
+ * supported by the CPU.
+ * This needs to be reviewed if the CPU changes.
+ */
+
+ return (((*((tANI_U32 *) addr1) - *((tANI_U32 *) addr2)) |
+ (*((tANI_U16 *) &(addr1[4])) - *((tANI_U16 *) &(addr2[4])))) == 0);
+#else
+ return((addr1[0] == addr2[0]) &&
+ (addr1[1] == addr2[1]) &&
+ (addr1[2] == addr2[2]) &&
+ (addr1[3] == addr2[3]) &&
+ (addr1[4] == addr2[4]) &&
+ (addr1[5] == addr2[5]));
+#endif
+}
+
+/// Hash table class
+typedef struct
+{
+
+ /// The hash table itself
+ tpDphHashNode *pHashTable;
+
+ /// The state array
+ tDphHashNode *pDphNodeArray;
+ tANI_U16 size;
+} dphHashTableClass;
+
+/// The hash table object
+extern dphHashTableClass dphHashTable;
+
+/// Print MAC addresse
+extern void dphPrintMacAddr(struct sAniSirGlobal *pMac, tANI_U8 addr[], tANI_U32);
+
+tpDphHashNode dphLookupHashEntry(tpAniSirGlobal pMac, tANI_U8 staAddr[], tANI_U16 *pStaId, dphHashTableClass* pDphHashTable);
+tpDphHashNode dphLookupAssocId(tpAniSirGlobal pMac, tANI_U16 staIdx, tANI_U16* assocId, dphHashTableClass* pDphHashTable);
+
+
+/// Get a pointer to the hash node
+extern tpDphHashNode dphGetHashEntry(tpAniSirGlobal pMac, tANI_U16 staId, dphHashTableClass* pDphHashTable);
+
+/// Add an entry to the hash table
+extern tpDphHashNode dphAddHashEntry(tpAniSirGlobal pMac, tSirMacAddr staAddr, tANI_U16 staId, dphHashTableClass* pDphHashTable);
+
+/// Delete an entry from the hash table
+extern tSirRetStatus dphDeleteHashEntry(tpAniSirGlobal pMac, tSirMacAddr staAddr, tANI_U16 staId, dphHashTableClass* pDphHashTable);
+
+void dphHashTableClassInit(tpAniSirGlobal pMac, dphHashTableClass* pDphHashTable);
+/// Initialize STA state
+extern tpDphHashNode dphInitStaState(tpAniSirGlobal pMac, tSirMacAddr staAddr,
+ tANI_U16 staId, tANI_U8 validStaIdx, dphHashTableClass* pDphHashTable);
+
+
+#endif
diff --git a/CORE/MAC/src/include/cfgApi.h b/CORE/MAC/src/include/cfgApi.h
new file mode 100644
index 0000000..7820782
--- /dev/null
+++ b/CORE/MAC/src/include/cfgApi.h
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * Author: Kevin Nguyen
+ * Date: 04/09/02
+ * History:-
+ * 04/09/02 Created.
+ * --------------------------------------------------------------------
+ *
+ */
+
+#ifndef __CFGAPI_H
+#define __CFGAPI_H
+
+#include <sirCommon.h>
+#include <sirParams.h>
+#include <sirMacProtDef.h>
+#include <wniApi.h>
+#include <aniGlobal.h>
+
+
+/*---------------------------------------------------------------------*/
+/* CFG definitions */
+/*---------------------------------------------------------------------*/
+#define CFG_TYPE_STR 0x0000000
+#define CFG_TYPE_INT 0x0000001
+#define CFG_HOST_RE 0x0000002
+#define CFG_HOST_WE 0x0000004
+
+// CFG status
+typedef enum eCfgStatusTypes {
+ CFG_INCOMPLETE,
+ CFG_SUCCESS,
+ CFG_FAILURE
+} tCfgStatusTypes;
+
+// WEP key mapping table row structure
+typedef struct
+{
+ tANI_U8 keyMappingAddr[SIR_MAC_ADDR_LENGTH];
+ tANI_U32 wepOn;
+ tANI_U8 key[SIR_MAC_KEY_LENGTH];
+ tANI_U32 status;
+} tCfgWepKeyEntry;
+
+
+/*---------------------------------------------------------------------*/
+/* CFG function prototypes */
+/*---------------------------------------------------------------------*/
+
+tANI_U32 cfgNeedRestart(tpAniSirGlobal pMac, tANI_U16 cfgId) ;
+tANI_U32 cfgNeedReload(tpAniSirGlobal pMac, tANI_U16 cfgId) ;
+
+/// CFG initialization function
+void wlan_cfgInit(tpAniSirGlobal);
+
+/// Process host message
+void cfgProcessMbMsg(tpAniSirGlobal, tSirMbMsg*);
+
+/// Set integer parameter value
+tSirRetStatus cfgSetInt(tpAniSirGlobal, tANI_U16, tANI_U32);
+
+/// Check if the parameter is valid
+tSirRetStatus cfgCheckValid(tpAniSirGlobal, tANI_U16);
+
+/// Get integer parameter value
+tSirRetStatus wlan_cfgGetInt(tpAniSirGlobal, tANI_U16, tANI_U32*);
+
+/// Increment integer parameter
+tSirRetStatus cfgIncrementInt(tpAniSirGlobal, tANI_U16, tANI_U32);
+
+/// Set string parameter value
+tSirRetStatus cfgSetStr(tpAniSirGlobal, tANI_U16, tANI_U8*, tANI_U32);
+
+tSirRetStatus cfgSetStrNotify(tpAniSirGlobal, tANI_U16, tANI_U8*, tANI_U32, int);
+
+//Cfg Download function for Prima or Integrated solutions.
+void processCfgDownloadReq(tpAniSirGlobal, tANI_U16, tANI_U32*);
+
+/// Get string parameter value
+tSirRetStatus wlan_cfgGetStr(tpAniSirGlobal, tANI_U16, tANI_U8*, tANI_U32*);
+
+/// Get string parameter maximum length
+tSirRetStatus wlan_cfgGetStrMaxLen(tpAniSirGlobal, tANI_U16, tANI_U32*);
+
+/// Get string parameter maximum length
+tSirRetStatus wlan_cfgGetStrLen(tpAniSirGlobal, tANI_U16, tANI_U32*);
+
+/// Get the regulatory tx power on given channel
+tPowerdBm cfgGetRegulatoryMaxTransmitPower(tpAniSirGlobal pMac, tANI_U8 channel);
+
+/// Dump CFG data to memory
+void cfgDump(tANI_U32*);
+
+/// Save parameters with P flag set
+void cfgSave(void);
+
+/// Get capability info
+extern tSirRetStatus cfgGetCapabilityInfo(tpAniSirGlobal pMac, tANI_U16 *pCap,tpPESession psessionEntry);
+
+/// Set capability info
+extern void cfgSetCapabilityInfo(tpAniSirGlobal, tANI_U16);
+
+/// Cleanup CFG module
+void cfgCleanup(tpAniSirGlobal pMac);
+
+extern tANI_U8 *gCfgParamName[];
+
+#endif /* __CFGAPI_H */
+
+
+
+
diff --git a/CORE/MAC/src/include/cfgGlobal.h b/CORE/MAC/src/include/cfgGlobal.h
new file mode 100644
index 0000000..9956dc4
--- /dev/null
+++ b/CORE/MAC/src/include/cfgGlobal.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * Author: Sandesh Goel
+ * Date: 02/09/03
+ * History:-
+ * 04/09/02 Created.
+ * --------------------------------------------------------------------
+ *
+ */
+
+#ifndef __CFGGLOBAL_H
+#define __CFGGLOBAL_H
+
+#include "sirCommon.h"
+#include "sirTypes.h"
+#include "wniCfgAp.h"
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+#define CFG_MAX_NUM_STA SIR_MAX_NUM_STA_IN_BSS
+#else
+#define CFG_MAX_NUM_STA SIR_MAX_NUM_STA_IN_IBSS
+#endif
+
+#define CFG_MAX_STR_LEN 256 // as the number of channels grows, 128 is not big enough
+
+/*--------------------------------------------------------------------*/
+/* Configuration Control Structure */
+/*--------------------------------------------------------------------*/
+typedef struct
+{
+ tANI_U32 control;
+} tCfgCtl;
+
+
+typedef struct sAniSirCfg
+{
+ // CFG module status
+ tANI_U8 gCfgStatus;
+
+ tCfgCtl *gCfgEntry;
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ tANI_U32 gCfgIBufMin[CFG_AP_IBUF_MAX_SIZE];
+ tANI_U32 gCfgIBufMax[CFG_AP_IBUF_MAX_SIZE];
+ tANI_U32 gCfgIBuf[CFG_AP_IBUF_MAX_SIZE];
+ tANI_U8 gCfgSBuf[CFG_AP_SBUF_MAX_SIZE];
+#else
+ tANI_U32 *gCfgIBufMin;
+ tANI_U32 *gCfgIBufMax;
+ tANI_U32 *gCfgIBuf;
+ tANI_U8 *gCfgSBuf;
+#endif
+
+ tANI_U16 gCfgMaxIBufSize;
+ tANI_U16 gCfgMaxSBufSize;
+
+ // Static buffer for string parameter (must be word-aligned)
+ tANI_U8 *gSBuffer;
+
+ // Message parameter list buffer (enough for largest possible response)
+ tANI_U32 *gParamList;
+} tAniSirCfg, *tpAniSirCfg;
+
+#endif
diff --git a/CORE/MAC/src/include/dot11f.h b/CORE/MAC/src/include/dot11f.h
new file mode 100644
index 0000000..7fe0dc4
--- /dev/null
+++ b/CORE/MAC/src/include/dot11f.h
@@ -0,0 +1,6883 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ */
+
+#ifndef DOT11F_H
+#define DOT11F_H
+/**
+ * \file dot11f.h
+ *
+ * \brief Structures, function prototypes & definitions
+ * for working with 802.11 Frames
+ *
+ *
+ * Copyright (C) 2012 Airgo Networks, Incorporated.
+ *
+ *
+ * This file was automatically generated by 'framesc'
+ * Tue May 15 13:12:01 2012 from the following file(s):
+ *
+ * dot11f.frms
+ *
+ * PLEASE DON'T EDIT THIS FILE BY HAND!
+ *
+ * Instead, please update the input files & re-run
+ * 'framesc' For more information on 'framesc' & the
+ * frames language, run 'framesc --help'.
+ *
+ *
+ */
+
+typedef tANI_U32 tDOT11F_U64[2];
+
+#if defined ( _MSC_VER )
+# pragma warning (disable: 4214) /* nonstandard extension used */
+#endif /* Microsoft C/C++ bit field types other than int */
+
+/*
+ * Frames Return Codes:
+ *
+ * Success is indicated by a return value of zero. Failure is indicated
+ * by the presence of the high bit. Warnings encountered in the course
+ * of a successful parse are indicated by various bits in the lower 31
+ * being turned on.
+ *
+ * For instance, a return value of 0x0000000a would indicate that the
+ * parse succeeded, but that a mandatory IE wasn't present, and some IE
+ * was found to be corrupt.
+ *
+ *
+ */
+
+#define DOT11F_PARSE_SUCCESS ( 0x00000000 )
+#define DOT11F_UNKNOWN_IES ( 0x00000001 )
+#define DOT11F_MANDATORY_IE_MISSING ( 0x00000002 )
+#define DOT11F_INCOMPLETE_IE ( 0x00000004 )
+#define DOT11F_SKIPPED_BAD_IE ( 0x00000008 )
+#define DOT11F_LAST_IE_TOO_LONG ( 0x00000010 )
+#define DOT11F_DUPLICATE_IE ( 0x00000020 )
+#define DOT11F_BAD_FIXED_VALUE ( 0x00000040 )
+#define DOT11F_INCOMPLETE_TLV ( 0x00000080 )
+#define DOT11F_INVALID_TLV_LENGTH ( 0x00000100 )
+#define DOT11F_SKIPPED_BAD_TLV ( 0x00000200 )
+#define DOT11F_UNKNOWN_TLVS ( 0x00000400 )
+#define DOT11F_LAST_TLV_TOO_LONG ( 0x00000800 )
+#define DOT11F_INTERNAL_ERROR ( 0x10000001 )
+#define DOT11F_MISSING_FIXED_FIELD ( 0x10000002 )
+#define DOT11F_BAD_INPUT_BUFFER ( 0x10000003 )
+#define DOT11F_BAD_OUTPUT_BUFFER ( 0x10000004 )
+#define DOT11F_BUFFER_OVERFLOW ( 0x10000005 )
+#define DOT11F_MANDATORY_TLV_MISSING ( 0x00001000 )
+#define DOT11F_FAILED(code) ( (code) & 0x10000000 )
+#define DOT11F_WARNED(code) ( ( ( 0 == (code) ) & 0x10000000 ) && code)
+#define DOT11F_SUCCEEDED(code) ( (code) == 0 )
+
+/*********************************************************************
+ * Fixed Fields *
+ ********************************************************************/
+
+typedef struct sDot11fFfAID {
+ tANI_U16 associd;
+} tDot11fFfAID;
+
+#define DOT11F_FF_AID_LEN ( 2 )
+
+void dot11fUnpackFfAID(tpAniSirGlobal, tANI_U8*, tDot11fFfAID*);
+
+void dot11fPackFfAID(tpAniSirGlobal, tDot11fFfAID*, tANI_U8*);
+
+typedef struct sDot11fFfAction {
+ tANI_U8 action;
+} tDot11fFfAction;
+
+#define DOT11F_FF_ACTION_LEN ( 1 )
+
+void dot11fUnpackFfAction(tpAniSirGlobal, tANI_U8*, tDot11fFfAction*);
+
+void dot11fPackFfAction(tpAniSirGlobal, tDot11fFfAction*, tANI_U8*);
+
+typedef struct sDot11fFfAddBAParameterSet {
+ tANI_U16 amsduSupported: 1;
+ tANI_U16 policy: 1;
+ tANI_U16 tid: 4;
+ tANI_U16 bufferSize: 10;
+} tDot11fFfAddBAParameterSet;
+
+#define DOT11F_FF_ADDBAPARAMETERSET_LEN ( 2 )
+
+void dot11fUnpackFfAddBAParameterSet(tpAniSirGlobal, tANI_U8*, tDot11fFfAddBAParameterSet*);
+
+void dot11fPackFfAddBAParameterSet(tpAniSirGlobal, tDot11fFfAddBAParameterSet*, tANI_U8*);
+
+#define ADDBAPARAMETERSET_AMSDUSUPPORTED_OFFSET 0
+#define ADDBAPARAMETERSET_AMSDUSUPPORTED_WIDTH 1
+#define ADDBAPARAMETERSET_POLICY_OFFSET 1
+#define ADDBAPARAMETERSET_POLICY_WIDTH 1
+#define ADDBAPARAMETERSET_TID_OFFSET 2
+#define ADDBAPARAMETERSET_TID_WIDTH 4
+#define ADDBAPARAMETERSET_BUFFERSIZE_OFFSET 6
+#define ADDBAPARAMETERSET_BUFFERSIZE_WIDTH 10
+
+typedef struct sDot11fFfAuthAlgo {
+ tANI_U16 algo;
+} tDot11fFfAuthAlgo;
+
+#define DOT11F_FF_AUTHALGO_LEN ( 2 )
+
+void dot11fUnpackFfAuthAlgo(tpAniSirGlobal, tANI_U8*, tDot11fFfAuthAlgo*);
+
+void dot11fPackFfAuthAlgo(tpAniSirGlobal, tDot11fFfAuthAlgo*, tANI_U8*);
+
+typedef struct sDot11fFfAuthSeqNo {
+ tANI_U16 no;
+} tDot11fFfAuthSeqNo;
+
+#define DOT11F_FF_AUTHSEQNO_LEN ( 2 )
+
+void dot11fUnpackFfAuthSeqNo(tpAniSirGlobal, tANI_U8*, tDot11fFfAuthSeqNo*);
+
+void dot11fPackFfAuthSeqNo(tpAniSirGlobal, tDot11fFfAuthSeqNo*, tANI_U8*);
+
+typedef struct sDot11fFfBAStartingSequenceControl {
+ tANI_U16 fragNumber: 4;
+ tANI_U16 ssn: 12;
+} tDot11fFfBAStartingSequenceControl;
+
+#define DOT11F_FF_BASTARTINGSEQUENCECONTROL_LEN ( 2 )
+
+void dot11fUnpackFfBAStartingSequenceControl(tpAniSirGlobal, tANI_U8*, tDot11fFfBAStartingSequenceControl*);
+
+void dot11fPackFfBAStartingSequenceControl(tpAniSirGlobal, tDot11fFfBAStartingSequenceControl*, tANI_U8*);
+
+#define BASTARTINGSEQUENCECONTROL_FRAGNUMBER_OFFSET 0
+#define BASTARTINGSEQUENCECONTROL_FRAGNUMBER_WIDTH 4
+#define BASTARTINGSEQUENCECONTROL_SSN_OFFSET 4
+#define BASTARTINGSEQUENCECONTROL_SSN_WIDTH 12
+
+typedef struct sDot11fFfBATimeout {
+ tANI_U16 timeout;
+} tDot11fFfBATimeout;
+
+#define DOT11F_FF_BATIMEOUT_LEN ( 2 )
+
+void dot11fUnpackFfBATimeout(tpAniSirGlobal, tANI_U8*, tDot11fFfBATimeout*);
+
+void dot11fPackFfBATimeout(tpAniSirGlobal, tDot11fFfBATimeout*, tANI_U8*);
+
+typedef struct sDot11fFfBeaconInterval {
+ tANI_U16 interval;
+} tDot11fFfBeaconInterval;
+
+#define DOT11F_FF_BEACONINTERVAL_LEN ( 2 )
+
+void dot11fUnpackFfBeaconInterval(tpAniSirGlobal, tANI_U8*, tDot11fFfBeaconInterval*);
+
+void dot11fPackFfBeaconInterval(tpAniSirGlobal, tDot11fFfBeaconInterval*, tANI_U8*);
+
+typedef struct sDot11fFfCapabilities {
+ tANI_U16 ess: 1;
+ tANI_U16 ibss: 1;
+ tANI_U16 cfPollable: 1;
+ tANI_U16 cfPollReq: 1;
+ tANI_U16 privacy: 1;
+ tANI_U16 shortPreamble: 1;
+ tANI_U16 pbcc: 1;
+ tANI_U16 channelAgility: 1;
+ tANI_U16 spectrumMgt: 1;
+ tANI_U16 qos: 1;
+ tANI_U16 shortSlotTime: 1;
+ tANI_U16 apsd: 1;
+ tANI_U16 rrm: 1;
+ tANI_U16 dsssOfdm: 1;
+ tANI_U16 delayedBA: 1;
+ tANI_U16 immediateBA: 1;
+} tDot11fFfCapabilities;
+
+#define DOT11F_FF_CAPABILITIES_LEN ( 2 )
+
+void dot11fUnpackFfCapabilities(tpAniSirGlobal, tANI_U8*, tDot11fFfCapabilities*);
+
+void dot11fPackFfCapabilities(tpAniSirGlobal, tDot11fFfCapabilities*, tANI_U8*);
+
+#define CAPABILITIES_ESS_OFFSET 0
+#define CAPABILITIES_ESS_WIDTH 1
+#define CAPABILITIES_IBSS_OFFSET 1
+#define CAPABILITIES_IBSS_WIDTH 1
+#define CAPABILITIES_CFPOLLABLE_OFFSET 2
+#define CAPABILITIES_CFPOLLABLE_WIDTH 1
+#define CAPABILITIES_CFPOLLREQ_OFFSET 3
+#define CAPABILITIES_CFPOLLREQ_WIDTH 1
+#define CAPABILITIES_PRIVACY_OFFSET 4
+#define CAPABILITIES_PRIVACY_WIDTH 1
+#define CAPABILITIES_SHORTPREAMBLE_OFFSET 5
+#define CAPABILITIES_SHORTPREAMBLE_WIDTH 1
+#define CAPABILITIES_PBCC_OFFSET 6
+#define CAPABILITIES_PBCC_WIDTH 1
+#define CAPABILITIES_CHANNELAGILITY_OFFSET 7
+#define CAPABILITIES_CHANNELAGILITY_WIDTH 1
+#define CAPABILITIES_SPECTRUMMGT_OFFSET 8
+#define CAPABILITIES_SPECTRUMMGT_WIDTH 1
+#define CAPABILITIES_QOS_OFFSET 9
+#define CAPABILITIES_QOS_WIDTH 1
+#define CAPABILITIES_SHORTSLOTTIME_OFFSET 10
+#define CAPABILITIES_SHORTSLOTTIME_WIDTH 1
+#define CAPABILITIES_APSD_OFFSET 11
+#define CAPABILITIES_APSD_WIDTH 1
+#define CAPABILITIES_RRM_OFFSET 12
+#define CAPABILITIES_RRM_WIDTH 1
+#define CAPABILITIES_DSSSOFDM_OFFSET 13
+#define CAPABILITIES_DSSSOFDM_WIDTH 1
+#define CAPABILITIES_DELAYEDBA_OFFSET 14
+#define CAPABILITIES_DELAYEDBA_WIDTH 1
+#define CAPABILITIES_IMMEDIATEBA_OFFSET 15
+#define CAPABILITIES_IMMEDIATEBA_WIDTH 1
+
+typedef struct sDot11fFfCategory {
+ tANI_U8 category;
+} tDot11fFfCategory;
+
+#define DOT11F_FF_CATEGORY_LEN ( 1 )
+
+void dot11fUnpackFfCategory(tpAniSirGlobal, tANI_U8*, tDot11fFfCategory*);
+
+void dot11fPackFfCategory(tpAniSirGlobal, tDot11fFfCategory*, tANI_U8*);
+
+typedef struct sDot11fFfCurrentAPAddress {
+ tANI_U8 mac[6];
+} tDot11fFfCurrentAPAddress;
+
+#define DOT11F_FF_CURRENTAPADDRESS_LEN ( 6 )
+
+void dot11fUnpackFfCurrentAPAddress(tpAniSirGlobal, tANI_U8*, tDot11fFfCurrentAPAddress*);
+
+void dot11fPackFfCurrentAPAddress(tpAniSirGlobal, tDot11fFfCurrentAPAddress*, tANI_U8*);
+
+typedef struct sDot11fFfDelBAParameterSet {
+ tANI_U16 reserved: 11;
+ tANI_U16 initiator: 1;
+ tANI_U16 tid: 4;
+} tDot11fFfDelBAParameterSet;
+
+#define DOT11F_FF_DELBAPARAMETERSET_LEN ( 2 )
+
+void dot11fUnpackFfDelBAParameterSet(tpAniSirGlobal, tANI_U8*, tDot11fFfDelBAParameterSet*);
+
+void dot11fPackFfDelBAParameterSet(tpAniSirGlobal, tDot11fFfDelBAParameterSet*, tANI_U8*);
+
+#define DELBAPARAMETERSET_RESERVED_OFFSET 0
+#define DELBAPARAMETERSET_RESERVED_WIDTH 11
+#define DELBAPARAMETERSET_INITIATOR_OFFSET 11
+#define DELBAPARAMETERSET_INITIATOR_WIDTH 1
+#define DELBAPARAMETERSET_TID_OFFSET 12
+#define DELBAPARAMETERSET_TID_WIDTH 4
+
+typedef struct sDot11fFfDialogToken {
+ tANI_U8 token;
+} tDot11fFfDialogToken;
+
+#define DOT11F_FF_DIALOGTOKEN_LEN ( 1 )
+
+void dot11fUnpackFfDialogToken(tpAniSirGlobal, tANI_U8*, tDot11fFfDialogToken*);
+
+void dot11fPackFfDialogToken(tpAniSirGlobal, tDot11fFfDialogToken*, tANI_U8*);
+
+typedef struct sDot11fFfLinkMargin {
+ tANI_U8 linkMargin;
+} tDot11fFfLinkMargin;
+
+#define DOT11F_FF_LINKMARGIN_LEN ( 1 )
+
+void dot11fUnpackFfLinkMargin(tpAniSirGlobal, tANI_U8*, tDot11fFfLinkMargin*);
+
+void dot11fPackFfLinkMargin(tpAniSirGlobal, tDot11fFfLinkMargin*, tANI_U8*);
+
+typedef struct sDot11fFfListenInterval {
+ tANI_U16 interval;
+} tDot11fFfListenInterval;
+
+#define DOT11F_FF_LISTENINTERVAL_LEN ( 2 )
+
+void dot11fUnpackFfListenInterval(tpAniSirGlobal, tANI_U8*, tDot11fFfListenInterval*);
+
+void dot11fPackFfListenInterval(tpAniSirGlobal, tDot11fFfListenInterval*, tANI_U8*);
+
+typedef struct sDot11fFfMaxTxPower {
+ tANI_U8 maxTxPower;
+} tDot11fFfMaxTxPower;
+
+#define DOT11F_FF_MAXTXPOWER_LEN ( 1 )
+
+void dot11fUnpackFfMaxTxPower(tpAniSirGlobal, tANI_U8*, tDot11fFfMaxTxPower*);
+
+void dot11fPackFfMaxTxPower(tpAniSirGlobal, tDot11fFfMaxTxPower*, tANI_U8*);
+
+typedef struct sDot11fFfNumOfRepetitions {
+ tANI_U16 repetitions;
+} tDot11fFfNumOfRepetitions;
+
+#define DOT11F_FF_NUMOFREPETITIONS_LEN ( 2 )
+
+void dot11fUnpackFfNumOfRepetitions(tpAniSirGlobal, tANI_U8*, tDot11fFfNumOfRepetitions*);
+
+void dot11fPackFfNumOfRepetitions(tpAniSirGlobal, tDot11fFfNumOfRepetitions*, tANI_U8*);
+
+typedef struct sDot11fFfP2POUI {
+ tANI_U32 oui;
+} tDot11fFfP2POUI;
+
+#define DOT11F_FF_P2POUI_LEN ( 4 )
+
+void dot11fUnpackFfP2POUI(tpAniSirGlobal, tANI_U8*, tDot11fFfP2POUI*);
+
+void dot11fPackFfP2POUI(tpAniSirGlobal, tDot11fFfP2POUI*, tANI_U8*);
+
+typedef struct sDot11fFfP2POUISubType {
+ tANI_U8 ouiSubtype;
+} tDot11fFfP2POUISubType;
+
+#define DOT11F_FF_P2POUISUBTYPE_LEN ( 1 )
+
+void dot11fUnpackFfP2POUISubType(tpAniSirGlobal, tANI_U8*, tDot11fFfP2POUISubType*);
+
+void dot11fPackFfP2POUISubType(tpAniSirGlobal, tDot11fFfP2POUISubType*, tANI_U8*);
+
+typedef struct sDot11fFfRCPI {
+ tANI_U8 rcpi;
+} tDot11fFfRCPI;
+
+#define DOT11F_FF_RCPI_LEN ( 1 )
+
+void dot11fUnpackFfRCPI(tpAniSirGlobal, tANI_U8*, tDot11fFfRCPI*);
+
+void dot11fPackFfRCPI(tpAniSirGlobal, tDot11fFfRCPI*, tANI_U8*);
+
+typedef struct sDot11fFfRSNI {
+ tANI_U8 rsni;
+} tDot11fFfRSNI;
+
+#define DOT11F_FF_RSNI_LEN ( 1 )
+
+void dot11fUnpackFfRSNI(tpAniSirGlobal, tANI_U8*, tDot11fFfRSNI*);
+
+void dot11fPackFfRSNI(tpAniSirGlobal, tDot11fFfRSNI*, tANI_U8*);
+
+typedef struct sDot11fFfReason {
+ tANI_U16 code;
+} tDot11fFfReason;
+
+#define DOT11F_FF_REASON_LEN ( 2 )
+
+void dot11fUnpackFfReason(tpAniSirGlobal, tANI_U8*, tDot11fFfReason*);
+
+void dot11fPackFfReason(tpAniSirGlobal, tDot11fFfReason*, tANI_U8*);
+
+typedef struct sDot11fFfRxAntennaId {
+ tANI_U8 antennaId;
+} tDot11fFfRxAntennaId;
+
+#define DOT11F_FF_RXANTENNAID_LEN ( 1 )
+
+void dot11fUnpackFfRxAntennaId(tpAniSirGlobal, tANI_U8*, tDot11fFfRxAntennaId*);
+
+void dot11fPackFfRxAntennaId(tpAniSirGlobal, tDot11fFfRxAntennaId*, tANI_U8*);
+
+typedef struct sDot11fFfSMPowerModeSet {
+ tANI_U8 PowerSave_En: 1;
+ tANI_U8 Mode: 1;
+ tANI_U8 reserved: 6;
+} tDot11fFfSMPowerModeSet;
+
+#define DOT11F_FF_SMPOWERMODESET_LEN ( 1 )
+
+void dot11fUnpackFfSMPowerModeSet(tpAniSirGlobal, tANI_U8*, tDot11fFfSMPowerModeSet*);
+
+void dot11fPackFfSMPowerModeSet(tpAniSirGlobal, tDot11fFfSMPowerModeSet*, tANI_U8*);
+
+#define SMPOWERMODESET_POWERSAVE_EN_OFFSET 0
+#define SMPOWERMODESET_POWERSAVE_EN_WIDTH 1
+#define SMPOWERMODESET_MODE_OFFSET 1
+#define SMPOWERMODESET_MODE_WIDTH 1
+#define SMPOWERMODESET_RESERVED_OFFSET 2
+#define SMPOWERMODESET_RESERVED_WIDTH 6
+
+typedef struct sDot11fFfStatus {
+ tANI_U16 status;
+} tDot11fFfStatus;
+
+#define DOT11F_FF_STATUS_LEN ( 2 )
+
+void dot11fUnpackFfStatus(tpAniSirGlobal, tANI_U8*, tDot11fFfStatus*);
+
+void dot11fPackFfStatus(tpAniSirGlobal, tDot11fFfStatus*, tANI_U8*);
+
+typedef struct sDot11fFfStatusCode {
+ tANI_U8 statusCode;
+} tDot11fFfStatusCode;
+
+#define DOT11F_FF_STATUSCODE_LEN ( 1 )
+
+void dot11fUnpackFfStatusCode(tpAniSirGlobal, tANI_U8*, tDot11fFfStatusCode*);
+
+void dot11fPackFfStatusCode(tpAniSirGlobal, tDot11fFfStatusCode*, tANI_U8*);
+
+typedef struct sDot11fFfTPCEleID {
+ tANI_U8 TPCId;
+} tDot11fFfTPCEleID;
+
+#define DOT11F_FF_TPCELEID_LEN ( 1 )
+
+void dot11fUnpackFfTPCEleID(tpAniSirGlobal, tANI_U8*, tDot11fFfTPCEleID*);
+
+void dot11fPackFfTPCEleID(tpAniSirGlobal, tDot11fFfTPCEleID*, tANI_U8*);
+
+typedef struct sDot11fFfTPCEleLen {
+ tANI_U8 TPCLen;
+} tDot11fFfTPCEleLen;
+
+#define DOT11F_FF_TPCELELEN_LEN ( 1 )
+
+void dot11fUnpackFfTPCEleLen(tpAniSirGlobal, tANI_U8*, tDot11fFfTPCEleLen*);
+
+void dot11fPackFfTPCEleLen(tpAniSirGlobal, tDot11fFfTPCEleLen*, tANI_U8*);
+
+typedef struct sDot11fFfTSInfo {
+ tANI_U32 traffic_type: 1;
+ tANI_U32 tsid: 4;
+ tANI_U32 direction: 2;
+ tANI_U32 access_policy: 2;
+ tANI_U32 aggregation: 1;
+ tANI_U32 psb: 1;
+ tANI_U32 user_priority: 3;
+ tANI_U32 tsinfo_ack_pol: 2;
+ tANI_U32 schedule: 1;
+ tANI_U32 unused: 15;
+} tDot11fFfTSInfo;
+
+#define DOT11F_FF_TSINFO_LEN ( 3 )
+
+void dot11fUnpackFfTSInfo(tpAniSirGlobal, tANI_U8*, tDot11fFfTSInfo*);
+
+void dot11fPackFfTSInfo(tpAniSirGlobal, tDot11fFfTSInfo*, tANI_U8*);
+
+#define TSINFO_TRAFFIC_TYPE_OFFSET 0
+#define TSINFO_TRAFFIC_TYPE_WIDTH 1
+#define TSINFO_TSID_OFFSET 1
+#define TSINFO_TSID_WIDTH 4
+#define TSINFO_DIRECTION_OFFSET 5
+#define TSINFO_DIRECTION_WIDTH 2
+#define TSINFO_ACCESS_POLICY_OFFSET 7
+#define TSINFO_ACCESS_POLICY_WIDTH 2
+#define TSINFO_AGGREGATION_OFFSET 9
+#define TSINFO_AGGREGATION_WIDTH 1
+#define TSINFO_PSB_OFFSET 10
+#define TSINFO_PSB_WIDTH 1
+#define TSINFO_USER_PRIORITY_OFFSET 11
+#define TSINFO_USER_PRIORITY_WIDTH 3
+#define TSINFO_TSINFO_ACK_POL_OFFSET 14
+#define TSINFO_TSINFO_ACK_POL_WIDTH 2
+#define TSINFO_SCHEDULE_OFFSET 16
+#define TSINFO_SCHEDULE_WIDTH 1
+#define TSINFO_UNUSED_OFFSET 17
+#define TSINFO_UNUSED_WIDTH 15
+
+typedef struct sDot11fFfTimeStamp {
+ tDOT11F_U64 timestamp;
+} tDot11fFfTimeStamp;
+
+#define DOT11F_FF_TIMESTAMP_LEN ( 8 )
+
+void dot11fUnpackFfTimeStamp(tpAniSirGlobal, tANI_U8*, tDot11fFfTimeStamp*);
+
+void dot11fPackFfTimeStamp(tpAniSirGlobal, tDot11fFfTimeStamp*, tANI_U8*);
+
+typedef struct sDot11fFfTxAntennaId {
+ tANI_U8 antennaId;
+} tDot11fFfTxAntennaId;
+
+#define DOT11F_FF_TXANTENNAID_LEN ( 1 )
+
+void dot11fUnpackFfTxAntennaId(tpAniSirGlobal, tANI_U8*, tDot11fFfTxAntennaId*);
+
+void dot11fPackFfTxAntennaId(tpAniSirGlobal, tDot11fFfTxAntennaId*, tANI_U8*);
+
+typedef struct sDot11fFfTxPower {
+ tANI_U8 txPower;
+} tDot11fFfTxPower;
+
+#define DOT11F_FF_TXPOWER_LEN ( 1 )
+
+void dot11fUnpackFfTxPower(tpAniSirGlobal, tANI_U8*, tDot11fFfTxPower*);
+
+void dot11fPackFfTxPower(tpAniSirGlobal, tDot11fFfTxPower*, tANI_U8*);
+
+/*********************************************************************
+ * TLVs *
+ ********************************************************************/
+
+// ID 1 (0x0001)
+typedef struct sDot11fTLVAuthorizedMACs {
+ tANI_U8 present;
+ tANI_U8 mac[6];
+} tDot11fTLVAuthorizedMACs;
+
+#define DOT11F_TLV_AUTHORIZEDMACS ( 1 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_AUTHORIZEDMACS_MIN_LEN ( 6 )
+
+#define DOT11F_TLV_AUTHORIZEDMACS_MAX_LEN ( 6 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvAuthorizedMACs(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVAuthorizedMACs*);
+
+tANI_U32 dot11fPackTlvAuthorizedMACs(tpAniSirGlobal, tDot11fTLVAuthorizedMACs*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvAuthorizedMACs(tpAniSirGlobal, tDot11fTLVAuthorizedMACs*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 3 (0x0003)
+typedef struct sDot11fTLVRequestToEnroll {
+ tANI_U8 present;
+ tANI_U8 req;
+} tDot11fTLVRequestToEnroll;
+
+#define DOT11F_TLV_REQUESTTOENROLL ( 3 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_REQUESTTOENROLL_MIN_LEN ( 1 )
+
+#define DOT11F_TLV_REQUESTTOENROLL_MAX_LEN ( 1 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvRequestToEnroll(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVRequestToEnroll*);
+
+tANI_U32 dot11fPackTlvRequestToEnroll(tpAniSirGlobal, tDot11fTLVRequestToEnroll*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvRequestToEnroll(tpAniSirGlobal, tDot11fTLVRequestToEnroll*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 0 (0x0000)
+typedef struct sDot11fTLVVersion2 {
+ tANI_U8 present;
+ tANI_U8 minor: 4;
+ tANI_U8 major: 4;
+} tDot11fTLVVersion2;
+
+#define DOT11F_TLV_VERSION2 ( 0 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_VERSION2_MIN_LEN ( 1 )
+
+#define DOT11F_TLV_VERSION2_MAX_LEN ( 1 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvVersion2(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVVersion2*);
+
+tANI_U32 dot11fPackTlvVersion2(tpAniSirGlobal, tDot11fTLVVersion2*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvVersion2(tpAniSirGlobal, tDot11fTLVVersion2*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4183 (0x1057)
+typedef struct sDot11fTLVAPSetupLocked {
+ tANI_U8 present;
+ tANI_U8 fLocked;
+} tDot11fTLVAPSetupLocked;
+
+#define DOT11F_TLV_APSETUPLOCKED ( 4183 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_APSETUPLOCKED_MIN_LEN ( 3 )
+
+#define DOT11F_TLV_APSETUPLOCKED_MAX_LEN ( 3 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvAPSetupLocked(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVAPSetupLocked*);
+
+tANI_U32 dot11fPackTlvAPSetupLocked(tpAniSirGlobal, tDot11fTLVAPSetupLocked*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvAPSetupLocked(tpAniSirGlobal, tDot11fTLVAPSetupLocked*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4098 (0x1002)
+typedef struct sDot11fTLVAssociationState {
+ tANI_U8 present;
+ tANI_U16 state;
+} tDot11fTLVAssociationState;
+
+#define DOT11F_TLV_ASSOCIATIONSTATE ( 4098 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_ASSOCIATIONSTATE_MIN_LEN ( 4 )
+
+#define DOT11F_TLV_ASSOCIATIONSTATE_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvAssociationState(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVAssociationState*);
+
+tANI_U32 dot11fPackTlvAssociationState(tpAniSirGlobal, tDot11fTLVAssociationState*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvAssociationState(tpAniSirGlobal, tDot11fTLVAssociationState*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 11 (0x000b)
+typedef struct sDot11fTLVChannelList {
+ tANI_U8 present;
+ tANI_U8 countryString[3];
+ tANI_U8 num_channelList;
+ tANI_U8 channelList[251];
+} tDot11fTLVChannelList;
+
+#define DOT11F_TLV_CHANNELLIST ( 11 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_CHANNELLIST_MIN_LEN ( 4 )
+
+#define DOT11F_TLV_CHANNELLIST_MAX_LEN ( 255 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvChannelList(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVChannelList*);
+
+tANI_U32 dot11fPackTlvChannelList(tpAniSirGlobal, tDot11fTLVChannelList*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvChannelList(tpAniSirGlobal, tDot11fTLVChannelList*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4104 (0x1008)
+typedef struct sDot11fTLVConfigMethods {
+ tANI_U8 present;
+ tANI_U16 methods;
+} tDot11fTLVConfigMethods;
+
+#define DOT11F_TLV_CONFIGMETHODS ( 4104 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_CONFIGMETHODS_MIN_LEN ( 4 )
+
+#define DOT11F_TLV_CONFIGMETHODS_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvConfigMethods(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVConfigMethods*);
+
+tANI_U32 dot11fPackTlvConfigMethods(tpAniSirGlobal, tDot11fTLVConfigMethods*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvConfigMethods(tpAniSirGlobal, tDot11fTLVConfigMethods*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4105 (0x1009)
+typedef struct sDot11fTLVConfigurationError {
+ tANI_U8 present;
+ tANI_U16 error;
+} tDot11fTLVConfigurationError;
+
+#define DOT11F_TLV_CONFIGURATIONERROR ( 4105 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_CONFIGURATIONERROR_MIN_LEN ( 4 )
+
+#define DOT11F_TLV_CONFIGURATIONERROR_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvConfigurationError(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVConfigurationError*);
+
+tANI_U32 dot11fPackTlvConfigurationError(tpAniSirGlobal, tDot11fTLVConfigurationError*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvConfigurationError(tpAniSirGlobal, tDot11fTLVConfigurationError*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 5 (0x0005)
+typedef struct sDot11fTLVConfigurationTimeout {
+ tANI_U8 present;
+ tANI_U8 GOConfigTimeout;
+ tANI_U8 CLConfigTimeout;
+} tDot11fTLVConfigurationTimeout;
+
+#define DOT11F_TLV_CONFIGURATIONTIMEOUT ( 5 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_CONFIGURATIONTIMEOUT_MIN_LEN ( 3 )
+
+#define DOT11F_TLV_CONFIGURATIONTIMEOUT_MAX_LEN ( 3 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvConfigurationTimeout(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVConfigurationTimeout*);
+
+tANI_U32 dot11fPackTlvConfigurationTimeout(tpAniSirGlobal, tDot11fTLVConfigurationTimeout*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvConfigurationTimeout(tpAniSirGlobal, tDot11fTLVConfigurationTimeout*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4113 (0x1011)
+typedef struct sDot11fTLVDeviceName {
+ tANI_U8 present;
+ tANI_U8 num_text;
+ tANI_U8 text[32];
+} tDot11fTLVDeviceName;
+
+#define DOT11F_TLV_DEVICENAME ( 4113 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_DEVICENAME_MIN_LEN ( 2 )
+
+#define DOT11F_TLV_DEVICENAME_MAX_LEN ( 34 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvDeviceName(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVDeviceName*);
+
+tANI_U32 dot11fPackTlvDeviceName(tpAniSirGlobal, tDot11fTLVDeviceName*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvDeviceName(tpAniSirGlobal, tDot11fTLVDeviceName*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4114 (0x1012)
+typedef struct sDot11fTLVDevicePasswordID {
+ tANI_U8 present;
+ tANI_U16 id;
+} tDot11fTLVDevicePasswordID;
+
+#define DOT11F_TLV_DEVICEPASSWORDID ( 4114 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_DEVICEPASSWORDID_MIN_LEN ( 4 )
+
+#define DOT11F_TLV_DEVICEPASSWORDID_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvDevicePasswordID(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVDevicePasswordID*);
+
+tANI_U32 dot11fPackTlvDevicePasswordID(tpAniSirGlobal, tDot11fTLVDevicePasswordID*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvDevicePasswordID(tpAniSirGlobal, tDot11fTLVDevicePasswordID*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 8 (0x0008)
+typedef struct sDot11fTLVExtendedListenTiming {
+ tANI_U8 present;
+ tANI_U16 availibilityPeriod;
+ tANI_U16 availibilityInterval;
+} tDot11fTLVExtendedListenTiming;
+
+#define DOT11F_TLV_EXTENDEDLISTENTIMING ( 8 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_EXTENDEDLISTENTIMING_MIN_LEN ( 5 )
+
+#define DOT11F_TLV_EXTENDEDLISTENTIMING_MAX_LEN ( 5 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvExtendedListenTiming(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVExtendedListenTiming*);
+
+tANI_U32 dot11fPackTlvExtendedListenTiming(tpAniSirGlobal, tDot11fTLVExtendedListenTiming*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvExtendedListenTiming(tpAniSirGlobal, tDot11fTLVExtendedListenTiming*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4 (0x0004)
+typedef struct sDot11fTLVGOIntent {
+ tANI_U8 present;
+ tANI_U8 GOIntent;
+} tDot11fTLVGOIntent;
+
+#define DOT11F_TLV_GOINTENT ( 4 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_GOINTENT_MIN_LEN ( 2 )
+
+#define DOT11F_TLV_GOINTENT_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvGOIntent(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVGOIntent*);
+
+tANI_U32 dot11fPackTlvGOIntent(tpAniSirGlobal, tDot11fTLVGOIntent*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvGOIntent(tpAniSirGlobal, tDot11fTLVGOIntent*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 9 (0x0009)
+typedef struct sDot11fTLVIntendedP2PInterfaceAddress {
+ tANI_U8 present;
+ tANI_U8 P2PInterfaceAddress[6];
+} tDot11fTLVIntendedP2PInterfaceAddress;
+
+#define DOT11F_TLV_INTENDEDP2PINTERFACEADDRESS ( 9 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_INTENDEDP2PINTERFACEADDRESS_MIN_LEN ( 7 )
+
+#define DOT11F_TLV_INTENDEDP2PINTERFACEADDRESS_MAX_LEN ( 7 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvIntendedP2PInterfaceAddress(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVIntendedP2PInterfaceAddress*);
+
+tANI_U32 dot11fPackTlvIntendedP2PInterfaceAddress(tpAniSirGlobal, tDot11fTLVIntendedP2PInterfaceAddress*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvIntendedP2PInterfaceAddress(tpAniSirGlobal, tDot11fTLVIntendedP2PInterfaceAddress*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 18 (0x0012)
+typedef struct sDot11fTLVInvitationFlags {
+ tANI_U8 present;
+ tANI_U8 invitationFlags;
+} tDot11fTLVInvitationFlags;
+
+#define DOT11F_TLV_INVITATIONFLAGS ( 18 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_INVITATIONFLAGS_MIN_LEN ( 2 )
+
+#define DOT11F_TLV_INVITATIONFLAGS_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvInvitationFlags(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVInvitationFlags*);
+
+tANI_U32 dot11fPackTlvInvitationFlags(tpAniSirGlobal, tDot11fTLVInvitationFlags*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvInvitationFlags(tpAniSirGlobal, tDot11fTLVInvitationFlags*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 6 (0x0006)
+typedef struct sDot11fTLVListenChannel {
+ tANI_U8 present;
+ tANI_U8 countryString[3];
+ tANI_U8 regulatoryClass;
+ tANI_U8 channel;
+} tDot11fTLVListenChannel;
+
+#define DOT11F_TLV_LISTENCHANNEL ( 6 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_LISTENCHANNEL_MIN_LEN ( 6 )
+
+#define DOT11F_TLV_LISTENCHANNEL_MAX_LEN ( 6 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvListenChannel(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVListenChannel*);
+
+tANI_U32 dot11fPackTlvListenChannel(tpAniSirGlobal, tDot11fTLVListenChannel*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvListenChannel(tpAniSirGlobal, tDot11fTLVListenChannel*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4129 (0x1021)
+typedef struct sDot11fTLVManufacturer {
+ tANI_U8 present;
+ tANI_U8 num_name;
+ tANI_U8 name[64];
+} tDot11fTLVManufacturer;
+
+#define DOT11F_TLV_MANUFACTURER ( 4129 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_MANUFACTURER_MIN_LEN ( 2 )
+
+#define DOT11F_TLV_MANUFACTURER_MAX_LEN ( 66 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvManufacturer(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVManufacturer*);
+
+tANI_U32 dot11fPackTlvManufacturer(tpAniSirGlobal, tDot11fTLVManufacturer*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvManufacturer(tpAniSirGlobal, tDot11fTLVManufacturer*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 1 (0x0001)
+typedef struct sDot11fTLVMinorReasonCode {
+ tANI_U8 present;
+ tANI_U8 minorReasonCode;
+} tDot11fTLVMinorReasonCode;
+
+#define DOT11F_TLV_MINORREASONCODE ( 1 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_MINORREASONCODE_MIN_LEN ( 2 )
+
+#define DOT11F_TLV_MINORREASONCODE_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvMinorReasonCode(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVMinorReasonCode*);
+
+tANI_U32 dot11fPackTlvMinorReasonCode(tpAniSirGlobal, tDot11fTLVMinorReasonCode*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvMinorReasonCode(tpAniSirGlobal, tDot11fTLVMinorReasonCode*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4131 (0x1023)
+typedef struct sDot11fTLVModelName {
+ tANI_U8 present;
+ tANI_U8 num_text;
+ tANI_U8 text[32];
+} tDot11fTLVModelName;
+
+#define DOT11F_TLV_MODELNAME ( 4131 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_MODELNAME_MIN_LEN ( 2 )
+
+#define DOT11F_TLV_MODELNAME_MAX_LEN ( 34 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvModelName(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVModelName*);
+
+tANI_U32 dot11fPackTlvModelName(tpAniSirGlobal, tDot11fTLVModelName*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvModelName(tpAniSirGlobal, tDot11fTLVModelName*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4132 (0x1024)
+typedef struct sDot11fTLVModelNumber {
+ tANI_U8 present;
+ tANI_U8 num_text;
+ tANI_U8 text[32];
+} tDot11fTLVModelNumber;
+
+#define DOT11F_TLV_MODELNUMBER ( 4132 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_MODELNUMBER_MIN_LEN ( 2 )
+
+#define DOT11F_TLV_MODELNUMBER_MAX_LEN ( 34 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvModelNumber(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVModelNumber*);
+
+tANI_U32 dot11fPackTlvModelNumber(tpAniSirGlobal, tDot11fTLVModelNumber*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvModelNumber(tpAniSirGlobal, tDot11fTLVModelNumber*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 12 (0x000c)
+typedef struct sDot11fTLVNoticeOfAbsence {
+ tANI_U8 present;
+ tANI_U8 index;
+ tANI_U8 CTSWindowOppPS;
+ tANI_U8 num_NoADesc;
+ tANI_U8 NoADesc[36];
+} tDot11fTLVNoticeOfAbsence;
+
+#define DOT11F_TLV_NOTICEOFABSENCE ( 12 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_NOTICEOFABSENCE_MIN_LEN ( 3 )
+
+#define DOT11F_TLV_NOTICEOFABSENCE_MAX_LEN ( 39 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvNoticeOfAbsence(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVNoticeOfAbsence*);
+
+tANI_U32 dot11fPackTlvNoticeOfAbsence(tpAniSirGlobal, tDot11fTLVNoticeOfAbsence*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvNoticeOfAbsence(tpAniSirGlobal, tDot11fTLVNoticeOfAbsence*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 17 (0x0011)
+typedef struct sDot11fTLVOperatingChannel {
+ tANI_U8 present;
+ tANI_U8 countryString[3];
+ tANI_U8 regulatoryClass;
+ tANI_U8 channel;
+} tDot11fTLVOperatingChannel;
+
+#define DOT11F_TLV_OPERATINGCHANNEL ( 17 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_OPERATINGCHANNEL_MIN_LEN ( 6 )
+
+#define DOT11F_TLV_OPERATINGCHANNEL_MAX_LEN ( 6 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvOperatingChannel(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVOperatingChannel*);
+
+tANI_U32 dot11fPackTlvOperatingChannel(tpAniSirGlobal, tDot11fTLVOperatingChannel*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvOperatingChannel(tpAniSirGlobal, tDot11fTLVOperatingChannel*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 2 (0x0002)
+typedef struct sDot11fTLVP2PCapability {
+ tANI_U8 present;
+ tANI_U8 deviceCapability;
+ tANI_U8 groupCapability;
+} tDot11fTLVP2PCapability;
+
+#define DOT11F_TLV_P2PCAPABILITY ( 2 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_P2PCAPABILITY_MIN_LEN ( 3 )
+
+#define DOT11F_TLV_P2PCAPABILITY_MAX_LEN ( 3 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvP2PCapability(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVP2PCapability*);
+
+tANI_U32 dot11fPackTlvP2PCapability(tpAniSirGlobal, tDot11fTLVP2PCapability*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvP2PCapability(tpAniSirGlobal, tDot11fTLVP2PCapability*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 3 (0x0003)
+typedef struct sDot11fTLVP2PDeviceId {
+ tANI_U8 present;
+ tANI_U8 P2PDeviceAddress[6];
+} tDot11fTLVP2PDeviceId;
+
+#define DOT11F_TLV_P2PDEVICEID ( 3 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_P2PDEVICEID_MIN_LEN ( 7 )
+
+#define DOT11F_TLV_P2PDEVICEID_MAX_LEN ( 7 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvP2PDeviceId(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVP2PDeviceId*);
+
+tANI_U32 dot11fPackTlvP2PDeviceId(tpAniSirGlobal, tDot11fTLVP2PDeviceId*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvP2PDeviceId(tpAniSirGlobal, tDot11fTLVP2PDeviceId*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 13 (0x000d)
+typedef struct sDot11fTLVP2PDeviceInfo {
+ tANI_U8 present;
+ tANI_U8 P2PDeviceAddress[6];
+ tANI_U16 configMethod;
+ tANI_U8 primaryDeviceType[8];
+ tDot11fTLVDeviceName DeviceName;
+} tDot11fTLVP2PDeviceInfo;
+
+#define DOT11F_TLV_P2PDEVICEINFO ( 13 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_P2PDEVICEINFO_MIN_LEN ( 17 )
+
+#define DOT11F_TLV_P2PDEVICEINFO_MAX_LEN ( 53 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvP2PDeviceInfo(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVP2PDeviceInfo*);
+
+tANI_U32 dot11fPackTlvP2PDeviceInfo(tpAniSirGlobal, tDot11fTLVP2PDeviceInfo*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvP2PDeviceInfo(tpAniSirGlobal, tDot11fTLVP2PDeviceInfo*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 7 (0x0007)
+typedef struct sDot11fTLVP2PGroupBssid {
+ tANI_U8 present;
+ tANI_U8 P2PGroupBssid[6];
+} tDot11fTLVP2PGroupBssid;
+
+#define DOT11F_TLV_P2PGROUPBSSID ( 7 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_P2PGROUPBSSID_MIN_LEN ( 7 )
+
+#define DOT11F_TLV_P2PGROUPBSSID_MAX_LEN ( 7 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvP2PGroupBssid(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVP2PGroupBssid*);
+
+tANI_U32 dot11fPackTlvP2PGroupBssid(tpAniSirGlobal, tDot11fTLVP2PGroupBssid*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvP2PGroupBssid(tpAniSirGlobal, tDot11fTLVP2PGroupBssid*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 15 (0x000f)
+typedef struct sDot11fTLVP2PGroupId {
+ tANI_U8 present;
+ tANI_U8 deviceAddress[6];
+ tANI_U8 num_ssid;
+ tANI_U8 ssid[32];
+} tDot11fTLVP2PGroupId;
+
+#define DOT11F_TLV_P2PGROUPID ( 15 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_P2PGROUPID_MIN_LEN ( 7 )
+
+#define DOT11F_TLV_P2PGROUPID_MAX_LEN ( 39 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvP2PGroupId(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVP2PGroupId*);
+
+tANI_U32 dot11fPackTlvP2PGroupId(tpAniSirGlobal, tDot11fTLVP2PGroupId*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvP2PGroupId(tpAniSirGlobal, tDot11fTLVP2PGroupId*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 14 (0x000e)
+typedef struct sDot11fTLVP2PGroupInfo {
+ tANI_U8 present;
+ tANI_U8 num_P2PClientInfoDesc;
+ tANI_U8 P2PClientInfoDesc[1024];
+} tDot11fTLVP2PGroupInfo;
+
+#define DOT11F_TLV_P2PGROUPINFO ( 14 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_P2PGROUPINFO_MIN_LEN ( 1 )
+
+#define DOT11F_TLV_P2PGROUPINFO_MAX_LEN ( 1025 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvP2PGroupInfo(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVP2PGroupInfo*);
+
+tANI_U32 dot11fPackTlvP2PGroupInfo(tpAniSirGlobal, tDot11fTLVP2PGroupInfo*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvP2PGroupInfo(tpAniSirGlobal, tDot11fTLVP2PGroupInfo*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 0 (0x0000)
+typedef struct sDot11fTLVP2PStatus {
+ tANI_U8 present;
+ tANI_U8 status;
+} tDot11fTLVP2PStatus;
+
+#define DOT11F_TLV_P2PSTATUS ( 0 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_P2PSTATUS_MIN_LEN ( 2 )
+
+#define DOT11F_TLV_P2PSTATUS_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvP2PStatus(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVP2PStatus*);
+
+tANI_U32 dot11fPackTlvP2PStatus(tpAniSirGlobal, tDot11fTLVP2PStatus*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvP2PStatus(tpAniSirGlobal, tDot11fTLVP2PStatus*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4180 (0x1054)
+typedef struct sDot11fTLVPrimaryDeviceType {
+ tANI_U8 present;
+ tANI_U16 primary_category;
+ tANI_U8 oui[4];
+ tANI_U16 sub_category;
+} tDot11fTLVPrimaryDeviceType;
+
+#define DOT11F_TLV_PRIMARYDEVICETYPE ( 4180 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_PRIMARYDEVICETYPE_MIN_LEN ( 10 )
+
+#define DOT11F_TLV_PRIMARYDEVICETYPE_MAX_LEN ( 10 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvPrimaryDeviceType(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVPrimaryDeviceType*);
+
+tANI_U32 dot11fPackTlvPrimaryDeviceType(tpAniSirGlobal, tDot11fTLVPrimaryDeviceType*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvPrimaryDeviceType(tpAniSirGlobal, tDot11fTLVPrimaryDeviceType*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4156 (0x103c)
+typedef struct sDot11fTLVRFBands {
+ tANI_U8 present;
+ tANI_U8 bands;
+} tDot11fTLVRFBands;
+
+#define DOT11F_TLV_RFBANDS ( 4156 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_RFBANDS_MIN_LEN ( 3 )
+
+#define DOT11F_TLV_RFBANDS_MAX_LEN ( 3 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvRFBands(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVRFBands*);
+
+tANI_U32 dot11fPackTlvRFBands(tpAniSirGlobal, tDot11fTLVRFBands*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvRFBands(tpAniSirGlobal, tDot11fTLVRFBands*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4202 (0x106a)
+typedef struct sDot11fTLVRequestDeviceType {
+ tANI_U8 present;
+ tANI_U16 primary_category;
+ tANI_U8 oui[4];
+ tANI_U16 sub_category;
+} tDot11fTLVRequestDeviceType;
+
+#define DOT11F_TLV_REQUESTDEVICETYPE ( 4202 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_REQUESTDEVICETYPE_MIN_LEN ( 10 )
+
+#define DOT11F_TLV_REQUESTDEVICETYPE_MAX_LEN ( 10 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvRequestDeviceType(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVRequestDeviceType*);
+
+tANI_U32 dot11fPackTlvRequestDeviceType(tpAniSirGlobal, tDot11fTLVRequestDeviceType*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvRequestDeviceType(tpAniSirGlobal, tDot11fTLVRequestDeviceType*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4154 (0x103a)
+typedef struct sDot11fTLVRequestType {
+ tANI_U8 present;
+ tANI_U8 reqType;
+} tDot11fTLVRequestType;
+
+#define DOT11F_TLV_REQUESTTYPE ( 4154 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_REQUESTTYPE_MIN_LEN ( 3 )
+
+#define DOT11F_TLV_REQUESTTYPE_MAX_LEN ( 3 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvRequestType(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVRequestType*);
+
+tANI_U32 dot11fPackTlvRequestType(tpAniSirGlobal, tDot11fTLVRequestType*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvRequestType(tpAniSirGlobal, tDot11fTLVRequestType*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4155 (0x103b)
+typedef struct sDot11fTLVResponseType {
+ tANI_U8 present;
+ tANI_U8 resType;
+} tDot11fTLVResponseType;
+
+#define DOT11F_TLV_RESPONSETYPE ( 4155 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_RESPONSETYPE_MIN_LEN ( 3 )
+
+#define DOT11F_TLV_RESPONSETYPE_MAX_LEN ( 3 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvResponseType(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVResponseType*);
+
+tANI_U32 dot11fPackTlvResponseType(tpAniSirGlobal, tDot11fTLVResponseType*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvResponseType(tpAniSirGlobal, tDot11fTLVResponseType*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4161 (0x1041)
+typedef struct sDot11fTLVSelectedRegistrar {
+ tANI_U8 present;
+ tANI_U8 selected;
+} tDot11fTLVSelectedRegistrar;
+
+#define DOT11F_TLV_SELECTEDREGISTRAR ( 4161 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_SELECTEDREGISTRAR_MIN_LEN ( 3 )
+
+#define DOT11F_TLV_SELECTEDREGISTRAR_MAX_LEN ( 3 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvSelectedRegistrar(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVSelectedRegistrar*);
+
+tANI_U32 dot11fPackTlvSelectedRegistrar(tpAniSirGlobal, tDot11fTLVSelectedRegistrar*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvSelectedRegistrar(tpAniSirGlobal, tDot11fTLVSelectedRegistrar*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4179 (0x1053)
+typedef struct sDot11fTLVSelectedRegistrarConfigMethods {
+ tANI_U8 present;
+ tANI_U16 methods;
+} tDot11fTLVSelectedRegistrarConfigMethods;
+
+#define DOT11F_TLV_SELECTEDREGISTRARCONFIGMETHODS ( 4179 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_SELECTEDREGISTRARCONFIGMETHODS_MIN_LEN ( 4 )
+
+#define DOT11F_TLV_SELECTEDREGISTRARCONFIGMETHODS_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvSelectedRegistrarConfigMethods(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVSelectedRegistrarConfigMethods*);
+
+tANI_U32 dot11fPackTlvSelectedRegistrarConfigMethods(tpAniSirGlobal, tDot11fTLVSelectedRegistrarConfigMethods*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvSelectedRegistrarConfigMethods(tpAniSirGlobal, tDot11fTLVSelectedRegistrarConfigMethods*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4162 (0x1042)
+typedef struct sDot11fTLVSerialNumber {
+ tANI_U8 present;
+ tANI_U8 num_text;
+ tANI_U8 text[32];
+} tDot11fTLVSerialNumber;
+
+#define DOT11F_TLV_SERIALNUMBER ( 4162 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_SERIALNUMBER_MIN_LEN ( 2 )
+
+#define DOT11F_TLV_SERIALNUMBER_MAX_LEN ( 34 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvSerialNumber(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVSerialNumber*);
+
+tANI_U32 dot11fPackTlvSerialNumber(tpAniSirGlobal, tDot11fTLVSerialNumber*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvSerialNumber(tpAniSirGlobal, tDot11fTLVSerialNumber*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4167 (0x1047)
+typedef struct sDot11fTLVUUID_E {
+ tANI_U8 present;
+ tANI_U8 uuid[16];
+} tDot11fTLVUUID_E;
+
+#define DOT11F_TLV_UUID_E ( 4167 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_UUID_E_MIN_LEN ( 18 )
+
+#define DOT11F_TLV_UUID_E_MAX_LEN ( 18 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvUUID_E(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVUUID_E*);
+
+tANI_U32 dot11fPackTlvUUID_E(tpAniSirGlobal, tDot11fTLVUUID_E*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvUUID_E(tpAniSirGlobal, tDot11fTLVUUID_E*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4168 (0x1048)
+typedef struct sDot11fTLVUUID_R {
+ tANI_U8 present;
+ tANI_U8 uuid[16];
+} tDot11fTLVUUID_R;
+
+#define DOT11F_TLV_UUID_R ( 4168 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_UUID_R_MIN_LEN ( 18 )
+
+#define DOT11F_TLV_UUID_R_MAX_LEN ( 18 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvUUID_R(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVUUID_R*);
+
+tANI_U32 dot11fPackTlvUUID_R(tpAniSirGlobal, tDot11fTLVUUID_R*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvUUID_R(tpAniSirGlobal, tDot11fTLVUUID_R*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4169 (0x1049)
+typedef struct sDot11fTLVVendorExtension {
+ tANI_U8 present;
+ tANI_U8 vendorId[3];
+ tDot11fTLVVersion2 Version2;
+ tDot11fTLVAuthorizedMACs AuthorizedMACs;
+ tDot11fTLVRequestToEnroll RequestToEnroll;
+} tDot11fTLVVendorExtension;
+
+#define DOT11F_TLV_VENDOREXTENSION ( 4169 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_VENDOREXTENSION_MIN_LEN ( 5 )
+
+#define DOT11F_TLV_VENDOREXTENSION_MAX_LEN ( 19 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvVendorExtension(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVVendorExtension*);
+
+tANI_U32 dot11fPackTlvVendorExtension(tpAniSirGlobal, tDot11fTLVVendorExtension*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvVendorExtension(tpAniSirGlobal, tDot11fTLVVendorExtension*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4170 (0x104a)
+typedef struct sDot11fTLVVersion {
+ tANI_U8 present;
+ tANI_U8 minor: 4;
+ tANI_U8 major: 4;
+} tDot11fTLVVersion;
+
+#define DOT11F_TLV_VERSION ( 4170 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_VERSION_MIN_LEN ( 3 )
+
+#define DOT11F_TLV_VERSION_MAX_LEN ( 3 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvVersion(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVVersion*);
+
+tANI_U32 dot11fPackTlvVersion(tpAniSirGlobal, tDot11fTLVVersion*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvVersion(tpAniSirGlobal, tDot11fTLVVersion*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4164 (0x1044)
+typedef struct sDot11fTLVWPSState {
+ tANI_U8 present;
+ tANI_U8 state;
+} tDot11fTLVWPSState;
+
+#define DOT11F_TLV_WPSSTATE ( 4164 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_WPSSTATE_MIN_LEN ( 3 )
+
+#define DOT11F_TLV_WPSSTATE_MAX_LEN ( 3 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvWPSState(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVWPSState*);
+
+tANI_U32 dot11fPackTlvWPSState(tpAniSirGlobal, tDot11fTLVWPSState*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvWPSState(tpAniSirGlobal, tDot11fTLVWPSState*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 16 (0x0010)
+typedef struct sDot11fTLVP2PInterface {
+ tANI_U8 present;
+ tANI_U8 P2PDeviceAddress[6];
+} tDot11fTLVP2PInterface;
+
+#define DOT11F_TLV_P2PINTERFACE ( 16 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_P2PINTERFACE_MIN_LEN ( 7 )
+
+#define DOT11F_TLV_P2PINTERFACE_MAX_LEN ( 7 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvP2PInterface(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVP2PInterface*);
+
+tANI_U32 dot11fPackTlvP2PInterface(tpAniSirGlobal, tDot11fTLVP2PInterface*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvP2PInterface(tpAniSirGlobal, tDot11fTLVP2PInterface*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 10 (0x000a)
+typedef struct sDot11fTLVP2PManageability {
+ tANI_U8 present;
+ tANI_U8 manageability;
+} tDot11fTLVP2PManageability;
+
+#define DOT11F_TLV_P2PMANAGEABILITY ( 10 )
+
+// N.B. These #defines do *not* include the ID & length
+#define DOT11F_TLV_P2PMANAGEABILITY_MIN_LEN ( 2 )
+
+#define DOT11F_TLV_P2PMANAGEABILITY_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackTlvP2PManageability(tpAniSirGlobal, tANI_U8*,tANI_U16, tDot11fTLVP2PManageability*);
+
+tANI_U32 dot11fPackTlvP2PManageability(tpAniSirGlobal, tDot11fTLVP2PManageability*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedTlvP2PManageability(tpAniSirGlobal, tDot11fTLVP2PManageability*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+/*********************************************************************
+ * Information Elements *
+ ********************************************************************/
+
+// EID 1 (0x01)
+typedef struct sDot11fIEAPName {
+ tANI_U8 present;
+ tANI_U8 num_name;
+ tANI_U8 name[32];
+} tDot11fIEAPName;
+
+#define DOT11F_EID_APNAME ( 1 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_APNAME_MIN_LEN ( 1 )
+
+#define DOT11F_IE_APNAME_MAX_LEN ( 32 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeAPName(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEAPName*);
+
+tANI_U32 dot11fPackIeAPName(tpAniSirGlobal, tDot11fIEAPName*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEAPName(tpAniSirGlobal, tDot11fIEAPName*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 4 (0x04)
+typedef struct sDot11fIEBPIndicator {
+ tANI_U8 present;
+ tANI_U8 indicator;
+ tANI_U8 type;
+} tDot11fIEBPIndicator;
+
+#define DOT11F_EID_BPINDICATOR ( 4 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_BPINDICATOR_MIN_LEN ( 2 )
+
+#define DOT11F_IE_BPINDICATOR_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeBPIndicator(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEBPIndicator*);
+
+tANI_U32 dot11fPackIeBPIndicator(tpAniSirGlobal, tDot11fIEBPIndicator*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEBPIndicator(tpAniSirGlobal, tDot11fIEBPIndicator*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 2 (0x02)
+typedef struct sDot11fIECondensedCountryStr {
+ tANI_U8 present;
+ tANI_U8 countryStr[2];
+} tDot11fIECondensedCountryStr;
+
+#define DOT11F_EID_CONDENSEDCOUNTRYSTR ( 2 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_CONDENSEDCOUNTRYSTR_MIN_LEN ( 2 )
+
+#define DOT11F_IE_CONDENSEDCOUNTRYSTR_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeCondensedCountryStr(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIECondensedCountryStr*);
+
+tANI_U32 dot11fPackIeCondensedCountryStr(tpAniSirGlobal, tDot11fIECondensedCountryStr*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIECondensedCountryStr(tpAniSirGlobal, tDot11fIECondensedCountryStr*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 2 (0x02)
+typedef struct sDot11fIEGTK {
+ tANI_U8 present;
+ tANI_U16 keyId: 2;
+ tANI_U16 reserved: 14;
+ tANI_U8 keyLength;
+ tANI_U8 RSC[8];
+ tANI_U8 num_key;
+ tANI_U8 key[32];
+} tDot11fIEGTK;
+
+#define DOT11F_EID_GTK ( 2 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_GTK_MIN_LEN ( 16 )
+
+#define DOT11F_IE_GTK_MAX_LEN ( 43 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeGTK(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEGTK*);
+
+tANI_U32 dot11fPackIeGTK(tpAniSirGlobal, tDot11fIEGTK*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEGTK(tpAniSirGlobal, tDot11fIEGTK*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 2 (0x02)
+typedef struct sDot11fIEHCF {
+ tANI_U8 present;
+ tANI_U8 enabled;
+} tDot11fIEHCF;
+
+#define DOT11F_EID_HCF ( 2 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_HCF_MIN_LEN ( 1 )
+
+#define DOT11F_IE_HCF_MAX_LEN ( 1 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeHCF(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEHCF*);
+
+tANI_U32 dot11fPackIeHCF(tpAniSirGlobal, tDot11fIEHCF*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEHCF(tpAniSirGlobal, tDot11fIEHCF*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 9 (0x09)
+typedef struct sDot11fIELLAttr {
+ tANI_U8 present;
+ tANI_U32 defer_threshold;
+} tDot11fIELLAttr;
+
+#define DOT11F_EID_LLATTR ( 9 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_LLATTR_MIN_LEN ( 4 )
+
+#define DOT11F_IE_LLATTR_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeLLAttr(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIELLAttr*);
+
+tANI_U32 dot11fPackIeLLAttr(tpAniSirGlobal, tDot11fIELLAttr*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIELLAttr(tpAniSirGlobal, tDot11fIELLAttr*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 8 (0x08)
+typedef struct sDot11fIELoadBalance {
+ tANI_U8 present;
+ tANI_U8 bssid[6];
+ tANI_U8 channel;
+} tDot11fIELoadBalance;
+
+#define DOT11F_EID_LOADBALANCE ( 8 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_LOADBALANCE_MIN_LEN ( 7 )
+
+#define DOT11F_IE_LOADBALANCE_MAX_LEN ( 7 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeLoadBalance(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIELoadBalance*);
+
+tANI_U32 dot11fPackIeLoadBalance(tpAniSirGlobal, tDot11fIELoadBalance*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIELoadBalance(tpAniSirGlobal, tDot11fIELoadBalance*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 6 (0x06)
+typedef struct sDot11fIELoadInfo {
+ tANI_U8 present;
+ tANI_U16 num_stas;
+ tANI_U16 channel_util;
+} tDot11fIELoadInfo;
+
+#define DOT11F_EID_LOADINFO ( 6 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_LOADINFO_MIN_LEN ( 4 )
+
+#define DOT11F_IE_LOADINFO_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeLoadInfo(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIELoadInfo*);
+
+tANI_U32 dot11fPackIeLoadInfo(tpAniSirGlobal, tDot11fIELoadInfo*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIELoadInfo(tpAniSirGlobal, tDot11fIELoadInfo*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 7 (0x07)
+typedef struct sDot11fIEPropAssocType {
+ tANI_U8 present;
+ tANI_U8 type;
+} tDot11fIEPropAssocType;
+
+#define DOT11F_EID_PROPASSOCTYPE ( 7 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_PROPASSOCTYPE_MIN_LEN ( 1 )
+
+#define DOT11F_IE_PROPASSOCTYPE_MAX_LEN ( 1 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIePropAssocType(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEPropAssocType*);
+
+tANI_U32 dot11fPackIePropAssocType(tpAniSirGlobal, tDot11fIEPropAssocType*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEPropAssocType(tpAniSirGlobal, tDot11fIEPropAssocType*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 10 (0x0a)
+typedef struct sDot11fIEPropCapability {
+ tANI_U8 present;
+ tANI_U16 capability;
+} tDot11fIEPropCapability;
+
+#define DOT11F_EID_PROPCAPABILITY ( 10 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_PROPCAPABILITY_MIN_LEN ( 2 )
+
+#define DOT11F_IE_PROPCAPABILITY_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIePropCapability(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEPropCapability*);
+
+tANI_U32 dot11fPackIePropCapability(tpAniSirGlobal, tDot11fIEPropCapability*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEPropCapability(tpAniSirGlobal, tDot11fIEPropCapability*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 15 (0x0f)
+typedef struct sDot11fIEPropChannSwitchAnn {
+ tANI_U8 present;
+ tANI_U8 mode;
+ tANI_U8 primary_channel;
+ tANI_U8 sub_band;
+ tANI_U8 channel_switch_count;
+} tDot11fIEPropChannSwitchAnn;
+
+#define DOT11F_EID_PROPCHANNSWITCHANN ( 15 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_PROPCHANNSWITCHANN_MIN_LEN ( 4 )
+
+#define DOT11F_IE_PROPCHANNSWITCHANN_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIePropChannSwitchAnn(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEPropChannSwitchAnn*);
+
+tANI_U32 dot11fPackIePropChannSwitchAnn(tpAniSirGlobal, tDot11fIEPropChannSwitchAnn*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEPropChannSwitchAnn(tpAniSirGlobal, tDot11fIEPropChannSwitchAnn*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 12 (0x0c)
+typedef struct sDot11fIEPropEDCAParams {
+ tANI_U8 present;
+ tANI_U8 qos;
+ tANI_U8 reserved;
+ tANI_U8 acbe_aifsn: 4;
+ tANI_U8 acbe_acm: 1;
+ tANI_U8 acbe_aci: 2;
+ tANI_U8 unused1: 1;
+ tANI_U8 acbe_min: 4;
+ tANI_U8 acbe_max: 4;
+ tANI_U16 acbe_txoplimit;
+ tANI_U8 acbk_aifsn: 4;
+ tANI_U8 acbk_acm: 1;
+ tANI_U8 acbk_aci: 2;
+ tANI_U8 unused2: 1;
+ tANI_U8 acbk_min: 4;
+ tANI_U8 acbk_max: 4;
+ tANI_U16 acbk_txoplimit;
+ tANI_U8 acvi_aifsn: 4;
+ tANI_U8 acvi_acm: 1;
+ tANI_U8 acvi_aci: 2;
+ tANI_U8 unused3: 1;
+ tANI_U8 acvi_min: 4;
+ tANI_U8 acvi_max: 4;
+ tANI_U16 acvi_txoplimit;
+ tANI_U8 acvo_aifsn: 4;
+ tANI_U8 acvo_acm: 1;
+ tANI_U8 acvo_aci: 2;
+ tANI_U8 unused4: 1;
+ tANI_U8 acvo_min: 4;
+ tANI_U8 acvo_max: 4;
+ tANI_U16 acvo_txoplimit;
+} tDot11fIEPropEDCAParams;
+
+#define DOT11F_EID_PROPEDCAPARAMS ( 12 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_PROPEDCAPARAMS_MIN_LEN ( 18 )
+
+#define DOT11F_IE_PROPEDCAPARAMS_MAX_LEN ( 18 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIePropEDCAParams(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEPropEDCAParams*);
+
+tANI_U32 dot11fPackIePropEDCAParams(tpAniSirGlobal, tDot11fIEPropEDCAParams*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEPropEDCAParams(tpAniSirGlobal, tDot11fIEPropEDCAParams*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 16 (0x10)
+typedef struct sDot11fIEPropQuietBSS {
+ tANI_U8 present;
+ tANI_U8 quiet_count;
+ tANI_U8 quiet_period;
+ tANI_U16 quiet_duration;
+ tANI_U16 quiet_offset;
+} tDot11fIEPropQuietBSS;
+
+#define DOT11F_EID_PROPQUIETBSS ( 16 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_PROPQUIETBSS_MIN_LEN ( 6 )
+
+#define DOT11F_IE_PROPQUIETBSS_MAX_LEN ( 6 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIePropQuietBSS(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEPropQuietBSS*);
+
+tANI_U32 dot11fPackIePropQuietBSS(tpAniSirGlobal, tDot11fIEPropQuietBSS*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEPropQuietBSS(tpAniSirGlobal, tDot11fIEPropQuietBSS*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 0 (0x00)
+typedef struct sDot11fIEPropSuppRates {
+ tANI_U8 present;
+ tANI_U8 num_rates;
+ tANI_U8 rates[12];
+} tDot11fIEPropSuppRates;
+
+#define DOT11F_EID_PROPSUPPRATES ( 0 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_PROPSUPPRATES_MIN_LEN ( 1 )
+
+#define DOT11F_IE_PROPSUPPRATES_MAX_LEN ( 12 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIePropSuppRates(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEPropSuppRates*);
+
+tANI_U32 dot11fPackIePropSuppRates(tpAniSirGlobal, tDot11fIEPropSuppRates*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEPropSuppRates(tpAniSirGlobal, tDot11fIEPropSuppRates*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 3 (0x03)
+typedef struct sDot11fIER0KH_ID {
+ tANI_U8 present;
+ tANI_U8 num_PMK_R0_ID;
+ tANI_U8 PMK_R0_ID[48];
+} tDot11fIER0KH_ID;
+
+#define DOT11F_EID_R0KH_ID ( 3 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_R0KH_ID_MIN_LEN ( 1 )
+
+#define DOT11F_IE_R0KH_ID_MAX_LEN ( 48 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeR0KH_ID(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIER0KH_ID*);
+
+tANI_U32 dot11fPackIeR0KH_ID(tpAniSirGlobal, tDot11fIER0KH_ID*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIER0KH_ID(tpAniSirGlobal, tDot11fIER0KH_ID*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 1 (0x01)
+typedef struct sDot11fIER1KH_ID {
+ tANI_U8 present;
+ tANI_U8 PMK_R1_ID[6];
+} tDot11fIER1KH_ID;
+
+#define DOT11F_EID_R1KH_ID ( 1 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_R1KH_ID_MIN_LEN ( 6 )
+
+#define DOT11F_IE_R1KH_ID_MAX_LEN ( 6 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeR1KH_ID(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIER1KH_ID*);
+
+tANI_U32 dot11fPackIeR1KH_ID(tpAniSirGlobal, tDot11fIER1KH_ID*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIER1KH_ID(tpAniSirGlobal, tDot11fIER1KH_ID*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 1 (0x01)
+typedef struct sDot11fIETSFInfo {
+ tANI_U8 present;
+ tANI_U16 TsfOffset;
+ tANI_U16 BeaconIntvl;
+} tDot11fIETSFInfo;
+
+#define DOT11F_EID_TSFINFO ( 1 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_TSFINFO_MIN_LEN ( 4 )
+
+#define DOT11F_IE_TSFINFO_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeTSFInfo(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIETSFInfo*);
+
+tANI_U32 dot11fPackIeTSFInfo(tpAniSirGlobal, tDot11fIETSFInfo*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIETSFInfo(tpAniSirGlobal, tDot11fIETSFInfo*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 18 (0x12)
+typedef struct sDot11fIETaurus {
+ tANI_U8 present;
+ tANI_U16 baTIDBitmap;
+ tANI_U16 baPolicy;
+ tANI_U16 baBufferSize: 12;
+ tANI_U16 rsvd: 4;
+} tDot11fIETaurus;
+
+#define DOT11F_EID_TAURUS ( 18 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_TAURUS_MIN_LEN ( 6 )
+
+#define DOT11F_IE_TAURUS_MAX_LEN ( 6 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeTaurus(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIETaurus*);
+
+tANI_U32 dot11fPackIeTaurus(tpAniSirGlobal, tDot11fIETaurus*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIETaurus(tpAniSirGlobal, tDot11fIETaurus*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 14 (0x0e)
+typedef struct sDot11fIETitan {
+ tANI_U8 present;
+ tANI_U8 concat_tcid_bitmap;
+ tANI_U8 compression_tcid_bitmap;
+ tANI_U8 cb_state;
+ tANI_U8 rev_fcs_state;
+} tDot11fIETitan;
+
+#define DOT11F_EID_TITAN ( 14 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_TITAN_MIN_LEN ( 4 )
+
+#define DOT11F_IE_TITAN_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeTitan(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIETitan*);
+
+tANI_U32 dot11fPackIeTitan(tpAniSirGlobal, tDot11fIETitan*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIETitan(tpAniSirGlobal, tDot11fIETitan*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 17 (0x11)
+typedef struct sDot11fIETriggerStaBgScan {
+ tANI_U8 present;
+ tANI_U8 enable;
+} tDot11fIETriggerStaBgScan;
+
+#define DOT11F_EID_TRIGGERSTABGSCAN ( 17 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_TRIGGERSTABGSCAN_MIN_LEN ( 1 )
+
+#define DOT11F_IE_TRIGGERSTABGSCAN_MAX_LEN ( 1 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeTriggerStaBgScan(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIETriggerStaBgScan*);
+
+tANI_U32 dot11fPackIeTriggerStaBgScan(tpAniSirGlobal, tDot11fIETriggerStaBgScan*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIETriggerStaBgScan(tpAniSirGlobal, tDot11fIETriggerStaBgScan*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 11 (0x0b)
+typedef struct sDot11fIEVersion {
+ tANI_U8 present;
+ tANI_U32 chip_rev;
+ tANI_U8 card_type;
+ tANI_U8 num_build_version;
+ tANI_U8 build_version[20];
+} tDot11fIEVersion;
+
+#define DOT11F_EID_VERSION ( 11 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_VERSION_MIN_LEN ( 5 )
+
+#define DOT11F_IE_VERSION_MAX_LEN ( 25 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeVersion(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEVersion*);
+
+tANI_U32 dot11fPackIeVersion(tpAniSirGlobal, tDot11fIEVersion*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEVersion(tpAniSirGlobal, tDot11fIEVersion*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 3 (0x03)
+typedef struct sDot11fIEWDS {
+ tANI_U8 present;
+ tANI_U8 num_wdsData;
+ tANI_U8 wdsData[64];
+} tDot11fIEWDS;
+
+#define DOT11F_EID_WDS ( 3 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WDS_MIN_LEN ( 0 )
+
+#define DOT11F_IE_WDS_MAX_LEN ( 64 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWDS(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWDS*);
+
+tANI_U32 dot11fPackIeWDS(tpAniSirGlobal, tDot11fIEWDS*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWDS(tpAniSirGlobal, tDot11fIEWDS*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 51 (0x33)
+typedef struct sDot11fIEAPChannelReport {
+ tANI_U8 present;
+ tANI_U8 regulatoryClass;
+ tANI_U8 num_channelList;
+ tANI_U8 channelList[50];
+} tDot11fIEAPChannelReport;
+
+#define DOT11F_EID_APCHANNELREPORT ( 51 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_APCHANNELREPORT_MIN_LEN ( 1 )
+
+#define DOT11F_IE_APCHANNELREPORT_MAX_LEN ( 51 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeAPChannelReport(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEAPChannelReport*);
+
+tANI_U32 dot11fPackIeAPChannelReport(tpAniSirGlobal, tDot11fIEAPChannelReport*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEAPChannelReport(tpAniSirGlobal, tDot11fIEAPChannelReport*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 2 (0x02)
+typedef struct sDot11fIEBcnReportingDetail {
+ tANI_U8 present;
+ tANI_U8 reportingDetail;
+} tDot11fIEBcnReportingDetail;
+
+#define DOT11F_EID_BCNREPORTINGDETAIL ( 2 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_BCNREPORTINGDETAIL_MIN_LEN ( 1 )
+
+#define DOT11F_IE_BCNREPORTINGDETAIL_MAX_LEN ( 1 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeBcnReportingDetail(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEBcnReportingDetail*);
+
+tANI_U32 dot11fPackIeBcnReportingDetail(tpAniSirGlobal, tDot11fIEBcnReportingDetail*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEBcnReportingDetail(tpAniSirGlobal, tDot11fIEBcnReportingDetail*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 1 (0x01)
+typedef struct sDot11fIEBeaconReportFrmBody {
+ tANI_U8 present;
+ tANI_U8 num_reportedFields;
+ tANI_U8 reportedFields[224];
+} tDot11fIEBeaconReportFrmBody;
+
+#define DOT11F_EID_BEACONREPORTFRMBODY ( 1 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_BEACONREPORTFRMBODY_MIN_LEN ( 0 )
+
+#define DOT11F_IE_BEACONREPORTFRMBODY_MAX_LEN ( 224 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeBeaconReportFrmBody(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEBeaconReportFrmBody*);
+
+tANI_U32 dot11fPackIeBeaconReportFrmBody(tpAniSirGlobal, tDot11fIEBeaconReportFrmBody*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEBeaconReportFrmBody(tpAniSirGlobal, tDot11fIEBeaconReportFrmBody*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 1 (0x01)
+typedef struct sDot11fIEBeaconReporting {
+ tANI_U8 present;
+ tANI_U8 reportingCondition;
+ tANI_U8 threshold;
+} tDot11fIEBeaconReporting;
+
+#define DOT11F_EID_BEACONREPORTING ( 1 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_BEACONREPORTING_MIN_LEN ( 2 )
+
+#define DOT11F_IE_BEACONREPORTING_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeBeaconReporting(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEBeaconReporting*);
+
+tANI_U32 dot11fPackIeBeaconReporting(tpAniSirGlobal, tDot11fIEBeaconReporting*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEBeaconReporting(tpAniSirGlobal, tDot11fIEBeaconReporting*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 66 (0x42)
+typedef struct sDot11fIEMeasurementPilot {
+ tANI_U8 present;
+ tANI_U8 measurementPilot;
+ tANI_U8 num_vendorSpecific;
+ tANI_U8 vendorSpecific[255];
+} tDot11fIEMeasurementPilot;
+
+#define DOT11F_EID_MEASUREMENTPILOT ( 66 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_MEASUREMENTPILOT_MIN_LEN ( 1 )
+
+#define DOT11F_IE_MEASUREMENTPILOT_MAX_LEN ( 256 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeMeasurementPilot(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEMeasurementPilot*);
+
+tANI_U32 dot11fPackIeMeasurementPilot(tpAniSirGlobal, tDot11fIEMeasurementPilot*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEMeasurementPilot(tpAniSirGlobal, tDot11fIEMeasurementPilot*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 71 (0x47)
+typedef struct sDot11fIEMultiBssid {
+ tANI_U8 present;
+ tANI_U8 maxBSSIDIndicator;
+ tANI_U8 num_vendorSpecific;
+ tANI_U8 vendorSpecific[255];
+} tDot11fIEMultiBssid;
+
+#define DOT11F_EID_MULTIBSSID ( 71 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_MULTIBSSID_MIN_LEN ( 1 )
+
+#define DOT11F_IE_MULTIBSSID_MAX_LEN ( 256 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeMultiBssid(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEMultiBssid*);
+
+tANI_U32 dot11fPackIeMultiBssid(tpAniSirGlobal, tDot11fIEMultiBssid*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEMultiBssid(tpAniSirGlobal, tDot11fIEMultiBssid*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 57 (0x39)
+typedef struct sDot11fIERICData {
+ tANI_U8 present;
+ tANI_U8 Identifier;
+ tANI_U8 resourceDescCount;
+ tANI_U16 statusCode;
+} tDot11fIERICData;
+
+#define DOT11F_EID_RICDATA ( 57 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_RICDATA_MIN_LEN ( 4 )
+
+#define DOT11F_IE_RICDATA_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeRICData(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIERICData*);
+
+tANI_U32 dot11fPackIeRICData(tpAniSirGlobal, tDot11fIERICData*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIERICData(tpAniSirGlobal, tDot11fIERICData*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 75 (0x4b)
+typedef struct sDot11fIERICDescriptor {
+ tANI_U8 present;
+ tANI_U8 resourceType;
+ tANI_U8 num_variableData;
+ tANI_U8 variableData[255];
+} tDot11fIERICDescriptor;
+
+#define DOT11F_EID_RICDESCRIPTOR ( 75 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_RICDESCRIPTOR_MIN_LEN ( 1 )
+
+#define DOT11F_IE_RICDESCRIPTOR_MAX_LEN ( 256 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeRICDescriptor(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIERICDescriptor*);
+
+tANI_U32 dot11fPackIeRICDescriptor(tpAniSirGlobal, tDot11fIERICDescriptor*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIERICDescriptor(tpAniSirGlobal, tDot11fIERICDescriptor*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 70 (0x46)
+typedef struct sDot11fIERRMEnabledCap {
+ tANI_U8 present;
+ tANI_U8 LinkMeasurement: 1;
+ tANI_U8 NeighborRpt: 1;
+ tANI_U8 parallel: 1;
+ tANI_U8 repeated: 1;
+ tANI_U8 BeaconPassive: 1;
+ tANI_U8 BeaconActive: 1;
+ tANI_U8 BeaconTable: 1;
+ tANI_U8 BeaconRepCond: 1;
+ tANI_U8 FrameMeasurement: 1;
+ tANI_U8 ChannelLoad: 1;
+ tANI_U8 NoiseHistogram: 1;
+ tANI_U8 statistics: 1;
+ tANI_U8 LCIMeasurement: 1;
+ tANI_U8 LCIAzimuth: 1;
+ tANI_U8 TCMCapability: 1;
+ tANI_U8 triggeredTCM: 1;
+ tANI_U8 APChanReport: 1;
+ tANI_U8 RRMMIBEnabled: 1;
+ tANI_U8 operatingChanMax: 3;
+ tANI_U8 nonOperatinChanMax: 3;
+ tANI_U8 MeasurementPilot: 3;
+ tANI_U8 MeasurementPilotEnabled: 1;
+ tANI_U8 NeighborTSFOffset: 1;
+ tANI_U8 RCPIMeasurement: 1;
+ tANI_U8 RSNIMeasurement: 1;
+ tANI_U8 BssAvgAccessDelay: 1;
+ tANI_U8 BSSAvailAdmission: 1;
+ tANI_U8 AntennaInformation: 1;
+ tANI_U8 reserved: 6;
+} tDot11fIERRMEnabledCap;
+
+#define DOT11F_EID_RRMENABLEDCAP ( 70 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_RRMENABLEDCAP_MIN_LEN ( 5 )
+
+#define DOT11F_IE_RRMENABLEDCAP_MAX_LEN ( 5 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeRRMEnabledCap(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIERRMEnabledCap*);
+
+tANI_U32 dot11fPackIeRRMEnabledCap(tpAniSirGlobal, tDot11fIERRMEnabledCap*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIERRMEnabledCap(tpAniSirGlobal, tDot11fIERRMEnabledCap*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 10 (0x0a)
+typedef struct sDot11fIERequestedInfo {
+ tANI_U8 present;
+ tANI_U8 num_requested_eids;
+ tANI_U8 requested_eids[255];
+} tDot11fIERequestedInfo;
+
+#define DOT11F_EID_REQUESTEDINFO ( 10 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_REQUESTEDINFO_MIN_LEN ( 0 )
+
+#define DOT11F_IE_REQUESTEDINFO_MAX_LEN ( 255 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeRequestedInfo(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIERequestedInfo*);
+
+tANI_U32 dot11fPackIeRequestedInfo(tpAniSirGlobal, tDot11fIERequestedInfo*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIERequestedInfo(tpAniSirGlobal, tDot11fIERequestedInfo*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 0 (0x00)
+typedef struct sDot11fIESSID {
+ tANI_U8 present;
+ tANI_U8 num_ssid;
+ tANI_U8 ssid[32];
+} tDot11fIESSID;
+
+#define DOT11F_EID_SSID ( 0 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_SSID_MIN_LEN ( 0 )
+
+#define DOT11F_IE_SSID_MAX_LEN ( 32 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeSSID(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIESSID*);
+
+tANI_U32 dot11fPackIeSSID(tpAniSirGlobal, tDot11fIESSID*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIESSID(tpAniSirGlobal, tDot11fIESSID*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 15 (0x0f)
+typedef struct sDot11fIESchedule {
+ tANI_U8 present;
+ tANI_U16 aggregation: 1;
+ tANI_U16 tsid: 4;
+ tANI_U16 direction: 2;
+ tANI_U16 reserved: 9;
+ tANI_U32 service_start_time;
+ tANI_U32 service_interval;
+ tANI_U16 max_service_dur;
+ tANI_U16 spec_interval;
+} tDot11fIESchedule;
+
+#define DOT11F_EID_SCHEDULE ( 15 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_SCHEDULE_MIN_LEN ( 14 )
+
+#define DOT11F_IE_SCHEDULE_MAX_LEN ( 14 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeSchedule(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIESchedule*);
+
+tANI_U32 dot11fPackIeSchedule(tpAniSirGlobal, tDot11fIESchedule*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIESchedule(tpAniSirGlobal, tDot11fIESchedule*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 14 (0x0e)
+typedef struct sDot11fIETCLAS {
+ tANI_U8 present;
+ tANI_U8 user_priority;
+ tANI_U8 classifier_type;
+ tANI_U8 classifier_mask;
+ union
+ {
+ struct
+ {
+ tANI_U8 source[6];
+ tANI_U8 dest[6];
+ tANI_U16 type;
+ } EthParams; /* classifier_type = 0 */
+ struct
+ {
+ tANI_U8 version;
+ union
+ {
+ struct
+ {
+ tANI_U8 source[4];
+ tANI_U8 dest[4];
+ tANI_U16 src_port;
+ tANI_U16 dest_port;
+ tANI_U8 DSCP;
+ tANI_U8 proto;
+ tANI_U8 reserved;
+ } IpV4Params; /* version = 4 */
+ struct
+ {
+ tANI_U8 source[16];
+ tANI_U8 dest[16];
+ tANI_U16 src_port;
+ tANI_U16 dest_port;
+ tANI_U8 flow_label[3];
+ } IpV6Params; /* version = 6 */
+ } params;
+ } IpParams; /* classifier_type = 1 */
+ struct
+ {
+ tANI_U16 tag_type;
+ } Params8021dq; /* classifier_type = 2 */
+ } info;
+} tDot11fIETCLAS;
+
+#define DOT11F_EID_TCLAS ( 14 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_TCLAS_MIN_LEN ( 5 )
+
+#define DOT11F_IE_TCLAS_MAX_LEN ( 43 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeTCLAS(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIETCLAS*);
+
+tANI_U32 dot11fPackIeTCLAS(tpAniSirGlobal, tDot11fIETCLAS*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIETCLAS(tpAniSirGlobal, tDot11fIETCLAS*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 44 (0x2c)
+typedef struct sDot11fIETCLASSPROC {
+ tANI_U8 present;
+ tANI_U8 processing;
+} tDot11fIETCLASSPROC;
+
+#define DOT11F_EID_TCLASSPROC ( 44 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_TCLASSPROC_MIN_LEN ( 1 )
+
+#define DOT11F_IE_TCLASSPROC_MAX_LEN ( 1 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeTCLASSPROC(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIETCLASSPROC*);
+
+tANI_U32 dot11fPackIeTCLASSPROC(tpAniSirGlobal, tDot11fIETCLASSPROC*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIETCLASSPROC(tpAniSirGlobal, tDot11fIETCLASSPROC*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 43 (0x2b)
+typedef struct sDot11fIETSDelay {
+ tANI_U8 present;
+ tANI_U32 delay;
+} tDot11fIETSDelay;
+
+#define DOT11F_EID_TSDELAY ( 43 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_TSDELAY_MIN_LEN ( 4 )
+
+#define DOT11F_IE_TSDELAY_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeTSDelay(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIETSDelay*);
+
+tANI_U32 dot11fPackIeTSDelay(tpAniSirGlobal, tDot11fIETSDelay*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIETSDelay(tpAniSirGlobal, tDot11fIETSDelay*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 13 (0x0d)
+typedef struct sDot11fIETSPEC {
+ tANI_U8 present;
+ tANI_U16 traffic_type: 1;
+ tANI_U16 tsid: 4;
+ tANI_U16 direction: 2;
+ tANI_U16 access_policy: 2;
+ tANI_U16 aggregation: 1;
+ tANI_U16 psb: 1;
+ tANI_U16 user_priority: 3;
+ tANI_U16 tsinfo_ack_pol: 2;
+ tANI_U8 schedule: 1;
+ tANI_U8 unused: 7;
+ tANI_U16 size: 15;
+ tANI_U16 fixed: 1;
+ tANI_U16 max_msdu_size;
+ tANI_U32 min_service_int;
+ tANI_U32 max_service_int;
+ tANI_U32 inactivity_int;
+ tANI_U32 suspension_int;
+ tANI_U32 service_start_time;
+ tANI_U32 min_data_rate;
+ tANI_U32 mean_data_rate;
+ tANI_U32 peak_data_rate;
+ tANI_U32 burst_size;
+ tANI_U32 delay_bound;
+ tANI_U32 min_phy_rate;
+ tANI_U16 surplus_bw_allowance;
+ tANI_U16 medium_time;
+} tDot11fIETSPEC;
+
+#define DOT11F_EID_TSPEC ( 13 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_TSPEC_MIN_LEN ( 55 )
+
+#define DOT11F_IE_TSPEC_MAX_LEN ( 55 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeTSPEC(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIETSPEC*);
+
+tANI_U32 dot11fPackIeTSPEC(tpAniSirGlobal, tDot11fIETSPEC*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIETSPEC(tpAniSirGlobal, tDot11fIETSPEC*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x02, 0x09}
+typedef struct sDot11fIEWMMSchedule {
+ tANI_U8 present;
+ tANI_U8 version /* Must be 1! */;
+ tANI_U16 aggregation: 1;
+ tANI_U16 tsid: 4;
+ tANI_U16 direction: 2;
+ tANI_U16 reserved: 9;
+ tANI_U32 service_start_time;
+ tANI_U32 service_interval;
+ tANI_U16 max_service_dur;
+ tANI_U16 spec_interval;
+} tDot11fIEWMMSchedule;
+
+#define DOT11F_EID_WMMSCHEDULE ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WMMSCHEDULE_MIN_LEN ( 20 )
+
+#define DOT11F_IE_WMMSCHEDULE_MAX_LEN ( 20 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWMMSchedule(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWMMSchedule*);
+
+tANI_U32 dot11fPackIeWMMSchedule(tpAniSirGlobal, tDot11fIEWMMSchedule*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWMMSchedule(tpAniSirGlobal, tDot11fIEWMMSchedule*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x02, 0x06}
+typedef struct sDot11fIEWMMTCLAS {
+ tANI_U8 present;
+ tANI_U8 version /* Must be 1! */;
+ tANI_U8 user_priority;
+ tANI_U8 classifier_type;
+ tANI_U8 classifier_mask;
+ union
+ {
+ struct
+ {
+ tANI_U8 source[6];
+ tANI_U8 dest[6];
+ tANI_U16 type;
+ } EthParams; /* classifier_type = 0 */
+ struct
+ {
+ tANI_U8 version;
+ union
+ {
+ struct
+ {
+ tANI_U8 source[4];
+ tANI_U8 dest[4];
+ tANI_U16 src_port;
+ tANI_U16 dest_port;
+ tANI_U8 DSCP;
+ tANI_U8 proto;
+ tANI_U8 reserved;
+ } IpV4Params; /* version = 4 */
+ struct
+ {
+ tANI_U8 source[16];
+ tANI_U8 dest[16];
+ tANI_U16 src_port;
+ tANI_U16 dest_port;
+ tANI_U8 flow_label[3];
+ } IpV6Params; /* version = 6 */
+ } params;
+ } IpParams; /* classifier_type = 1 */
+ struct
+ {
+ tANI_U16 tag_type;
+ } Params8021dq; /* classifier_type = 2 */
+ } info;
+} tDot11fIEWMMTCLAS;
+
+#define DOT11F_EID_WMMTCLAS ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WMMTCLAS_MIN_LEN ( 11 )
+
+#define DOT11F_IE_WMMTCLAS_MAX_LEN ( 49 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWMMTCLAS(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWMMTCLAS*);
+
+tANI_U32 dot11fPackIeWMMTCLAS(tpAniSirGlobal, tDot11fIEWMMTCLAS*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWMMTCLAS(tpAniSirGlobal, tDot11fIEWMMTCLAS*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x02, 0x07}
+typedef struct sDot11fIEWMMTCLASPROC {
+ tANI_U8 present;
+ tANI_U8 version /* Must be 1! */;
+ tANI_U8 processing;
+} tDot11fIEWMMTCLASPROC;
+
+#define DOT11F_EID_WMMTCLASPROC ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WMMTCLASPROC_MIN_LEN ( 7 )
+
+#define DOT11F_IE_WMMTCLASPROC_MAX_LEN ( 7 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWMMTCLASPROC(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWMMTCLASPROC*);
+
+tANI_U32 dot11fPackIeWMMTCLASPROC(tpAniSirGlobal, tDot11fIEWMMTCLASPROC*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWMMTCLASPROC(tpAniSirGlobal, tDot11fIEWMMTCLASPROC*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x02, 0x08}
+typedef struct sDot11fIEWMMTSDelay {
+ tANI_U8 present;
+ tANI_U8 version /* Must be 1! */;
+ tANI_U32 delay;
+} tDot11fIEWMMTSDelay;
+
+#define DOT11F_EID_WMMTSDELAY ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WMMTSDELAY_MIN_LEN ( 10 )
+
+#define DOT11F_IE_WMMTSDELAY_MAX_LEN ( 10 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWMMTSDelay(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWMMTSDelay*);
+
+tANI_U32 dot11fPackIeWMMTSDelay(tpAniSirGlobal, tDot11fIEWMMTSDelay*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWMMTSDelay(tpAniSirGlobal, tDot11fIEWMMTSDelay*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x02, 0x02}
+typedef struct sDot11fIEWMMTSPEC {
+ tANI_U8 present;
+ tANI_U8 version /* Must be 1! */;
+ tANI_U16 traffic_type: 1;
+ tANI_U16 tsid: 4;
+ tANI_U16 direction: 2;
+ tANI_U16 access_policy: 2;
+ tANI_U16 aggregation: 1;
+ tANI_U16 psb: 1;
+ tANI_U16 user_priority: 3;
+ tANI_U16 tsinfo_ack_pol: 2;
+ tANI_U8 tsinfo_rsvd: 7;
+ tANI_U8 burst_size_defn: 1;
+ tANI_U16 size: 15;
+ tANI_U16 fixed: 1;
+ tANI_U16 max_msdu_size;
+ tANI_U32 min_service_int;
+ tANI_U32 max_service_int;
+ tANI_U32 inactivity_int;
+ tANI_U32 suspension_int;
+ tANI_U32 service_start_time;
+ tANI_U32 min_data_rate;
+ tANI_U32 mean_data_rate;
+ tANI_U32 peak_data_rate;
+ tANI_U32 burst_size;
+ tANI_U32 delay_bound;
+ tANI_U32 min_phy_rate;
+ tANI_U16 surplus_bw_allowance;
+ tANI_U16 medium_time;
+} tDot11fIEWMMTSPEC;
+
+#define DOT11F_EID_WMMTSPEC ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WMMTSPEC_MIN_LEN ( 61 )
+
+#define DOT11F_IE_WMMTSPEC_MAX_LEN ( 61 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWMMTSPEC(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWMMTSPEC*);
+
+tANI_U32 dot11fPackIeWMMTSPEC(tpAniSirGlobal, tDot11fIEWMMTSPEC*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWMMTSPEC(tpAniSirGlobal, tDot11fIEWMMTSPEC*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x0a, 0xf5}
+typedef struct sDot11fIEAirgo {
+ tANI_U8 present;
+ tDot11fIEPropSuppRates PropSuppRates;
+ tDot11fIEAPName APName;
+ tDot11fIEHCF HCF;
+ tDot11fIEWDS WDS;
+ tDot11fIEBPIndicator BPIndicator;
+ tDot11fIELoadInfo LoadInfo;
+ tDot11fIELoadBalance LoadBalance;
+ tDot11fIEPropAssocType PropAssocType;
+ tDot11fIELLAttr LLAttr;
+ tDot11fIEPropCapability PropCapability;
+ tDot11fIEVersion Version;
+ tDot11fIEPropEDCAParams PropEDCAParams;
+ tDot11fIETitan Titan;
+ tDot11fIEPropChannSwitchAnn PropChannSwitchAnn;
+ tDot11fIEPropQuietBSS PropQuietBSS;
+ tDot11fIETriggerStaBgScan TriggerStaBgScan;
+ tDot11fIETaurus Taurus;
+} tDot11fIEAirgo;
+
+#define DOT11F_EID_AIRGO ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_AIRGO_MIN_LEN ( 3 )
+
+#define DOT11F_IE_AIRGO_MAX_LEN ( 230 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeAirgo(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEAirgo*);
+
+tANI_U32 dot11fPackIeAirgo(tpAniSirGlobal, tDot11fIEAirgo*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEAirgo(tpAniSirGlobal, tDot11fIEAirgo*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 156 (0x9c) {OUI 0x00, 0x40, 0x96, 0x00}
+typedef struct sDot11fIECCXCckmOpaque {
+ tANI_U8 present;
+ tANI_U8 num_data;
+ tANI_U8 data[20];
+} tDot11fIECCXCckmOpaque;
+
+#define DOT11F_EID_CCXCCKMOPAQUE ( 156 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_CCXCCKMOPAQUE_MIN_LEN ( 10 )
+
+#define DOT11F_IE_CCXCCKMOPAQUE_MAX_LEN ( 24 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeCCXCckmOpaque(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIECCXCckmOpaque*);
+
+tANI_U32 dot11fPackIeCCXCckmOpaque(tpAniSirGlobal, tDot11fIECCXCckmOpaque*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIECCXCckmOpaque(tpAniSirGlobal, tDot11fIECCXCckmOpaque*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x40, 0x96, 0x01}
+typedef struct sDot11fIECCXRadMgmtCap {
+ tANI_U8 present;
+ tANI_U8 mgmt_state;
+ tANI_U8 mbssid_mask: 3;
+ tANI_U8 reserved: 5;
+} tDot11fIECCXRadMgmtCap;
+
+#define DOT11F_EID_CCXRADMGMTCAP ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_CCXRADMGMTCAP_MIN_LEN ( 6 )
+
+#define DOT11F_IE_CCXRADMGMTCAP_MAX_LEN ( 6 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeCCXRadMgmtCap(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIECCXRadMgmtCap*);
+
+tANI_U32 dot11fPackIeCCXRadMgmtCap(tpAniSirGlobal, tDot11fIECCXRadMgmtCap*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIECCXRadMgmtCap(tpAniSirGlobal, tDot11fIECCXRadMgmtCap*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x40, 0x96, 0x07}
+typedef struct sDot11fIECCXTrafStrmMet {
+ tANI_U8 present;
+ tANI_U8 tsid;
+ tANI_U8 state;
+ tANI_U16 msmt_interval;
+} tDot11fIECCXTrafStrmMet;
+
+#define DOT11F_EID_CCXTRAFSTRMMET ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_CCXTRAFSTRMMET_MIN_LEN ( 8 )
+
+#define DOT11F_IE_CCXTRAFSTRMMET_MAX_LEN ( 8 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeCCXTrafStrmMet(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIECCXTrafStrmMet*);
+
+tANI_U32 dot11fPackIeCCXTrafStrmMet(tpAniSirGlobal, tDot11fIECCXTrafStrmMet*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIECCXTrafStrmMet(tpAniSirGlobal, tDot11fIECCXTrafStrmMet*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x40, 0x96, 0x08}
+typedef struct sDot11fIECCXTrafStrmRateSet {
+ tANI_U8 present;
+ tANI_U8 tsid;
+ tANI_U8 num_tsrates;
+ tANI_U8 tsrates[8];
+} tDot11fIECCXTrafStrmRateSet;
+
+#define DOT11F_EID_CCXTRAFSTRMRATESET ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_CCXTRAFSTRMRATESET_MIN_LEN ( 5 )
+
+#define DOT11F_IE_CCXTRAFSTRMRATESET_MAX_LEN ( 13 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeCCXTrafStrmRateSet(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIECCXTrafStrmRateSet*);
+
+tANI_U32 dot11fPackIeCCXTrafStrmRateSet(tpAniSirGlobal, tDot11fIECCXTrafStrmRateSet*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIECCXTrafStrmRateSet(tpAniSirGlobal, tDot11fIECCXTrafStrmRateSet*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 150 (0x96) {OUI 0x00, 0x40, 0x96, 0x00}
+typedef struct sDot11fIECCXTxmitPower {
+ tANI_U8 present;
+ tANI_U8 power_limit;
+ tANI_U8 reserved;
+} tDot11fIECCXTxmitPower;
+
+#define DOT11F_EID_CCXTXMITPOWER ( 150 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_CCXTXMITPOWER_MIN_LEN ( 6 )
+
+#define DOT11F_IE_CCXTXMITPOWER_MAX_LEN ( 6 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeCCXTxmitPower(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIECCXTxmitPower*);
+
+tANI_U32 dot11fPackIeCCXTxmitPower(tpAniSirGlobal, tDot11fIECCXTxmitPower*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIECCXTxmitPower(tpAniSirGlobal, tDot11fIECCXTxmitPower*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x40, 0x96, 0x03}
+typedef struct sDot11fIECCXVersion {
+ tANI_U8 present;
+ tANI_U8 version;
+} tDot11fIECCXVersion;
+
+#define DOT11F_EID_CCXVERSION ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_CCXVERSION_MIN_LEN ( 5 )
+
+#define DOT11F_IE_CCXVERSION_MAX_LEN ( 5 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeCCXVersion(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIECCXVersion*);
+
+tANI_U32 dot11fPackIeCCXVersion(tpAniSirGlobal, tDot11fIECCXVersion*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIECCXVersion(tpAniSirGlobal, tDot11fIECCXVersion*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 4 (0x04)
+typedef struct sDot11fIECFParams {
+ tANI_U8 present;
+ tANI_U8 cfp_count;
+ tANI_U8 cfp_period;
+ tANI_U16 cfp_maxduration;
+ tANI_U16 cfp_durremaining;
+} tDot11fIECFParams;
+
+#define DOT11F_EID_CFPARAMS ( 4 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_CFPARAMS_MIN_LEN ( 6 )
+
+#define DOT11F_IE_CFPARAMS_MAX_LEN ( 6 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeCFParams(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIECFParams*);
+
+tANI_U32 dot11fPackIeCFParams(tpAniSirGlobal, tDot11fIECFParams*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIECFParams(tpAniSirGlobal, tDot11fIECFParams*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 16 (0x10)
+typedef struct sDot11fIEChallengeText {
+ tANI_U8 present;
+ tANI_U8 num_text;
+ tANI_U8 text[253];
+} tDot11fIEChallengeText;
+
+#define DOT11F_EID_CHALLENGETEXT ( 16 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_CHALLENGETEXT_MIN_LEN ( 1 )
+
+#define DOT11F_IE_CHALLENGETEXT_MAX_LEN ( 253 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeChallengeText(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEChallengeText*);
+
+tANI_U32 dot11fPackIeChallengeText(tpAniSirGlobal, tDot11fIEChallengeText*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEChallengeText(tpAniSirGlobal, tDot11fIEChallengeText*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 37 (0x25)
+typedef struct sDot11fIEChanSwitchAnn {
+ tANI_U8 present;
+ tANI_U8 switchMode;
+ tANI_U8 newChannel;
+ tANI_U8 switchCount;
+} tDot11fIEChanSwitchAnn;
+
+#define DOT11F_EID_CHANSWITCHANN ( 37 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_CHANSWITCHANN_MIN_LEN ( 3 )
+
+#define DOT11F_IE_CHANSWITCHANN_MAX_LEN ( 3 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeChanSwitchAnn(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEChanSwitchAnn*);
+
+tANI_U32 dot11fPackIeChanSwitchAnn(tpAniSirGlobal, tDot11fIEChanSwitchAnn*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEChanSwitchAnn(tpAniSirGlobal, tDot11fIEChanSwitchAnn*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 7 (0x07)
+typedef struct sDot11fIECountry {
+ tANI_U8 present;
+ tANI_U8 country[3];
+ tANI_U8 num_triplets;
+ tANI_U8 triplets[84][3];
+} tDot11fIECountry;
+
+#define DOT11F_EID_COUNTRY ( 7 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_COUNTRY_MIN_LEN ( 3 )
+
+#define DOT11F_IE_COUNTRY_MAX_LEN ( 255 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeCountry(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIECountry*);
+
+tANI_U32 dot11fPackIeCountry(tpAniSirGlobal, tDot11fIECountry*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIECountry(tpAniSirGlobal, tDot11fIECountry*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 3 (0x03)
+typedef struct sDot11fIEDSParams {
+ tANI_U8 present;
+ tANI_U8 curr_channel;
+} tDot11fIEDSParams;
+
+#define DOT11F_EID_DSPARAMS ( 3 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_DSPARAMS_MIN_LEN ( 1 )
+
+#define DOT11F_IE_DSPARAMS_MAX_LEN ( 1 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeDSParams(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEDSParams*);
+
+tANI_U32 dot11fPackIeDSParams(tpAniSirGlobal, tDot11fIEDSParams*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEDSParams(tpAniSirGlobal, tDot11fIEDSParams*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 12 (0x0c)
+typedef struct sDot11fIEEDCAParamSet {
+ tANI_U8 present;
+ tANI_U8 qos;
+ tANI_U8 reserved;
+ tANI_U8 acbe_aifsn: 4;
+ tANI_U8 acbe_acm: 1;
+ tANI_U8 acbe_aci: 2;
+ tANI_U8 unused1: 1;
+ tANI_U8 acbe_acwmin: 4;
+ tANI_U8 acbe_acwmax: 4;
+ tANI_U16 acbe_txoplimit;
+ tANI_U8 acbk_aifsn: 4;
+ tANI_U8 acbk_acm: 1;
+ tANI_U8 acbk_aci: 2;
+ tANI_U8 unused2: 1;
+ tANI_U8 acbk_acwmin: 4;
+ tANI_U8 acbk_acwmax: 4;
+ tANI_U16 acbk_txoplimit;
+ tANI_U8 acvi_aifsn: 4;
+ tANI_U8 acvi_acm: 1;
+ tANI_U8 acvi_aci: 2;
+ tANI_U8 unused3: 1;
+ tANI_U8 acvi_acwmin: 4;
+ tANI_U8 acvi_acwmax: 4;
+ tANI_U16 acvi_txoplimit;
+ tANI_U8 acvo_aifsn: 4;
+ tANI_U8 acvo_acm: 1;
+ tANI_U8 acvo_aci: 2;
+ tANI_U8 unused4: 1;
+ tANI_U8 acvo_acwmin: 4;
+ tANI_U8 acvo_acwmax: 4;
+ tANI_U16 acvo_txoplimit;
+} tDot11fIEEDCAParamSet;
+
+#define DOT11F_EID_EDCAPARAMSET ( 12 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_EDCAPARAMSET_MIN_LEN ( 18 )
+
+#define DOT11F_IE_EDCAPARAMSET_MAX_LEN ( 18 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeEDCAParamSet(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEEDCAParamSet*);
+
+tANI_U32 dot11fPackIeEDCAParamSet(tpAniSirGlobal, tDot11fIEEDCAParamSet*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEEDCAParamSet(tpAniSirGlobal, tDot11fIEEDCAParamSet*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 42 (0x2a)
+typedef struct sDot11fIEERPInfo {
+ tANI_U8 present;
+ tANI_U8 non_erp_present: 1;
+ tANI_U8 use_prot: 1;
+ tANI_U8 barker_preamble: 1;
+ tANI_U8 unused: 5;
+} tDot11fIEERPInfo;
+
+#define DOT11F_EID_ERPINFO ( 42 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_ERPINFO_MIN_LEN ( 1 )
+
+#define DOT11F_IE_ERPINFO_MAX_LEN ( 1 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeERPInfo(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEERPInfo*);
+
+tANI_U32 dot11fPackIeERPInfo(tpAniSirGlobal, tDot11fIEERPInfo*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEERPInfo(tpAniSirGlobal, tDot11fIEERPInfo*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 62 (0x3e)
+typedef struct sDot11fIEExtChanSwitchAnn {
+ tANI_U8 present;
+ tANI_U8 secondaryChannelOffset;
+} tDot11fIEExtChanSwitchAnn;
+
+#define DOT11F_EID_EXTCHANSWITCHANN ( 62 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_EXTCHANSWITCHANN_MIN_LEN ( 1 )
+
+#define DOT11F_IE_EXTCHANSWITCHANN_MAX_LEN ( 1 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeExtChanSwitchAnn(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEExtChanSwitchAnn*);
+
+tANI_U32 dot11fPackIeExtChanSwitchAnn(tpAniSirGlobal, tDot11fIEExtChanSwitchAnn*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEExtChanSwitchAnn(tpAniSirGlobal, tDot11fIEExtChanSwitchAnn*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 50 (0x32)
+typedef struct sDot11fIEExtSuppRates {
+ tANI_U8 present;
+ tANI_U8 num_rates;
+ tANI_U8 rates[12];
+} tDot11fIEExtSuppRates;
+
+#define DOT11F_EID_EXTSUPPRATES ( 50 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_EXTSUPPRATES_MIN_LEN ( 1 )
+
+#define DOT11F_IE_EXTSUPPRATES_MAX_LEN ( 12 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeExtSuppRates(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEExtSuppRates*);
+
+tANI_U32 dot11fPackIeExtSuppRates(tpAniSirGlobal, tDot11fIEExtSuppRates*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEExtSuppRates(tpAniSirGlobal, tDot11fIEExtSuppRates*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 2 (0x02)
+typedef struct sDot11fIEFHParamSet {
+ tANI_U8 present;
+ tANI_U16 dwell_time;
+ tANI_U8 hop_set;
+ tANI_U8 hop_pattern;
+ tANI_U8 hop_index;
+} tDot11fIEFHParamSet;
+
+#define DOT11F_EID_FHPARAMSET ( 2 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_FHPARAMSET_MIN_LEN ( 5 )
+
+#define DOT11F_IE_FHPARAMSET_MAX_LEN ( 5 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeFHParamSet(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEFHParamSet*);
+
+tANI_U32 dot11fPackIeFHParamSet(tpAniSirGlobal, tDot11fIEFHParamSet*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEFHParamSet(tpAniSirGlobal, tDot11fIEFHParamSet*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 8 (0x08)
+typedef struct sDot11fIEFHParams {
+ tANI_U8 present;
+ tANI_U8 radix;
+ tANI_U8 nchannels;
+} tDot11fIEFHParams;
+
+#define DOT11F_EID_FHPARAMS ( 8 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_FHPARAMS_MIN_LEN ( 2 )
+
+#define DOT11F_IE_FHPARAMS_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeFHParams(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEFHParams*);
+
+tANI_U32 dot11fPackIeFHParams(tpAniSirGlobal, tDot11fIEFHParams*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEFHParams(tpAniSirGlobal, tDot11fIEFHParams*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 9 (0x09)
+typedef struct sDot11fIEFHPattTable {
+ tANI_U8 present;
+ tANI_U8 flag;
+ tANI_U8 nsets;
+ tANI_U8 modulus;
+ tANI_U8 offset;
+ tANI_U8 num_randtable;
+ tANI_U8 randtable[251];
+} tDot11fIEFHPattTable;
+
+#define DOT11F_EID_FHPATTTABLE ( 9 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_FHPATTTABLE_MIN_LEN ( 4 )
+
+#define DOT11F_IE_FHPATTTABLE_MAX_LEN ( 255 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeFHPattTable(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEFHPattTable*);
+
+tANI_U32 dot11fPackIeFHPattTable(tpAniSirGlobal, tDot11fIEFHPattTable*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEFHPattTable(tpAniSirGlobal, tDot11fIEFHPattTable*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 55 (0x37)
+typedef struct sDot11fIEFTInfo {
+ tANI_U8 present;
+ tANI_U16 reserved: 8;
+ tANI_U16 IECount: 8;
+ tANI_U8 MIC[16];
+ tANI_U8 Anonce[32];
+ tANI_U8 Snonce[32];
+ tDot11fIER1KH_ID R1KH_ID;
+ tDot11fIEGTK GTK;
+ tDot11fIER0KH_ID R0KH_ID;
+} tDot11fIEFTInfo;
+
+#define DOT11F_EID_FTINFO ( 55 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_FTINFO_MIN_LEN ( 82 )
+
+#define DOT11F_IE_FTINFO_MAX_LEN ( 185 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeFTInfo(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEFTInfo*);
+
+tANI_U32 dot11fPackIeFTInfo(tpAniSirGlobal, tDot11fIEFTInfo*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEFTInfo(tpAniSirGlobal, tDot11fIEFTInfo*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 56 (0x38)
+typedef struct sDot11fIEFTTimeoutInterval {
+ tANI_U8 present;
+ tANI_U8 timeoutType;
+ tANI_U32 timeoutValue;
+} tDot11fIEFTTimeoutInterval;
+
+#define DOT11F_EID_FTTIMEOUTINTERVAL ( 56 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_FTTIMEOUTINTERVAL_MIN_LEN ( 5 )
+
+#define DOT11F_IE_FTTIMEOUTINTERVAL_MAX_LEN ( 5 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeFTTimeoutInterval(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEFTTimeoutInterval*);
+
+tANI_U32 dot11fPackIeFTTimeoutInterval(tpAniSirGlobal, tDot11fIEFTTimeoutInterval*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEFTTimeoutInterval(tpAniSirGlobal, tDot11fIEFTTimeoutInterval*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 45 (0x2d)
+typedef struct sDot11fIEHTCaps {
+ tANI_U8 present;
+ tANI_U16 advCodingCap: 1;
+ tANI_U16 supportedChannelWidthSet: 1;
+ tANI_U16 mimoPowerSave: 2;
+ tANI_U16 greenField: 1;
+ tANI_U16 shortGI20MHz: 1;
+ tANI_U16 shortGI40MHz: 1;
+ tANI_U16 txSTBC: 1;
+ tANI_U16 rxSTBC: 2;
+ tANI_U16 delayedBA: 1;
+ tANI_U16 maximalAMSDUsize: 1;
+ tANI_U16 dsssCckMode40MHz: 1;
+ tANI_U16 psmp: 1;
+ tANI_U16 stbcControlFrame: 1;
+ tANI_U16 lsigTXOPProtection: 1;
+ tANI_U8 maxRxAMPDUFactor: 2;
+ tANI_U8 mpduDensity: 3;
+ tANI_U8 reserved1: 3;
+ tANI_U8 supportedMCSSet[16];
+ tANI_U16 pco: 1;
+ tANI_U16 transitionTime: 2;
+ tANI_U16 reserved2: 5;
+ tANI_U16 mcsFeedback: 2;
+ tANI_U16 reserved3: 6;
+ tANI_U32 txBF: 1;
+ tANI_U32 rxStaggeredSounding: 1;
+ tANI_U32 txStaggeredSounding: 1;
+ tANI_U32 rxZLF: 1;
+ tANI_U32 txZLF: 1;
+ tANI_U32 implicitTxBF: 1;
+ tANI_U32 calibration: 2;
+ tANI_U32 explicitCSITxBF: 1;
+ tANI_U32 explicitUncompressedSteeringMatrix: 1;
+ tANI_U32 explicitBFCSIFeedback: 3;
+ tANI_U32 explicitUncompressedSteeringMatrixFeedback: 3;
+ tANI_U32 explicitCompressedSteeringMatrixFeedback: 3;
+ tANI_U32 csiNumBFAntennae: 2;
+ tANI_U32 uncompressedSteeringMatrixBFAntennae: 2;
+ tANI_U32 compressedSteeringMatrixBFAntennae: 2;
+ tANI_U32 reserved4: 7;
+ tANI_U8 antennaSelection: 1;
+ tANI_U8 explicitCSIFeedbackTx: 1;
+ tANI_U8 antennaIndicesFeedbackTx: 1;
+ tANI_U8 explicitCSIFeedback: 1;
+ tANI_U8 antennaIndicesFeedback: 1;
+ tANI_U8 rxAS: 1;
+ tANI_U8 txSoundingPPDUs: 1;
+ tANI_U8 reserved5: 1;
+ tANI_U8 num_rsvd;
+ tANI_U8 rsvd[32];
+} tDot11fIEHTCaps;
+
+#define DOT11F_EID_HTCAPS ( 45 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_HTCAPS_MIN_LEN ( 26 )
+
+#define DOT11F_IE_HTCAPS_MAX_LEN ( 58 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeHTCaps(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEHTCaps*);
+
+tANI_U32 dot11fPackIeHTCaps(tpAniSirGlobal, tDot11fIEHTCaps*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEHTCaps(tpAniSirGlobal, tDot11fIEHTCaps*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 61 (0x3d)
+typedef struct sDot11fIEHTInfo {
+ tANI_U8 present;
+ tANI_U8 primaryChannel;
+ tANI_U8 secondaryChannelOffset: 2;
+ tANI_U8 recommendedTxWidthSet: 1;
+ tANI_U8 rifsMode: 1;
+ tANI_U8 controlledAccessOnly: 1;
+ tANI_U8 serviceIntervalGranularity: 3;
+ tANI_U16 opMode: 2;
+ tANI_U16 nonGFDevicesPresent: 1;
+ tANI_U16 transmitBurstLimit: 1;
+ tANI_U16 obssNonHTStaPresent: 1;
+ tANI_U16 reserved: 11;
+ tANI_U16 basicSTBCMCS: 7;
+ tANI_U16 dualCTSProtection: 1;
+ tANI_U16 secondaryBeacon: 1;
+ tANI_U16 lsigTXOPProtectionFullSupport: 1;
+ tANI_U16 pcoActive: 1;
+ tANI_U16 pcoPhase: 1;
+ tANI_U16 reserved2: 4;
+ tANI_U8 basicMCSSet[16];
+ tANI_U8 num_rsvd;
+ tANI_U8 rsvd[32];
+} tDot11fIEHTInfo;
+
+#define DOT11F_EID_HTINFO ( 61 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_HTINFO_MIN_LEN ( 22 )
+
+#define DOT11F_IE_HTINFO_MAX_LEN ( 54 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeHTInfo(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEHTInfo*);
+
+tANI_U32 dot11fPackIeHTInfo(tpAniSirGlobal, tDot11fIEHTInfo*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEHTInfo(tpAniSirGlobal, tDot11fIEHTInfo*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 6 (0x06)
+typedef struct sDot11fIEIBSSParams {
+ tANI_U8 present;
+ tANI_U16 atim;
+} tDot11fIEIBSSParams;
+
+#define DOT11F_EID_IBSSPARAMS ( 6 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_IBSSPARAMS_MIN_LEN ( 2 )
+
+#define DOT11F_IE_IBSSPARAMS_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeIBSSParams(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEIBSSParams*);
+
+tANI_U32 dot11fPackIeIBSSParams(tpAniSirGlobal, tDot11fIEIBSSParams*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEIBSSParams(tpAniSirGlobal, tDot11fIEIBSSParams*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 39 (0x27)
+typedef struct sDot11fIEMeasurementReport {
+ tANI_U8 present;
+ tANI_U8 token;
+ tANI_U8 late: 1;
+ tANI_U8 incapable: 1;
+ tANI_U8 refused: 1;
+ tANI_U8 unused: 5;
+ tANI_U8 type;
+ union
+ {
+ struct
+ {
+ tANI_U8 channel;
+ tDOT11F_U64 meas_start_time;
+ tANI_U16 meas_duration;
+ tANI_U8 bss: 1;
+ tANI_U8 ofdm_preamble: 1;
+ tANI_U8 unid_signal: 1;
+ tANI_U8 rader: 1;
+ tANI_U8 unmeasured: 1;
+ tANI_U8 unused: 3;
+ } Basic; /* type = 0 */
+ struct
+ {
+ tANI_U8 channel;
+ tDOT11F_U64 meas_start_time;
+ tANI_U16 meas_duration;
+ tANI_U8 cca_busy_fraction;
+ } CCA; /* type = 1 */
+ struct
+ {
+ tANI_U8 channel;
+ tDOT11F_U64 meas_start_time;
+ tANI_U16 meas_duration;
+ tANI_U8 rpi0_density;
+ tANI_U8 rpi1_density;
+ tANI_U8 rpi2_density;
+ tANI_U8 rpi3_density;
+ tANI_U8 rpi4_density;
+ tANI_U8 rpi5_density;
+ tANI_U8 rpi6_density;
+ tANI_U8 rpi7_density;
+ } RPIHistogram; /* type = 2 */
+ struct
+ {
+ tANI_U8 regClass;
+ tANI_U8 channel;
+ tDOT11F_U64 meas_start_time;
+ tANI_U16 meas_duration;
+ tANI_U8 condensed_PHY: 7;
+ tANI_U8 reported_frame_type: 1;
+ tANI_U8 RCPI;
+ tANI_U8 RSNI;
+ tANI_U8 BSSID[6];
+ tANI_U8 antenna_id;
+ tANI_U32 parent_TSF;
+ tDot11fIEBeaconReportFrmBody BeaconReportFrmBody;
+ } Beacon; /* type = 5 */
+ } report;
+} tDot11fIEMeasurementReport;
+
+#define DOT11F_EID_MEASUREMENTREPORT ( 39 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_MEASUREMENTREPORT_MIN_LEN ( 3 )
+
+#define DOT11F_IE_MEASUREMENTREPORT_MAX_LEN ( 29 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeMeasurementReport(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEMeasurementReport*);
+
+tANI_U32 dot11fPackIeMeasurementReport(tpAniSirGlobal, tDot11fIEMeasurementReport*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEMeasurementReport(tpAniSirGlobal, tDot11fIEMeasurementReport*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 38 (0x26)
+typedef struct sDot11fIEMeasurementRequest {
+ tANI_U8 present;
+ tANI_U8 measurement_token;
+ tANI_U8 parallel: 1;
+ tANI_U8 enable: 1;
+ tANI_U8 request: 1;
+ tANI_U8 report: 1;
+ tANI_U8 durationMandatory: 1;
+ tANI_U8 unused: 3;
+ tANI_U8 measurement_type;
+ union
+ {
+ struct
+ {
+ tANI_U8 channel_no;
+ tANI_U8 meas_start_time[8];
+ tANI_U16 meas_duration;
+ } Basic; /* measurement_type = 0 */
+ struct
+ {
+ tANI_U8 channel_no;
+ tANI_U8 meas_start_time[8];
+ tANI_U16 meas_duration;
+ } CCA; /* measurement_type = 1 */
+ struct
+ {
+ tANI_U8 channel_no;
+ tANI_U8 meas_start_time[8];
+ tANI_U16 meas_duration;
+ } RPIHistogram; /* measurement_type = 2 */
+ struct
+ {
+ tANI_U8 regClass;
+ tANI_U8 channel;
+ tANI_U16 randomization;
+ tANI_U16 meas_duration;
+ tANI_U8 meas_mode;
+ tANI_U8 BSSID[6];
+ tDot11fIESSID SSID;
+ tDot11fIEBeaconReporting BeaconReporting;
+ tDot11fIEBcnReportingDetail BcnReportingDetail;
+ tDot11fIERequestedInfo RequestedInfo;
+ tANI_U16 num_APChannelReport;
+ tDot11fIEAPChannelReport APChannelReport[2];
+ } Beacon; /* measurement_type = 5 */
+ } measurement_request;
+} tDot11fIEMeasurementRequest;
+
+#define DOT11F_EID_MEASUREMENTREQUEST ( 38 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_MEASUREMENTREQUEST_MIN_LEN ( 14 )
+
+#define DOT11F_IE_MEASUREMENTREQUEST_MAX_LEN ( 16 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeMeasurementRequest(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEMeasurementRequest*);
+
+tANI_U32 dot11fPackIeMeasurementRequest(tpAniSirGlobal, tDot11fIEMeasurementRequest*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEMeasurementRequest(tpAniSirGlobal, tDot11fIEMeasurementRequest*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 54 (0x36)
+typedef struct sDot11fIEMobilityDomain {
+ tANI_U8 present;
+ tANI_U16 MDID;
+ tANI_U8 overDSCap: 1;
+ tANI_U8 resourceReqCap: 1;
+ tANI_U8 reserved: 6;
+} tDot11fIEMobilityDomain;
+
+#define DOT11F_EID_MOBILITYDOMAIN ( 54 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_MOBILITYDOMAIN_MIN_LEN ( 3 )
+
+#define DOT11F_IE_MOBILITYDOMAIN_MAX_LEN ( 3 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeMobilityDomain(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEMobilityDomain*);
+
+tANI_U32 dot11fPackIeMobilityDomain(tpAniSirGlobal, tDot11fIEMobilityDomain*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEMobilityDomain(tpAniSirGlobal, tDot11fIEMobilityDomain*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 52 (0x34)
+typedef struct sDot11fIENeighborReport {
+ tANI_U8 present;
+ tANI_U8 bssid[6];
+ tANI_U8 APReachability: 2;
+ tANI_U8 Security: 1;
+ tANI_U8 KeyScope: 1;
+ tANI_U8 SpecMgmtCap: 1;
+ tANI_U8 QosCap: 1;
+ tANI_U8 apsd: 1;
+ tANI_U8 rrm: 1;
+ tANI_U8 DelayedBA: 1;
+ tANI_U8 ImmBA: 1;
+ tANI_U8 MobilityDomain: 1;
+ tANI_U8 reserved: 5;
+ tANI_U16 reserved1;
+ tANI_U8 regulatoryClass;
+ tANI_U8 channel;
+ tANI_U8 PhyType;
+ tDot11fIETSFInfo TSFInfo;
+ tDot11fIECondensedCountryStr CondensedCountryStr;
+ tDot11fIEMeasurementPilot MeasurementPilot;
+ tDot11fIERRMEnabledCap RRMEnabledCap;
+ tDot11fIEMultiBssid MultiBssid;
+} tDot11fIENeighborReport;
+
+#define DOT11F_EID_NEIGHBORREPORT ( 52 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_NEIGHBORREPORT_MIN_LEN ( 13 )
+
+#define DOT11F_IE_NEIGHBORREPORT_MAX_LEN ( 546 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeNeighborReport(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIENeighborReport*);
+
+tANI_U32 dot11fPackIeNeighborReport(tpAniSirGlobal, tDot11fIENeighborReport*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIENeighborReport(tpAniSirGlobal, tDot11fIENeighborReport*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a, 0x09} (Multi-IE)
+typedef struct sDot11fIEP2PAssocReq {
+ tANI_U8 present;
+ tDot11fTLVP2PCapability P2PCapability;
+ tDot11fTLVExtendedListenTiming ExtendedListenTiming;
+ tDot11fTLVP2PDeviceInfo P2PDeviceInfo;
+} tDot11fIEP2PAssocReq;
+
+#define DOT11F_EID_P2PASSOCREQ ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_P2PASSOCREQ_MIN_LEN ( 4 )
+
+#define DOT11F_IE_P2PASSOCREQ_MAX_LEN ( 71 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeP2PAssocReq(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEP2PAssocReq*);
+
+tANI_U32 dot11fPackIeP2PAssocReq(tpAniSirGlobal, tDot11fIEP2PAssocReq*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEP2PAssocReq(tpAniSirGlobal, tDot11fIEP2PAssocReq*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a, 0x09} (Multi-IE)
+typedef struct sDot11fIEP2PAssocRes {
+ tANI_U8 present;
+ tDot11fTLVP2PStatus P2PStatus;
+ tDot11fTLVExtendedListenTiming ExtendedListenTiming;
+} tDot11fIEP2PAssocRes;
+
+#define DOT11F_EID_P2PASSOCRES ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_P2PASSOCRES_MIN_LEN ( 4 )
+
+#define DOT11F_IE_P2PASSOCRES_MAX_LEN ( 15 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeP2PAssocRes(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEP2PAssocRes*);
+
+tANI_U32 dot11fPackIeP2PAssocRes(tpAniSirGlobal, tDot11fIEP2PAssocRes*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEP2PAssocRes(tpAniSirGlobal, tDot11fIEP2PAssocRes*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a, 0x09} (Multi-IE)
+typedef struct sDot11fIEP2PBeacon {
+ tANI_U8 present;
+ tDot11fTLVP2PCapability P2PCapability;
+ tDot11fTLVP2PDeviceId P2PDeviceId;
+ tDot11fTLVNoticeOfAbsence NoticeOfAbsence;
+} tDot11fIEP2PBeacon;
+
+#define DOT11F_EID_P2PBEACON ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_P2PBEACON_MIN_LEN ( 4 )
+
+#define DOT11F_IE_P2PBEACON_MAX_LEN ( 59 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeP2PBeacon(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEP2PBeacon*);
+
+tANI_U32 dot11fPackIeP2PBeacon(tpAniSirGlobal, tDot11fIEP2PBeacon*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEP2PBeacon(tpAniSirGlobal, tDot11fIEP2PBeacon*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a, 0x09} (Multi-IE)
+typedef struct sDot11fIEP2PBeaconProbeRes {
+ tANI_U8 present;
+ tDot11fTLVP2PCapability P2PCapability;
+ tDot11fTLVP2PDeviceId P2PDeviceId;
+ tDot11fTLVExtendedListenTiming ExtendedListenTiming;
+ tDot11fTLVNoticeOfAbsence NoticeOfAbsence;
+ tDot11fTLVP2PDeviceInfo P2PDeviceInfo;
+ tDot11fTLVP2PGroupInfo P2PGroupInfo;
+} tDot11fIEP2PBeaconProbeRes;
+
+#define DOT11F_EID_P2PBEACONPROBERES ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_P2PBEACONPROBERES_MIN_LEN ( 4 )
+
+#define DOT11F_IE_P2PBEACONPROBERES_MAX_LEN ( 1148 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeP2PBeaconProbeRes(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEP2PBeaconProbeRes*);
+
+tANI_U32 dot11fPackIeP2PBeaconProbeRes(tpAniSirGlobal, tDot11fIEP2PBeaconProbeRes*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEP2PBeaconProbeRes(tpAniSirGlobal, tDot11fIEP2PBeaconProbeRes*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a, 0x09} (Multi-IE)
+typedef struct sDot11fIEP2PDeAuth {
+ tANI_U8 present;
+ tDot11fTLVMinorReasonCode MinorReasonCode;
+} tDot11fIEP2PDeAuth;
+
+#define DOT11F_EID_P2PDEAUTH ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_P2PDEAUTH_MIN_LEN ( 4 )
+
+#define DOT11F_IE_P2PDEAUTH_MAX_LEN ( 8 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeP2PDeAuth(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEP2PDeAuth*);
+
+tANI_U32 dot11fPackIeP2PDeAuth(tpAniSirGlobal, tDot11fIEP2PDeAuth*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEP2PDeAuth(tpAniSirGlobal, tDot11fIEP2PDeAuth*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a, 0x09} (Multi-IE)
+typedef struct sDot11fIEP2PDeviceDiscoverabilityReq {
+ tANI_U8 present;
+ tDot11fTLVP2PDeviceId P2PDeviceId;
+ tDot11fTLVP2PGroupId P2PGroupId;
+} tDot11fIEP2PDeviceDiscoverabilityReq;
+
+#define DOT11F_EID_P2PDEVICEDISCOVERABILITYREQ ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_P2PDEVICEDISCOVERABILITYREQ_MIN_LEN ( 4 )
+
+#define DOT11F_IE_P2PDEVICEDISCOVERABILITYREQ_MAX_LEN ( 54 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeP2PDeviceDiscoverabilityReq(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEP2PDeviceDiscoverabilityReq*);
+
+tANI_U32 dot11fPackIeP2PDeviceDiscoverabilityReq(tpAniSirGlobal, tDot11fIEP2PDeviceDiscoverabilityReq*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEP2PDeviceDiscoverabilityReq(tpAniSirGlobal, tDot11fIEP2PDeviceDiscoverabilityReq*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a, 0x09} (Multi-IE)
+typedef struct sDot11fIEP2PDeviceDiscoverabilityRes {
+ tANI_U8 present;
+ tDot11fTLVP2PStatus P2PStatus;
+} tDot11fIEP2PDeviceDiscoverabilityRes;
+
+#define DOT11F_EID_P2PDEVICEDISCOVERABILITYRES ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_P2PDEVICEDISCOVERABILITYRES_MIN_LEN ( 4 )
+
+#define DOT11F_IE_P2PDEVICEDISCOVERABILITYRES_MAX_LEN ( 8 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeP2PDeviceDiscoverabilityRes(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEP2PDeviceDiscoverabilityRes*);
+
+tANI_U32 dot11fPackIeP2PDeviceDiscoverabilityRes(tpAniSirGlobal, tDot11fIEP2PDeviceDiscoverabilityRes*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEP2PDeviceDiscoverabilityRes(tpAniSirGlobal, tDot11fIEP2PDeviceDiscoverabilityRes*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a, 0x09} (Multi-IE)
+typedef struct sDot11fIEP2PDisAssoc {
+ tANI_U8 present;
+ tDot11fTLVMinorReasonCode MinorReasonCode;
+} tDot11fIEP2PDisAssoc;
+
+#define DOT11F_EID_P2PDISASSOC ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_P2PDISASSOC_MIN_LEN ( 4 )
+
+#define DOT11F_IE_P2PDISASSOC_MAX_LEN ( 8 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeP2PDisAssoc(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEP2PDisAssoc*);
+
+tANI_U32 dot11fPackIeP2PDisAssoc(tpAniSirGlobal, tDot11fIEP2PDisAssoc*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEP2PDisAssoc(tpAniSirGlobal, tDot11fIEP2PDisAssoc*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a, 0x09} (Multi-IE)
+typedef struct sDot11fIEP2PGONegCnf {
+ tANI_U8 present;
+ tDot11fTLVP2PStatus P2PStatus;
+ tDot11fTLVP2PCapability P2PCapability;
+ tDot11fTLVOperatingChannel OperatingChannel;
+ tDot11fTLVChannelList ChannelList;
+ tDot11fTLVP2PGroupId P2PGroupId;
+} tDot11fIEP2PGONegCnf;
+
+#define DOT11F_EID_P2PGONEGCNF ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_P2PGONEGCNF_MIN_LEN ( 4 )
+
+#define DOT11F_IE_P2PGONEGCNF_MAX_LEN ( 319 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeP2PGONegCnf(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEP2PGONegCnf*);
+
+tANI_U32 dot11fPackIeP2PGONegCnf(tpAniSirGlobal, tDot11fIEP2PGONegCnf*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEP2PGONegCnf(tpAniSirGlobal, tDot11fIEP2PGONegCnf*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a, 0x09} (Multi-IE)
+typedef struct sDot11fIEP2PGONegReq {
+ tANI_U8 present;
+ tDot11fTLVP2PCapability P2PCapability;
+ tDot11fTLVGOIntent GOIntent;
+ tDot11fTLVConfigurationTimeout ConfigurationTimeout;
+ tDot11fTLVListenChannel ListenChannel;
+ tDot11fTLVExtendedListenTiming ExtendedListenTiming;
+ tDot11fTLVIntendedP2PInterfaceAddress IntendedP2PInterfaceAddress;
+ tDot11fTLVChannelList ChannelList;
+ tDot11fTLVP2PDeviceInfo P2PDeviceInfo;
+ tDot11fTLVOperatingChannel OperatingChannel;
+} tDot11fIEP2PGONegReq;
+
+#define DOT11F_EID_P2PGONEGREQ ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_P2PGONEGREQ_MIN_LEN ( 4 )
+
+#define DOT11F_IE_P2PGONEGREQ_MAX_LEN ( 362 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeP2PGONegReq(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEP2PGONegReq*);
+
+tANI_U32 dot11fPackIeP2PGONegReq(tpAniSirGlobal, tDot11fIEP2PGONegReq*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEP2PGONegReq(tpAniSirGlobal, tDot11fIEP2PGONegReq*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a, 0x09} (Multi-IE)
+typedef struct sDot11fIEP2PGONegRes {
+ tANI_U8 present;
+ tDot11fTLVP2PStatus P2PStatus;
+ tDot11fTLVP2PCapability P2PCapability;
+ tDot11fTLVGOIntent GOIntent;
+ tDot11fTLVConfigurationTimeout ConfigurationTimeout;
+ tDot11fTLVOperatingChannel OperatingChannel;
+ tDot11fTLVIntendedP2PInterfaceAddress IntendedP2PInterfaceAddress;
+ tDot11fTLVChannelList ChannelList;
+ tDot11fTLVP2PDeviceInfo P2PDeviceInfo;
+ tDot11fTLVP2PGroupId P2PGroupId;
+} tDot11fIEP2PGONegRes;
+
+#define DOT11F_EID_P2PGONEGRES ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_P2PGONEGRES_MIN_LEN ( 4 )
+
+#define DOT11F_IE_P2PGONEGRES_MAX_LEN ( 392 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeP2PGONegRes(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEP2PGONegRes*);
+
+tANI_U32 dot11fPackIeP2PGONegRes(tpAniSirGlobal, tDot11fIEP2PGONegRes*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEP2PGONegRes(tpAniSirGlobal, tDot11fIEP2PGONegRes*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x04} (Multi-IE)
+typedef struct sDot11fIEP2PGONegWPS {
+ tANI_U8 present;
+ tDot11fTLVVersion Version;
+ tDot11fTLVDevicePasswordID DevicePasswordID;
+} tDot11fIEP2PGONegWPS;
+
+#define DOT11F_EID_P2PGONEGWPS ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_P2PGONEGWPS_MIN_LEN ( 4 )
+
+#define DOT11F_IE_P2PGONEGWPS_MAX_LEN ( 15 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeP2PGONegWPS(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEP2PGONegWPS*);
+
+tANI_U32 dot11fPackIeP2PGONegWPS(tpAniSirGlobal, tDot11fIEP2PGONegWPS*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEP2PGONegWPS(tpAniSirGlobal, tDot11fIEP2PGONegWPS*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a, 0x09}
+typedef struct sDot11fIEP2PIEOpaque {
+ tANI_U8 present;
+ tANI_U8 num_data;
+ tANI_U8 data[249];
+} tDot11fIEP2PIEOpaque;
+
+#define DOT11F_EID_P2PIEOPAQUE ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_P2PIEOPAQUE_MIN_LEN ( 6 )
+
+#define DOT11F_IE_P2PIEOPAQUE_MAX_LEN ( 253 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeP2PIEOpaque(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEP2PIEOpaque*);
+
+tANI_U32 dot11fPackIeP2PIEOpaque(tpAniSirGlobal, tDot11fIEP2PIEOpaque*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEP2PIEOpaque(tpAniSirGlobal, tDot11fIEP2PIEOpaque*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a, 0x09} (Multi-IE)
+typedef struct sDot11fIEP2PInvitationReq {
+ tANI_U8 present;
+ tDot11fTLVConfigurationTimeout ConfigurationTimeout;
+ tDot11fTLVInvitationFlags InvitationFlags;
+ tDot11fTLVOperatingChannel OperatingChannel;
+ tDot11fTLVP2PGroupBssid P2PGroupBssid;
+ tDot11fTLVChannelList ChannelList;
+ tDot11fTLVP2PGroupId P2PGroupId;
+ tDot11fTLVP2PDeviceInfo P2PDeviceInfo;
+} tDot11fIEP2PInvitationReq;
+
+#define DOT11F_EID_P2PINVITATIONREQ ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_P2PINVITATIONREQ_MIN_LEN ( 4 )
+
+#define DOT11F_IE_P2PINVITATIONREQ_MAX_LEN ( 383 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeP2PInvitationReq(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEP2PInvitationReq*);
+
+tANI_U32 dot11fPackIeP2PInvitationReq(tpAniSirGlobal, tDot11fIEP2PInvitationReq*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEP2PInvitationReq(tpAniSirGlobal, tDot11fIEP2PInvitationReq*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a, 0x09} (Multi-IE)
+typedef struct sDot11fIEP2PInvitationRes {
+ tANI_U8 present;
+ tDot11fTLVP2PStatus P2PStatus;
+ tDot11fTLVConfigurationTimeout ConfigurationTimeout;
+ tDot11fTLVOperatingChannel OperatingChannel;
+ tDot11fTLVP2PGroupBssid P2PGroupBssid;
+ tDot11fTLVChannelList ChannelList;
+} tDot11fIEP2PInvitationRes;
+
+#define DOT11F_EID_P2PINVITATIONRES ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_P2PINVITATIONRES_MIN_LEN ( 4 )
+
+#define DOT11F_IE_P2PINVITATIONRES_MAX_LEN ( 287 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeP2PInvitationRes(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEP2PInvitationRes*);
+
+tANI_U32 dot11fPackIeP2PInvitationRes(tpAniSirGlobal, tDot11fIEP2PInvitationRes*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEP2PInvitationRes(tpAniSirGlobal, tDot11fIEP2PInvitationRes*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a, 0x09} (Multi-IE)
+typedef struct sDot11fIEP2PNoticeOfAbsence {
+ tANI_U8 present;
+ tDot11fTLVNoticeOfAbsence NoticeOfAbsence;
+} tDot11fIEP2PNoticeOfAbsence;
+
+#define DOT11F_EID_P2PNOTICEOFABSENCE ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_P2PNOTICEOFABSENCE_MIN_LEN ( 4 )
+
+#define DOT11F_IE_P2PNOTICEOFABSENCE_MAX_LEN ( 45 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeP2PNoticeOfAbsence(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEP2PNoticeOfAbsence*);
+
+tANI_U32 dot11fPackIeP2PNoticeOfAbsence(tpAniSirGlobal, tDot11fIEP2PNoticeOfAbsence*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEP2PNoticeOfAbsence(tpAniSirGlobal, tDot11fIEP2PNoticeOfAbsence*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a, 0x09} (Multi-IE)
+typedef struct sDot11fIEP2PPresenceResponse {
+ tANI_U8 present;
+ tDot11fTLVP2PStatus P2PStatus;
+ tDot11fTLVNoticeOfAbsence NoticeOfAbsence;
+} tDot11fIEP2PPresenceResponse;
+
+#define DOT11F_EID_P2PPRESENCERESPONSE ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_P2PPRESENCERESPONSE_MIN_LEN ( 4 )
+
+#define DOT11F_IE_P2PPRESENCERESPONSE_MAX_LEN ( 49 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeP2PPresenceResponse(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEP2PPresenceResponse*);
+
+tANI_U32 dot11fPackIeP2PPresenceResponse(tpAniSirGlobal, tDot11fIEP2PPresenceResponse*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEP2PPresenceResponse(tpAniSirGlobal, tDot11fIEP2PPresenceResponse*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a, 0x09} (Multi-IE)
+typedef struct sDot11fIEP2PProbeReq {
+ tANI_U8 present;
+ tDot11fTLVP2PCapability P2PCapability;
+ tDot11fTLVP2PDeviceId P2PDeviceId;
+ tDot11fTLVListenChannel ListenChannel;
+ tDot11fTLVExtendedListenTiming ExtendedListenTiming;
+ tDot11fTLVOperatingChannel OperatingChannel;
+} tDot11fIEP2PProbeReq;
+
+#define DOT11F_EID_P2PPROBEREQ ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_P2PPROBEREQ_MIN_LEN ( 4 )
+
+#define DOT11F_IE_P2PPROBEREQ_MAX_LEN ( 41 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeP2PProbeReq(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEP2PProbeReq*);
+
+tANI_U32 dot11fPackIeP2PProbeReq(tpAniSirGlobal, tDot11fIEP2PProbeReq*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEP2PProbeReq(tpAniSirGlobal, tDot11fIEP2PProbeReq*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a, 0x09} (Multi-IE)
+typedef struct sDot11fIEP2PProbeRes {
+ tANI_U8 present;
+ tDot11fTLVP2PCapability P2PCapability;
+ tDot11fTLVExtendedListenTiming ExtendedListenTiming;
+ tDot11fTLVNoticeOfAbsence NoticeOfAbsence;
+ tDot11fTLVP2PDeviceInfo P2PDeviceInfo;
+ tDot11fTLVP2PGroupInfo P2PGroupInfo;
+} tDot11fIEP2PProbeRes;
+
+#define DOT11F_EID_P2PPROBERES ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_P2PPROBERES_MIN_LEN ( 4 )
+
+#define DOT11F_IE_P2PPROBERES_MAX_LEN ( 1139 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeP2PProbeRes(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEP2PProbeRes*);
+
+tANI_U32 dot11fPackIeP2PProbeRes(tpAniSirGlobal, tDot11fIEP2PProbeRes*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEP2PProbeRes(tpAniSirGlobal, tDot11fIEP2PProbeRes*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a, 0x09} (Multi-IE)
+typedef struct sDot11fIEP2PProvisionDiscoveryReq {
+ tANI_U8 present;
+ tDot11fTLVP2PCapability P2PCapability;
+ tDot11fTLVP2PDeviceInfo P2PDeviceInfo;
+ tDot11fTLVP2PGroupId P2PGroupId;
+} tDot11fIEP2PProvisionDiscoveryReq;
+
+#define DOT11F_EID_P2PPROVISIONDISCOVERYREQ ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_P2PPROVISIONDISCOVERYREQ_MIN_LEN ( 4 )
+
+#define DOT11F_IE_P2PPROVISIONDISCOVERYREQ_MAX_LEN ( 105 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeP2PProvisionDiscoveryReq(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEP2PProvisionDiscoveryReq*);
+
+tANI_U32 dot11fPackIeP2PProvisionDiscoveryReq(tpAniSirGlobal, tDot11fIEP2PProvisionDiscoveryReq*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEP2PProvisionDiscoveryReq(tpAniSirGlobal, tDot11fIEP2PProvisionDiscoveryReq*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x04} (Multi-IE)
+typedef struct sDot11fIEP2PWSCProvisionDiscoveryRes {
+ tANI_U8 present;
+ tDot11fTLVConfigMethods ConfigMethods;
+} tDot11fIEP2PWSCProvisionDiscoveryRes;
+
+#define DOT11F_EID_P2PWSCPROVISIONDISCOVERYRES ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_P2PWSCPROVISIONDISCOVERYRES_MIN_LEN ( 4 )
+
+#define DOT11F_IE_P2PWSCPROVISIONDISCOVERYRES_MAX_LEN ( 10 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeP2PWSCProvisionDiscoveryRes(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEP2PWSCProvisionDiscoveryRes*);
+
+tANI_U32 dot11fPackIeP2PWSCProvisionDiscoveryRes(tpAniSirGlobal, tDot11fIEP2PWSCProvisionDiscoveryRes*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEP2PWSCProvisionDiscoveryRes(tpAniSirGlobal, tDot11fIEP2PWSCProvisionDiscoveryRes*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 33 (0x21)
+typedef struct sDot11fIEPowerCaps {
+ tANI_U8 present;
+ tANI_U8 minTxPower;
+ tANI_U8 maxTxPower;
+} tDot11fIEPowerCaps;
+
+#define DOT11F_EID_POWERCAPS ( 33 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_POWERCAPS_MIN_LEN ( 2 )
+
+#define DOT11F_IE_POWERCAPS_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIePowerCaps(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEPowerCaps*);
+
+tANI_U32 dot11fPackIePowerCaps(tpAniSirGlobal, tDot11fIEPowerCaps*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEPowerCaps(tpAniSirGlobal, tDot11fIEPowerCaps*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 32 (0x20)
+typedef struct sDot11fIEPowerConstraints {
+ tANI_U8 present;
+ tANI_U8 localPowerConstraints;
+} tDot11fIEPowerConstraints;
+
+#define DOT11F_EID_POWERCONSTRAINTS ( 32 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_POWERCONSTRAINTS_MIN_LEN ( 1 )
+
+#define DOT11F_IE_POWERCONSTRAINTS_MAX_LEN ( 1 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIePowerConstraints(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEPowerConstraints*);
+
+tANI_U32 dot11fPackIePowerConstraints(tpAniSirGlobal, tDot11fIEPowerConstraints*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEPowerConstraints(tpAniSirGlobal, tDot11fIEPowerConstraints*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 11 (0x0b)
+typedef struct sDot11fIEQBSSLoad {
+ tANI_U8 present;
+ tANI_U16 stacount;
+ tANI_U8 chautil;
+ tANI_U16 avail;
+} tDot11fIEQBSSLoad;
+
+#define DOT11F_EID_QBSSLOAD ( 11 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_QBSSLOAD_MIN_LEN ( 5 )
+
+#define DOT11F_IE_QBSSLOAD_MAX_LEN ( 5 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeQBSSLoad(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEQBSSLoad*);
+
+tANI_U32 dot11fPackIeQBSSLoad(tpAniSirGlobal, tDot11fIEQBSSLoad*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEQBSSLoad(tpAniSirGlobal, tDot11fIEQBSSLoad*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 46 (0x2e)
+typedef struct sDot11fIEQOSCapsAp {
+ tANI_U8 present;
+ tANI_U8 reserved: 1;
+ tANI_U8 txopreq: 1;
+ tANI_U8 qreq: 1;
+ tANI_U8 qack: 1;
+ tANI_U8 count: 4;
+} tDot11fIEQOSCapsAp;
+
+#define DOT11F_EID_QOSCAPSAP ( 46 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_QOSCAPSAP_MIN_LEN ( 1 )
+
+#define DOT11F_IE_QOSCAPSAP_MAX_LEN ( 1 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeQOSCapsAp(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEQOSCapsAp*);
+
+tANI_U32 dot11fPackIeQOSCapsAp(tpAniSirGlobal, tDot11fIEQOSCapsAp*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEQOSCapsAp(tpAniSirGlobal, tDot11fIEQOSCapsAp*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 46 (0x2e)
+typedef struct sDot11fIEQOSCapsStation {
+ tANI_U8 present;
+ tANI_U8 more_data_ack: 1;
+ tANI_U8 max_sp_length: 2;
+ tANI_U8 qack: 1;
+ tANI_U8 acbe_uapsd: 1;
+ tANI_U8 acbk_uapsd: 1;
+ tANI_U8 acvi_uapsd: 1;
+ tANI_U8 acvo_uapsd: 1;
+} tDot11fIEQOSCapsStation;
+
+#define DOT11F_EID_QOSCAPSSTATION ( 46 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_QOSCAPSSTATION_MIN_LEN ( 1 )
+
+#define DOT11F_IE_QOSCAPSSTATION_MAX_LEN ( 1 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeQOSCapsStation(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEQOSCapsStation*);
+
+tANI_U32 dot11fPackIeQOSCapsStation(tpAniSirGlobal, tDot11fIEQOSCapsStation*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEQOSCapsStation(tpAniSirGlobal, tDot11fIEQOSCapsStation*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 40 (0x28)
+typedef struct sDot11fIEQuiet {
+ tANI_U8 present;
+ tANI_U8 count;
+ tANI_U8 period;
+ tANI_U16 duration;
+ tANI_U16 offset;
+} tDot11fIEQuiet;
+
+#define DOT11F_EID_QUIET ( 40 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_QUIET_MIN_LEN ( 6 )
+
+#define DOT11F_IE_QUIET_MAX_LEN ( 6 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeQuiet(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEQuiet*);
+
+tANI_U32 dot11fPackIeQuiet(tpAniSirGlobal, tDot11fIEQuiet*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEQuiet(tpAniSirGlobal, tDot11fIEQuiet*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 53 (0x35)
+typedef struct sDot11fIERCPIIE {
+ tANI_U8 present;
+ tANI_U8 rcpi;
+} tDot11fIERCPIIE;
+
+#define DOT11F_EID_RCPIIE ( 53 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_RCPIIE_MIN_LEN ( 1 )
+
+#define DOT11F_IE_RCPIIE_MAX_LEN ( 1 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeRCPIIE(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIERCPIIE*);
+
+tANI_U32 dot11fPackIeRCPIIE(tpAniSirGlobal, tDot11fIERCPIIE*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIERCPIIE(tpAniSirGlobal, tDot11fIERCPIIE*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 57 (0x39)
+typedef struct sDot11fIERICDataDesc {
+ tANI_U8 present;
+ tDot11fIERICData RICData;
+ tDot11fIERICDescriptor RICDescriptor;
+ tDot11fIETSPEC TSPEC;
+ tANI_U16 num_TCLAS;
+ tDot11fIETCLAS TCLAS[2];
+ tDot11fIETCLASSPROC TCLASSPROC;
+ tDot11fIETSDelay TSDelay;
+ tDot11fIESchedule Schedule;
+ tDot11fIEWMMTSPEC WMMTSPEC;
+ tANI_U16 num_WMMTCLAS;
+ tDot11fIEWMMTCLAS WMMTCLAS[2];
+ tDot11fIEWMMTCLASPROC WMMTCLASPROC;
+ tDot11fIEWMMTSDelay WMMTSDelay;
+ tDot11fIEWMMSchedule WMMSchedule;
+} tDot11fIERICDataDesc;
+
+#define DOT11F_EID_RICDATADESC ( 57 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_RICDATADESC_MIN_LEN ( 0 )
+
+#define DOT11F_IE_RICDATADESC_MAX_LEN ( 548 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeRICDataDesc(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIERICDataDesc*);
+
+tANI_U32 dot11fPackIeRICDataDesc(tpAniSirGlobal, tDot11fIERICDataDesc*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIERICDataDesc(tpAniSirGlobal, tDot11fIERICDataDesc*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 48 (0x30)
+typedef struct sDot11fIERSN {
+ tANI_U8 present;
+ tANI_U16 version /* Must be 1! */;
+ tANI_U8 gp_cipher_suite[4];
+ tANI_U16 pwise_cipher_suite_count;
+ tANI_U8 pwise_cipher_suites[4][4];
+ tANI_U16 akm_suite_count;
+ tANI_U8 akm_suites[4][4];
+ tANI_U16 preauth: 1;
+ tANI_U16 no_pwise: 1;
+ tANI_U16 PTKSA_replay_counter: 2;
+ tANI_U16 GTKSA_replay_counter: 2;
+ tANI_U16 reserved: 10;
+ tANI_U16 pmkid_count;
+ tANI_U8 pmkid[4][16];
+} tDot11fIERSN;
+
+#define DOT11F_EID_RSN ( 48 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_RSN_MIN_LEN ( 6 )
+
+#define DOT11F_IE_RSN_MAX_LEN ( 110 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeRSN(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIERSN*);
+
+tANI_U32 dot11fPackIeRSN(tpAniSirGlobal, tDot11fIERSN*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIERSN(tpAniSirGlobal, tDot11fIERSN*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 65 (0x41)
+typedef struct sDot11fIERSNIIE {
+ tANI_U8 present;
+ tANI_U8 rsni;
+} tDot11fIERSNIIE;
+
+#define DOT11F_EID_RSNIIE ( 65 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_RSNIIE_MIN_LEN ( 1 )
+
+#define DOT11F_IE_RSNIIE_MAX_LEN ( 1 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeRSNIIE(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIERSNIIE*);
+
+tANI_U32 dot11fPackIeRSNIIE(tpAniSirGlobal, tDot11fIERSNIIE*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIERSNIIE(tpAniSirGlobal, tDot11fIERSNIIE*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 48 (0x30)
+typedef struct sDot11fIERSNOpaque {
+ tANI_U8 present;
+ tANI_U8 num_data;
+ tANI_U8 data[253];
+} tDot11fIERSNOpaque;
+
+#define DOT11F_EID_RSNOPAQUE ( 48 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_RSNOPAQUE_MIN_LEN ( 6 )
+
+#define DOT11F_IE_RSNOPAQUE_MAX_LEN ( 253 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeRSNOpaque(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIERSNOpaque*);
+
+tANI_U32 dot11fPackIeRSNOpaque(tpAniSirGlobal, tDot11fIERSNOpaque*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIERSNOpaque(tpAniSirGlobal, tDot11fIERSNOpaque*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 36 (0x24)
+typedef struct sDot11fIESuppChannels {
+ tANI_U8 present;
+ tANI_U8 num_bands;
+ tANI_U8 bands[48][2];
+} tDot11fIESuppChannels;
+
+#define DOT11F_EID_SUPPCHANNELS ( 36 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_SUPPCHANNELS_MIN_LEN ( 2 )
+
+#define DOT11F_IE_SUPPCHANNELS_MAX_LEN ( 96 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeSuppChannels(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIESuppChannels*);
+
+tANI_U32 dot11fPackIeSuppChannels(tpAniSirGlobal, tDot11fIESuppChannels*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIESuppChannels(tpAniSirGlobal, tDot11fIESuppChannels*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 1 (0x01)
+typedef struct sDot11fIESuppRates {
+ tANI_U8 present;
+ tANI_U8 num_rates;
+ tANI_U8 rates[12];
+} tDot11fIESuppRates;
+
+#define DOT11F_EID_SUPPRATES ( 1 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_SUPPRATES_MIN_LEN ( 0 )
+
+#define DOT11F_IE_SUPPRATES_MAX_LEN ( 12 )
+
+#define DOT11F_IS_BG_RATE(_x) (((_x) == 02) || \
+ ((_x) == 04) || \
+ ((_x) == 11) || \
+ ((_x) == 22) || \
+ ((_x) == 12) || \
+ ((_x) == 18) || \
+ ((_x) == 24) || \
+ ((_x) == 36) || \
+ ((_x) == 48) || \
+ ((_x) == 72) || \
+ ((_x) == 96) || \
+ ((_x) == 108))
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeSuppRates(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIESuppRates*);
+
+tANI_U32 dot11fPackIeSuppRates(tpAniSirGlobal, tDot11fIESuppRates*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIESuppRates(tpAniSirGlobal, tDot11fIESuppRates*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 5 (0x05)
+typedef struct sDot11fIETIM {
+ tANI_U8 present;
+ tANI_U8 dtim_count;
+ tANI_U8 dtim_period;
+ tANI_U8 bmpctl;
+ tANI_U8 num_vbmp;
+ tANI_U8 vbmp[251];
+} tDot11fIETIM;
+
+#define DOT11F_EID_TIM ( 5 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_TIM_MIN_LEN ( 4 )
+
+#define DOT11F_IE_TIM_MAX_LEN ( 254 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeTIM(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIETIM*);
+
+tANI_U32 dot11fPackIeTIM(tpAniSirGlobal, tDot11fIETIM*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIETIM(tpAniSirGlobal, tDot11fIETIM*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 35 (0x23)
+typedef struct sDot11fIETPCReport {
+ tANI_U8 present;
+ tANI_U8 tx_power;
+ tANI_U8 link_margin;
+} tDot11fIETPCReport;
+
+#define DOT11F_EID_TPCREPORT ( 35 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_TPCREPORT_MIN_LEN ( 2 )
+
+#define DOT11F_IE_TPCREPORT_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeTPCReport(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIETPCReport*);
+
+tANI_U32 dot11fPackIeTPCReport(tpAniSirGlobal, tDot11fIETPCReport*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIETPCReport(tpAniSirGlobal, tDot11fIETPCReport*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 34 (0x22)
+typedef struct sDot11fIETPCRequest {
+ tANI_U8 present;
+} tDot11fIETPCRequest;
+
+#define DOT11F_EID_TPCREQUEST ( 34 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_TPCREQUEST_MIN_LEN ( 0 )
+
+#define DOT11F_IE_TPCREQUEST_MAX_LEN ( 0 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeTPCRequest(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIETPCRequest*);
+
+tANI_U32 dot11fPackIeTPCRequest(tpAniSirGlobal, tDot11fIETPCRequest*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIETPCRequest(tpAniSirGlobal, tDot11fIETPCRequest*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 68 (0x44)
+typedef struct sDot11fIEWAPI {
+ tANI_U8 present;
+ tANI_U16 version /* Must be 1! */;
+ tANI_U16 akm_suite_count;
+ tANI_U8 akm_suites[4][4];
+ tANI_U16 unicast_cipher_suite_count;
+ tANI_U8 unicast_cipher_suites[4][4];
+ tANI_U8 multicast_cipher_suite[4];
+ tANI_U16 preauth: 1;
+ tANI_U16 reserved: 15;
+ tANI_U16 bkid_count;
+ tANI_U8 bkid[4][16];
+} tDot11fIEWAPI;
+
+#define DOT11F_EID_WAPI ( 68 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WAPI_MIN_LEN ( 12 )
+
+#define DOT11F_IE_WAPI_MAX_LEN ( 110 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWAPI(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWAPI*);
+
+tANI_U32 dot11fPackIeWAPI(tpAniSirGlobal, tDot11fIEWAPI*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWAPI(tpAniSirGlobal, tDot11fIEWAPI*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 68 (0x44)
+typedef struct sDot11fIEWAPIOpaque {
+ tANI_U8 present;
+ tANI_U8 num_data;
+ tANI_U8 data[253];
+} tDot11fIEWAPIOpaque;
+
+#define DOT11F_EID_WAPIOPAQUE ( 68 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WAPIOPAQUE_MIN_LEN ( 6 )
+
+#define DOT11F_IE_WAPIOPAQUE_MAX_LEN ( 253 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWAPIOpaque(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWAPIOpaque*);
+
+tANI_U32 dot11fPackIeWAPIOpaque(tpAniSirGlobal, tDot11fIEWAPIOpaque*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWAPIOpaque(tpAniSirGlobal, tDot11fIEWAPIOpaque*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x08, 0x00}
+typedef struct sDot11fIEWFATPC {
+ tANI_U8 present;
+ tANI_U8 txPower;
+ tANI_U8 linkMargin;
+} tDot11fIEWFATPC;
+
+#define DOT11F_EID_WFATPC ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WFATPC_MIN_LEN ( 7 )
+
+#define DOT11F_IE_WFATPC_MAX_LEN ( 7 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWFATPC(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWFATPC*);
+
+tANI_U32 dot11fPackIeWFATPC(tpAniSirGlobal, tDot11fIEWFATPC*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWFATPC(tpAniSirGlobal, tDot11fIEWFATPC*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x02, 0x05}
+typedef struct sDot11fIEWMMCaps {
+ tANI_U8 present;
+ tANI_U8 version /* Must be 1! */;
+ tANI_U8 reserved: 4;
+ tANI_U8 qack: 1;
+ tANI_U8 queue_request: 1;
+ tANI_U8 txop_request: 1;
+ tANI_U8 more_ack: 1;
+} tDot11fIEWMMCaps;
+
+#define DOT11F_EID_WMMCAPS ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WMMCAPS_MIN_LEN ( 7 )
+
+#define DOT11F_IE_WMMCAPS_MAX_LEN ( 7 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWMMCaps(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWMMCaps*);
+
+tANI_U32 dot11fPackIeWMMCaps(tpAniSirGlobal, tDot11fIEWMMCaps*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWMMCaps(tpAniSirGlobal, tDot11fIEWMMCaps*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x02, 0x00}
+typedef struct sDot11fIEWMMInfoAp {
+ tANI_U8 present;
+ tANI_U8 version;
+ tANI_U8 param_set_count: 4;
+ tANI_U8 reserved: 3;
+ tANI_U8 uapsd: 1;
+} tDot11fIEWMMInfoAp;
+
+#define DOT11F_EID_WMMINFOAP ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WMMINFOAP_MIN_LEN ( 7 )
+
+#define DOT11F_IE_WMMINFOAP_MAX_LEN ( 7 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWMMInfoAp(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWMMInfoAp*);
+
+tANI_U32 dot11fPackIeWMMInfoAp(tpAniSirGlobal, tDot11fIEWMMInfoAp*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWMMInfoAp(tpAniSirGlobal, tDot11fIEWMMInfoAp*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x02, 0x00}
+typedef struct sDot11fIEWMMInfoStation {
+ tANI_U8 present;
+ tANI_U8 version;
+ tANI_U8 acvo_uapsd: 1;
+ tANI_U8 acvi_uapsd: 1;
+ tANI_U8 acbk_uapsd: 1;
+ tANI_U8 acbe_uapsd: 1;
+ tANI_U8 reserved1: 1;
+ tANI_U8 max_sp_length: 2;
+ tANI_U8 reserved2: 1;
+} tDot11fIEWMMInfoStation;
+
+#define DOT11F_EID_WMMINFOSTATION ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WMMINFOSTATION_MIN_LEN ( 7 )
+
+#define DOT11F_IE_WMMINFOSTATION_MAX_LEN ( 7 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWMMInfoStation(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWMMInfoStation*);
+
+tANI_U32 dot11fPackIeWMMInfoStation(tpAniSirGlobal, tDot11fIEWMMInfoStation*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWMMInfoStation(tpAniSirGlobal, tDot11fIEWMMInfoStation*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x02, 0x01}
+typedef struct sDot11fIEWMMParams {
+ tANI_U8 present;
+ tANI_U8 version /* Must be 1! */;
+ tANI_U8 qosInfo;
+ tANI_U8 reserved2;
+ tANI_U8 acbe_aifsn: 4;
+ tANI_U8 acbe_acm: 1;
+ tANI_U8 acbe_aci: 2;
+ tANI_U8 unused1: 1;
+ tANI_U8 acbe_acwmin: 4;
+ tANI_U8 acbe_acwmax: 4;
+ tANI_U16 acbe_txoplimit;
+ tANI_U8 acbk_aifsn: 4;
+ tANI_U8 acbk_acm: 1;
+ tANI_U8 acbk_aci: 2;
+ tANI_U8 unused2: 1;
+ tANI_U8 acbk_acwmin: 4;
+ tANI_U8 acbk_acwmax: 4;
+ tANI_U16 acbk_txoplimit;
+ tANI_U8 acvi_aifsn: 4;
+ tANI_U8 acvi_acm: 1;
+ tANI_U8 acvi_aci: 2;
+ tANI_U8 unused3: 1;
+ tANI_U8 acvi_acwmin: 4;
+ tANI_U8 acvi_acwmax: 4;
+ tANI_U16 acvi_txoplimit;
+ tANI_U8 acvo_aifsn: 4;
+ tANI_U8 acvo_acm: 1;
+ tANI_U8 acvo_aci: 2;
+ tANI_U8 unused4: 1;
+ tANI_U8 acvo_acwmin: 4;
+ tANI_U8 acvo_acwmax: 4;
+ tANI_U16 acvo_txoplimit;
+} tDot11fIEWMMParams;
+
+#define DOT11F_EID_WMMPARAMS ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WMMPARAMS_MIN_LEN ( 24 )
+
+#define DOT11F_IE_WMMPARAMS_MAX_LEN ( 24 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWMMParams(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWMMParams*);
+
+tANI_U32 dot11fPackIeWMMParams(tpAniSirGlobal, tDot11fIEWMMParams*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWMMParams(tpAniSirGlobal, tDot11fIEWMMParams*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x01}
+typedef struct sDot11fIEWPA {
+ tANI_U8 present;
+ tANI_U16 version /* Must be 1! */;
+ tANI_U8 multicast_cipher_present; //field added to fix the bug in dot11fPackIEWPA
+ tANI_U8 multicast_cipher[4];
+ tANI_U16 unicast_cipher_count;
+ tANI_U8 unicast_ciphers[4][4];
+ tANI_U16 auth_suite_count;
+ tANI_U8 auth_suites[4][4];
+ tANI_U16 caps;
+} tDot11fIEWPA;
+
+#define DOT11F_EID_WPA ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WPA_MIN_LEN ( 6 )
+
+#define DOT11F_IE_WPA_MAX_LEN ( 48 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWPA(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWPA*);
+
+tANI_U32 dot11fPackIeWPA(tpAniSirGlobal, tDot11fIEWPA*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWPA(tpAniSirGlobal, tDot11fIEWPA*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x01}
+typedef struct sDot11fIEWPAOpaque {
+ tANI_U8 present;
+ tANI_U8 num_data;
+ tANI_U8 data[249];
+} tDot11fIEWPAOpaque;
+
+#define DOT11F_EID_WPAOPAQUE ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WPAOPAQUE_MIN_LEN ( 6 )
+
+#define DOT11F_IE_WPAOPAQUE_MAX_LEN ( 253 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWPAOpaque(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWPAOpaque*);
+
+tANI_U32 dot11fPackIeWPAOpaque(tpAniSirGlobal, tDot11fIEWPAOpaque*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWPAOpaque(tpAniSirGlobal, tDot11fIEWPAOpaque*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x04} (Multi-IE)
+typedef struct sDot11fIEWSC {
+ tANI_U8 present;
+ tDot11fTLVVersion Version;
+ tDot11fTLVWPSState WPSState;
+ tDot11fTLVAPSetupLocked APSetupLocked;
+ tDot11fTLVSelectedRegistrarConfigMethods SelectedRegistrarConfigMethods;
+ tDot11fTLVUUID_E UUID_E;
+ tDot11fTLVUUID_R UUID_R;
+ tDot11fTLVRFBands RFBands;
+ tDot11fTLVSelectedRegistrar SelectedRegistrar;
+ tDot11fTLVConfigMethods ConfigMethods;
+ tDot11fTLVAssociationState AssociationState;
+ tDot11fTLVConfigurationError ConfigurationError;
+ tDot11fTLVManufacturer Manufacturer;
+ tDot11fTLVModelName ModelName;
+ tDot11fTLVModelNumber ModelNumber;
+ tDot11fTLVSerialNumber SerialNumber;
+ tDot11fTLVDeviceName DeviceName;
+ tDot11fTLVDevicePasswordID DevicePasswordID;
+ tDot11fTLVPrimaryDeviceType PrimaryDeviceType;
+ tDot11fTLVRequestType RequestType;
+ tDot11fTLVResponseType ResponseType;
+ tDot11fTLVVendorExtension VendorExtension;
+ tDot11fTLVRequestDeviceType RequestDeviceType;
+} tDot11fIEWSC;
+
+#define DOT11F_EID_WSC ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WSC_MIN_LEN ( 4 )
+
+#define DOT11F_IE_WSC_MAX_LEN ( 366 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWSC(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWSC*);
+
+tANI_U32 dot11fPackIeWSC(tpAniSirGlobal, tDot11fIEWSC*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWSC(tpAniSirGlobal, tDot11fIEWSC*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x04} (Multi-IE)
+typedef struct sDot11fIEWscAssocReq {
+ tANI_U8 present;
+ tDot11fTLVVersion Version;
+ tDot11fTLVRequestType RequestType;
+ tDot11fTLVVendorExtension VendorExtension;
+} tDot11fIEWscAssocReq;
+
+#define DOT11F_EID_WSCASSOCREQ ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WSCASSOCREQ_MIN_LEN ( 4 )
+
+#define DOT11F_IE_WSCASSOCREQ_MAX_LEN ( 35 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWscAssocReq(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWscAssocReq*);
+
+tANI_U32 dot11fPackIeWscAssocReq(tpAniSirGlobal, tDot11fIEWscAssocReq*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWscAssocReq(tpAniSirGlobal, tDot11fIEWscAssocReq*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x04} (Multi-IE)
+typedef struct sDot11fIEWscAssocRes {
+ tANI_U8 present;
+ tDot11fTLVVersion Version;
+ tDot11fTLVResponseType ResponseType;
+ tDot11fTLVVendorExtension VendorExtension;
+} tDot11fIEWscAssocRes;
+
+#define DOT11F_EID_WSCASSOCRES ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WSCASSOCRES_MIN_LEN ( 4 )
+
+#define DOT11F_IE_WSCASSOCRES_MAX_LEN ( 35 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWscAssocRes(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWscAssocRes*);
+
+tANI_U32 dot11fPackIeWscAssocRes(tpAniSirGlobal, tDot11fIEWscAssocRes*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWscAssocRes(tpAniSirGlobal, tDot11fIEWscAssocRes*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x04} (Multi-IE)
+typedef struct sDot11fIEWscBeacon {
+ tANI_U8 present;
+ tDot11fTLVVersion Version;
+ tDot11fTLVWPSState WPSState;
+ tDot11fTLVAPSetupLocked APSetupLocked;
+ tDot11fTLVSelectedRegistrar SelectedRegistrar;
+ tDot11fTLVDevicePasswordID DevicePasswordID;
+ tDot11fTLVSelectedRegistrarConfigMethods SelectedRegistrarConfigMethods;
+ tDot11fTLVUUID_E UUID_E;
+ tDot11fTLVRFBands RFBands;
+ tDot11fTLVVendorExtension VendorExtension;
+} tDot11fIEWscBeacon;
+
+#define DOT11F_EID_WSCBEACON ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WSCBEACON_MIN_LEN ( 4 )
+
+#define DOT11F_IE_WSCBEACON_MAX_LEN ( 82 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWscBeacon(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWscBeacon*);
+
+tANI_U32 dot11fPackIeWscBeacon(tpAniSirGlobal, tDot11fIEWscBeacon*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWscBeacon(tpAniSirGlobal, tDot11fIEWscBeacon*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x04} (Multi-IE)
+typedef struct sDot11fIEWscBeaconProbeRes {
+ tANI_U8 present;
+ tDot11fTLVVersion Version;
+ tDot11fTLVWPSState WPSState;
+ tDot11fTLVAPSetupLocked APSetupLocked;
+ tDot11fTLVSelectedRegistrar SelectedRegistrar;
+ tDot11fTLVDevicePasswordID DevicePasswordID;
+ tDot11fTLVSelectedRegistrarConfigMethods SelectedRegistrarConfigMethods;
+ tDot11fTLVResponseType ResponseType;
+ tDot11fTLVUUID_E UUID_E;
+ tDot11fTLVManufacturer Manufacturer;
+ tDot11fTLVModelName ModelName;
+ tDot11fTLVModelNumber ModelNumber;
+ tDot11fTLVSerialNumber SerialNumber;
+ tDot11fTLVPrimaryDeviceType PrimaryDeviceType;
+ tDot11fTLVDeviceName DeviceName;
+ tDot11fTLVConfigMethods ConfigMethods;
+ tDot11fTLVRFBands RFBands;
+ tDot11fTLVVendorExtension VendorExtension;
+} tDot11fIEWscBeaconProbeRes;
+
+#define DOT11F_EID_WSCBEACONPROBERES ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WSCBEACONPROBERES_MIN_LEN ( 4 )
+
+#define DOT11F_IE_WSCBEACONPROBERES_MAX_LEN ( 317 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWscBeaconProbeRes(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWscBeaconProbeRes*);
+
+tANI_U32 dot11fPackIeWscBeaconProbeRes(tpAniSirGlobal, tDot11fIEWscBeaconProbeRes*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWscBeaconProbeRes(tpAniSirGlobal, tDot11fIEWscBeaconProbeRes*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x04}
+typedef struct sDot11fIEWscIEOpaque {
+ tANI_U8 present;
+ tANI_U8 num_data;
+ tANI_U8 data[249];
+} tDot11fIEWscIEOpaque;
+
+#define DOT11F_EID_WSCIEOPAQUE ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WSCIEOPAQUE_MIN_LEN ( 6 )
+
+#define DOT11F_IE_WSCIEOPAQUE_MAX_LEN ( 253 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWscIEOpaque(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWscIEOpaque*);
+
+tANI_U32 dot11fPackIeWscIEOpaque(tpAniSirGlobal, tDot11fIEWscIEOpaque*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWscIEOpaque(tpAniSirGlobal, tDot11fIEWscIEOpaque*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x04} (Multi-IE)
+typedef struct sDot11fIEWscProbeReq {
+ tANI_U8 present;
+ tDot11fTLVVersion Version;
+ tDot11fTLVRequestType RequestType;
+ tDot11fTLVConfigMethods ConfigMethods;
+ tDot11fTLVUUID_E UUID_E;
+ tDot11fTLVPrimaryDeviceType PrimaryDeviceType;
+ tDot11fTLVRFBands RFBands;
+ tDot11fTLVAssociationState AssociationState;
+ tDot11fTLVConfigurationError ConfigurationError;
+ tDot11fTLVDevicePasswordID DevicePasswordID;
+ tDot11fTLVManufacturer Manufacturer;
+ tDot11fTLVModelName ModelName;
+ tDot11fTLVModelNumber ModelNumber;
+ tDot11fTLVDeviceName DeviceName;
+ tDot11fTLVVendorExtension VendorExtension;
+ tDot11fTLVRequestDeviceType RequestDeviceType;
+} tDot11fIEWscProbeReq;
+
+#define DOT11F_EID_WSCPROBEREQ ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WSCPROBEREQ_MIN_LEN ( 4 )
+
+#define DOT11F_IE_WSCPROBEREQ_MAX_LEN ( 284 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWscProbeReq(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWscProbeReq*);
+
+tANI_U32 dot11fPackIeWscProbeReq(tpAniSirGlobal, tDot11fIEWscProbeReq*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWscProbeReq(tpAniSirGlobal, tDot11fIEWscProbeReq*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x04} (Multi-IE)
+typedef struct sDot11fIEWscProbeRes {
+ tANI_U8 present;
+ tDot11fTLVVersion Version;
+ tDot11fTLVWPSState WPSState;
+ tDot11fTLVAPSetupLocked APSetupLocked;
+ tDot11fTLVSelectedRegistrar SelectedRegistrar;
+ tDot11fTLVDevicePasswordID DevicePasswordID;
+ tDot11fTLVSelectedRegistrarConfigMethods SelectedRegistrarConfigMethods;
+ tDot11fTLVResponseType ResponseType;
+ tDot11fTLVUUID_E UUID_E;
+ tDot11fTLVManufacturer Manufacturer;
+ tDot11fTLVModelName ModelName;
+ tDot11fTLVModelNumber ModelNumber;
+ tDot11fTLVSerialNumber SerialNumber;
+ tDot11fTLVPrimaryDeviceType PrimaryDeviceType;
+ tDot11fTLVDeviceName DeviceName;
+ tDot11fTLVConfigMethods ConfigMethods;
+ tDot11fTLVRFBands RFBands;
+ tDot11fTLVVendorExtension VendorExtension;
+} tDot11fIEWscProbeRes;
+
+#define DOT11F_EID_WSCPROBERES ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WSCPROBERES_MIN_LEN ( 4 )
+
+#define DOT11F_IE_WSCPROBERES_MAX_LEN ( 317 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWscProbeRes(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWscProbeRes*);
+
+tANI_U32 dot11fPackIeWscProbeRes(tpAniSirGlobal, tDot11fIEWscProbeRes*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWscProbeRes(tpAniSirGlobal, tDot11fIEWscProbeRes*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x04} (Multi-IE)
+typedef struct sDot11fIEWscReassocRes {
+ tANI_U8 present;
+ tDot11fTLVVersion Version;
+ tDot11fTLVResponseType ResponseType;
+ tDot11fTLVVendorExtension VendorExtension;
+} tDot11fIEWscReassocRes;
+
+#define DOT11F_EID_WSCREASSOCRES ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WSCREASSOCRES_MIN_LEN ( 4 )
+
+#define DOT11F_IE_WSCREASSOCRES_MAX_LEN ( 35 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWscReassocRes(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWscReassocRes*);
+
+tANI_U32 dot11fPackIeWscReassocRes(tpAniSirGlobal, tDot11fIEWscReassocRes*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWscReassocRes(tpAniSirGlobal, tDot11fIEWscReassocRes*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+/************************************************************************
+ * Frames
+ **********************************************************************/
+
+typedef struct sDot11fAddBAReq{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fFfAddBAParameterSet AddBAParameterSet;
+ tDot11fFfBATimeout BATimeout;
+ tDot11fFfBAStartingSequenceControl BAStartingSequenceControl;
+} tDot11fAddBAReq;
+
+#define DOT11F_ADDBAREQ ( 1 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackAddBAReq(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fAddBAReq *pFrm);
+tANI_U32 dot11fPackAddBAReq(tpAniSirGlobal pCtx, tDot11fAddBAReq *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedAddBAReqSize(tpAniSirGlobal pCtx, tDot11fAddBAReq *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fAddBARsp{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fFfStatus Status;
+ tDot11fFfAddBAParameterSet AddBAParameterSet;
+ tDot11fFfBATimeout BATimeout;
+} tDot11fAddBARsp;
+
+#define DOT11F_ADDBARSP ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackAddBARsp(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fAddBARsp *pFrm);
+tANI_U32 dot11fPackAddBARsp(tpAniSirGlobal pCtx, tDot11fAddBARsp *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedAddBARspSize(tpAniSirGlobal pCtx, tDot11fAddBARsp *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fAddTSRequest{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fIETSPEC TSPEC;
+ tANI_U16 num_TCLAS;
+ tDot11fIETCLAS TCLAS[2];
+ tDot11fIETCLASSPROC TCLASSPROC;
+ tDot11fIEWMMTSPEC WMMTSPEC;
+ tANI_U16 num_WMMTCLAS;
+ tDot11fIEWMMTCLAS WMMTCLAS[2];
+ tDot11fIEWMMTCLASPROC WMMTCLASPROC;
+ tDot11fIECCXTrafStrmRateSet CCXTrafStrmRateSet;
+} tDot11fAddTSRequest;
+
+#define DOT11F_ADDTSREQUEST ( 3 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackAddTSRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fAddTSRequest *pFrm);
+tANI_U32 dot11fPackAddTSRequest(tpAniSirGlobal pCtx, tDot11fAddTSRequest *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedAddTSRequestSize(tpAniSirGlobal pCtx, tDot11fAddTSRequest *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fAddTSResponse{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fFfStatus Status;
+ tDot11fIETSDelay TSDelay;
+ tDot11fIETSPEC TSPEC;
+ tANI_U16 num_TCLAS;
+ tDot11fIETCLAS TCLAS[2];
+ tDot11fIETCLASSPROC TCLASSPROC;
+ tDot11fIESchedule Schedule;
+ tDot11fIEWMMTSDelay WMMTSDelay;
+ tDot11fIEWMMSchedule WMMSchedule;
+ tDot11fIEWMMTSPEC WMMTSPEC;
+ tANI_U16 num_WMMTCLAS;
+ tDot11fIEWMMTCLAS WMMTCLAS[2];
+ tDot11fIEWMMTCLASPROC WMMTCLASPROC;
+ tDot11fIECCXTrafStrmMet CCXTrafStrmMet;
+} tDot11fAddTSResponse;
+
+#define DOT11F_ADDTSRESPONSE ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackAddTSResponse(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fAddTSResponse *pFrm);
+tANI_U32 dot11fPackAddTSResponse(tpAniSirGlobal pCtx, tDot11fAddTSResponse *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedAddTSResponseSize(tpAniSirGlobal pCtx, tDot11fAddTSResponse *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fAssocRequest{
+ tDot11fFfCapabilities Capabilities;
+ tDot11fFfListenInterval ListenInterval;
+ tDot11fIESSID SSID;
+ tDot11fIESuppRates SuppRates;
+ tDot11fIEExtSuppRates ExtSuppRates;
+ tDot11fIEPowerCaps PowerCaps;
+ tDot11fIESuppChannels SuppChannels;
+ tDot11fIERSNOpaque RSNOpaque;
+ tDot11fIEQOSCapsStation QOSCapsStation;
+ tDot11fIERRMEnabledCap RRMEnabledCap;
+ tDot11fIEMobilityDomain MobilityDomain;
+ tDot11fIEWPAOpaque WPAOpaque;
+ tDot11fIEHTCaps HTCaps;
+ tDot11fIEWMMCaps WMMCaps;
+ tDot11fIEWMMInfoStation WMMInfoStation;
+ tDot11fIEAirgo Airgo;
+ tDot11fIEWscIEOpaque WscIEOpaque;
+ tDot11fIEWAPIOpaque WAPIOpaque;
+ tDot11fIECCXRadMgmtCap CCXRadMgmtCap;
+ tDot11fIECCXVersion CCXVersion;
+ tDot11fIEP2PIEOpaque P2PIEOpaque;
+} tDot11fAssocRequest;
+
+#define DOT11F_ASSOCREQUEST ( 5 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackAssocRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fAssocRequest *pFrm);
+tANI_U32 dot11fPackAssocRequest(tpAniSirGlobal pCtx, tDot11fAssocRequest *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedAssocRequestSize(tpAniSirGlobal pCtx, tDot11fAssocRequest *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fAssocResponse{
+ tDot11fFfCapabilities Capabilities;
+ tDot11fFfStatus Status;
+ tDot11fFfAID AID;
+ tDot11fIESuppRates SuppRates;
+ tDot11fIEExtSuppRates ExtSuppRates;
+ tDot11fIEEDCAParamSet EDCAParamSet;
+ tDot11fIERCPIIE RCPIIE;
+ tDot11fIERSNIIE RSNIIE;
+ tDot11fIERRMEnabledCap RRMEnabledCap;
+ tDot11fIEMobilityDomain MobilityDomain;
+ tDot11fIEFTInfo FTInfo;
+ tANI_U16 num_RICDataDesc;
+ tDot11fIERICDataDesc RICDataDesc[2];
+ tDot11fIEWPA WPA;
+ tDot11fIEHTCaps HTCaps;
+ tDot11fIEHTInfo HTInfo;
+ tDot11fIEWMMParams WMMParams;
+ tDot11fIEWMMCaps WMMCaps;
+ tDot11fIECCXRadMgmtCap CCXRadMgmtCap;
+ tDot11fIECCXTrafStrmMet CCXTrafStrmMet;
+ tDot11fIECCXTxmitPower CCXTxmitPower;
+ tANI_U16 num_WMMTSPEC;
+ tDot11fIEWMMTSPEC WMMTSPEC[4];
+ tDot11fIEAirgo Airgo;
+ tDot11fIEWscAssocRes WscAssocRes;
+ tDot11fIEP2PAssocRes P2PAssocRes;
+} tDot11fAssocResponse;
+
+#define DOT11F_ASSOCRESPONSE ( 6 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackAssocResponse(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fAssocResponse *pFrm);
+tANI_U32 dot11fPackAssocResponse(tpAniSirGlobal pCtx, tDot11fAssocResponse *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedAssocResponseSize(tpAniSirGlobal pCtx, tDot11fAssocResponse *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fAuthentication{
+ tDot11fFfAuthAlgo AuthAlgo;
+ tDot11fFfAuthSeqNo AuthSeqNo;
+ tDot11fFfStatus Status;
+ tDot11fIEChallengeText ChallengeText;
+ tDot11fIERSNOpaque RSNOpaque;
+ tDot11fIEMobilityDomain MobilityDomain;
+ tDot11fIEFTInfo FTInfo;
+ tDot11fIEFTTimeoutInterval FTTimeoutInterval;
+ tANI_U16 num_RICDataDesc;
+ tDot11fIERICDataDesc RICDataDesc[2];
+} tDot11fAuthentication;
+
+#define DOT11F_AUTHENTICATION ( 7 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackAuthentication(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fAuthentication *pFrm);
+tANI_U32 dot11fPackAuthentication(tpAniSirGlobal pCtx, tDot11fAuthentication *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedAuthenticationSize(tpAniSirGlobal pCtx, tDot11fAuthentication *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fBeacon{
+ tDot11fFfTimeStamp TimeStamp;
+ tDot11fFfBeaconInterval BeaconInterval;
+ tDot11fFfCapabilities Capabilities;
+ tDot11fIESSID SSID;
+ tDot11fIESuppRates SuppRates;
+ tDot11fIEFHParamSet FHParamSet;
+ tDot11fIEDSParams DSParams;
+ tDot11fIECFParams CFParams;
+ tDot11fIEIBSSParams IBSSParams;
+ tDot11fIETIM TIM;
+ tDot11fIECountry Country;
+ tDot11fIEFHParams FHParams;
+ tDot11fIEFHPattTable FHPattTable;
+ tDot11fIEPowerConstraints PowerConstraints;
+ tDot11fIEChanSwitchAnn ChanSwitchAnn;
+ tDot11fIEQuiet Quiet;
+ tDot11fIETPCReport TPCReport;
+ tDot11fIEERPInfo ERPInfo;
+ tDot11fIEExtSuppRates ExtSuppRates;
+ tDot11fIERSN RSN;
+ tDot11fIEQBSSLoad QBSSLoad;
+ tDot11fIEEDCAParamSet EDCAParamSet;
+ tDot11fIEQOSCapsAp QOSCapsAp;
+ tDot11fIEAPChannelReport APChannelReport;
+ tDot11fIERRMEnabledCap RRMEnabledCap;
+ tDot11fIEMobilityDomain MobilityDomain;
+ tDot11fIEWPA WPA;
+ tDot11fIEHTCaps HTCaps;
+ tDot11fIEHTInfo HTInfo;
+ tDot11fIEExtChanSwitchAnn ExtChanSwitchAnn;
+ tDot11fIEWMMInfoAp WMMInfoAp;
+ tDot11fIEWMMParams WMMParams;
+ tDot11fIEWMMCaps WMMCaps;
+ tDot11fIEWAPI WAPI;
+ tDot11fIECCXRadMgmtCap CCXRadMgmtCap;
+ tDot11fIECCXTrafStrmMet CCXTrafStrmMet;
+ tDot11fIECCXTxmitPower CCXTxmitPower;
+ tDot11fIEAirgo Airgo;
+ tDot11fIEWscBeacon WscBeacon;
+ tDot11fIEP2PBeacon P2PBeacon;
+} tDot11fBeacon;
+
+#define DOT11F_BEACON ( 8 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackBeacon(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fBeacon *pFrm);
+tANI_U32 dot11fPackBeacon(tpAniSirGlobal pCtx, tDot11fBeacon *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedBeaconSize(tpAniSirGlobal pCtx, tDot11fBeacon *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fBeacon1{
+ tDot11fFfTimeStamp TimeStamp;
+ tDot11fFfBeaconInterval BeaconInterval;
+ tDot11fFfCapabilities Capabilities;
+ tDot11fIESSID SSID;
+ tDot11fIESuppRates SuppRates;
+ tDot11fIEDSParams DSParams;
+ tDot11fIEIBSSParams IBSSParams;
+} tDot11fBeacon1;
+
+#define DOT11F_BEACON1 ( 9 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackBeacon1(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fBeacon1 *pFrm);
+tANI_U32 dot11fPackBeacon1(tpAniSirGlobal pCtx, tDot11fBeacon1 *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedBeacon1Size(tpAniSirGlobal pCtx, tDot11fBeacon1 *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fBeacon2{
+ tDot11fIECountry Country;
+ tDot11fIEPowerConstraints PowerConstraints;
+ tDot11fIEChanSwitchAnn ChanSwitchAnn;
+ tDot11fIEQuiet Quiet;
+ tDot11fIETPCReport TPCReport;
+ tDot11fIEERPInfo ERPInfo;
+ tDot11fIEExtSuppRates ExtSuppRates;
+ tDot11fIERSN RSN;
+ tDot11fIEEDCAParamSet EDCAParamSet;
+ tDot11fIEAPChannelReport APChannelReport;
+ tDot11fIERRMEnabledCap RRMEnabledCap;
+ tDot11fIEMobilityDomain MobilityDomain;
+ tDot11fIEWPA WPA;
+ tDot11fIEHTCaps HTCaps;
+ tDot11fIEHTInfo HTInfo;
+ tDot11fIEExtChanSwitchAnn ExtChanSwitchAnn;
+ tDot11fIEWMMInfoAp WMMInfoAp;
+ tDot11fIEWMMParams WMMParams;
+ tDot11fIEWMMCaps WMMCaps;
+ tDot11fIEAirgo Airgo;
+ tDot11fIEWscBeacon WscBeacon;
+ tDot11fIEWAPI WAPI;
+ tDot11fIECCXRadMgmtCap CCXRadMgmtCap;
+ tDot11fIECCXTrafStrmMet CCXTrafStrmMet;
+ tDot11fIECCXTxmitPower CCXTxmitPower;
+ tDot11fIEP2PBeacon P2PBeacon;
+} tDot11fBeacon2;
+
+#define DOT11F_BEACON2 ( 10 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackBeacon2(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fBeacon2 *pFrm);
+tANI_U32 dot11fPackBeacon2(tpAniSirGlobal pCtx, tDot11fBeacon2 *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedBeacon2Size(tpAniSirGlobal pCtx, tDot11fBeacon2 *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fBeaconIEs{
+ tDot11fIESSID SSID;
+ tDot11fIESuppRates SuppRates;
+ tDot11fIEFHParamSet FHParamSet;
+ tDot11fIEDSParams DSParams;
+ tDot11fIECFParams CFParams;
+ tDot11fIEIBSSParams IBSSParams;
+ tDot11fIETIM TIM;
+ tDot11fIECountry Country;
+ tDot11fIEFHParams FHParams;
+ tDot11fIEFHPattTable FHPattTable;
+ tDot11fIEPowerConstraints PowerConstraints;
+ tDot11fIEChanSwitchAnn ChanSwitchAnn;
+ tDot11fIEQuiet Quiet;
+ tDot11fIETPCReport TPCReport;
+ tDot11fIEERPInfo ERPInfo;
+ tDot11fIEExtSuppRates ExtSuppRates;
+ tDot11fIERSN RSN;
+ tDot11fIEQBSSLoad QBSSLoad;
+ tDot11fIEEDCAParamSet EDCAParamSet;
+ tDot11fIEQOSCapsAp QOSCapsAp;
+ tDot11fIEAPChannelReport APChannelReport;
+ tDot11fIERRMEnabledCap RRMEnabledCap;
+ tDot11fIEMobilityDomain MobilityDomain;
+ tDot11fIEWPA WPA;
+ tDot11fIEHTCaps HTCaps;
+ tDot11fIEHTInfo HTInfo;
+ tDot11fIEExtChanSwitchAnn ExtChanSwitchAnn;
+ tDot11fIEWMMInfoAp WMMInfoAp;
+ tDot11fIEWMMParams WMMParams;
+ tDot11fIEWMMCaps WMMCaps;
+ tDot11fIEWAPI WAPI;
+ tDot11fIECCXVersion CCXVersion;
+ tDot11fIECCXRadMgmtCap CCXRadMgmtCap;
+ tDot11fIECCXTrafStrmMet CCXTrafStrmMet;
+ tDot11fIECCXTxmitPower CCXTxmitPower;
+ tDot11fIEAirgo Airgo;
+ tDot11fIEWscBeaconProbeRes WscBeaconProbeRes;
+ tDot11fIEP2PBeaconProbeRes P2PBeaconProbeRes;
+} tDot11fBeaconIEs;
+
+#define DOT11F_BEACONIES ( 11 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackBeaconIEs(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fBeaconIEs *pFrm);
+tANI_U32 dot11fPackBeaconIEs(tpAniSirGlobal pCtx, tDot11fBeaconIEs *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedBeaconIEsSize(tpAniSirGlobal pCtx, tDot11fBeaconIEs *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fChannelSwitch{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fIEChanSwitchAnn ChanSwitchAnn;
+ tDot11fIEExtChanSwitchAnn ExtChanSwitchAnn;
+} tDot11fChannelSwitch;
+
+#define DOT11F_CHANNELSWITCH ( 12 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackChannelSwitch(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fChannelSwitch *pFrm);
+tANI_U32 dot11fPackChannelSwitch(tpAniSirGlobal pCtx, tDot11fChannelSwitch *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedChannelSwitchSize(tpAniSirGlobal pCtx, tDot11fChannelSwitch *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fDeAuth{
+ tDot11fFfReason Reason;
+ tDot11fIEP2PDeAuth P2PDeAuth;
+} tDot11fDeAuth;
+
+#define DOT11F_DEAUTH ( 13 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackDeAuth(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fDeAuth *pFrm);
+tANI_U32 dot11fPackDeAuth(tpAniSirGlobal pCtx, tDot11fDeAuth *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedDeAuthSize(tpAniSirGlobal pCtx, tDot11fDeAuth *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fDelBAInd{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfDelBAParameterSet DelBAParameterSet;
+ tDot11fFfReason Reason;
+} tDot11fDelBAInd;
+
+#define DOT11F_DELBAIND ( 14 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackDelBAInd(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fDelBAInd *pFrm);
+tANI_U32 dot11fPackDelBAInd(tpAniSirGlobal pCtx, tDot11fDelBAInd *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedDelBAIndSize(tpAniSirGlobal pCtx, tDot11fDelBAInd *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fDelTS{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfTSInfo TSInfo;
+ tDot11fFfReason Reason;
+} tDot11fDelTS;
+
+#define DOT11F_DELTS ( 15 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackDelTS(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fDelTS *pFrm);
+tANI_U32 dot11fPackDelTS(tpAniSirGlobal pCtx, tDot11fDelTS *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedDelTSSize(tpAniSirGlobal pCtx, tDot11fDelTS *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fDeviceDiscoverabilityReq{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfP2POUI P2POUI;
+ tDot11fFfP2POUISubType P2POUISubType;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fIEP2PDeviceDiscoverabilityReq P2PDeviceDiscoverabilityReq;
+} tDot11fDeviceDiscoverabilityReq;
+
+#define DOT11F_DEVICEDISCOVERABILITYREQ ( 16 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackDeviceDiscoverabilityReq(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fDeviceDiscoverabilityReq *pFrm);
+tANI_U32 dot11fPackDeviceDiscoverabilityReq(tpAniSirGlobal pCtx, tDot11fDeviceDiscoverabilityReq *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedDeviceDiscoverabilityReqSize(tpAniSirGlobal pCtx, tDot11fDeviceDiscoverabilityReq *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fDeviceDiscoverabilityRes{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfP2POUI P2POUI;
+ tDot11fFfP2POUISubType P2POUISubType;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fIEP2PDeviceDiscoverabilityRes P2PDeviceDiscoverabilityRes;
+} tDot11fDeviceDiscoverabilityRes;
+
+#define DOT11F_DEVICEDISCOVERABILITYRES ( 17 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackDeviceDiscoverabilityRes(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fDeviceDiscoverabilityRes *pFrm);
+tANI_U32 dot11fPackDeviceDiscoverabilityRes(tpAniSirGlobal pCtx, tDot11fDeviceDiscoverabilityRes *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedDeviceDiscoverabilityResSize(tpAniSirGlobal pCtx, tDot11fDeviceDiscoverabilityRes *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fDisassociation{
+ tDot11fFfReason Reason;
+ tDot11fIEP2PDisAssoc P2PDisAssoc;
+} tDot11fDisassociation;
+
+#define DOT11F_DISASSOCIATION ( 18 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackDisassociation(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fDisassociation *pFrm);
+tANI_U32 dot11fPackDisassociation(tpAniSirGlobal pCtx, tDot11fDisassociation *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedDisassociationSize(tpAniSirGlobal pCtx, tDot11fDisassociation *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fGODiscoverabilityReq{
+ tDot11fFfCategory Category;
+ tDot11fFfP2POUI P2POUI;
+ tDot11fFfP2POUISubType P2POUISubType;
+ tDot11fFfDialogToken DialogToken;
+} tDot11fGODiscoverabilityReq;
+
+#define DOT11F_GODISCOVERABILITYREQ ( 19 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackGODiscoverabilityReq(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fGODiscoverabilityReq *pFrm);
+tANI_U32 dot11fPackGODiscoverabilityReq(tpAniSirGlobal pCtx, tDot11fGODiscoverabilityReq *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedGODiscoverabilityReqSize(tpAniSirGlobal pCtx, tDot11fGODiscoverabilityReq *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fGONegCnf{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfP2POUI P2POUI;
+ tDot11fFfP2POUISubType P2POUISubType;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fIEP2PGONegCnf P2PGONegCnf;
+} tDot11fGONegCnf;
+
+#define DOT11F_GONEGCNF ( 20 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackGONegCnf(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fGONegCnf *pFrm);
+tANI_U32 dot11fPackGONegCnf(tpAniSirGlobal pCtx, tDot11fGONegCnf *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedGONegCnfSize(tpAniSirGlobal pCtx, tDot11fGONegCnf *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fGONegReq{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfP2POUI P2POUI;
+ tDot11fFfP2POUISubType P2POUISubType;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fIEP2PGONegWPS P2PGONegWPS;
+ tDot11fIEP2PGONegReq P2PGONegReq;
+} tDot11fGONegReq;
+
+#define DOT11F_GONEGREQ ( 21 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackGONegReq(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fGONegReq *pFrm);
+tANI_U32 dot11fPackGONegReq(tpAniSirGlobal pCtx, tDot11fGONegReq *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedGONegReqSize(tpAniSirGlobal pCtx, tDot11fGONegReq *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fGONegRes{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfP2POUI P2POUI;
+ tDot11fFfP2POUISubType P2POUISubType;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fIEP2PGONegWPS P2PGONegWPS;
+ tDot11fIEP2PGONegRes P2PGONegRes;
+} tDot11fGONegRes;
+
+#define DOT11F_GONEGRES ( 22 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackGONegRes(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fGONegRes *pFrm);
+tANI_U32 dot11fPackGONegRes(tpAniSirGlobal pCtx, tDot11fGONegRes *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedGONegResSize(tpAniSirGlobal pCtx, tDot11fGONegRes *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fInvitationReq{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfP2POUI P2POUI;
+ tDot11fFfP2POUISubType P2POUISubType;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fIEP2PInvitationReq P2PInvitationReq;
+} tDot11fInvitationReq;
+
+#define DOT11F_INVITATIONREQ ( 23 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackInvitationReq(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fInvitationReq *pFrm);
+tANI_U32 dot11fPackInvitationReq(tpAniSirGlobal pCtx, tDot11fInvitationReq *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedInvitationReqSize(tpAniSirGlobal pCtx, tDot11fInvitationReq *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fInvitationRes{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfP2POUI P2POUI;
+ tDot11fFfP2POUISubType P2POUISubType;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fIEP2PInvitationRes P2PInvitationRes;
+} tDot11fInvitationRes;
+
+#define DOT11F_INVITATIONRES ( 24 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackInvitationRes(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fInvitationRes *pFrm);
+tANI_U32 dot11fPackInvitationRes(tpAniSirGlobal pCtx, tDot11fInvitationRes *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedInvitationResSize(tpAniSirGlobal pCtx, tDot11fInvitationRes *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fLinkMeasurementReport{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fFfTPCEleID TPCEleID;
+ tDot11fFfTPCEleLen TPCEleLen;
+ tDot11fFfTxPower TxPower;
+ tDot11fFfLinkMargin LinkMargin;
+ tDot11fFfRxAntennaId RxAntennaId;
+ tDot11fFfTxAntennaId TxAntennaId;
+ tDot11fFfRCPI RCPI;
+ tDot11fFfRSNI RSNI;
+} tDot11fLinkMeasurementReport;
+
+#define DOT11F_LINKMEASUREMENTREPORT ( 25 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackLinkMeasurementReport(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fLinkMeasurementReport *pFrm);
+tANI_U32 dot11fPackLinkMeasurementReport(tpAniSirGlobal pCtx, tDot11fLinkMeasurementReport *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedLinkMeasurementReportSize(tpAniSirGlobal pCtx, tDot11fLinkMeasurementReport *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fLinkMeasurementRequest{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fFfTxPower TxPower;
+ tDot11fFfMaxTxPower MaxTxPower;
+} tDot11fLinkMeasurementRequest;
+
+#define DOT11F_LINKMEASUREMENTREQUEST ( 26 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackLinkMeasurementRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fLinkMeasurementRequest *pFrm);
+tANI_U32 dot11fPackLinkMeasurementRequest(tpAniSirGlobal pCtx, tDot11fLinkMeasurementRequest *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedLinkMeasurementRequestSize(tpAniSirGlobal pCtx, tDot11fLinkMeasurementRequest *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fMeasurementReport{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fIEMeasurementReport MeasurementReport;
+} tDot11fMeasurementReport;
+
+#define DOT11F_MEASUREMENTREPORT ( 27 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackMeasurementReport(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fMeasurementReport *pFrm);
+tANI_U32 dot11fPackMeasurementReport(tpAniSirGlobal pCtx, tDot11fMeasurementReport *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedMeasurementReportSize(tpAniSirGlobal pCtx, tDot11fMeasurementReport *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fMeasurementRequest{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfDialogToken DialogToken;
+ tANI_U16 num_MeasurementRequest;
+ tDot11fIEMeasurementRequest MeasurementRequest[4];
+} tDot11fMeasurementRequest;
+
+#define DOT11F_MEASUREMENTREQUEST ( 28 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackMeasurementRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fMeasurementRequest *pFrm);
+tANI_U32 dot11fPackMeasurementRequest(tpAniSirGlobal pCtx, tDot11fMeasurementRequest *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedMeasurementRequestSize(tpAniSirGlobal pCtx, tDot11fMeasurementRequest *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fNeighborReportRequest{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fIESSID SSID;
+} tDot11fNeighborReportRequest;
+
+#define DOT11F_NEIGHBORREPORTREQUEST ( 29 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackNeighborReportRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fNeighborReportRequest *pFrm);
+tANI_U32 dot11fPackNeighborReportRequest(tpAniSirGlobal pCtx, tDot11fNeighborReportRequest *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedNeighborReportRequestSize(tpAniSirGlobal pCtx, tDot11fNeighborReportRequest *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fNeighborReportResponse{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfDialogToken DialogToken;
+ tANI_U16 num_NeighborReport;
+ tDot11fIENeighborReport NeighborReport[4];
+} tDot11fNeighborReportResponse;
+
+#define DOT11F_NEIGHBORREPORTRESPONSE ( 30 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackNeighborReportResponse(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fNeighborReportResponse *pFrm);
+tANI_U32 dot11fPackNeighborReportResponse(tpAniSirGlobal pCtx, tDot11fNeighborReportResponse *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedNeighborReportResponseSize(tpAniSirGlobal pCtx, tDot11fNeighborReportResponse *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fNoticeOfAbs{
+ tDot11fFfCategory Category;
+ tDot11fFfP2POUI P2POUI;
+ tDot11fFfP2POUISubType P2POUISubType;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fIEP2PNoticeOfAbsence P2PNoticeOfAbsence;
+} tDot11fNoticeOfAbs;
+
+#define DOT11F_NOTICEOFABS ( 31 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackNoticeOfAbs(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fNoticeOfAbs *pFrm);
+tANI_U32 dot11fPackNoticeOfAbs(tpAniSirGlobal pCtx, tDot11fNoticeOfAbs *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedNoticeOfAbsSize(tpAniSirGlobal pCtx, tDot11fNoticeOfAbs *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fPresenceReq{
+ tDot11fFfCategory Category;
+ tDot11fFfP2POUI P2POUI;
+ tDot11fFfP2POUISubType P2POUISubType;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fIEP2PNoticeOfAbsence P2PNoticeOfAbsence;
+} tDot11fPresenceReq;
+
+#define DOT11F_PRESENCEREQ ( 32 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackPresenceReq(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fPresenceReq *pFrm);
+tANI_U32 dot11fPackPresenceReq(tpAniSirGlobal pCtx, tDot11fPresenceReq *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedPresenceReqSize(tpAniSirGlobal pCtx, tDot11fPresenceReq *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fPresenceRes{
+ tDot11fFfCategory Category;
+ tDot11fFfP2POUI P2POUI;
+ tDot11fFfP2POUISubType P2POUISubType;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fIEP2PPresenceResponse P2PPresenceResponse;
+} tDot11fPresenceRes;
+
+#define DOT11F_PRESENCERES ( 33 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackPresenceRes(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fPresenceRes *pFrm);
+tANI_U32 dot11fPackPresenceRes(tpAniSirGlobal pCtx, tDot11fPresenceRes *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedPresenceResSize(tpAniSirGlobal pCtx, tDot11fPresenceRes *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fProbeRequest{
+ tDot11fIESSID SSID;
+ tDot11fIESuppRates SuppRates;
+ tDot11fIERequestedInfo RequestedInfo;
+ tDot11fIEExtSuppRates ExtSuppRates;
+ tDot11fIEDSParams DSParams;
+ tDot11fIEHTCaps HTCaps;
+ tDot11fIEWscProbeReq WscProbeReq;
+ tDot11fIEWFATPC WFATPC;
+ tDot11fIEP2PProbeReq P2PProbeReq;
+} tDot11fProbeRequest;
+
+#define DOT11F_PROBEREQUEST ( 34 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackProbeRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fProbeRequest *pFrm);
+tANI_U32 dot11fPackProbeRequest(tpAniSirGlobal pCtx, tDot11fProbeRequest *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedProbeRequestSize(tpAniSirGlobal pCtx, tDot11fProbeRequest *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fProbeResponse{
+ tDot11fFfTimeStamp TimeStamp;
+ tDot11fFfBeaconInterval BeaconInterval;
+ tDot11fFfCapabilities Capabilities;
+ tDot11fIESSID SSID;
+ tDot11fIESuppRates SuppRates;
+ tDot11fIEFHParamSet FHParamSet;
+ tDot11fIEDSParams DSParams;
+ tDot11fIECFParams CFParams;
+ tDot11fIEIBSSParams IBSSParams;
+ tDot11fIECountry Country;
+ tDot11fIEFHParams FHParams;
+ tDot11fIEFHPattTable FHPattTable;
+ tDot11fIEPowerConstraints PowerConstraints;
+ tDot11fIEChanSwitchAnn ChanSwitchAnn;
+ tDot11fIEQuiet Quiet;
+ tDot11fIETPCReport TPCReport;
+ tDot11fIEERPInfo ERPInfo;
+ tDot11fIEExtSuppRates ExtSuppRates;
+ tDot11fIERSN RSN;
+ tDot11fIEQBSSLoad QBSSLoad;
+ tDot11fIEEDCAParamSet EDCAParamSet;
+ tDot11fIERRMEnabledCap RRMEnabledCap;
+ tDot11fIEAPChannelReport APChannelReport;
+ tDot11fIEMobilityDomain MobilityDomain;
+ tDot11fIEWPA WPA;
+ tDot11fIEHTCaps HTCaps;
+ tDot11fIEHTInfo HTInfo;
+ tDot11fIEExtChanSwitchAnn ExtChanSwitchAnn;
+ tDot11fIEWMMInfoAp WMMInfoAp;
+ tDot11fIEWMMParams WMMParams;
+ tDot11fIEWMMCaps WMMCaps;
+ tDot11fIEWAPI WAPI;
+ tDot11fIECCXRadMgmtCap CCXRadMgmtCap;
+ tDot11fIECCXTrafStrmMet CCXTrafStrmMet;
+ tDot11fIECCXTxmitPower CCXTxmitPower;
+ tDot11fIEAirgo Airgo;
+ tDot11fIEWscProbeRes WscProbeRes;
+ tDot11fIEP2PProbeRes P2PProbeRes;
+} tDot11fProbeResponse;
+
+#define DOT11F_PROBERESPONSE ( 35 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackProbeResponse(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fProbeResponse *pFrm);
+tANI_U32 dot11fPackProbeResponse(tpAniSirGlobal pCtx, tDot11fProbeResponse *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedProbeResponseSize(tpAniSirGlobal pCtx, tDot11fProbeResponse *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fProvisionDiscoveryReq{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfP2POUI P2POUI;
+ tDot11fFfP2POUISubType P2POUISubType;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fIEP2PProvisionDiscoveryReq P2PProvisionDiscoveryReq;
+} tDot11fProvisionDiscoveryReq;
+
+#define DOT11F_PROVISIONDISCOVERYREQ ( 36 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackProvisionDiscoveryReq(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fProvisionDiscoveryReq *pFrm);
+tANI_U32 dot11fPackProvisionDiscoveryReq(tpAniSirGlobal pCtx, tDot11fProvisionDiscoveryReq *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedProvisionDiscoveryReqSize(tpAniSirGlobal pCtx, tDot11fProvisionDiscoveryReq *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fProvisionDiscoveryRes{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfP2POUI P2POUI;
+ tDot11fFfP2POUISubType P2POUISubType;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fIEP2PWSCProvisionDiscoveryRes P2PWSCProvisionDiscoveryRes;
+} tDot11fProvisionDiscoveryRes;
+
+#define DOT11F_PROVISIONDISCOVERYRES ( 37 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackProvisionDiscoveryRes(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fProvisionDiscoveryRes *pFrm);
+tANI_U32 dot11fPackProvisionDiscoveryRes(tpAniSirGlobal pCtx, tDot11fProvisionDiscoveryRes *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedProvisionDiscoveryResSize(tpAniSirGlobal pCtx, tDot11fProvisionDiscoveryRes *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fRadioMeasurementReport{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfDialogToken DialogToken;
+ tANI_U16 num_MeasurementReport;
+ tDot11fIEMeasurementReport MeasurementReport[4];
+} tDot11fRadioMeasurementReport;
+
+#define DOT11F_RADIOMEASUREMENTREPORT ( 38 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackRadioMeasurementReport(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fRadioMeasurementReport *pFrm);
+tANI_U32 dot11fPackRadioMeasurementReport(tpAniSirGlobal pCtx, tDot11fRadioMeasurementReport *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedRadioMeasurementReportSize(tpAniSirGlobal pCtx, tDot11fRadioMeasurementReport *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fRadioMeasurementRequest{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fFfNumOfRepetitions NumOfRepetitions;
+ tANI_U16 num_MeasurementRequest;
+ tDot11fIEMeasurementRequest MeasurementRequest[2];
+} tDot11fRadioMeasurementRequest;
+
+#define DOT11F_RADIOMEASUREMENTREQUEST ( 39 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackRadioMeasurementRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fRadioMeasurementRequest *pFrm);
+tANI_U32 dot11fPackRadioMeasurementRequest(tpAniSirGlobal pCtx, tDot11fRadioMeasurementRequest *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedRadioMeasurementRequestSize(tpAniSirGlobal pCtx, tDot11fRadioMeasurementRequest *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fReAssocRequest{
+ tDot11fFfCapabilities Capabilities;
+ tDot11fFfListenInterval ListenInterval;
+ tDot11fFfCurrentAPAddress CurrentAPAddress;
+ tDot11fIESSID SSID;
+ tDot11fIESuppRates SuppRates;
+ tDot11fIEExtSuppRates ExtSuppRates;
+ tDot11fIEPowerCaps PowerCaps;
+ tDot11fIESuppChannels SuppChannels;
+ tDot11fIERSNOpaque RSNOpaque;
+ tDot11fIEQOSCapsStation QOSCapsStation;
+ tDot11fIERRMEnabledCap RRMEnabledCap;
+ tDot11fIEMobilityDomain MobilityDomain;
+ tDot11fIEFTInfo FTInfo;
+ tANI_U16 num_RICDataDesc;
+ tDot11fIERICDataDesc RICDataDesc[2];
+ tDot11fIEWPAOpaque WPAOpaque;
+ tDot11fIEHTCaps HTCaps;
+ tDot11fIEWMMCaps WMMCaps;
+ tDot11fIEWMMInfoStation WMMInfoStation;
+ tDot11fIEAirgo Airgo;
+ tDot11fIEWscIEOpaque WscIEOpaque;
+ tDot11fIEWAPIOpaque WAPIOpaque;
+ tDot11fIECCXRadMgmtCap CCXRadMgmtCap;
+ tDot11fIECCXVersion CCXVersion;
+ tDot11fIECCXCckmOpaque CCXCckmOpaque;
+ tANI_U16 num_WMMTSPEC;
+ tDot11fIEWMMTSPEC WMMTSPEC[4];
+ tDot11fIECCXTrafStrmRateSet CCXTrafStrmRateSet;
+ tDot11fIEP2PIEOpaque P2PIEOpaque;
+} tDot11fReAssocRequest;
+
+#define DOT11F_REASSOCREQUEST ( 40 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackReAssocRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fReAssocRequest *pFrm);
+tANI_U32 dot11fPackReAssocRequest(tpAniSirGlobal pCtx, tDot11fReAssocRequest *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedReAssocRequestSize(tpAniSirGlobal pCtx, tDot11fReAssocRequest *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fReAssocResponse{
+ tDot11fFfCapabilities Capabilities;
+ tDot11fFfStatus Status;
+ tDot11fFfAID AID;
+ tDot11fIESuppRates SuppRates;
+ tDot11fIEExtSuppRates ExtSuppRates;
+ tDot11fIEEDCAParamSet EDCAParamSet;
+ tDot11fIERCPIIE RCPIIE;
+ tDot11fIERSNIIE RSNIIE;
+ tDot11fIERRMEnabledCap RRMEnabledCap;
+ tDot11fIERSNOpaque RSNOpaque;
+ tDot11fIEMobilityDomain MobilityDomain;
+ tDot11fIEFTInfo FTInfo;
+ tANI_U16 num_RICDataDesc;
+ tDot11fIERICDataDesc RICDataDesc[2];
+ tDot11fIEWPA WPA;
+ tDot11fIEHTCaps HTCaps;
+ tDot11fIEHTInfo HTInfo;
+ tDot11fIEWMMParams WMMParams;
+ tDot11fIECCXRadMgmtCap CCXRadMgmtCap;
+ tDot11fIECCXTrafStrmMet CCXTrafStrmMet;
+ tDot11fIECCXTxmitPower CCXTxmitPower;
+ tANI_U16 num_WMMTSPEC;
+ tDot11fIEWMMTSPEC WMMTSPEC[4];
+ tDot11fIECCXTrafStrmRateSet CCXTrafStrmRateSet;
+ tDot11fIEAirgo Airgo;
+ tDot11fIEWscReassocRes WscReassocRes;
+ tDot11fIEP2PAssocRes P2PAssocRes;
+} tDot11fReAssocResponse;
+
+#define DOT11F_REASSOCRESPONSE ( 41 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackReAssocResponse(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fReAssocResponse *pFrm);
+tANI_U32 dot11fPackReAssocResponse(tpAniSirGlobal pCtx, tDot11fReAssocResponse *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedReAssocResponseSize(tpAniSirGlobal pCtx, tDot11fReAssocResponse *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fSMPowerSave{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfSMPowerModeSet SMPowerModeSet;
+} tDot11fSMPowerSave;
+
+#define DOT11F_SMPOWERSAVE ( 42 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackSMPowerSave(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fSMPowerSave *pFrm);
+tANI_U32 dot11fPackSMPowerSave(tpAniSirGlobal pCtx, tDot11fSMPowerSave *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedSMPowerSaveSize(tpAniSirGlobal pCtx, tDot11fSMPowerSave *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fTPCReport{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fIETPCReport TPCReport;
+} tDot11fTPCReport;
+
+#define DOT11F_TPCREPORT ( 43 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackTPCReport(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fTPCReport *pFrm);
+tANI_U32 dot11fPackTPCReport(tpAniSirGlobal pCtx, tDot11fTPCReport *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedTPCReportSize(tpAniSirGlobal pCtx, tDot11fTPCReport *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fTPCRequest{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fIETPCRequest TPCRequest;
+} tDot11fTPCRequest;
+
+#define DOT11F_TPCREQUEST ( 44 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackTPCRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fTPCRequest *pFrm);
+tANI_U32 dot11fPackTPCRequest(tpAniSirGlobal pCtx, tDot11fTPCRequest *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedTPCRequestSize(tpAniSirGlobal pCtx, tDot11fTPCRequest *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fWMMAddTSRequest{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fFfStatusCode StatusCode;
+ tDot11fIEWMMTSPEC WMMTSPEC;
+ tDot11fIECCXTrafStrmRateSet CCXTrafStrmRateSet;
+} tDot11fWMMAddTSRequest;
+
+#define DOT11F_WMMADDTSREQUEST ( 45 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackWMMAddTSRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fWMMAddTSRequest *pFrm);
+tANI_U32 dot11fPackWMMAddTSRequest(tpAniSirGlobal pCtx, tDot11fWMMAddTSRequest *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedWMMAddTSRequestSize(tpAniSirGlobal pCtx, tDot11fWMMAddTSRequest *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fWMMAddTSResponse{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fFfStatusCode StatusCode;
+ tDot11fIEWMMTSPEC WMMTSPEC;
+ tDot11fIECCXTrafStrmMet CCXTrafStrmMet;
+} tDot11fWMMAddTSResponse;
+
+#define DOT11F_WMMADDTSRESPONSE ( 46 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackWMMAddTSResponse(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fWMMAddTSResponse *pFrm);
+tANI_U32 dot11fPackWMMAddTSResponse(tpAniSirGlobal pCtx, tDot11fWMMAddTSResponse *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedWMMAddTSResponseSize(tpAniSirGlobal pCtx, tDot11fWMMAddTSResponse *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+typedef struct sDot11fWMMDelTS{
+ tDot11fFfCategory Category;
+ tDot11fFfAction Action;
+ tDot11fFfDialogToken DialogToken;
+ tDot11fFfStatusCode StatusCode;
+ tDot11fIEWMMTSPEC WMMTSPEC;
+} tDot11fWMMDelTS;
+
+#define DOT11F_WMMDELTS ( 47 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+tANI_U32 dot11fUnpackWMMDelTS(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fWMMDelTS *pFrm);
+tANI_U32 dot11fPackWMMDelTS(tpAniSirGlobal pCtx, tDot11fWMMDelTS *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
+tANI_U32 dot11fGetPackedWMMDelTSSize(tpAniSirGlobal pCtx, tDot11fWMMDelTS *pFrm, tANI_U32 *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+#endif /* DOT11F_H */
diff --git a/CORE/MAC/src/include/dphGlobal.h b/CORE/MAC/src/include/dphGlobal.h
new file mode 100644
index 0000000..56e5ed9
--- /dev/null
+++ b/CORE/MAC/src/include/dphGlobal.h
@@ -0,0 +1,372 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * Author: Sandesh Goel
+ * Date: 02/25/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#ifndef __DPH_GLOBAL_H__
+#define __DPH_GLOBAL_H__
+
+#include "limGlobal.h"
+//#include "parserApi.h"
+#include "sirMacProtDef.h"
+#include "sirMacPropExts.h"
+#include "sirApi.h"
+
+/// Following determines whether statistics are maintained or not
+#define DPH_STATS
+
+/// traffic category not allowed
+#define DPH_TID_NOTALLOWED 0xFF
+
+/// Periodicity of invocation of rate adaptation (in ms)
+#define DPH_RATE_ADAPTATION_PERIOD 20
+
+// Rate indices
+#define DPH_PHY_RATE_1_INDEX 0
+#define DPH_PHY_RATE_2_INDEX 1
+#define DPH_PHY_RATE_5_5_INDEX 2
+#define DPH_PHY_RATE_11_INDEX 3
+#define DPH_PHY_RATE_6_INDEX 4
+#define DPH_PHY_RATE_9_INDEX 5
+#define DPH_PHY_RATE_12_INDEX 6
+#define DPH_PHY_RATE_18_INDEX 7
+#define DPH_PHY_RATE_24_INDEX 8
+#define DPH_PHY_RATE_36_INDEX 9
+#define DPH_PHY_RATE_48_INDEX 10
+#define DPH_PHY_RATE_54_INDEX 11
+#define DPH_PHY_RATE_72_INDEX 12
+#define DPH_PHY_RATE_96_INDEX 13
+#define DPH_PHY_RATE_108_INDEX 14
+#define DPH_PHY_RATE_144_INDEX 15
+#define DPH_PHY_RATE_MAX_INDEX 16
+
+/// Maximum time to wait for a management packet to go out (ms)
+#define DPH_MAX_MGMT_WAIT_TIME 10000
+
+/// Step size for the wait time histogram (ms)
+#define DPH_WAIT_HIST_STEP 20
+
+/// Number of entries in wait time histogram
+#define DPH_WAIT_HIST_SIZE 100
+
+/// TCID for Management & Keep Alive Mgmt frames
+#define DPH_MGMT_TCID 4
+#define DPH_KEEPALIVE_PROBE_RESPONSE_TCID 0
+
+/// STAID for Management frames
+#define DPH_USE_MGMT_STAID -1
+
+// Keep Alive frames
+#define DPH_NON_KEEPALIVE_FRAME 0
+#define DPH_KEEPALIVE_FRAME 1
+
+/// Mask for subtype, type, protocol version, order and wep fields in the mac frame control
+#define DPH_FC_BD_FILL_MASK 0xFFCC
+
+/// Enable/Disable Txop generation in TFP for HCF mode
+#define DPH_ENABLE_HCF_TXOP_GEN_AT_TFP 0x00
+#define DPH_DISABLE_HCF_TXOP_GEN_AT_TFP 0x02
+
+/// Enable/Disable Txop generation in TFP for EDCF mode
+#define DPH_ENABLE_EDCF_TXOP_GEN_AT_TFP 0x00
+#define DPH_DISABLE_EDCF_TXOP_GEN_AT_TFP 0x01
+
+#define DPH_DUMP_ALL_STA_ID -1
+#define DPH_DUMP_RX_BD 0
+#define DPH_DUMP_TX_BD 1
+#define DPH_DUMP_TX_MGMT_BD 2
+
+//DPH Hash Index for BSS(STA's Peer) on station.
+#define DPH_STA_HASH_INDEX_PEER 1
+
+typedef struct sDphRateBasedCtr
+{
+ tANI_U32 hi;
+ tANI_U32 lo;
+} tDphRateBasedCtr;
+
+typedef struct sDphPhyRates
+{
+ tANI_U8 dataRateX2;
+ tANI_U8 ackRateX2;
+ tANI_U8 rtsRateX2;
+} tDphPhyRates;
+
+typedef struct sDphIFSValues
+{
+ tANI_U8 sifs;
+ tANI_U8 pifs;
+ tANI_U8 difs;
+ tANI_U8 preamble;
+} tDphIFSValues;
+
+typedef struct sDphQosParams
+{
+ tANI_U8 addtsPresent;
+ tSirAddtsReqInfo addts;
+ tSirMacQosCapabilityStaIE capability;
+} tDphQosParams;
+
+/// Queue attribute structure
+typedef struct sDphQueueAttr
+{
+ tANI_U16 valid : 1;
+ tANI_U16 seqNum : 12;
+ tANI_U16 ackPolicy : 2;
+ tANI_U16 rsvd : 1;
+} tDphQueueAttr, *tpDphQueueAttr;
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+typedef struct sCfgTrafficClass {
+ //Use Block ACK on this STA/TID
+ // Fields used to store the default TC parameters for this TSPEC.
+ // They will be used when the TSPEC is deleted.
+ tANI_U8 fDisableTx:1;
+ tANI_U8 fDisableRx:1;
+ tANI_U8 fUseBATx:1;
+ tANI_U8 fUseBARx:1;
+
+ // 1: expect to see frames with compressed BA coming from this peer MAC
+ tANI_U8 fRxCompBA:1;
+ tANI_U8 fTxCompBA:1;
+
+ // immediate ACK or delayed ACK for frames from this peer MAC
+ tANI_U8 fRxBApolicy:1;
+
+ // immediate ACK or delayed ACK for frames to this peer MAC
+ tANI_U8 fTxBApolicy:1;
+
+ //Initiator or recipient
+ tANI_U8 role;
+
+ //Max # of MSDU received from this STA, negotiated at ADDBA
+ // used for maintaining block ack state info
+ tANI_U16 rxBufSize;
+
+ //Max # of MSDU send to this STA, negotiated at ADDBA
+ tANI_U16 txBufSize;
+
+ //BA timeout negotiated at ADDBA. Unit: TU
+ tANI_U16 tuTxBAWaitTimeout; //Time for Tx to wait for BA. 0 means no timeout
+
+ tANI_U16 tuRxBAWaitTimeout; //Time for Rx to wait for explicit/implicit BAR. 0 means no timeout
+
+} tCfgTrafficClass;
+#endif /* EATURE_WLAN_INTEGRATED_SOC */
+
+/// STA state node
+typedef struct sDphHashNode
+{
+
+ //BYTE 0
+ // HASH ENTRY FIELDS NOT NEEDED IN HAL.
+ /// This STA valid or not
+ tANI_U8 valid : 1;
+ tANI_U8 encPolicy : 3;
+ tANI_U8 defaultKey : 1;
+ tANI_U8 defaultKeyId : 2;
+ tANI_U8 qosMode : 1;
+
+ //BYTE 1
+ tANI_U8 erpEnabled : 1;
+ tANI_U8 added : 1; // This has been added to the dph hash table
+ tANI_U8 linkTestOn : 1;
+ tANI_U8 shortPreambleEnabled : 1;
+ tANI_U8 shortSlotTimeEnabled : 1;
+ tANI_U8 stopTx:1;
+ tANI_U8 wmeEnabled: 1; // set if both ap and sta are wme capable
+ tANI_U8 lleEnabled: 1; // set if both ap and sta are 11e capable
+
+ //BYTE 2
+ tANI_U8 wsmEnabled: 1; // set if both ap and sta are wsm capable
+ tANI_U8 versionPresent:1; // station gave version info
+ tANI_U8 burstEnableForce:1; // allow bursting regardless of qosMode
+ tANI_U8 staAuthenticated:1;
+ /// Whether the peer is ANI or not
+ tANI_U8 aniPeer:1;
+ tANI_U8 titanPeer:1; // flag to indicate if its a titan peer
+ tANI_U8 fAniCount:1;
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ tANI_U8 hcfEnabled : 1;
+#else
+ tANI_U8 rsvd:1;
+#endif
+
+ /// Fragmentation size
+ tANI_U16 fragSize;
+
+ /// LIM state
+ tLimMlmStaContext mlmStaContext;
+
+ /// Number of Tim to wait if the STA doesn't respond / fetch data
+ tANI_U8 timWaitCount;
+
+ /// Number of Successfull MPDU's being sent
+ tANI_U32 curTxMpduCnt;
+
+
+ /// number of consecutive TIMs sent without response
+ tANI_U8 numTimSent;
+
+ // qos parameter info
+ tDphQosParams qos;
+
+ // station version info - valid only if versionPresent is set
+ tSirMacPropVersion version;
+ // station proprietary capability
+ tANI_U16 propCapability;
+
+#ifdef PLM_WDS
+ tANI_U8 wdsIndex;
+ tANI_U8 wdsPeerBeaconSeen;
+#endif
+
+ //Taurus capabilities
+ tANI_U16 baPolicyFlag; //BA Policy for each TID.
+
+ /*
+ * All the legacy and airgo supported rates.
+ */
+ tSirSupportedRates supportedRates;
+
+ tANI_U8 htGreenfield:1;
+ tANI_U8 htShortGI40Mhz:1;
+ tANI_U8 htShortGI20Mhz:1;
+ // DSSS/CCK at 40 MHz: Enabled 1 or Disabled
+ tANI_U8 htDsssCckRate40MHzSupport:1;
+ // L-SIG TXOP Protection used only if peer support available
+ tANI_U8 htLsigTXOPProtection:1;
+ // A-MPDU Density
+ // 000 - No restriction
+ // 001 - 1/8 usec
+ // 010 - 1/4 usec
+ // 011 - 1/2 usec
+ // 100 - 1 usec
+ // 101 - 2 usec
+ // 110 - 4 usec
+ // 111 - 8 usec
+ //
+ tANI_U8 htAMpduDensity:3;
+
+
+ //Set to 0 for 3839 octets
+ //Set to 1 for 7935 octets
+ tANI_U8 htMaxAmsduLength;
+
+
+ // MIMO Power Save
+ tSirMacHTMIMOPowerSaveState htMIMOPSState;
+
+ //
+
+ // Maximum Rx A-MPDU factor
+ tANI_U8 htMaxRxAMpduFactor:2;
+ //
+ // Recommended Tx Width Set
+ // 0 - use 20 MHz channel (control channel)
+ // 1 - use 40 Mhz channel
+ //
+ tANI_U8 htSupportedChannelWidthSet:1;
+ tANI_U8 rsvd1:5;
+
+ ///////////////////////////////////////////////////////////////////////
+ // DPH HASH ENTRY FIELDS NEEDED IN HAL ONLY
+ ///////////////////////////////////////////////////////////////////////
+ tANI_U8 dpuSig:4; // DPU signiture
+ tANI_U8 staSig:4; // STA signature
+ tANI_U8 staType;
+
+ tANI_U16 bssId; // BSSID
+ tANI_U16 assocId; // Association ID
+
+
+ //This is the real sta index generated by HAL
+ tANI_U16 staIndex;
+ tANI_U8 staAddr[6];
+ /*The DPU signatures will be sent eventually to TL to help it determine the
+ association to which a packet belongs to*/
+ /*Unicast DPU signature*/
+ tANI_U8 ucUcastSig;
+
+ /*Broadcast DPU signature*/
+ tANI_U8 ucBcastSig;
+
+ //
+ // PE needs this info on a per-STA, per-TID basis
+ // At any point in time, when this data is sampled,
+ // it gives a measure of:
+ // a) All the active bA sessions
+ // b) And the BA configuration itself
+ //
+ tCfgTrafficClass tcCfg[STACFG_MAX_TC];
+
+ // Block Ack state
+ // This is used between PE and HAL only.
+ // can be set to one of the values from the following enum
+ /*typedef enum eLimBAState
+ {
+ eLIM_BA_STATE_IDLE, // we are not waiting for anything from HAL.
+ eLIM_BA_STATE_WT_ADD_RSP, //We are waiting for Add rsponse from HAL.
+ eLIM_BA_STATE_WT_DEL_RSP // We are waiting for Del response from HAL.
+ } tLimBAState; */
+
+
+ //BA state bitmap 2 bits per tid
+ // BA state for tid i = (baState >> tid*2) & 0x3
+ tANI_U32 baState;
+
+ /* When a station with already an existing dph entry tries to
+ * associate again, the old dph entry will be zeroed out except
+ * for the next pointer. The next pointer must be defined at the
+ * end of the structure.
+ */
+ struct sDphHashNode *next;
+
+} tDphHashNode, *tpDphHashNode;
+
+#include "dphHashTable.h"
+
+// -------------------------------------------------------------------
+
+// get protection overrides from config variable
+// bit0: force cts to self protection for tx to Airgo peers
+// bit1: force cts to self protection for tx to non Airgo peers
+#define DPH_PROT_OVERRIDE_NONANI_PEER_GET(cfgval) ((cfgval) & 1)
+#define DPH_PROT_OVERRIDE_ANI_PEER_GET(cfgval) (((cfgval) & 2) >> 1)
+
+typedef struct sAniSirDph
+{
+ /// The hash table object
+ dphHashTableClass dphHashTable;
+} tAniSirDph, *tpAniSirDph;
+
+#endif
+
+
diff --git a/CORE/MAC/src/include/parserApi.h b/CORE/MAC/src/include/parserApi.h
new file mode 100644
index 0000000..ac63e09
--- /dev/null
+++ b/CORE/MAC/src/include/parserApi.h
@@ -0,0 +1,845 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file parserApi.h contains the definitions used
+ * for parsing received 802.11 frames
+ * Author: Chandra Modumudi
+ * Date: 02/11/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+#ifndef __PARSE_H__
+#define __PARSE_H__
+
+#include <stdarg.h>
+#include "sirMacPropExts.h"
+#include "dot11f.h"
+#include "limSession.h"
+
+#define COUNTRY_STRING_LENGTH ( 3 )
+#define COUNTRY_INFO_MAX_CHANNEL ( 84 )
+#define MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE (COUNTRY_STRING_LENGTH * COUNTRY_INFO_MAX_CHANNEL)
+#define HIGHEST_24GHZ_CHANNEL_NUM ( 14 )
+
+typedef struct sSirCountryInformation
+{
+ tANI_U8 countryString[COUNTRY_STRING_LENGTH];
+ tANI_U8 numIntervals; //number of channel intervals
+ struct channelPowerLim
+ {
+ tANI_U8 channelNumber;
+ tANI_U8 numChannel;
+ tANI_U8 maxTransmitPower;
+ } channelTransmitPower[COUNTRY_INFO_MAX_CHANNEL];
+} tSirCountryInformation,*tpSirCountryInformation;
+
+
+/// Structure common to Beaons & Probe Responses
+typedef struct sSirProbeRespBeacon
+{
+ tSirMacTimeStamp timeStamp;
+ tANI_U16 beaconInterval;
+ tSirMacCapabilityInfo capabilityInfo;
+
+ tSirMacSSid ssId;
+ tSirMacRateSet supportedRates;
+ tSirMacRateSet extendedRates;
+ tSirMacChanNum channelNumber;
+ tSirMacCfParamSet cfParamSet;
+ tSirMacTim tim;
+ tSirMacEdcaParamSetIE edcaParams;
+ tSirMacQosCapabilityIE qosCapability;
+
+ tSirCountryInformation countryInfoParam;
+ tSirMacWpaInfo wpa;
+ tSirMacRsnInfo rsn;
+
+ tSirMacErpInfo erpIEInfo;
+
+ tSirPropIEStruct propIEinfo;
+ tDot11fIEPowerConstraints localPowerConstraint;
+ tDot11fIETPCReport tpcReport;
+ tDot11fIEChanSwitchAnn channelSwitchIE;
+ tDot11fIEExtChanSwitchAnn extChannelSwitchIE;
+ tSirMacAddr bssid;
+ tDot11fIEQuiet quietIE;
+ tDot11fIEHTCaps HTCaps;
+ tDot11fIEHTInfo HTInfo;
+#ifdef WLAN_FEATURE_P2P
+ tDot11fIEP2PProbeRes P2PProbeRes;
+#endif
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ tANI_U8 mdie[SIR_MDIE_SIZE];
+#endif
+#ifdef FEATURE_WLAN_CCX
+ tDot11fIECCXTxmitPower ccxTxPwr;
+ tDot11fIEQBSSLoad QBSSLoad;
+#endif
+ tANI_U8 ssidPresent;
+ tANI_U8 suppRatesPresent;
+ tANI_U8 extendedRatesPresent;
+ tANI_U8 cfPresent;
+ tANI_U8 dsParamsPresent;
+ tANI_U8 timPresent;
+
+ tANI_U8 edcaPresent;
+ tANI_U8 qosCapabilityPresent;
+ tANI_U8 wmeEdcaPresent;
+ tANI_U8 wmeInfoPresent;
+ tANI_U8 wsmCapablePresent;
+
+ tANI_U8 countryInfoPresent;
+ tANI_U8 wpaPresent;
+ tANI_U8 rsnPresent;
+ tANI_U8 erpPresent;
+ tANI_U8 channelSwitchPresent;
+ tANI_U8 extChannelSwitchPresent;
+ tANI_U8 quietIEPresent;
+ tANI_U8 tpcReportPresent;
+ tANI_U8 powerConstraintPresent;
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ tANI_U8 mdiePresent;
+#endif
+
+} tSirProbeRespBeacon, *tpSirProbeRespBeacon;
+
+// probe Request structure
+typedef struct sSirProbeReq
+{
+ tSirMacSSid ssId;
+ tSirMacRateSet supportedRates;
+ tSirMacRateSet extendedRates;
+ tDot11fIEWscProbeReq probeReqWscIeInfo;
+ tDot11fIEHTCaps HTCaps;
+ tANI_U8 ssidPresent;
+ tANI_U8 suppRatesPresent;
+ tANI_U8 extendedRatesPresent;
+ tANI_U8 wscIePresent;
+ tANI_U8 p2pIePresent;
+
+} tSirProbeReq, *tpSirProbeReq;
+
+/// Association Request structure (one day to be replaced by
+/// tDot11fAssocRequest)
+typedef struct sSirAssocReq
+{
+
+ tSirMacCapabilityInfo capabilityInfo;
+ tANI_U16 listenInterval;
+ tSirMacAddr currentApAddr; /* only in reassoc frames */
+ tSirMacSSid ssId;
+ tSirMacRateSet supportedRates;
+ tSirMacRateSet extendedRates;
+
+ tSirAddtsReqInfo addtsReq;
+ tSirMacQosCapabilityStaIE qosCapability;
+
+ tSirMacWpaInfo wpa;
+ tSirMacRsnInfo rsn;
+ tSirAddie addIE;
+
+ tSirPropIEStruct propIEinfo;
+ tSirMacPowerCapabilityIE powerCapability;
+ tSirMacSupportedChannelIE supportedChannels;
+ tDot11fIEHTCaps HTCaps;
+#ifdef WLAN_SOFTAP_FEATURE
+ tDot11fIEWMMInfoStation WMMInfoStation;
+#endif
+ /// This is set if the frame is a reassoc request:
+ tANI_U8 reassocRequest;
+ tANI_U8 ssidPresent;
+ tANI_U8 suppRatesPresent;
+ tANI_U8 extendedRatesPresent;
+
+ tANI_U8 wmeInfoPresent;
+ tANI_U8 qosCapabilityPresent;
+ tANI_U8 addtsPresent;
+ tANI_U8 wsmCapablePresent;
+
+ tANI_U8 wpaPresent;
+ tANI_U8 rsnPresent;
+ tANI_U8 addIEPresent;
+
+ tANI_U8 powerCapabilityPresent;
+ tANI_U8 supportedChannelsPresent;
+#ifdef WLAN_SOFTAP_FEATURE
+ // keeing copy of assoction request received, this is
+ // required for indicating the frame to upper layers
+ tANI_U32 assocReqFrameLength;
+ tANI_U8* assocReqFrame;
+#endif
+} tSirAssocReq, *tpSirAssocReq;
+
+
+/// Association Response structure (one day to be replaced by
+/// tDot11fAssocRequest)
+typedef struct sSirAssocRsp
+{
+
+ tSirMacCapabilityInfo capabilityInfo;
+ tANI_U16 aid;
+ tANI_U16 statusCode;
+ tSirMacRateSet supportedRates;
+ tSirMacRateSet extendedRates;
+ tSirPropIEStruct propIEinfo;
+ tSirMacEdcaParamSetIE edca;
+ tSirAddtsRspInfo addtsRsp;
+ tDot11fIEHTCaps HTCaps;
+ tDot11fIEHTInfo HTInfo;
+#if defined WLAN_FEATURE_VOWIFI_11R
+ tDot11fIEFTInfo FTInfo;
+ tANI_U8 mdie[SIR_MDIE_SIZE];
+ tANI_U8 num_RICData;
+ tDot11fIERICDataDesc RICData[2];
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+ tANI_U8 num_tspecs;
+ tDot11fIEWMMTSPEC TSPECInfo[SIR_CCX_MAX_TSPEC_IES];
+ tSirMacCCXTSMIE tsmIE;
+#endif
+
+ tANI_U8 suppRatesPresent;
+ tANI_U8 extendedRatesPresent;
+
+ tANI_U8 edcaPresent;
+ tANI_U8 wmeEdcaPresent;
+ tANI_U8 addtsPresent;
+ tANI_U8 wsmCapablePresent;
+#if defined WLAN_FEATURE_VOWIFI_11R
+ tANI_U8 ftinfoPresent;
+ tANI_U8 mdiePresent;
+ tANI_U8 ricPresent;
+#endif
+#ifdef FEATURE_WLAN_CCX
+ tANI_U8 tspecPresent;
+ tANI_U8 tsmPresent;
+#endif
+} tSirAssocRsp, *tpSirAssocRsp;
+
+tANI_U8
+sirIsPropCapabilityEnabled(struct sAniSirGlobal *pMac, tANI_U32 bitnum);
+
+tSirRetStatus
+sirGetCfgPropCaps(struct sAniSirGlobal *, tANI_U16 *);
+
+void dot11fLog(tpAniSirGlobal pMac, int nSev, const char *lpszFormat, ...);
+
+#define CFG_GET_INT(nStatus, pMac, nItem, cfg ) \
+ (nStatus) = wlan_cfgGetInt( (pMac), (nItem), & (cfg) ); \
+ if ( eSIR_SUCCESS != (nStatus) ) \
+ { \
+ dot11fLog( (pMac), LOGP, FL("Failed to retrieve " \
+ #nItem " from CFG (%d).\n"), \
+ (nStatus) ); \
+ return nStatus; \
+ }
+
+#define CFG_GET_INT_NO_STATUS(nStatus, pMac, nItem, cfg ) \
+ (nStatus) = wlan_cfgGetInt( (pMac), (nItem), & (cfg) ); \
+ if ( eSIR_SUCCESS != (nStatus) ) \
+ { \
+ dot11fLog( (pMac), LOGP, FL("Failed to retrieve " \
+ #nItem " from CFG (%d).\n"), \
+ (nStatus) ); \
+ return; \
+ }
+
+#define CFG_GET_STR(nStatus, pMac, nItem, cfg, nCfg, nMaxCfg) \
+ (nCfg) = (nMaxCfg); \
+ (nStatus) = wlan_cfgGetStr( (pMac), (nItem), (cfg), & (nCfg) ); \
+ if ( eSIR_SUCCESS != (nStatus) ) \
+ { \
+ dot11fLog( (pMac), LOGP, FL("Failed to retrieve " \
+ #nItem " from CFG (%d).\n"), \
+ (nStatus) ); \
+ return nStatus; \
+ }
+
+#define CFG_GET_STR_NO_STATUS(nStatus, pMac, nItem, cfg, nCfg, \
+ nMaxCfg) \
+ (nCfg) = (nMaxCfg); \
+ (nStatus) = wlan_cfgGetStr( (pMac), (nItem), (cfg), & (nCfg) ); \
+ if ( eSIR_SUCCESS != (nStatus) ) \
+ { \
+ dot11fLog( (pMac), LOGP, FL("Failed to retrieve " \
+ #nItem " from CFG (%d).\n"), \
+ (nStatus) ); \
+ return; \
+ }
+
+void swapBitField16(tANI_U16 in, tANI_U16 *out);
+
+// Currently implemented as "shims" between callers & the new framesc-
+// generated code:
+
+tSirRetStatus
+sirConvertProbeReqFrame2Struct(struct sAniSirGlobal *pMac,
+ tANI_U8 *frame,
+ tANI_U32 len,
+ tpSirProbeReq probe);
+
+tSirRetStatus
+sirConvertProbeFrame2Struct(struct sAniSirGlobal *pMac, tANI_U8 *frame,
+ tANI_U32 len,
+ tpSirProbeRespBeacon probe);
+
+tSirRetStatus
+sirConvertAssocReqFrame2Struct(struct sAniSirGlobal *pMac,
+ tANI_U8 * frame,
+ tANI_U32 len,
+ tpSirAssocReq assoc);
+
+tSirRetStatus
+sirConvertAssocRespFrame2Struct(struct sAniSirGlobal *pMac,
+ tANI_U8 * frame,
+ tANI_U32 len,
+ tpSirAssocRsp assoc);
+
+tSirRetStatus
+sirConvertReassocReqFrame2Struct(struct sAniSirGlobal *pMac,
+ tANI_U8 * frame,
+ tANI_U32 len,
+ tpSirAssocReq assoc);
+
+tSirRetStatus
+sirParseBeaconIE(struct sAniSirGlobal *pMac,
+ tpSirProbeRespBeacon pBeaconStruct,
+ tANI_U8 *pPayload,
+ tANI_U32 payloadLength);
+
+tSirRetStatus
+sirConvertBeaconFrame2Struct(struct sAniSirGlobal *pMac,
+ tANI_U8 *pBeaconFrame,
+ tpSirProbeRespBeacon pBeaconStruct);
+
+tSirRetStatus
+sirConvertAuthFrame2Struct(struct sAniSirGlobal *pMac,
+ tANI_U8 * frame,
+ tANI_U32 len,
+ tpSirMacAuthFrameBody auth);
+
+tSirRetStatus
+sirConvertAddtsReq2Struct(struct sAniSirGlobal *pMac,
+ tANI_U8 *frame,
+ tANI_U32 len,
+ tSirAddtsReqInfo *addTs);
+
+tSirRetStatus
+sirConvertAddtsRsp2Struct(struct sAniSirGlobal *pMac,
+ tANI_U8 *frame,
+ tANI_U32 len,
+ tSirAddtsRspInfo *addts);
+
+tSirRetStatus
+sirConvertDeltsReq2Struct(struct sAniSirGlobal *pMac,
+ tANI_U8 *frame,
+ tANI_U32 len,
+ tSirDeltsReqInfo *delTs);
+
+#ifdef ANI_SUPPORT_11H
+tSirRetStatus
+sirConvertTpcReqFrame2Struct(struct sAniSirGlobal *, tANI_U8 *,
+ tpSirMacTpcReqActionFrame, tANI_U32);
+
+tSirRetStatus
+sirConvertMeasReqFrame2Struct(struct sAniSirGlobal *, tANI_U8 *,
+ tpSirMacMeasReqActionFrame, tANI_U32);
+#endif
+
+
+/**
+ * \brief Populated a tDot11fFfCapabilities
+ *
+ * \sa PopulatedDot11fCapabilities2
+ *
+ *
+ * \param pMac Pointer to the global MAC datastructure
+ *
+ * \param pDot11f Address of a tDot11fFfCapabilities to be filled in
+ *
+ *
+ * \note If SIR_MAC_PROP_CAPABILITY_11EQOS is enabled, we'll clear the QOS
+ * bit in pDot11f
+ *
+ *
+ */
+
+tSirRetStatus
+PopulateDot11fCapabilities(tpAniSirGlobal pMac,
+ tDot11fFfCapabilities *pDot11f,
+ tpPESession psessionEntry);
+
+/**
+ * \brief Populated a tDot11fFfCapabilities
+ *
+ * \sa PopulatedDot11fCapabilities2
+ *
+ *
+ * \param pMac Pointer to the global MAC datastructure
+ *
+ * \param pDot11f Address of a tDot11fFfCapabilities to be filled in
+ *
+ * \param pSta Pointer to a tDphHashNode representing a peer
+ *
+ *
+ * \note If SIR_MAC_PROP_CAPABILITY_11EQOS is enabled on our peer, we'll
+ * clear the QOS bit in pDot11f
+ *
+ *
+ */
+
+struct sDphHashNode;
+
+tSirRetStatus
+PopulateDot11fCapabilities2(tpAniSirGlobal pMac,
+ tDot11fFfCapabilities *pDot11f,
+ struct sDphHashNode *pSta,
+ tpPESession psessionEntry);
+
+/// Populate a tDot11fIEChanSwitchAnn
+void
+PopulateDot11fChanSwitchAnn(tpAniSirGlobal pMac,
+ tDot11fIEChanSwitchAnn *pDot11f);
+
+/// Populate a tDot11fIEChanSwitchAnn
+void
+PopulateDot11fExtChanSwitchAnn(tpAniSirGlobal pMac,
+ tDot11fIEExtChanSwitchAnn *pDot11f);
+
+/// Populate a tDot11fIECountry
+tSirRetStatus
+PopulateDot11fCountry(tpAniSirGlobal pMac,
+ tDot11fIECountry *pDot11f, tpPESession psessionEntry);
+
+/// Populated a PopulateDot11fDSParams
+tSirRetStatus
+PopulateDot11fDSParams(tpAniSirGlobal pMac,
+ tDot11fIEDSParams *pDot11f, tANI_U8 channel,
+ tpPESession psessionEntry);
+
+
+/// Populated a tDot11fIEEDCAParamSet
+void
+PopulateDot11fEDCAParamSet(tpAniSirGlobal pMac,
+ tDot11fIEEDCAParamSet *pDot11f,
+ tpPESession psessionEntry);
+
+#ifdef WLAN_SOFTAP_FEATURE
+tSirRetStatus
+PopulateDot11fERPInfo(tpAniSirGlobal pMac,
+ tDot11fIEERPInfo *pDot11f, tpPESession psessionEntry);
+#else
+tSirRetStatus
+PopulateDot11fERPInfo(tpAniSirGlobal pMac,
+ tDot11fIEERPInfo *pDot11f);
+#endif
+
+tSirRetStatus
+PopulateDot11fExtSuppRates(tpAniSirGlobal pMac,
+ tANI_U8 nChannelNum, tDot11fIEExtSuppRates *pDot11f,
+ tpPESession psessionEntry);
+
+#if defined WLAN_FEATURE_VOWIFI
+tSirRetStatus
+PopulateDot11fBeaconReport(tpAniSirGlobal pMac,
+ tDot11fIEMeasurementReport *pDot11f,
+ tSirMacBeaconReport *pBeaconReport );
+#endif
+
+/**
+ * \brief Populate a tDot11fIEExtSuppRates
+ *
+ *
+ * \param pMac Pointer to the global MAC datastructure
+ *
+ * \param nChannelNum Channel on which the enclosing frame will be going out
+ *
+ * \param pDot11f Address of a tDot11fIEExtSuppRates struct to be filled in.
+ *
+ *
+ * This method is a NOP if the channel is greater than 14.
+ *
+ *
+ */
+
+tSirRetStatus
+PopulateDot11fExtSuppRates1(tpAniSirGlobal pMac,
+ tANI_U8 nChannelNum,
+ tDot11fIEExtSuppRates *pDot11f);
+
+tSirRetStatus
+PopulateDot11fHCF(tpAniSirGlobal pMac,
+ tANI_U32 capEnable,
+ tDot11fIEHCF *pDot11f);
+
+tSirRetStatus
+PopulateDot11fHTCaps(tpAniSirGlobal pMac,
+ tDot11fIEHTCaps *pDot11f);
+
+#ifdef WLAN_SOFTAP_FEATURE
+tSirRetStatus
+PopulateDot11fHTInfo(tpAniSirGlobal pMac,
+ tDot11fIEHTInfo *pDot11f,
+ tpPESession psessionEntry);
+#else
+tSirRetStatus
+PopulateDot11fHTInfo(tpAniSirGlobal pMac,
+ tDot11fIEHTInfo *pDot11f);
+#endif
+
+void PopulateDot11fIBSSParams(tpAniSirGlobal pMac,
+ tDot11fIEIBSSParams *pDot11f, tpPESession psessionEntry);
+
+#ifdef ANI_SUPPORT_11H
+tSirRetStatus
+PopulateDot11fMeasurementReport0(tpAniSirGlobal pMac,
+ tpSirMacMeasReqActionFrame pReq,
+ tDot11fIEMeasurementReport *pDot11f);
+
+/// Populate a tDot11fIEMeasurementReport when the report type is CCA
+tSirRetStatus
+PopulateDot11fMeasurementReport1(tpAniSirGlobal pMac,
+ tpSirMacMeasReqActionFrame pReq,
+ tDot11fIEMeasurementReport *pDot11f);
+
+/// Populate a tDot11fIEMeasurementReport when the report type is RPI Hist
+tSirRetStatus
+PopulateDot11fMeasurementReport2(tpAniSirGlobal pMac,
+ tpSirMacMeasReqActionFrame pReq,
+ tDot11fIEMeasurementReport *pDot11f);
+#endif //ANI_SUPPORT_11H
+
+/// Populate a tDot11fIEPowerCaps
+void
+PopulateDot11fPowerCaps(tpAniSirGlobal pMac,
+ tDot11fIEPowerCaps *pCaps,
+ tANI_U8 nAssocType,tpPESession psessionEntry);
+
+/// Populate a tDot11fIEPowerConstraints
+tSirRetStatus
+PopulateDot11fPowerConstraints(tpAniSirGlobal pMac,
+ tDot11fIEPowerConstraints *pDot11f);
+
+tSirRetStatus
+PopulateDot11fPropCapability(tpAniSirGlobal pMac,
+ tANI_U32 capEnable,
+ tDot11fIEPropCapability *pDot11f);
+
+void
+PopulateDot11fPropChannSwitchAnn(tpAniSirGlobal pMac,
+ tANI_U32 capEnable,
+ tDot11fIEPropChannSwitchAnn *pDot11f);
+
+void
+PopulateDot11fPropEDCAParams(tpAniSirGlobal pMac,
+ tANI_U16 caps,
+ tDot11fIEPropEDCAParams *pDot11f);
+
+tSirRetStatus
+PopulateDot11fPropSuppRates(tpAniSirGlobal pMac,
+ tANI_U32 capEnable,
+ tDot11fIEPropSuppRates *pDot11f);
+
+void
+PopulateDot11fQOSCapsAp(tpAniSirGlobal pMac,
+ tDot11fIEQOSCapsAp *pDot11f, tpPESession psessionEntry);
+
+void
+PopulateDot11fQOSCapsStation(tpAniSirGlobal pMac,
+ tDot11fIEQOSCapsStation *pDot11f);
+
+tSirRetStatus
+PopulateDot11fRSN(tpAniSirGlobal pMac,
+ tpSirRSNie pRsnIe,
+ tDot11fIERSN *pDot11f);
+
+tSirRetStatus
+PopulateDot11fRSNOpaque( tpAniSirGlobal pMac,
+ tpSirRSNie pRsnIe,
+ tDot11fIERSNOpaque *pDot11f );
+
+#if defined(FEATURE_WLAN_WAPI)
+
+tSirRetStatus
+PopulateDot11fWAPI(tpAniSirGlobal pMac,
+ tpSirRSNie pRsnIe,
+ tDot11fIEWAPI *pDot11f);
+
+tSirRetStatus PopulateDot11fWAPIOpaque( tpAniSirGlobal pMac,
+ tpSirRSNie pRsnIe,
+ tDot11fIEWAPIOpaque *pDot11f );
+
+#endif //defined(FEATURE_WLAN_WAPI)
+
+/// Populate a tDot11fIESSID given a tSirMacSSid
+void
+PopulateDot11fSSID(tpAniSirGlobal pMac,
+ tSirMacSSid *pInternal,
+ tDot11fIESSID *pDot11f);
+
+/// Populate a tDot11fIESSID from CFG
+tSirRetStatus
+PopulateDot11fSSID2(tpAniSirGlobal pMac,
+ tDot11fIESSID *pDot11f);
+
+
+/**
+ * \brief Populate a tDot11fIESchedule
+ *
+ * \sa PopulateDot11fWMMSchedule
+ *
+ *
+ * \param pSchedule Address of a tSirMacScheduleIE struct
+ *
+ * \param pDot11f Address of a tDot11fIESchedule to be filled in
+ *
+ *
+ */
+
+void
+PopulateDot11fSchedule(tSirMacScheduleIE *pSchedule,
+ tDot11fIESchedule *pDot11f);
+
+void
+PopulateDot11fSuppChannels(tpAniSirGlobal pMac,
+ tDot11fIESuppChannels *pDot11f,
+ tANI_U8 nAssocType,tpPESession psessionEntry);
+
+/**
+ * \brief Populated a tDot11fIESuppRates
+ *
+ *
+ * \param pMac Pointer to the global MAC datastructure
+ *
+ * \param nChannelNum Channel the enclosing frame will be going out on; see
+ * below
+ *
+ * \param pDot11f Address of a tDot11fIESuppRates struct to be filled in.
+ *
+ *
+ * If nChannelNum is greater than 13, the supported rates will be
+ * WNI_CFG_SUPPORTED_RATES_11B. If it is less than or equal to 13, the
+ * supported rates will be WNI_CFG_SUPPORTED_RATES_11A. If nChannelNum is
+ * set to the sentinel value POPULATE_DOT11F_RATES_OPERATIONAL, the struct
+ * will be populated with WNI_CFG_OPERATIONAL_RATE_SET.
+ *
+ *
+ */
+
+#define POPULATE_DOT11F_RATES_OPERATIONAL ( 0xff )
+
+tSirRetStatus
+PopulateDot11fSuppRates(tpAniSirGlobal pMac,
+ tANI_U8 nChannelNum,
+ tDot11fIESuppRates *pDot11f,tpPESession);
+
+
+tSirRetStatus PopulateDot11fTPCReport(tpAniSirGlobal pMac,
+ tDot11fIETPCReport *pDot11f,
+ tpPESession psessionEntry);
+
+/// Populate a tDot11FfTSInfo
+void PopulateDot11fTSInfo(tSirMacTSInfo *pInfo,
+ tDot11fFfTSInfo *pDot11f);
+
+
+void PopulateDot11fWMM(tpAniSirGlobal pMac,
+ tDot11fIEWMMInfoAp *pInfo,
+ tDot11fIEWMMParams *pParams,
+ tDot11fIEWMMCaps *pCaps,
+ tpPESession psessionEntry);
+
+void PopulateDot11fWMMCaps(tDot11fIEWMMCaps *pCaps);
+
+#ifdef FEATURE_WLAN_CCX
+void PopulateDot11TSRSIE(tpAniSirGlobal pMac,
+ tSirMacCCXTSRSIE *pOld,
+ tDot11fIECCXTrafStrmRateSet *pDot11f,
+ tANI_U8 rate_length);
+void PopulateDot11fReAssocTspec(tpAniSirGlobal pMac, tDot11fReAssocRequest *pReassoc, tpPESession psessionEntry);
+#endif
+
+void PopulateDot11fWMMInfoAp(tpAniSirGlobal pMac,
+ tDot11fIEWMMInfoAp *pInfo,
+ tpPESession psessionEntry);
+
+void PopulateDot11fWMMInfoStation(tpAniSirGlobal pMac,
+ tDot11fIEWMMInfoStation *pInfo);
+
+#ifdef WLAN_SOFTAP_FEATURE
+void PopulateDot11fWMMParams(tpAniSirGlobal pMac,
+ tDot11fIEWMMParams *pParams,
+ tpPESession psessionEntry);
+#else
+void PopulateDot11fWMMParams(tpAniSirGlobal pMac,
+ tDot11fIEWMMParams *pParams);
+#endif
+
+/**
+ * \brief Populate a tDot11fIEWMMSchedule
+ *
+ * \sa PopulatedDot11fSchedule
+ *
+ *
+ * \param pSchedule Address of a tSirMacScheduleIE struct
+ *
+ * \param pDot11f Address of a tDot11fIEWMMSchedule to be filled in
+ *
+ *
+ */
+
+void
+PopulateDot11fWMMSchedule(tSirMacScheduleIE *pSchedule,
+ tDot11fIEWMMSchedule *pDot11f);
+
+tSirRetStatus
+PopulateDot11fWPA(tpAniSirGlobal pMac,
+ tpSirRSNie pRsnIe,
+ tDot11fIEWPA *pDot11f);
+
+tSirRetStatus
+PopulateDot11fWPAOpaque( tpAniSirGlobal pMac,
+ tpSirRSNie pRsnIe,
+ tDot11fIEWPAOpaque *pDot11f );
+
+void
+PopulateDot11fTSPEC(tSirMacTspecIE *pOld,
+ tDot11fIETSPEC *pDot11f);
+
+void
+PopulateDot11fWMMTSPEC(tSirMacTspecIE *pOld,
+ tDot11fIEWMMTSPEC *pDot11f);
+
+tSirRetStatus
+PopulateDot11fTCLAS(tpAniSirGlobal pMac,
+ tSirTclasInfo *pOld,
+ tDot11fIETCLAS *pDot11f);
+
+tSirRetStatus
+PopulateDot11fWMMTCLAS(tpAniSirGlobal pMac,
+ tSirTclasInfo *pOld,
+ tDot11fIEWMMTCLAS *pDot11f);
+
+#if ( WNI_POLARIS_FW_PRODUCT == AP )
+
+tSirRetStatus
+PopulateDot11fCFParams(tpAniSirGlobal pMac,
+ tDot11fFfCapabilities *pCaps,
+ tDot11fIECFParams *pDot11f);
+
+void
+PopulateDot11fQuiet(tpAniSirGlobal pMac,
+ tDot11fIEQuiet *pDot11f);
+
+tSirRetStatus
+PopulateDot11fAPName(tpAniSirGlobal pMac,
+ tANI_U32 capEnable,
+ tDot11fIEAPName *pDot11f);
+
+void
+PopulateDot11fPropQuietBSS(tpAniSirGlobal pMac,
+ tANI_U32 capsEnable,
+ tDot11fIEPropQuietBSS *pDot11f);
+
+void
+PopulateDot11fTrigStaBkScan(tpAniSirGlobal pMac,
+ tANI_U32 capsEnable,
+ tDot11fIETriggerStaBgScan *pDot11f);
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+
+tSirRetStatus
+PopulateDot11fWDS(tpAniSirGlobal pMac,
+ tANI_U32 capEnable,
+ tDot11fIEWDS *pDot11f );
+
+#endif // WNI_POLARIS_FW_PACKAGE == ADVANCED
+
+#endif // WNI_POLARIS_FW_PRODUCT == AP
+
+tSirRetStatus PopulateDot11fWsc(tpAniSirGlobal pMac,
+ tDot11fIEWscBeacon *pDot11f);
+
+tSirRetStatus PopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
+ tDot11fIEWscBeacon *pDot11f);
+
+tSirRetStatus DePopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
+ tDot11fIEWscBeacon *pDot11f);
+
+#ifdef WLAN_SOFTAP_FEATURE
+tSirRetStatus PopulateDot11fProbeResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscProbeRes *pDot11f, tpPESession psessionEntry);
+tSirRetStatus PopulateDot11fAssocResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscAssocRes *pDot11f, tpPESession psessionEntry);
+tSirRetStatus PopulateDot11fBeaconWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscBeacon *pDot11f, tpPESession psessionEntry);
+#endif
+
+tSirRetStatus PopulateDot11fWscInProbeRes(tpAniSirGlobal pMac,
+ tDot11fIEWscProbeRes *pDot11f);
+
+tSirRetStatus PopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
+ tDot11fIEWscProbeRes *pDot11f);
+
+tSirRetStatus DePopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
+ tDot11fIEWscProbeRes *pDot11f);
+
+
+tSirRetStatus PopulateDot11fAssocResWscIE(tpAniSirGlobal pMac,
+ tDot11fIEWscAssocRes *pDot11f,
+ tpSirAssocReq pRcvdAssocReq);
+
+#ifdef WLAN_FEATURE_P2P
+tSirRetStatus PopulateDot11AssocResP2PIE(tpAniSirGlobal pMac,
+ tDot11fIEP2PAssocRes *pDot11f,
+ tpSirAssocReq pRcvdAssocReq);
+#endif
+
+tSirRetStatus PopulateDot11fWscInAssocRes(tpAniSirGlobal pMac,
+ tDot11fIEWscAssocRes *pDot11f);
+
+
+#if defined WLAN_FEATURE_VOWIFI
+tSirRetStatus PopulateDot11fWFATPC( tpAniSirGlobal pMac,
+ tDot11fIEWFATPC *pDot11f, tANI_U8 txPower, tANI_U8 linkMargin );
+
+tSirRetStatus PopulateDot11fRRMIe( tpAniSirGlobal pMac,
+ tDot11fIERRMEnabledCap *pDot11f,
+ tpPESession psessionEntry );
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+void PopulateMDIE( tpAniSirGlobal pMac,
+ tDot11fIEMobilityDomain *pDot11f, tANI_U8 mdie[] );
+void PopulateFTInfo( tpAniSirGlobal pMac,
+ tDot11fIEFTInfo *pDot11f );
+#endif
+
+void PopulateDot11fAssocRspRates ( tpAniSirGlobal pMac, tDot11fIESuppRates *pSupp,
+ tDot11fIEExtSuppRates *pExt, tANI_U16 *_11bRates, tANI_U16 *_11aRates );
+
+int FindIELocation( tpAniSirGlobal pMac,
+ tpSirRSNie pRsnIe,
+ tANI_U8 EID);
+#endif
diff --git a/CORE/MAC/src/include/phyGlobal.h b/CORE/MAC/src/include/phyGlobal.h
new file mode 100644
index 0000000..60dafcf
--- /dev/null
+++ b/CORE/MAC/src/include/phyGlobal.h
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ *
+ * Airgo Networks, Inc proprietary.
+ * All Rights Reserved, Copyright 2005
+ * This program is the confidential and proprietary product of Airgo Networks Inc.
+ * Any Unauthorized use, reproduction or transfer of this program is strictly prohibited.
+ *
+ * phyGlobal.h: Holds all globals for the phy, rf, and asic layers in hal
+ * Author: Mark Nelson
+ * Date: 4/9/05
+ *
+ * History -
+ * Date Modified by Modification Information
+ --------------------------------------------------------------------------
+ */
+
+#ifndef PHYGLOBAL_H
+#define PHYGLOBAL_H
+
+#include "halPhyVos.h"
+#include "wlan_rf.h"
+#include "wlan_phy.h"
+#include "phyTxPower.h"
+#include <qwlanhw_volans.h>
+#include "asic.h"
+#include "wlan_nv.h"
+
+
+
+//#define ANI_MANF_DIAG //temporary until this is part of manfDiag build - aniGlobal.h needs this to build the ptt globals
+
+#ifdef VOLANS_VSWR_WORKAROUND
+#define OPEN_LOOP_TX_HIGH_GAIN_OVERRIDE 6 //used for RVR tests in open loop mode
+#else
+#define OPEN_LOOP_TX_HIGH_GAIN_OVERRIDE 10 //used for RVR tests in open loop mode
+#endif
+#define OPEN_LOOP_TX_LOW_GAIN_OVERRIDE 3 //used for throughput tests in open loop mode
+
+// Function pointer for to the CB function after set channel response from FW
+typedef void (*funcHalSetChanCB)(tpAniSirGlobal, void*, tANI_U32, tANI_U16);
+
+// Structure to save the context from where the set channel is called
+typedef struct sPhySetChanCntx {
+ tANI_U8 newChannel;
+ tANI_U8 newRfBand;
+ tANI_U8 newCbState;
+ tANI_U8 newCalReqd;
+ void* pData;
+ funcHalSetChanCB pFunc;
+ tANI_U16 dialog_token;
+} tPhySetChanCntx, *tpPhySetChanCntx;
+
+
+typedef struct
+{
+ sHalNv nvCache;
+ void *nvTables[NUM_NV_TABLE_IDS];
+
+ //event object for blocked wait around halPhySetChannel
+ HAL_PHY_SET_CHAN_EVENT_TYPE setChanEvent;
+ tANI_U32 fwSetChannelStatus;
+
+ tPhySetChanCntx setChanCntx;
+
+ //physical layer data - corresponds to individual modules
+ tPhy phy;
+ tAsicTxFir txfir;
+ //tPhyTxPower phyTPC;
+ tRF rf;
+ tAsicAgc agc;
+
+ tANI_BOOLEAN wfm_clk80; //=ON if 20MHZ clock samples, =OFF for 80MHZ clock samples
+ tANI_U8 calPeriodTicks; //counts peiodic interrupts since last periodic calibration
+ tANI_BOOLEAN densityEnabled;
+ ePhyNwDensity nwDensity20MHz; // Network density value for 20MHz channel width
+ ePhyNwDensity nwDensity40MHz; // Network density value for 40MHz channel width
+ ePhyRxDisabledPktTypes modTypes; //current disabled packet types
+ volatile tANI_BOOLEAN setPhyMsgEvent;
+ tANI_U32 hdetResidualDCO;
+}tAniSirPhy;
+
+#endif /* PHYGLOBAL_H */
diff --git a/CORE/MAC/src/include/sirCommon.h b/CORE/MAC/src/include/sirCommon.h
new file mode 100644
index 0000000..cc8737f
--- /dev/null
+++ b/CORE/MAC/src/include/sirCommon.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file sirCommon.h contains the common definitions used by all
+ * Firmware modules.
+ *
+ * Author: V. K. Kandarpa
+ * Date: 04/12/2002
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+
+#ifndef __SIRCOMMON_H
+#define __SIRCOMMON_H
+
+#include "sirApi.h"
+#include "sirParams.h"
+#include "sirWrapper.h"
+
+#ifndef NULL
+#define NULL TX_NULL
+#endif
+
+/* ********************************************* *
+ * *
+ * SIRIUS SYSTEM EXTERNAL GLOBALS *
+ * *
+ * ********************************************* */
+
+
+// All the following are resource definitions
+
+#endif /* __SIRCOMMON_H */
diff --git a/CORE/MAC/src/include/sirDebug.h b/CORE/MAC/src/include/sirDebug.h
new file mode 100644
index 0000000..e1680d3
--- /dev/null
+++ b/CORE/MAC/src/include/sirDebug.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * Author: Sandesh Goel
+ * Date: 02/25/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#ifndef __POL_DEBUG_H__
+#define __POL_DEBUG_H__
+
+#define LOGOFF 0
+#define LOGP 1
+#define LOGE 2
+#define LOGW 3
+#define LOG1 4
+#define LOG2 5
+#define LOG3 6
+#define LOG4 7
+
+#ifdef ANI_DEBUG
+#define PMM_LOG_LEVEL LOG4
+#define SCH_LOG_LEVEL LOG4
+#define ARQ_LOG_LEVEL LOG4
+#define LIM_LOG_LEVEL LOG4
+#define HAL_LOG_LEVEL LOG4
+#define SYS_LOG_LEVEL LOG4
+#define CFG_LOG_LEVEL LOG4
+#define DPH_LOG_LEVEL LOG4
+#else
+#define PMM_LOG_LEVEL LOGW
+#define SCH_LOG_LEVEL LOGW
+#define ARQ_LOG_LEVEL LOGW
+#define LIM_LOG_LEVEL LOGW
+#define HAL_LOG_LEVEL LOGW
+#define SYS_LOG_LEVEL LOGW
+#define CFG_LOG_LEVEL LOGW
+#define DPH_LOG_LEVEL LOGW
+#endif
+
+
+#ifdef WLAN_MDM_CODE_REDUCTION_OPT
+#ifdef PE_DEBUG_LOGE
+#define PELOGE(p) { p }
+#else
+#define PELOGE(p) { }
+#endif
+
+#ifdef PE_DEBUG_LOGW
+#define PELOGW(p) { p }
+#else
+#define PELOGW(p) { }
+#endif
+
+#define PELOG1(p) { }
+#define PELOG2(p) { }
+#define PELOG3(p) { }
+#define PELOG4(p) { }
+
+
+#else /* WLAN_MDM_CODE_REDUCTION_OPT */
+
+#ifdef PE_DEBUG_LOGE
+#define PELOGE(p) { p }
+#else
+#define PELOGE(p) { }
+#endif
+
+#ifdef PE_DEBUG_LOGW
+#define PELOGW(p) { p }
+#else
+#define PELOGW(p) { }
+#endif
+
+#ifdef PE_DEBUG_LOG1
+#define PELOG1(p) { p }
+#else
+#define PELOG1(p) { }
+#endif
+
+#ifdef PE_DEBUG_LOG2
+#define PELOG2(p) { p }
+#else
+#define PELOG2(p) { }
+#endif
+
+#ifdef PE_DEBUG_LOG3
+#define PELOG3(p) { p }
+#else
+#define PELOG3(p) { }
+#endif
+
+#ifdef PE_DEBUG_LOG4
+#define PELOG4(p) { p }
+#else
+#define PELOG4(p) { }
+#endif
+
+#endif /* WLAN_MDM_CODE_REDUCTION_OPT */
+
+#define FL(x) "%s: %d: "\
+ x, __FUNCTION__, __LINE__
+
+#endif
diff --git a/CORE/MAC/src/include/sirParams.h b/CORE/MAC/src/include/sirParams.h
new file mode 100644
index 0000000..02da0c9
--- /dev/null
+++ b/CORE/MAC/src/include/sirParams.h
@@ -0,0 +1,682 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file sirParams.h contains the common parameter definitions, which
+ * are not dependent on threadX API. These can be used by all Firmware
+ * modules.
+ *
+ * Author: Sandesh Goel
+ * Date: 04/13/2002
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+
+#ifndef __SIRPARAMS_H
+#define __SIRPARAMS_H
+
+# include "sirTypes.h"
+
+#define SIR_SDK_OPT_MAX_NUM_PRE_AUTH 32
+
+// Firmware wide constants
+
+#define SIR_MAX_PACKET_SIZE 2048
+#define SIR_MAX_NUM_CHANNELS 64
+#define SIR_MAX_NUM_STA_IN_IBSS 16
+#define SIR_MAX_NUM_STA_IN_BSS 256
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+typedef enum
+{
+ PHY_SINGLE_CHANNEL_CENTERED = 0, // 20MHz IF bandwidth centered on IF carrier
+ PHY_DOUBLE_CHANNEL_LOW_PRIMARY = 1, // 40MHz IF bandwidth with lower 20MHz supporting the primary channel
+ //not allowed PHY_DOUBLE_CHANNEL_CENTERED = 2, // 40MHz IF bandwidth centered on IF carrier
+ PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3 // 40MHz IF bandwidth with higher 20MHz supporting the primary channel
+}ePhyChanBondState;
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+typedef enum eSriLinkState {
+ eSIR_LINK_IDLE_STATE = 0,
+ eSIR_LINK_PREASSOC_STATE = 1,
+ eSIR_LINK_POSTASSOC_STATE = 2,
+ eSIR_LINK_AP_STATE = 3,
+ eSIR_LINK_IBSS_STATE = 4,
+ // BT-AMP Case
+ eSIR_LINK_BTAMP_PREASSOC_STATE = 5,
+ eSIR_LINK_BTAMP_POSTASSOC_STATE = 6,
+ eSIR_LINK_BTAMP_AP_STATE = 7,
+ eSIR_LINK_BTAMP_STA_STATE = 8,
+
+ // Reserved for HAL internal use
+ eSIR_LINK_LEARN_STATE = 9,
+ eSIR_LINK_SCAN_STATE = 10,
+ eSIR_LINK_FINISH_SCAN_STATE = 11,
+ eSIR_LINK_INIT_CAL_STATE = 12,
+ eSIR_LINK_FINISH_CAL_STATE = 13,
+ eSIR_LINK_LISTEN_STATE = 14
+} tSirLinkState;
+
+
+/// Message queue structure used across Sirius project.
+/// NOTE: this structure should be multiples of a word size (4bytes)
+/// as this is used in tx_queue where it expects to be multiples of 4 bytes.
+typedef struct sSirMsgQ
+{
+ tANI_U16 type;
+ /*
+ * This field can be used as sequence number/dialog token for matching
+ * requests and responses.
+ */
+ tANI_U16 reserved;
+ /**
+ * Based on the type either a bodyptr pointer into
+ * memory or bodyval as a 32 bit data is used.
+ * bodyptr: is always a freeable pointer, one should always
+ * make sure that bodyptr is always freeable.
+ *
+ * Messages should use either bodyptr or bodyval; not both !!!.
+ */
+ void *bodyptr;
+ tANI_U32 bodyval;
+} tSirMsgQ, *tpSirMsgQ;
+
+/// Mailbox Message Structure Define
+typedef struct sSirMbMsg
+{
+ tANI_U16 type;
+
+ /**
+ * This length includes 4 bytes of header, that is,
+ * 2 bytes type + 2 bytes msgLen + n*4 bytes of data.
+ * This field is byte length.
+ */
+ tANI_U16 msgLen;
+
+ /**
+ * This is the first data word in the mailbox message.
+ * It is followed by n words of data.
+ * NOTE: data[1] is not a place holder to store data
+ * instead to dereference the message body.
+ */
+ tANI_U32 data[1];
+} tSirMbMsg, *tpSirMbMsg;
+
+#ifdef WLAN_FEATURE_P2P
+/// Mailbox Message Structure for P2P
+typedef struct sSirMbMsgP2p
+{
+ tANI_U16 type;
+
+ /**
+ * This length includes 4 bytes of header, that is,
+ * 2 bytes type + 2 bytes msgLen + n*4 bytes of data.
+ * This field is byte length.
+ */
+ tANI_U16 msgLen;
+
+ tANI_U32 sessionId;
+ /**
+ * This is the first data word in the mailbox message.
+ * It is followed by n words of data.
+ * NOTE: data[1] is not a place holder to store data
+ * instead to dereference the message body.
+ */
+ tANI_U32 data[1];
+} tSirMbMsgP2p, *tpSirMbMsgP2p;
+#endif
+
+/// Message queue definitions
+// msgtype(2bytes) reserved(2bytes) bodyptr(4bytes) bodyval(4bytes)
+// NOTE tSirMsgQ should be always multiples of WORD(4Bytes)
+// All Queue Message Size are multiples of word Size (4 bytes)
+#define SYS_MSG_SIZE (sizeof(tSirMsgQ)/4)
+
+/// gHalMsgQ
+
+#define SYS_HAL_MSG_SIZE SYS_MSG_SIZE
+
+/// gMMHhiPriorityMsgQ
+
+#define SYS_MMH_HI_PRI_MSG_SIZE SYS_MSG_SIZE
+
+/// gMMHprotocolMsgQ
+
+#define SYS_MMH_PROT_MSG_SIZE SYS_MSG_SIZE
+
+/// gMMHdebugMsgQ
+
+#define SYS_MMH_DEBUG_MSG_SIZE SYS_MSG_SIZE
+
+/// gMAINTmsgQ
+
+#define SYS_MNT_MSG_SIZE SYS_MSG_SIZE
+
+/// LIM Message Queue
+
+#define SYS_LIM_MSG_SIZE SYS_MSG_SIZE
+
+/// ARQ Message Queue
+
+#define SYS_ARQ_MSG_SIZE SYS_MSG_SIZE
+
+/// Scheduler Message Queue
+
+#define SYS_SCH_MSG_SIZE SYS_MSG_SIZE
+
+/// PMM Message Queue
+
+#define SYS_PMM_MSG_SIZE SYS_MSG_SIZE
+
+/// TX Message Queue
+
+#define SYS_TX_MSG_SIZE (sizeof(void *)/4) // Message pointer size
+
+/// RX Message Queue
+
+#define SYS_RX_MSG_SIZE (sizeof(void *)/4) // Message pointer size
+
+/// PTT Message Queue
+#define SYS_NIM_PTT_MSG_SIZE SYS_MSG_SIZE // Message pointer size
+
+
+
+/* *************************************** *
+ * *
+ * Block pool configuration *
+ * *
+ * *************************************** */
+
+// The following values specify the number of blocks to be created
+// for each block pool size.
+
+#define SIR_BUF_BLK_32_NUM 64
+#define SIR_BUF_BLK_64_NUM 128
+#define SIR_BUF_BLK_96_NUM 16
+#define SIR_BUF_BLK_128_NUM 128
+#define SIR_BUF_BLK_160_NUM 8
+#define SIR_BUF_BLK_192_NUM 0
+#define SIR_BUF_BLK_224_NUM 0
+#define SIR_BUF_BLK_256_NUM 128
+#define SIR_BUF_BLK_512_NUM 0
+#define SIR_BUF_BLK_768_NUM 0
+#define SIR_BUF_BLK_1024_NUM 2
+#define SIR_BUF_BLK_1280_NUM 0
+#define SIR_BUF_BLK_1536_NUM 2
+#define SIR_BUF_BLK_1792_NUM 0
+#define SIR_BUF_BLK_2048_NUM 2
+#define SIR_BUF_BLK_2304_NUM 0
+
+/* ******************************************* *
+ * *
+ * SIRIUS MESSAGE TYPES *
+ * *
+ * ******************************************* */
+
+
+/*
+ * The following message types have bounds defined for each module for
+ * inter thread/module communications.
+ * Each module will get 256 message types in total.
+ * Note that message type definitions for mailbox messages for
+ * communication with Host are in wniApi.h file.
+ *
+ * Any addition/deletion to this message list should also be
+ * reflected in the halUtil_getMsgString() routine.
+ */
+
+// HAL message types
+#define SIR_HAL_MSG_TYPES_BEGIN (SIR_HAL_MODULE_ID << 8)
+#define SIR_HAL_ITC_MSG_TYPES_BEGIN SIR_HAL_MSG_TYPES_BEGIN+0x20
+#define SIR_HAL_RADAR_DETECTED_IND SIR_HAL_ITC_MSG_TYPES_BEGIN
+#define SIR_HAL_WDT_KAM_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 1
+#define SIR_HAL_TIMER_TEMP_MEAS_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 2
+#define SIR_HAL_TIMER_PERIODIC_STATS_COLLECT_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 3
+#define SIR_HAL_CAL_REQ_NTF SIR_HAL_ITC_MSG_TYPES_BEGIN + 4
+#define SIR_HAL_MNT_OPEN_TPC_TEMP_MEAS_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 5
+#define SIR_HAL_CCA_MONITOR_INTERVAL_TO SIR_HAL_ITC_MSG_TYPES_BEGIN + 6
+#define SIR_HAL_CCA_MONITOR_DURATION_TO SIR_HAL_ITC_MSG_TYPES_BEGIN + 7
+#define SIR_HAL_CCA_MONITOR_START SIR_HAL_ITC_MSG_TYPES_BEGIN + 8
+#define SIR_HAL_CCA_MONITOR_STOP SIR_HAL_ITC_MSG_TYPES_BEGIN + 9
+#define SIR_HAL_CCA_CHANGE_MODE SIR_HAL_ITC_MSG_TYPES_BEGIN + 10
+#define SIR_HAL_TIMER_WRAP_AROUND_STATS_COLLECT_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 11
+
+/*
+ * New Taurus related messages
+ */
+#define SIR_HAL_ADD_STA_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 13
+#define SIR_HAL_ADD_STA_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 14
+#define SIR_HAL_DELETE_STA_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 15
+#define SIR_HAL_DELETE_STA_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 16
+#define SIR_HAL_ADD_BSS_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 17
+#define SIR_HAL_ADD_BSS_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 18
+#define SIR_HAL_DELETE_BSS_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 19
+#define SIR_HAL_DELETE_BSS_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 20
+#define SIR_HAL_INIT_SCAN_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 21
+#define SIR_HAL_INIT_SCAN_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 22
+#define SIR_HAL_START_SCAN_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 23
+#define SIR_HAL_START_SCAN_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 24
+#define SIR_HAL_END_SCAN_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 25
+#define SIR_HAL_END_SCAN_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 26
+#define SIR_HAL_FINISH_SCAN_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 27
+#define SIR_HAL_FINISH_SCAN_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 28
+#define SIR_HAL_SEND_BEACON_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 29
+#define SIR_HAL_SEND_BEACON_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 30
+
+#define SIR_HAL_INIT_CFG_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 31
+#define SIR_HAL_INIT_CFG_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 32
+
+#define SIR_HAL_INIT_WM_CFG_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 33
+#define SIR_HAL_INIT_WM_CFG_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 34
+
+#define SIR_HAL_SET_BSSKEY_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 35
+#define SIR_HAL_SET_BSSKEY_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 36
+#define SIR_HAL_SET_STAKEY_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 37
+#define SIR_HAL_SET_STAKEY_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 38
+#define SIR_HAL_DPU_STATS_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 39
+#define SIR_HAL_DPU_STATS_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 40
+#define SIR_HAL_GET_DPUINFO_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 41
+#define SIR_HAL_GET_DPUINFO_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 42
+
+#define SIR_HAL_UPDATE_EDCA_PROFILE_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 43
+
+#define SIR_HAL_UPDATE_STARATEINFO_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 45
+#define SIR_HAL_UPDATE_STARATEINFO_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 46
+
+#define SIR_HAL_UPDATE_BEACON_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 47
+#define SIR_HAL_UPDATE_CF_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 48
+#define SIR_HAL_CHNL_SWITCH_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 49
+#define SIR_HAL_ADD_TS_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 50
+#define SIR_HAL_DEL_TS_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 51
+#define SIR_HAL_SOFTMAC_TXSTAT_REPORT SIR_HAL_ITC_MSG_TYPES_BEGIN + 52
+
+#define SIR_HAL_MBOX_SENDMSG_COMPLETE_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 61
+#define SIR_HAL_EXIT_BMPS_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 53
+#define SIR_HAL_EXIT_BMPS_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 54
+#define SIR_HAL_EXIT_BMPS_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 55
+#define SIR_HAL_ENTER_BMPS_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 56
+#define SIR_HAL_ENTER_BMPS_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 57
+#define SIR_HAL_BMPS_STATUS_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 58
+#define SIR_HAL_MISSED_BEACON_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 59
+
+#define SIR_HAL_SWITCH_CHANNEL_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 60
+#define SIR_HAL_PWR_SAVE_CFG SIR_HAL_ITC_MSG_TYPES_BEGIN + 62
+
+#define SIR_HAL_REGISTER_PE_CALLBACK SIR_HAL_ITC_MSG_TYPES_BEGIN + 63
+#define SIR_HAL_SOFTMAC_MEM_READREQUEST SIR_HAL_ITC_MSG_TYPES_BEGIN + 64
+#define SIR_HAL_SOFTMAC_MEM_WRITEREQUEST SIR_HAL_ITC_MSG_TYPES_BEGIN + 65
+
+#define SIR_HAL_SOFTMAC_MEM_READRESPONSE SIR_HAL_ITC_MSG_TYPES_BEGIN + 66
+#define SIR_HAL_SOFTMAC_BULKREGWRITE_CONFIRM SIR_HAL_ITC_MSG_TYPES_BEGIN + 67
+#define SIR_HAL_SOFTMAC_BULKREGREAD_RESPONSE SIR_HAL_ITC_MSG_TYPES_BEGIN + 68
+#define SIR_HAL_SOFTMAC_HOSTMESG_MSGPROCESSRESULT SIR_HAL_ITC_MSG_TYPES_BEGIN + 69
+
+#define SIR_HAL_ADDBA_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 70
+#define SIR_HAL_ADDBA_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 71
+#define SIR_HAL_DELBA_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 72
+#define SIR_HAL_DEL_BA_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 73
+
+//message from sme to initiate delete block ack session.
+#define SIR_HAL_DELBA_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 74
+#define SIR_HAL_IBSS_STA_ADD SIR_HAL_ITC_MSG_TYPES_BEGIN + 75
+#define SIR_HAL_TIMER_ADJUST_ADAPTIVE_THRESHOLD_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 76
+#define SIR_HAL_SET_LINK_STATE SIR_HAL_ITC_MSG_TYPES_BEGIN + 77
+#define SIR_HAL_ENTER_IMPS_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 78
+#define SIR_HAL_ENTER_IMPS_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 79
+#define SIR_HAL_EXIT_IMPS_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 80
+#define SIR_HAL_EXIT_IMPS_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 81
+#define SIR_HAL_SOFTMAC_HOSTMESG_PS_STATUS_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 82
+#define SIR_HAL_POSTPONE_ENTER_IMPS_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 83
+#define SIR_HAL_STA_STAT_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 84
+#define SIR_HAL_GLOBAL_STAT_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 85
+#define SIR_HAL_AGGR_STAT_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 86
+#define SIR_HAL_STA_STAT_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 87
+#define SIR_HAL_GLOBAL_STAT_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 88
+#define SIR_HAL_AGGR_STAT_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 89
+#define SIR_HAL_STAT_SUMM_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 90
+#define SIR_HAL_STAT_SUMM_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 92
+#define SIR_HAL_REMOVE_BSSKEY_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 93
+#define SIR_HAL_REMOVE_BSSKEY_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 94
+#define SIR_HAL_REMOVE_STAKEY_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 95
+#define SIR_HAL_REMOVE_STAKEY_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 96
+#define SIR_HAL_SET_STA_BCASTKEY_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 97
+#define SIR_HAL_SET_STA_BCASTKEY_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 98
+#define SIR_HAL_REMOVE_STA_BCASTKEY_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 99
+#define SIR_HAL_REMOVE_STA_BCASTKEY_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 100
+#define SIR_HAL_ADD_TS_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 101
+#define SIR_HAL_DPU_MIC_ERROR SIR_HAL_ITC_MSG_TYPES_BEGIN + 102
+#define SIR_HAL_TIMER_BA_ACTIVITY_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 103
+#define SIR_HAL_TIMER_CHIP_MONITOR_TIMEOUT SIR_HAL_ITC_MSG_TYPES_BEGIN + 104
+#define SIR_HAL_TIMER_TRAFFIC_ACTIVITY_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 105
+#define SIR_HAL_TIMER_ADC_RSSI_STATS SIR_HAL_ITC_MSG_TYPES_BEGIN + 106
+#define SIR_HAL_MIC_FAILURE_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 107
+
+#ifdef WLAN_SOFTAP_FEATURE
+//107 ... Slots is Free for use.
+#define SIR_HAL_UPDATE_UAPSD_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 108
+#endif
+
+#define SIR_HAL_SET_MIMOPS_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 109
+#define SIR_HAL_SET_MIMOPS_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 110
+#define SIR_HAL_SYS_READY_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 111
+#define SIR_HAL_SET_TX_POWER_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 112
+#define SIR_HAL_SET_TX_POWER_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 113
+#define SIR_HAL_GET_TX_POWER_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 114
+#define SIR_HAL_GET_TX_POWER_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 115
+#define SIR_HAL_GET_NOISE_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 116
+#define SIR_HAL_GET_NOISE_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 117
+
+/* Messages to support transmit_halt and transmit_resume */
+#define SIR_HAL_TRANSMISSION_CONTROL_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 118
+/* Indication from LIM to HAL to Initialize radar interrupt */
+#define SIR_HAL_INIT_RADAR_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 119
+/* Messages to support transmit_halt and transmit_resume */
+
+
+#define SIR_HAL_BEACON_PRE_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 120
+#define SIR_HAL_ENTER_UAPSD_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 121
+#define SIR_HAL_ENTER_UAPSD_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 122
+#define SIR_HAL_EXIT_UAPSD_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 123
+#define SIR_HAL_EXIT_UAPSD_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 124
+#define SIR_HAL_LOW_RSSI_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 125
+#define SIR_HAL_BEACON_FILTER_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 126
+/// PE <-> HAL WOWL messages
+#define SIR_HAL_WOWL_ADD_BCAST_PTRN SIR_HAL_ITC_MSG_TYPES_BEGIN + 127
+#define SIR_HAL_WOWL_DEL_BCAST_PTRN SIR_HAL_ITC_MSG_TYPES_BEGIN + 128
+#define SIR_HAL_WOWL_ENTER_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 129
+#define SIR_HAL_WOWL_ENTER_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 130
+#define SIR_HAL_WOWL_EXIT_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 131
+#define SIR_HAL_WOWL_EXIT_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 132
+#define SIR_HAL_TX_COMPLETE_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 133
+#define SIR_HAL_TIMER_RA_COLLECT_AND_ADAPT SIR_HAL_ITC_MSG_TYPES_BEGIN + 134
+/// PE <-> HAL statistics messages
+#define SIR_HAL_GET_STATISTICS_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 135
+#define SIR_HAL_GET_STATISTICS_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 136
+#define SIR_HAL_SET_KEY_DONE SIR_HAL_ITC_MSG_TYPES_BEGIN + 137
+
+/// PE <-> HAL BTC messages
+#define SIR_HAL_BTC_SET_CFG SIR_HAL_ITC_MSG_TYPES_BEGIN + 138
+#define SIR_HAL_SIGNAL_BT_EVENT SIR_HAL_ITC_MSG_TYPES_BEGIN + 139
+#define SIR_HAL_HANDLE_FW_MBOX_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 140
+#define SIR_HAL_UPDATE_PROBE_RSP_TEMPLATE_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 141
+
+#ifdef ANI_CHIPSET_VOLANS
+/* PE <-> HAL addr2 mismatch message */
+#define SIR_LIM_ADDR2_MISS_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 142
+#endif
+
+#define SIR_HAL_SET_MAX_TX_POWER_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 146
+#define SIR_HAL_SET_MAX_TX_POWER_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 147
+
+#define SIR_HAL_SEND_MSG_COMPLETE SIR_HAL_ITC_MSG_TYPES_BEGIN + 148
+
+/// PE <-> HAL Host Offload message
+#define SIR_HAL_SET_HOST_OFFLOAD SIR_HAL_ITC_MSG_TYPES_BEGIN + 149
+
+#define SIR_HAL_ADD_STA_SELF_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 150
+#define SIR_HAL_ADD_STA_SELF_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 151
+#define SIR_HAL_DEL_STA_SELF_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 152
+#define SIR_HAL_DEL_STA_SELF_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 153
+#define SIR_HAL_SIGNAL_BTAMP_EVENT SIR_HAL_ITC_MSG_TYPES_BEGIN + 154
+
+#define SIR_HAL_CFG_RXP_FILTER_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 155
+#define SIR_HAL_CFG_RXP_FILTER_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 156
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+#define SIR_HAL_AGGR_ADD_TS_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 157
+#define SIR_HAL_AGGR_ADD_TS_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 158
+#define SIR_HAL_AGGR_QOS_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 159
+#define SIR_HAL_AGGR_QOS_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 160
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+#ifdef WLAN_FEATURE_P2P
+/* P2P <-> HAL P2P msg */
+#define SIR_HAL_SET_P2P_GO_NOA_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 161
+#define SIR_HAL_P2P_NOA_ATTR_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 162
+#endif
+
+#define SIR_HAL_SET_LINK_STATE_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 165
+
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#define SIR_HAL_WLAN_SUSPEND_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 166
+#define SIR_HAL_WLAN_RESUME_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 167
+#endif
+
+/// PE <-> HAL Keep Alive message
+#define SIR_HAL_SET_KEEP_ALIVE SIR_HAL_ITC_MSG_TYPES_BEGIN + 168
+
+#ifdef WLAN_NS_OFFLOAD
+#define SIR_HAL_SET_NS_OFFLOAD SIR_HAL_ITC_MSG_TYPES_BEGIN + 169
+#endif //WLAN_NS_OFFLOAD
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+#define SIR_HAL_SET_PNO_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 170
+#define SIR_HAL_SET_PNO_CHANGED_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 171
+#define SIR_HAL_UPDATE_SCAN_PARAMS SIR_HAL_ITC_MSG_TYPES_BEGIN + 172
+#define SIR_HAL_SET_RSSI_FILTER_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 173
+#endif // FEATURE_WLAN_SCAN_PNO
+
+
+#define SIR_HAL_SET_TX_PER_TRACKING_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 174
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+#define SIR_HAL_8023_MULTICAST_LIST_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 175
+#define SIR_HAL_RECEIVE_FILTER_SET_FILTER_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 176
+#define SIR_HAL_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 177
+#define SIR_HAL_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 178
+#define SIR_HAL_RECEIVE_FILTER_CLEAR_FILTER_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 179
+#endif // WLAN_FEATURE_PACKET_FILTERING
+
+#define SIR_HAL_SET_POWER_PARAMS_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 180
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+#define SIR_HAL_GTK_OFFLOAD_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 181
+#define SIR_HAL_GTK_OFFLOAD_GETINFO_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 182
+#define SIR_HAL_GTK_OFFLOAD_GETINFO_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 183
+#endif //WLAN_FEATURE_GTK_OFFLOAD
+
+#ifdef FEATURE_WLAN_CCX
+#define SIR_HAL_TSM_STATS_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 184
+#define SIR_HAL_TSM_STATS_RSP SIR_HAL_ITC_MSG_TYPES_BEGIN + 185
+#endif
+
+
+#ifdef WLAN_WAKEUP_EVENTS
+#define SIR_HAL_WAKE_REASON_IND SIR_HAL_ITC_MSG_TYPES_BEGIN + 186
+#endif //WLAN_WAKEUP_EVENTS
+
+#define SIR_HAL_SET_TM_LEVEL_REQ SIR_HAL_ITC_MSG_TYPES_BEGIN + 187
+
+#define SIR_HAL_MSG_TYPES_END SIR_HAL_ITC_MSG_TYPES_BEGIN + 0xFF
+// CFG message types
+#define SIR_CFG_MSG_TYPES_BEGIN (SIR_CFG_MODULE_ID << 8)
+#define SIR_CFG_ITC_MSG_TYPES_BEGIN SIR_CFG_MSG_TYPES_BEGIN+0xB0
+#define SIR_CFG_PARAM_UPDATE_IND SIR_CFG_ITC_MSG_TYPES_BEGIN
+#define SIR_CFG_DOWNLOAD_COMPLETE_IND SIR_CFG_ITC_MSG_TYPES_BEGIN + 1
+#define SIR_CFG_MSG_TYPES_END SIR_CFG_MSG_TYPES_BEGIN+0xFF
+
+// LIM message types
+#define SIR_LIM_MSG_TYPES_BEGIN (SIR_LIM_MODULE_ID << 8)
+#define SIR_LIM_ITC_MSG_TYPES_BEGIN SIR_LIM_MSG_TYPES_BEGIN+0xB0
+// Messages to/from HAL
+#define SIR_LIM_RESUME_ACTIVITY_NTF SIR_LIM_ITC_MSG_TYPES_BEGIN
+#define SIR_LIM_SUSPEND_ACTIVITY_REQ SIR_LIM_ITC_MSG_TYPES_BEGIN + 1
+#define SIR_HAL_SUSPEND_ACTIVITY_RSP SIR_LIM_ITC_MSG_TYPES_BEGIN + 2
+// Message from ISR upon TFP retry interrupt
+#define SIR_LIM_RETRY_INTERRUPT_MSG SIR_LIM_ITC_MSG_TYPES_BEGIN + 3
+// Message from BB Transport
+#define SIR_BB_XPORT_MGMT_MSG SIR_LIM_ITC_MSG_TYPES_BEGIN + 4
+// UNUSED SIR_LIM_ITC_MSG_TYPES_BEGIN + 6
+// Message from ISR upon SP's Invalid session key interrupt
+#define SIR_LIM_INV_KEY_INTERRUPT_MSG SIR_LIM_ITC_MSG_TYPES_BEGIN + 7
+// Message from ISR upon SP's Invalid key ID interrupt
+#define SIR_LIM_KEY_ID_INTERRUPT_MSG SIR_LIM_ITC_MSG_TYPES_BEGIN + 8
+// Message from ISR upon SP's Replay threshold reached interrupt
+#define SIR_LIM_REPLAY_THRES_INTERRUPT_MSG SIR_LIM_ITC_MSG_TYPES_BEGIN + 9
+// Message from HDD after the TD dummy packet is cleaned up
+#define SIR_LIM_TD_DUMMY_CALLBACK_MSG SIR_LIM_ITC_MSG_TYPES_BEGIN + 0xA
+// Message from SCH when the STA is ready to be deleted
+#define SIR_LIM_SCH_CLEAN_MSG SIR_LIM_ITC_MSG_TYPES_BEGIN + 0xB
+// Message from ISR upon Radar Detection
+#define SIR_LIM_RADAR_DETECT_IND SIR_LIM_ITC_MSG_TYPES_BEGIN + 0xC
+
+/////////////////////////////////////
+// message id Available
+////////////////////////////////////
+
+
+// Message from Hal to send out a DEL-TS indication
+#define SIR_LIM_DEL_TS_IND SIR_LIM_ITC_MSG_TYPES_BEGIN + 0xE
+//Message from HAL to send BA global timer timeout
+#define SIR_LIM_ADD_BA_IND SIR_LIM_ITC_MSG_TYPES_BEGIN + 0xF
+//Indication from HAL to delete all the BA sessions when the BA activity check timer is disabled
+#define SIR_LIM_DEL_BA_ALL_IND SIR_LIM_ITC_MSG_TYPES_BEGIN + 0x10
+//Indication from HAL to delete Station context
+#define SIR_LIM_DELETE_STA_CONTEXT_IND SIR_LIM_ITC_MSG_TYPES_BEGIN + 0x11
+//Indication from HAL to delete BA
+#define SIR_LIM_DEL_BA_IND SIR_LIM_ITC_MSG_TYPES_BEGIN + 0x12
+#define SIR_LIM_UPDATE_BEACON SIR_LIM_ITC_MSG_TYPES_BEGIN + 0x13
+
+
+// LIM Timeout messages
+#define SIR_LIM_TIMEOUT_MSG_START (SIR_LIM_MODULE_ID << 8) + 0xD0
+#define SIR_LIM_MIN_CHANNEL_TIMEOUT SIR_LIM_TIMEOUT_MSG_START
+#define SIR_LIM_MAX_CHANNEL_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 1
+#define SIR_LIM_JOIN_FAIL_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 2
+#define SIR_LIM_AUTH_FAIL_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 3
+#define SIR_LIM_AUTH_RSP_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 4
+#define SIR_LIM_ASSOC_FAIL_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 5
+#define SIR_LIM_REASSOC_FAIL_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 6
+#define SIR_LIM_HEART_BEAT_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 7
+// currently unused SIR_LIM_TIMEOUT_MSG_START + 0x8
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+#define SIR_LIM_PREAUTH_CLNUP_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 0x9
+#endif
+// Link Monitoring Messages
+#define SIR_LIM_CHANNEL_SCAN_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 0xA
+#define SIR_LIM_PROBE_HB_FAILURE_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 0xB
+#define SIR_LIM_ADDTS_RSP_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 0xC
+#if (WNI_POLARIS_FW_PRODUCT == AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+#define SIR_LIM_MEASUREMENT_IND_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 0x10
+#define SIR_LIM_LEARN_INTERVAL_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 0x11
+#define SIR_LIM_LEARN_DURATION_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 0x12
+#endif
+#define SIR_LIM_LINK_TEST_DURATION_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 0x13
+#define SIR_LIM_HASH_MISS_THRES_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 0x16
+#define SIR_LIM_CNF_WAIT_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 0x17
+#define SIR_LIM_KEEPALIVE_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 0x18
+#define SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 0x19
+#define SIR_LIM_CHANNEL_SWITCH_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 0x1A
+#define SIR_LIM_QUIET_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 0x1B
+#define SIR_LIM_QUIET_BSS_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 0x1C
+
+#ifdef WLAN_SOFTAP_FEATURE
+#define SIR_LIM_WPS_OVERLAP_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 0x1D
+#endif
+#ifdef WLAN_FEATURE_VOWIFI_11R
+#define SIR_LIM_FT_PREAUTH_RSP_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 0x1E
+#endif
+#ifdef WLAN_FEATURE_P2P
+#define SIR_LIM_REMAIN_CHN_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 0x1F
+#endif
+
+#ifdef WMM_APSD
+#define SIR_LIM_WMM_APSD_SP_START_MSG_TYPE SIR_LIM_TIMEOUT_MSG_START + 0x21
+#define SIR_LIM_WMM_APSD_SP_END_MSG_TYPE SIR_LIM_TIMEOUT_MSG_START + 0x22
+#endif
+#define SIR_LIM_BEACON_GEN_IND SIR_LIM_TIMEOUT_MSG_START + 0x23
+#define SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 0x24
+#ifdef FEATURE_WLAN_CCX
+#define SIR_LIM_CCX_TSM_TIMEOUT SIR_LIM_TIMEOUT_MSG_START + 0x25
+#endif
+
+#define SIR_LIM_MSG_TYPES_END SIR_LIM_MSG_TYPES_BEGIN+0xFF
+
+// SCH message types
+#define SIR_SCH_MSG_TYPES_BEGIN (SIR_SCH_MODULE_ID << 8)
+#define SIR_SCH_CHANNEL_SWITCH_REQUEST SIR_SCH_MSG_TYPES_BEGIN
+#define SIR_SCH_START_SCAN_REQ SIR_SCH_MSG_TYPES_BEGIN + 1
+#define SIR_SCH_START_SCAN_RSP SIR_SCH_MSG_TYPES_BEGIN + 2
+#define SIR_SCH_END_SCAN_NTF SIR_SCH_MSG_TYPES_BEGIN + 3
+#define SIR_SCH_MSG_TYPES_END SIR_SCH_MSG_TYPES_BEGIN+0xFF
+
+// PMM message types
+#define SIR_PMM_MSG_TYPES_BEGIN (SIR_PMM_MODULE_ID << 8)
+#define SIR_PMM_CHANGE_PM_MODE SIR_PMM_MSG_TYPES_BEGIN
+#define SIR_PMM_CHANGE_IMPS_MODE (SIR_PMM_MSG_TYPES_BEGIN + 1) //for Idle mode power save
+#define SIR_PMM_MSG_TYPES_END (SIR_PMM_MSG_TYPES_BEGIN+0xFF)
+
+// MNT message types
+#define SIR_MNT_MSG_TYPES_BEGIN (SIR_MNT_MODULE_ID << 8)
+#define SIR_MNT_RELEASE_BD SIR_MNT_MSG_TYPES_BEGIN + 0
+#define SIR_MNT_MSG_TYPES_END SIR_MNT_MSG_TYPES_BEGIN + 0xFF
+
+// DVT message types
+#define SIR_DVT_MSG_TYPES_BEGIN (SIR_DVT_MODULE_ID << 8)
+#define SIR_DVT_ITC_MSG_TYPES_BEGIN SIR_DVT_MSG_TYPES_BEGIN+0x0F
+#define SIR_DVT_MSG_TYPES_END SIR_DVT_ITC_MSG_TYPES_BEGIN+0xFFF
+
+
+//PTT message types
+#define SIR_PTT_MSG_TYPES_BEGIN 0x3000
+#define SIR_PTT_MSG_TYPES_END 0x3300
+
+
+/* ****************************************** *
+ * *
+ * EVENT TYPE Defintions *
+ * *
+ * ****************************************** */
+
+// MMH Events that are used in other modules to post events to MMH
+# define SIR_HAL_MMH_TXMB_READY_EVT 0x00000002
+# define SIR_HAL_MMH_RXMB_DONE_EVT 0x00000004
+# define SIR_HAL_MMH_MSGQ_NE_EVT 0x00000008
+
+# define SIR_HSTEMUL_TXMB_DONE_EVT 0x00000100
+# define SIR_HSTEMUL_RXMB_READY_EVT 0x00000200
+# define SIR_HSTEMUL_MSGQ_NE_EVT 0x00000400
+
+# define SIR_TST_XMIT_MSG_QS_EMPTY_EVT 0x00000080
+
+//added for OBSS
+
+//Param Change Bitmap sent to HAL
+#define PARAM_BCN_INTERVAL_CHANGED (1 << 0)
+#define PARAM_SHORT_PREAMBLE_CHANGED (1 << 1)
+#define PARAM_SHORT_SLOT_TIME_CHANGED (1 << 2)
+#define PARAM_llACOEXIST_CHANGED (1 << 3)
+#define PARAM_llBCOEXIST_CHANGED (1 << 4)
+#define PARAM_llGCOEXIST_CHANGED (1 << 5)
+#define PARAM_HT20MHZCOEXIST_CHANGED (1<<6)
+#define PARAM_NON_GF_DEVICES_PRESENT_CHANGED (1<<7)
+#define PARAM_RIFS_MODE_CHANGED (1<<8)
+#define PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED (1<<9)
+#define PARAM_OBSS_MODE_CHANGED (1<<10)
+#define PARAM_BEACON_UPDATE_MASK (PARAM_BCN_INTERVAL_CHANGED|PARAM_SHORT_PREAMBLE_CHANGED|PARAM_SHORT_SLOT_TIME_CHANGED|PARAM_llACOEXIST_CHANGED |PARAM_llBCOEXIST_CHANGED|\
+ PARAM_llGCOEXIST_CHANGED|PARAM_HT20MHZCOEXIST_CHANGED|PARAM_NON_GF_DEVICES_PRESENT_CHANGED|PARAM_RIFS_MODE_CHANGED|PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED| PARAM_OBSS_MODE_CHANGED)
+
+
+
+#endif
diff --git a/CORE/MAC/src/include/sirWrapper.h b/CORE/MAC/src/include/sirWrapper.h
new file mode 100644
index 0000000..8410162
--- /dev/null
+++ b/CORE/MAC/src/include/sirWrapper.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file sirWrapper.h contains the common definitions used by all
+ * Firmware modules.
+ *
+ * Author: Susan Tsao
+ * Date: 09/24/2007
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+
+#ifndef __SIR_WRAPPER_H_
+#define __SIR_WRAPPER_H_
+
+#if defined VOSS_ENABLED
+#include "VossWrapper.h"
+#elif defined ANI_OS_TYPE_OSX
+#include "OSXWrapper.h"
+#else // ANI_OS_TYPE undefined
+#error Unknown or missing ANI_OS_TYPE macro
+#endif // ANI_OS_TYPE
+
+
+
+
+#endif //__SIR_WRAPPER_H_
+
diff --git a/CORE/MAC/src/include/sirWrapper.h~ b/CORE/MAC/src/include/sirWrapper.h~
new file mode 100644
index 0000000..fb03d3e
--- /dev/null
+++ b/CORE/MAC/src/include/sirWrapper.h~
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Qualcomm Networks, Inc proprietary. All rights reserved.
+ * This file sirWrapper.h contains the common definitions used by all
+ * Firmware modules.
+ *
+ * Author: Susan Tsao
+ * Date: 09/24/2007
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+
+#ifndef __SIR_WRAPPER_H_
+#define __SIR_WRAPPER_H_
+
+#if defined VOSS_ENABLED
+#include "VossWrapper.h"
+#elif defined ANI_OS_TYPE_OSX
+#include "OSXWrapper.h"
+#else // ANI_OS_TYPE undefined
+#error Unknown or missing ANI_OS_TYPE macro
+#endif // ANI_OS_TYPE
+
+
+
+
+#endif //__SIR_WRAPPER_H_
+
diff --git a/CORE/MAC/src/include/sysGlobal.h b/CORE/MAC/src/include/sysGlobal.h
new file mode 100644
index 0000000..24ffaa6
--- /dev/null
+++ b/CORE/MAC/src/include/sysGlobal.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef __SYS_GLOBAL_H__
+#define __SYS_GLOBAL_H__
+
+typedef struct sAniSirSys
+{
+ tANI_U32 abort; /* system is aborting and will be unloaded, only MMH thread is running */
+
+ // Radio ID
+ tANI_U32 gSirRadioId;
+
+ tANI_U32 gSysFrameCount[4][16];
+ tANI_U32 gSysBbtReceived;
+ tANI_U32 gSysBbtPostedToLim;
+ tANI_U32 gSysBbtPostedToSch;
+ tANI_U32 gSysBbtPostedToPmm;
+ tANI_U32 gSysBbtPostedToHal;
+ tANI_U32 gSysBbtDropped;
+ tANI_U32 gSysBbtNonLearnFrameInv;
+ tANI_U32 gSysBbtLearnFrameInv;
+ tANI_U32 gSysBbtCrcFail;
+ tANI_U32 gSysBbtDuplicates;
+ tANI_U32 gSysReleaseCount;
+ tANI_U32 probeError, probeBadSsid, probeIgnore, probeRespond;
+
+ tANI_U32 gSysFramesSent[4][16];
+
+ tANI_U32 gSysEnableLearnMode;
+ tANI_U32 gSysEnableScanMode;
+ tANI_U32 gSysEnableLinkMonitorMode;
+
+ tANI_U32 gSysResetCounts;
+
+ TX_THREAD gSirSchThread;
+ TX_THREAD gSirPmmThread;
+ TX_THREAD gSirLimThread;
+ TX_THREAD gSirHalThread;
+ TX_THREAD gSirMntThread;
+ TX_THREAD gSirMmhThread;
+
+ TX_QUEUE gSirHalMsgQ; // Message Queue variables
+ TX_QUEUE gSirMntMsgQ;
+ TX_QUEUE gSirLimMsgQ;
+ TX_QUEUE gSirLimDeferredMsgQ;
+ TX_QUEUE gSirSchMsgQ;
+ TX_QUEUE gSirPmmMsgQ;
+
+ TX_THREAD gSirNimPttThread;
+ TX_QUEUE gSirNimRDMsgQ;
+
+ TX_QUEUE gSirHalEvtQ;
+ TX_QUEUE gSirTxMsgQ;
+ TX_QUEUE gSirRxMsgQ;
+
+ // The system is based on the HAL states. The following static definition
+ // of the HAL state.
+ tANI_U16 gSirThreadCount;
+
+ tANI_U8 debugOnReset;
+
+ tANI_BOOLEAN fTestRadar;
+ tANI_U8 detRadarChIds[20];
+ tANI_U32 radarDetectCount;
+ tANI_U8 radarDetected;
+ tANI_U8 gSysdropLimPkts;
+} tAniSirSys, *tpAniSirSys;
+
+#endif
diff --git a/CORE/MAC/src/include/utilsApi.h b/CORE/MAC/src/include/utilsApi.h
new file mode 100644
index 0000000..f8b71dd
--- /dev/null
+++ b/CORE/MAC/src/include/utilsApi.h
@@ -0,0 +1,858 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * Author: Kevin Nguyen
+ * Date: 02/27/02
+ * History:-
+ * 02/12/02 Created.
+ * --------------------------------------------------------------------
+ *
+ */
+
+#ifndef __UTILSAPI_H
+#define __UTILSAPI_H
+
+#include <stdarg.h>
+#include <sirCommon.h>
+#include "aniGlobal.h"
+#include "utilsGlobal.h"
+#if defined VOSS_ENABLED
+#include "VossWrapper.h"
+#elif defined ANI_OS_TYPE_LINUX
+#include "rtaiWrapper.h"
+#elif defined ANI_OS_TYPE_OSX
+#include "palApiPci.h"
+#endif
+
+
+#if defined ANI_OS_TYPE_LINUX
+
+extern void rt_sched_lock();
+extern void rt_sched_unlock();
+
+#define SIR_DECLARE_FLAGS tANI_U32 flags
+#define SIR_SCHED_LOCK() rt_sched_lock()
+#define SIR_SCHED_UNLOCK() rt_sched_unlock()
+
+#else
+
+#define SIR_DECLARE_FLAGS
+#define SIR_SCHED_LOCK() TX_DISABLE_INTR;
+#define SIR_SCHED_UNLOCK() TX_ENABLE_INTR;
+
+#endif
+
+#define LOG_INDEX_FOR_MODULE( modId ) ( ( modId ) - LOG_FIRST_MODULE_ID )
+#define GET_MIN_VALUE(__val1, __val2) ((__val1 < __val2) ? __val1 : __val2)
+
+// The caller must check loglevel. This API assumes loglevel is good
+extern void logDebug(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 debugLevel, const char *pStr, va_list marker);
+
+extern void logDbg(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 debugLevel, const char *pStr,...);
+
+extern tANI_U32 gPktAllocCnt, gPktFreeCnt;
+
+/// Debug dumps
+extern void logPrintf(tpAniSirGlobal, tANI_U32, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4);
+
+/// RTAI dump
+extern int logRtaiDump(tpAniSirGlobal, tANI_U32, tANI_U32, tANI_U32, tANI_U32, tANI_U32, tANI_U8 *);
+
+/// Log initialization
+extern tSirRetStatus logInit (tpAniSirGlobal);
+
+extern void
+logDeinit(tpAniSirGlobal );
+
+extern tSirRetStatus cfgInit(tpAniSirGlobal);
+extern void cfgDeInit(tpAniSirGlobal);
+
+// -------------------------------------------------------------------
+/**
+ * sirDumpBuf()
+ *
+ * FUNCTION:
+ * This function is called to dump a buffer with a certain level
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ *
+ * @param pBuf: buffer pointer
+ * @return None.
+ */
+
+void sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size);
+
+#if defined ANI_OS_TYPE_LINUX
+
+
+ struct rtLibApp;
+ void* rtaiBufAlloc(struct rtLibApp * rt, tANI_U16 size, tANI_U32 waitOpt);
+ tSirRetStatus rtaiBufInit(unsigned int radioId, t_mac_block_table* block_table);
+ tANI_U16 rtaiBufAvail(tANI_U16 size);
+
+extern void sysSuspendThreads(tpAniSirGlobal pMac);
+
+#define sharedBufAlloc(pMac, x, y) rtaiBufAlloc(pMac->rt,x,y)
+#define bufInit(x) rtaiBufInit(x)
+#define bufAvail(x) rtaiBufAvail(x)
+
+#define BUF_32 32
+#define BUF_64 64
+#define BUF_96 96
+#define BUF_128 128
+#define BUF_160 160
+#define BUF_256 256
+#define BUF_512 512
+#define BUF_1024 1024
+#define BUF_1536 1536
+#define BUF_2048 2048
+#define BUF_8192 8192
+#define RTAI_MAX_BUF_SIZE BUF_8192
+
+#endif
+
+// --------------------------------------------------------------------
+/**
+ * sirSwapU16()
+ *
+ * FUNCTION:
+ * This function is called to swap two U8s of an tANI_U16 value
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ *
+ * @param val tANI_U16 value to be tANI_U8 swapped
+ * @return Swapped tANI_U16 value
+ */
+
+static inline tANI_U16
+sirSwapU16(tANI_U16 val)
+{
+ return(((val & 0x00FF) << 8) | ((val & 0xFF00) >> 8));
+}/*** end sirSwapU16() ***/
+
+// --------------------------------------------------------------------
+/**
+ * sirSwapU16ifNeeded()
+ *
+ * FUNCTION:
+ * This function is called to swap two U8s of an tANI_U16 value depending
+ * on endiannes of the target processor/compiler the software is
+ * running on
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ *
+ * @param val tANI_U16 value to be tANI_U8 swapped
+ * @return Swapped tANI_U16 value
+ */
+
+static inline tANI_U16
+sirSwapU16ifNeeded(tANI_U16 val)
+{
+#ifndef ANI_LITTLE_BYTE_ENDIAN
+ return sirSwapU16(val);
+#else
+ return val;
+#endif
+}/*** end sirSwapU16ifNeeded() ***/
+
+// --------------------------------------------------------------------
+/**
+ * sirSwapU32()
+ *
+ * FUNCTION:
+ * This function is called to swap four U8s of an tANI_U32 value
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ *
+ * @param val tANI_U32 value to be tANI_U8 swapped
+ * @return Swapped tANI_U32 value
+ */
+
+static inline tANI_U32
+sirSwapU32(tANI_U32 val)
+{
+ return((val << 24) |
+ (val >> 24) |
+ ((val & 0x0000FF00) << 8) |
+ ((val & 0x00FF0000) >> 8));
+}/*** end sirSwapU32() ***/
+
+// --------------------------------------------------------------------
+/**
+ * sirSwapU32ifNeeded()
+ *
+ * FUNCTION:
+ * This function is called to swap U8s of an tANI_U32 value depending
+ * on endiannes of the target processor/compiler the software is
+ * running on
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ *
+ * @param val tANI_U32 value to be tANI_U8 swapped
+ * @return Swapped tANI_U32 value
+ */
+
+static inline tANI_U32
+sirSwapU32ifNeeded(tANI_U32 val)
+{
+#ifndef ANI_LITTLE_BYTE_ENDIAN
+ return sirSwapU32(val);
+#else
+ return val;
+#endif
+}/*** end sirSwapU32ifNeeded() ***/
+
+
+
+
+// -------------------------------------------------------------------
+/**
+ * sirSwapU32Buf
+ *
+ * FUNCTION:
+ * It swaps N dwords into the same buffer
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ *
+ * @param ptr address of tANI_U32 array
+ * @return void
+ *
+ */
+
+static inline void
+sirSwapU32Buf(tANI_U32 *ptr, tANI_U32 nWords)
+{
+ tANI_U32 i;
+
+ for (i=0; i < nWords; i++)
+ ptr[i] = sirSwapU32(ptr[i]);
+}
+
+// --------------------------------------------------------------------
+/**
+ * sirSwapU32BufIfNeeded()
+ *
+ * FUNCTION:
+ * This function is called to swap U8s of U32s in the buffer depending
+ * on endiannes of the target processor/compiler the software is
+ * running on
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ *
+ * @param pBuf Buffer that will get swapped
+ * @param nWords Number DWORDS will be swapped
+ * @return void
+ */
+
+static inline void
+sirSwapU32BufIfNeeded(tANI_U32* pBuf, tANI_U32 nWords)
+{
+#ifdef ANI_LITTLE_BYTE_ENDIAN
+ sirSwapU32Buf(pBuf, nWords);
+#endif
+}/*** end sirSwapU32ifNeeded() ***/
+
+
+// --------------------------------------------------------------------
+/**
+ * sirSwapBDIfNeeded
+ *
+ * FUNCTION:
+ * Byte swap all the dwords in the BD, except the PHY/MAC headers
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ *
+ * @param pBd BD that will get swapped
+ * @return void
+ */
+
+static inline void
+sirSwapBDIfNeeded(tANI_U32 *pBd)
+{
+ sirSwapU32BufIfNeeded(pBd, 6);
+ sirSwapU32BufIfNeeded(pBd+18, 14);
+}
+
+
+// -------------------------------------------------------------------
+/**
+ * sirStoreU16N
+ *
+ * FUNCTION:
+ * It stores a 16 bit number into the byte array in network byte order
+ * i.e. the least significant byte first
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ *
+ * @param ptr address of destination byte array
+ * @param val value to store
+ * @return None
+ */
+
+static inline void
+sirStoreU16N(tANI_U8 *ptr, tANI_U16 val)
+{
+ *ptr++ = (val >> 8) & 0xff;
+ *ptr = val & 0xff;
+}
+
+// -------------------------------------------------------------------
+/**
+ * sirStoreU32N
+ *
+ * FUNCTION:
+ * It stores a 32 bit number into the byte array in network byte order
+ * i.e. the least significant byte first
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ *
+ * @param ptr address of destination byte array
+ * @param val value to store
+ * @return None
+ */
+
+static inline void
+sirStoreU32N(tANI_U8 *ptr, tANI_U32 val)
+{
+ *ptr++ = (tANI_U8) (val >> 24) & 0xff;
+ *ptr++ = (tANI_U8) (val >> 16) & 0xff;
+ *ptr++ = (tANI_U8) (val >> 8) & 0xff;
+ *ptr = (tANI_U8) (val) & 0xff;
+}
+
+// -------------------------------------------------------------------
+/**
+ * sirStoreU16
+ *
+ * FUNCTION:
+ * It stores a 16 bit number into the byte array in NON-network byte order
+ * i.e. the least significant byte first
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ *
+ * @param ptr address of destination byte array
+ * @param val value to store
+ * @return None
+ */
+
+static inline void
+sirStoreU16(tANI_U8 *ptr, tANI_U16 val)
+{
+ *ptr++ = val & 0xff;
+ *ptr = (val >> 8) & 0xff;
+}
+
+// -------------------------------------------------------------------
+/**
+ * sirStoreU32
+ *
+ * FUNCTION:
+ * It stores a 32 bit number into the byte array in NON-network byte order
+ * i.e. the least significant byte first
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ *
+ * @param ptr address of destination byte array
+ * @param val value to store
+ * @return None
+ */
+
+static inline void
+sirStoreU32(tANI_U8 *ptr, tANI_U32 val)
+{
+ *ptr++ = (tANI_U8) val & 0xff;
+ *ptr++ = (tANI_U8) (val >> 8) & 0xff;
+ *ptr++ = (tANI_U8) (val >> 16) & 0xff;
+ *ptr = (tANI_U8) (val >> 24) & 0xff;
+}
+
+// -------------------------------------------------------------------
+/**
+ * sirStoreU32BufN
+ *
+ * FUNCTION:
+ * It stores a 32 bit number into the byte array in network byte order
+ * i.e. the least significant byte first. It performs the above operation
+ * on entire buffer and writes to the dst buffer
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * Assumes that the pSrc buffer is of all tANI_U32 data type fields.
+ *
+ * NOTE:
+ * Must be used if all the fields in the buffer must be of tANI_U32 types.
+ *
+ * @param pDst address of destination byte array
+ * @param pSrc address of the source DWORD array
+ * @param length number of DWORDs
+ * @return None
+ */
+
+static inline void
+sirStoreBufN(tANI_U8* pDst, tANI_U32* pSrc, tANI_U32 length)
+{
+ while (length)
+ {
+ sirStoreU32N(pDst, *pSrc);
+ pDst += 4;
+ pSrc++;
+ length--;
+ }
+}
+
+// -------------------------------------------------------------------
+/**
+ * sirReadU16N
+ *
+ * FUNCTION:
+ * It reads a 16 bit number from the byte array in network byte order
+ * i.e. the least significant byte first
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ *
+ * @param ptr address of byte array
+ * @return 16 bit value
+ */
+
+static inline tANI_U16
+sirReadU16N(tANI_U8 *ptr)
+{
+ return(((*ptr) << 8) |
+ (*(ptr+1)));
+}
+/**
+ * sirSwapU32Buf
+ *
+ * FUNCTION:
+ * It swaps N dwords into the same buffer
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ *
+ * @param ptr address of tANI_U32 array
+ * @return void
+ *
+ */
+
+static inline void
+sirSwapNStore(tANI_U32 *src, tANI_U32 *dst, tANI_U32 nWords)
+{
+ tANI_U32 i;
+
+ for (i=0; i < nWords; i++)
+ dst[i] = sirSwapU32(src[i]);
+}
+
+// -------------------------------------------------------------------
+/**
+ * sirReadU32N
+ *
+ * FUNCTION:
+ * It reads a 32 bit number from the byte array in network byte order
+ * i.e. the least significant byte first
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ *
+ * @param ptr address of byte array
+ * @return 32 bit value
+ */
+
+static inline tANI_U32
+sirReadU32N(tANI_U8 *ptr)
+{
+ return((*(ptr) << 24) |
+ (*(ptr+1) << 16) |
+ (*(ptr+2) << 8) |
+ (*(ptr+3)));
+}
+
+// -------------------------------------------------------------------
+/**
+ * sirReadU16
+ *
+ * FUNCTION:
+ * It reads a 16 bit number from the byte array in NON-network byte order
+ * i.e. the least significant byte first
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ *
+ * @param ptr address of byte array
+ * @return 16 bit value
+ */
+
+static inline tANI_U16
+sirReadU16(tANI_U8 *ptr)
+{
+ return((*ptr) |
+ (*(ptr+1) << 8));
+}
+
+// -------------------------------------------------------------------
+/**
+ * sirReadU32
+ *
+ * FUNCTION:
+ * It reads a 32 bit number from the byte array in NON-network byte order
+ * i.e. the least significant byte first
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ *
+ * @param ptr address of byte array
+ * @return 32 bit value
+ */
+
+static inline tANI_U32
+sirReadU32(tANI_U8 *ptr)
+{
+ return((*(ptr)) |
+ (*(ptr+1) << 8) |
+ (*(ptr+2) << 16) |
+ (*(ptr+3) << 24));
+}
+
+// -------------------------------------------------------------------
+
+
+/// Copy a MAC address from 'from' to 'to'
+static inline void
+sirCopyMacAddr(tANI_U8 to[], tANI_U8 from[])
+{
+#if defined( _X86_ )
+ tANI_U32 align = (0x3 & ((tANI_U32) to | (tANI_U32) from ));
+ if( align ==0){
+ *((tANI_U16 *) &(to[4])) = *((tANI_U16 *) &(from[4]));
+ *((tANI_U32 *) to) = *((tANI_U32 *) from);
+ }else if (align == 2){
+ *((tANI_U16 *) &to[4]) = *((tANI_U16 *) &from[4]);
+ *((tANI_U16 *) &to[2]) = *((tANI_U16 *) &from[2]);
+ *((tANI_U16 *) &to[0]) = *((tANI_U16 *) &from[0]);
+ }else{
+ to[5] = from[5];
+ to[4] = from[4];
+ to[3] = from[3];
+ to[2] = from[2];
+ to[1] = from[1];
+ to[0] = from[0];
+ }
+#else
+ to[0] = from[0];
+ to[1] = from[1];
+ to[2] = from[2];
+ to[3] = from[3];
+ to[4] = from[4];
+ to[5] = from[5];
+#endif
+}
+
+static inline tANI_U8
+sirCompareMacAddr(tANI_U8 addr1[], tANI_U8 addr2[])
+{
+#if defined( _X86_ )
+ tANI_U32 align = (0x3 & ((tANI_U32) addr1 | (tANI_U32) addr2 ));
+
+ if( align ==0){
+ return ((*((tANI_U16 *) &(addr1[4])) == *((tANI_U16 *) &(addr2[4])))&&
+ (*((tANI_U32 *) addr1) == *((tANI_U32 *) addr2)));
+ }else if(align == 2){
+ return ((*((tANI_U16 *) &addr1[4]) == *((tANI_U16 *) &addr2[4])) &&
+ (*((tANI_U16 *) &addr1[2]) == *((tANI_U16 *) &addr2[2])) &&
+ (*((tANI_U16 *) &addr1[0]) == *((tANI_U16 *) &addr2[0])));
+ }else{
+ return ( (addr1[5]==addr2[5])&&
+ (addr1[4]==addr2[4])&&
+ (addr1[3]==addr2[3])&&
+ (addr1[2]==addr2[2])&&
+ (addr1[1]==addr2[1])&&
+ (addr1[0]==addr2[0]));
+ }
+#else
+ return ( (addr1[0]==addr2[0])&&
+ (addr1[1]==addr2[1])&&
+ (addr1[2]==addr2[2])&&
+ (addr1[3]==addr2[3])&&
+ (addr1[4]==addr2[4])&&
+ (addr1[5]==addr2[5]));
+#endif
+}
+
+
+/*
+* converts tANI_U16 CW value to 4 bit value to be inserted in IE
+*/
+static inline tANI_U8 convertCW(tANI_U16 cw)
+{
+ tANI_U8 val = 0;
+ while (cw > 0)
+ {
+ val++;
+ cw >>= 1;
+ }
+ if (val > 15)
+ return 0xF;
+ return val;
+}
+
+/* The user priority to AC mapping is such:
+ * UP(1, 2) ---> AC_BK(1)
+ * UP(0, 3) ---> AC_BE(0)
+ * UP(4, 5) ---> AC_VI(2)
+ * UP(6, 7) ---> AC_VO(3)
+ */
+#define WLAN_UP_TO_AC_MAP 0x33220110
+#define upToAc(up) ((WLAN_UP_TO_AC_MAP >> ((up) << 2)) & 0x03)
+
+#if defined VOSS_ENABLED
+
+#define sirBusyWait(microsecond) vos_busy_wait(microsecond / 1000)
+#define sirSleepWait(duration) vos_sleep_us(duration)
+
+#elif defined ANI_OS_TYPE_LINUX
+ //rt_busy_sleep(duration)
+
+#define sirBusyWait(duration) tx_busy_wait(duration)
+
+#define sirSleepWait(duration) sirSleepWaitIntern(duration)
+
+#elif defined ANI_OS_TYPE_WINDOWS
+
+#define sirBusyWait(duration) sirBusyWaitIntern(pMac, duration)
+
+#define sirSleepWait(duration) sirSleepWaitIntern(pMac, duration)
+
+#elif defined ANI_OS_TYPE_OSX
+#define sirBusyWait(duration) palBusyWait(duration)
+#define sirSleepWait(duration) palSleepWait(duration)
+#endif
+
+
+
+/**---------------------------------------------------------------------
+ * sirSleepWait
+ *
+ * FUNCTION:
+ * This function is called to yield the CPU for a given duration
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ *
+ * @param duration Duration to yield (nanoseconds)
+ * @return None
+ */
+
+#if defined ANI_OS_TYPE_WINDOWS
+
+static inline void
+sirSleepWaitIntern(void *pMac, tANI_U32 duration)
+
+#else
+
+static inline void
+sirSleepWaitIntern(tANI_U32 duration)
+
+#endif
+{
+#if defined ANI_OS_TYPE_LINUX
+ //temporary measure: not sure we can sleep less than 500usec on rtai
+ //so sleep at this amount of time so as we are garanteed to yield
+ if (duration<500000)
+ duration=500000;
+ tx_thread_sleep(duration);
+ // rt_sleep(duration/40/*temporary magic number: clock is 25MHz*/);
+#elif defined ANI_OS_TYPE_WINDOWS
+ // Can't sleep on windows at dispatch level
+ // what to do here?
+ if (duration >= 50000)
+ {
+ tANI_U32 i;
+
+ for (i = duration / 50000; i; i--)
+ sirBusyWait(50000);
+ }
+#endif
+} // sirSleepWait
+
+// -------------------------------------------------------------------
+
+/// Parse the next IE in a message
+extern tSirRetStatus sirParseNextIE(tpAniSirGlobal, tANI_U8 *pPayload,
+ tANI_U16 payloadLength, tANI_S16 lastType,
+ tANI_U8 *pType, tANI_U8 *pLength);
+
+/// Check if the given channel is 11b channel
+#define SIR_IS_CHANNEL_11B(chId) (chId <= 14)
+
+// -------------------------------------------------------------------
+/**
+ * halRoundS32
+ *
+ * FUNCTION:
+ * Performs integer rounding like returns 12346 for 123456 or -12346 for -123456
+ * Note that a decimal place is lost.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ *
+ * @param tANI_S32 input
+ * @return rounded number
+ */
+static inline tANI_S32
+halRoundS32(tANI_S32 p)
+{
+ tANI_S32 k, i, j;
+
+ i = p/10;
+ j = p%10;
+ if (p > 0)
+ k = i + (j > 4 ? 1 : 0);
+ else if (p < 0)
+ k = i + (j < -5 ? -1 : 0);
+ else
+ k = p;
+
+ return(k);
+}
+
+// New functions for endianess conversion
+#ifdef ANI_LITTLE_BYTE_ENDIAN
+#define ani_cpu_to_be16(x) sirSwapU16((x))
+#define ani_cpu_to_le16(x) (x)
+#define ani_cpu_to_be32(x) sirSwapU32((x))
+#define ani_cpu_to_le32(x) (x)
+#else // ANI_LITTLE_BYTE_ENDIAN
+#define ani_cpu_to_be16(x) (x)
+#define ani_cpu_to_le16(x) sirSwapU16((x))
+#define ani_cpu_to_be32(x) (x)
+#define ani_cpu_to_le32(x) sirSwapU32((x))
+#endif // ANI_LITTLE_BYTE_ENDIAN
+
+#define ani_le16_to_cpu(x) ani_cpu_to_le16(x)
+#define ani_le32_to_cpu(x) ani_cpu_to_le32(x)
+#define ani_be16_to_cpu(x) ani_cpu_to_be16(x)
+#define ani_be32_to_cpu(x) ani_cpu_to_be32(x)
+
+void ConverttoBigEndian(void *ptr, tANI_U16 size);
+void CreateScanCtsFrame(tpAniSirGlobal pMac, tSirMacMgmtHdr *macMgmtHdr, tSirMacAddr selfMac);
+void CreateScanDataNullFrame(tpAniSirGlobal pMac, tSirMacMgmtHdr *macMgmtHdr,
+ tANI_U8 pwrMgmt, tSirMacAddr bssid,
+ tSirMacAddr selfMacAddr);
+void CreateInitScanRawFrame(tpAniSirGlobal pMac, tSirMacMgmtHdr *macMgmtHdr, tBssSystemRole role);
+void CreateFinishScanRawFrame(tpAniSirGlobal pMac, tSirMacMgmtHdr *macMgmtHdr, tBssSystemRole role);
+
+#endif /* __UTILSAPI_H */
+
+
diff --git a/CORE/MAC/src/include/utilsGlobal.h b/CORE/MAC/src/include/utilsGlobal.h
new file mode 100644
index 0000000..3006082
--- /dev/null
+++ b/CORE/MAC/src/include/utilsGlobal.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * Author: Sandesh Goel
+ * Date: 02/25/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#ifndef __UTILS_GLOBAL_H__
+#define __UTILS_GLOBAL_H__
+
+#include "sirParams.h"
+
+/*
+ * Current debug and event log level
+ */
+#define LOG_FIRST_MODULE_ID SIR_FIRST_MODULE_ID
+#define LOG_LAST_MODULE_ID SIR_LAST_MODULE_ID
+#define LOG_ENTRY_NUM (LOG_LAST_MODULE_ID - LOG_FIRST_MODULE_ID + 1)
+
+typedef struct sAniSirUtils
+{
+ tANI_U32 gLogEvtLevel[LOG_ENTRY_NUM];
+ tANI_U32 gLogDbgLevel[LOG_ENTRY_NUM];
+
+} tAniSirUtils, *tpAniSirUtils;
+
+#endif
diff --git a/CORE/MAC/src/pe/include/limAdmitControl.h b/CORE/MAC/src/pe/include/limAdmitControl.h
new file mode 100644
index 0000000..158a94a
--- /dev/null
+++ b/CORE/MAC/src/pe/include/limAdmitControl.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * Author: Dinesh Upadhyay
+ * Date: 10/24/06
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#ifndef __LIM_ADMIT_CONTROL_H__
+#define __LIM_ADMIT_CONTROL_H__
+
+#include "sirCommon.h"
+#include "sirMacProtDef.h"
+
+#include "aniGlobal.h"
+
+tSirRetStatus
+limTspecFindByAssocId(tpAniSirGlobal, tANI_U16, tSirMacTspecIE*, tpLimTspecInfo, tpLimTspecInfo *);
+
+// Add TSPEC in lim local table
+tSirRetStatus limTspecAdd(
+ tpAniSirGlobal pMac,
+ tANI_U8 *pAddr,
+ tANI_U16 assocId,
+ tSirMacTspecIE *pTspec,
+ tANI_U32 interval,
+ tpLimTspecInfo *ppInfo);
+
+
+// admit control interface
+extern tSirRetStatus
+limAdmitControlAddTS(
+ tpAniSirGlobal pMac,
+ tANI_U8 *pAddr,
+ tSirAddtsReqInfo *addts,
+ tSirMacQosCapabilityStaIE *qos,
+ tANI_U16 assocId,
+ tANI_U8 alloc,
+ tSirMacScheduleIE *pSch,
+ tANI_U8 *pTspecIdx ,//index to the lim tspec table.
+ tpPESession psessionEntry
+ );
+
+static inline tSirRetStatus
+limAdmitControlAddSta(
+ tpAniSirGlobal pMac,
+ tANI_U8 *staAddr,
+ tANI_U8 alloc)
+{ return eSIR_SUCCESS;}
+
+extern tSirRetStatus
+limAdmitControlDeleteSta(
+ tpAniSirGlobal pMac,
+ tANI_U16 assocId);
+
+extern tSirRetStatus
+limAdmitControlDeleteTS(
+ tpAniSirGlobal pMac,
+ tANI_U16 assocId,
+ tSirMacTSInfo *tsinfo,
+ tANI_U8 *tsStatus,
+ tANI_U8 *tspecIdx);
+
+extern tSirRetStatus
+limUpdateAdmitPolicy(
+ tpAniSirGlobal pMac);
+
+tSirRetStatus limAdmitControlInit(tpAniSirGlobal pMac);
+
+tSirRetStatus limSendHalMsgAddTs(tpAniSirGlobal pMac, tANI_U16 staIdx, tANI_U8 tspecIdx, tSirMacTspecIE tspecIE, tANI_U8 sessionId);
+tSirRetStatus limSendHalMsgDelTs(tpAniSirGlobal pMac, tANI_U16 staIdx, tANI_U8 tspecIdx, tSirDeltsReqInfo delts);
+void limProcessHalAddTsRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg);
+
+#endif
diff --git a/CORE/MAC/src/pe/include/limApi.h b/CORE/MAC/src/pe/include/limApi.h
new file mode 100644
index 0000000..e0f2a4d
--- /dev/null
+++ b/CORE/MAC/src/pe/include/limApi.h
@@ -0,0 +1,321 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limApi.h contains the definitions exported by
+ * LIM module.
+ * Author: Chandra Modumudi
+ * Date: 02/11/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+#ifndef __LIM_API_H
+#define __LIM_API_H
+
+#include "wniApi.h"
+#include "sirApi.h"
+#include "aniGlobal.h"
+#include "sirMacProtDef.h"
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+#include "sirMacPropExts.h"
+#endif
+#include "sirCommon.h"
+#include "sirDebug.h"
+#include "schGlobal.h"
+#include "utilsApi.h"
+#include "limGlobal.h"
+#include "halMsgApi.h"
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#include "wlan_qct_wdi_ds.h"
+#endif
+#include "wlan_qct_wda.h"
+
+#define LIM_POL_SYS_SCAN_MODE 0
+#define LIM_POL_SYS_LEARN_MODE 1
+
+
+/* Macro to count heartbeat */
+
+#define limResetHBPktCount(psessionEntry) (psessionEntry->LimRxedBeaconCntDuringHB = 0)
+
+
+
+/* Useful macros for fetching various states in pMac->lim */
+/* gLimSystemRole */
+#define GET_LIM_SYSTEM_ROLE(psessionEntry) (psessionEntry->limSystemRole)
+#define LIM_IS_AP_ROLE(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_AP_ROLE)
+#define LIM_IS_STA_ROLE(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_STA_ROLE)
+#define LIM_IS_IBSS_ROLE(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_STA_IN_IBSS_ROLE)
+/* gLimSmeState */
+#define GET_LIM_SME_STATE(pMac) (pMac->lim.gLimSmeState)
+#define SET_LIM_SME_STATE(pMac, state) (pMac->lim.gLimSmeState = state)
+/* gLimMlmState */
+#define GET_LIM_MLM_STATE(pMac) (pMac->lim.gLimMlmState)
+#define SET_LIM_MLM_STATE(pMac, state) (pMac->lim.gLimMlmState = state)
+/*tpdphHashNode mlmStaContext*/
+#define GET_LIM_STA_CONTEXT_MLM_STATE(pStaDs) (pStaDs->mlmStaContext.mlmState)
+#define SET_LIM_STA_CONTEXT_MLM_STATE(pStaDs, state) (pStaDs->mlmStaContext.mlmState = state)
+/* gLimQuietState */
+#define GET_LIM_QUIET_STATE(pMac) (pMac->lim.gLimSpecMgmt.quietState)
+#define SET_LIM_QUIET_STATE(pMac, state) (pMac->lim.gLimSpecMgmt.quietState = state)
+
+#define LIM_IS_CONNECTION_ACTIVE(psessionEntry) (psessionEntry->LimRxedBeaconCntDuringHB)
+
+/*pMac->lim.gLimProcessDefdMsgs*/
+#define GET_LIM_PROCESS_DEFD_MESGS(pMac) (pMac->lim.gLimProcessDefdMsgs)
+#define SET_LIM_PROCESS_DEFD_MESGS(pMac, val) (pMac->lim.gLimProcessDefdMsgs = val)
+// LIM exported function templates
+//inline tANI_U16
+//limGetNumAniPeersInBss(tpAniSirGlobal pMac)
+//{ return pMac->lim.gLimNumOfAniSTAs; }
+#define LIM_IS_RADAR_DETECTED(pMac) (pMac->lim.gLimSpecMgmt.fRadarDetCurOperChan)
+#define LIM_SET_RADAR_DETECTED(pMac, val) (pMac->lim.gLimSpecMgmt.fRadarDetCurOperChan = val)
+#define LIM_MIN_BCN_PR_LENGTH 12
+#define LIM_BCN_PR_CAPABILITY_OFFSET 10
+
+typedef enum eMgmtFrmDropReason
+{
+ eMGMT_DROP_NO_DROP,
+ eMGMT_DROP_NOT_LAST_IBSS_BCN,
+ eMGMT_DROP_INFRA_BCN_IN_IBSS,
+ eMGMT_DROP_SCAN_MODE_FRAME,
+ eMGMT_DROP_NON_SCAN_MODE_FRAME,
+ eMGMT_DROP_INVALID_SIZE,
+}tMgmtFrmDropReason;
+
+
+
+
+/// During TD ring clean up at HDD in RTAI, will call this call back
+extern void limPostTdDummyPktCallbak(void* pMacGlobals, unsigned int* pBd);
+
+/**
+ * Function to initialize LIM state machines.
+ * This called upon LIM thread creation.
+ */
+extern tSirRetStatus limInitialize(tpAniSirGlobal);
+tSirRetStatus peOpen(tpAniSirGlobal pMac, tMacOpenParameters *pMacOpenParam);
+tSirRetStatus peClose(tpAniSirGlobal pMac);
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+tSirRetStatus limStart(tpAniSirGlobal pMac);
+#endif
+/**
+ * Function to Initialize radar interrupts.
+ */
+void limRadarInit(tpAniSirGlobal pMac);
+
+tSirRetStatus peStart(tpAniSirGlobal pMac);
+void peStop(tpAniSirGlobal pMac);
+tSirRetStatus pePostMsgApi(tpAniSirGlobal pMac, tSirMsgQ* pMsg);
+tSirRetStatus peProcessMsg(tpAniSirGlobal pMac, tSirMsgQ* limMsg);
+void limDumpInit(tpAniSirGlobal pMac);
+
+/**
+ * Function to cleanup LIM state.
+ * This called upon reset/persona change etc
+ */
+extern void limCleanup(tpAniSirGlobal);
+
+/// Function to post messages to LIM thread
+extern tANI_U32 limPostMsgApi(tpAniSirGlobal, tSirMsgQ *);
+
+/**
+ * Function to fetch messages posted LIM thread
+ */
+extern void limProcessMessageQueue(tpAniSirGlobal);
+
+/**
+ * Function to process messages posted to LIM thread
+ * and dispatch to various sub modules within LIM module.
+ */
+extern void limMessageProcessor(tpAniSirGlobal, tpSirMsgQ);
+extern void limProcessMessages(tpAniSirGlobal, tpSirMsgQ); // DT test alt deferred 2
+
+/**
+ * Function to check the LIM state if system can be put in
+ * Learn Mode.
+ * This is called by SCH upon receiving SCH_START_LEARN_MODE
+ * message from LIM.
+ */
+extern tSirRetStatus limCheckStateForLearnMode(tpAniSirGlobal);
+
+/**
+ * Function to check the LIM state if system is in Scan/Learn state.
+ */
+extern tANI_U8 limIsSystemInScanState(tpAniSirGlobal);
+
+#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+/**
+ * Function to setup Polaris into Learn mode.
+ * This is also called by SCH upon receiving SCH_START_LEARN_MODE
+ * message from LIM.
+ */
+extern void limSetLearnMode(tpAniSirGlobal);
+
+/**
+ * Function to re-enable Learn mode measurements
+ */
+extern void limReEnableLearnMode(tpAniSirGlobal);
+
+#endif //#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+
+/**
+ * Function to handle IBSS coalescing.
+ * Beacon Processing module to call this.
+ */
+extern tSirRetStatus limHandleIBSScoalescing(tpAniSirGlobal,
+ tpSchBeaconStruct,
+ tANI_U8 *,tpPESession);
+
+/// Function used by other Sirius modules to read global SME state
+ static inline tLimSmeStates
+limGetSmeState(tpAniSirGlobal pMac) { return pMac->lim.gLimSmeState; }
+
+/// Function used by other Sirius modules to read global system role
+ static inline tLimSystemRole
+limGetSystemRole(tpPESession psessionEntry) { return psessionEntry->limSystemRole; }
+
+//limGetAID(tpPESession psessionEntry) { return psessionEntry->limAID; }
+
+extern void limReceivedHBHandler(tpAniSirGlobal, tANI_U8, tpPESession);
+//extern void limResetHBPktCount(tpPESession);
+
+extern void limCheckAndQuietBSS(tpAniSirGlobal);
+
+/// Function to send WDS info to WSM if needed
+extern void limProcessWdsInfo(tpAniSirGlobal, tSirPropIEStruct);
+
+/// Function to initialize WDS info params
+extern void limInitWdsInfoParams(tpAniSirGlobal);
+
+/// Function that triggers STA context deletion
+extern void limTriggerSTAdeletion(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry);
+
+
+/// Function that checks for change in AP's capabilties on STA
+extern void limDetectChangeInApCapabilities(tpAniSirGlobal,
+ tpSirProbeRespBeacon,tpPESession);
+tSirRetStatus limUpdateShortSlot(tpAniSirGlobal pMac,
+ tpSirProbeRespBeacon pBeacon,
+ tpUpdateBeaconParams pBeaconParams,tpPESession);
+
+
+/// creates an addts request action frame and sends it out to staid
+extern void limSendAddtsReq (tpAniSirGlobal pMac, tANI_U16 staid, tANI_U8 tsid, tANI_U8 userPrio, tANI_U8 wme);
+/// creates a delts request action frame and sends it out to staid
+extern void limSendDeltsReq (tpAniSirGlobal pMac, tANI_U16 staid, tANI_U8 tsid, tANI_U8 userPrio, tANI_U8 wme);
+/// creates a SM Power State Mode update request action frame and sends it out to staid
+extern void limPostStartLearnModeMsgToSch(tpAniSirGlobal pMac);
+
+extern ePhyChanBondState limGetPhyCBState( tpAniSirGlobal pMac );
+tSirMacHTSecondaryChannelOffset limGetHTCBState(tAniCBSecondaryMode aniCBMode);
+tAniCBSecondaryMode limGetAniCBState( tSirMacHTSecondaryChannelOffset htCBMode) ;
+
+
+
+
+
+tANI_U8 limIsSystemInActiveState(tpAniSirGlobal pMac);
+
+#if 0 /* Currently, this function is not used but keep it around for when we do need it */
+tSirRetStatus limUpdateGlobalChannelBonding(tpAniSirGlobal pMac, tHalBitVal cbBit);
+#endif /* 0 */
+
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+extern void setupQuietBss( tpAniSirGlobal pMac, tANI_U32 learnInterval );
+extern tANI_BOOLEAN limUpdateQuietIEInBeacons( tpAniSirGlobal pMac );
+#endif
+
+#ifdef ANI_AP_SDK
+extern void limConvertScanDuration(tpAniSirGlobal pMac);
+#endif /* ANI_AP_SDK */
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+tSirRetStatus limProcessCcaMonitorModeChangeNotification(tpAniSirGlobal pMac, tANI_U32 ccaCbMode);
+#endif /* WNI_POLARIS_FW_PRODUCT == AP */
+
+void limHandleLowRssiInd(tpAniSirGlobal pMac);
+void limHandleBmpsStatusInd(tpAniSirGlobal pMac);
+void limHandleMissedBeaconInd(tpAniSirGlobal pMac);
+tMgmtFrmDropReason limIsPktCandidateForDrop(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U32 subType);
+void limMicFailureInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg);
+
+
+/* ----------------------------------------------------------------------- */
+// These used to be in DPH
+extern void limSetBssid(tpAniSirGlobal pMac, tANI_U8 *bssId);
+extern void limGetBssid(tpAniSirGlobal pMac, tANI_U8 *bssId);
+extern void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac);
+extern tSirRetStatus limCheckRxSeqNumber(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo);
+
+#define limGetQosMode(psessionEntry, pVal) *(pVal) = (psessionEntry)->limQosEnabled
+#define limGetWmeMode(psessionEntry, pVal) *(pVal) = (psessionEntry)->limWmeEnabled
+#define limGetWsmMode(psessionEntry, pVal) *(pVal) = (psessionEntry)->limWsmEnabled
+#define limGet11dMode(psessionEntry, pVal) *(pVal) = (psessionEntry)->lim11dEnabled
+#define limGetAckPolicy(pMac, pVal) *(pVal) = pMac->lim.ackPolicy
+
+/* ----------------------------------------------------------------------- */
+static inline void limGetPhyMode(tpAniSirGlobal pMac, tANI_U32 *phyMode, tpPESession psessionEntry)
+{
+ *phyMode = psessionEntry ? psessionEntry->gLimPhyMode : pMac->lim.gLimPhyMode;
+}
+
+/* ----------------------------------------------------------------------- */
+static inline void limGetRfBand(tpAniSirGlobal pMac, tSirRFBand *band, tpPESession psessionEntry)
+{
+ *band = psessionEntry ? psessionEntry->limRFBand : SIR_BAND_UNKNOWN;
+}
+
+/*--------------------------------------------------------------------------
+
+ \brief peProcessMessages() - Message Processor for PE
+
+ Voss calls this function to dispatch the message to PE
+
+ \param pMac - Pointer to Global MAC structure
+ \param pMsg - Pointer to the message structure
+
+ \return tANI_U32 - TX_SUCCESS for success.
+
+ --------------------------------------------------------------------------*/
+
+tSirRetStatus peProcessMessages(tpAniSirGlobal pMac, tSirMsgQ* pMsg);
+
+/** -------------------------------------------------------------
+\fn peFreeMsg
+\brief Called by VOS scheduler (function vos_sched_flush_mc_mqs)
+\ to free a given PE message on the TX and MC thread.
+\ This happens when there are messages pending in the PE
+\ queue when system is being stopped and reset.
+\param tpAniSirGlobal pMac
+\param tSirMsgQ pMsg
+\return none
+-----------------------------------------------------------------*/
+v_VOID_t peFreeMsg( tpAniSirGlobal pMac, tSirMsgQ* pMsg);
+
+/************************************************************/
+#endif /* __LIM_API_H */
+
diff --git a/CORE/MAC/src/pe/include/limFT.h b/CORE/MAC/src/pe/include/limFT.h
new file mode 100644
index 0000000..45dbaa4
--- /dev/null
+++ b/CORE/MAC/src/pe/include/limFT.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+/**=========================================================================
+
+ Macros and Function prototypes FT and 802.11R purposes
+
+ Copyright 2010 (c) Qualcomm, Incorporated. All Rights Reserved.
+ Qualcomm Confidential and Proprietary.
+
+ ========================================================================*/
+
+#ifndef __LIMFT_H__
+#define __LIMFT_H__
+
+
+#include <palTypes.h>
+#include <limGlobal.h>
+#include <aniGlobal.h>
+#include <limDebug.h>
+#include <limSerDesUtils.h>
+
+
+/*-------------------------------------------------------------------------
+ Function declarations and documenation
+ ------------------------------------------------------------------------*/
+extern void limFTOpen(tpAniSirGlobal pMac);
+extern void limFTCleanup(tpAniSirGlobal pMac);
+extern void limFTInit(tpAniSirGlobal pMac);
+extern int limProcessFTPreAuthReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg);
+extern void limPerformFTPreAuth(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
+ tpPESession psessionEntry);
+void limPerformPostFTPreAuth(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
+ tpPESession psessionEntry);
+void limFTResumeLinkCb(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data);
+void limPostFTPreAuthRsp(tpAniSirGlobal pMac, eHalStatus status,
+ tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
+ tpPESession psessionEntry);
+void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, eHalStatus status,
+ tANI_U8 *auth_rsp, tANI_U16 auth_rsp_len,
+ tpPESession psessionEntry);
+void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
+ tpPESession psessionEntry);
+void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac);
+
+int limisFastTransitionRequired(tpAniSirGlobal pMac, int SessionId);
+tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf );
+tSirRetStatus limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf );
+void limProcessFTAggrQoSRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg);
+
+#endif /* __LIMFT_H__ */
+
+#endif /* WLAN_FEATURE_VOWIFI_11R */
diff --git a/CORE/MAC/src/pe/include/limFTDefs.h b/CORE/MAC/src/pe/include/limFTDefs.h
new file mode 100644
index 0000000..b069bc1
--- /dev/null
+++ b/CORE/MAC/src/pe/include/limFTDefs.h
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+/**=========================================================================
+
+ Macros and Function prototypes FT and 802.11R purposes
+
+ Copyright 2010 (c) Qualcomm, Incorporated. All Rights Reserved.
+
+ Qualcomm Confidential and Proprietary.
+
+ ========================================================================*/
+
+#ifndef __LIMFTDEFS_H__
+#define __LIMFTDEFS_H__
+
+
+#include <palTypes.h>
+
+/*--------------------------------------------------------------------------
+ Preprocessor definitions and constants
+ ------------------------------------------------------------------------*/
+#define SIR_MDIE_SIZE 3 // MD ID(2 bytes), Capability(1 byte)
+#define MAX_TIDS 8
+#define MAX_FTIE_SIZE 256 // Max size limited to 256, on acct. of IW custom events
+
+
+/*--------------------------------------------------------------------------
+ Type declarations
+ ------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------
+ FT Pre Auth Req SME<->PE
+ ------------------------------------------------------------------------*/
+typedef struct sSirFTPreAuthReq
+{
+ tANI_U16 messageType; // eWNI_SME_FT_PRE_AUTH_REQ
+ tANI_U16 length;
+ tANI_U8 preAuthchannelNum;
+ tSirMacAddr currbssId; // BSSID currently associated to suspend the link
+ tSirMacAddr preAuthbssId; // BSSID to preauth to
+ tANI_U16 ft_ies_length;
+ tANI_U8 ft_ies[MAX_FTIE_SIZE];
+ tpSirBssDescription pbssDescription;
+} tSirFTPreAuthReq, *tpSirFTPreAuthReq;
+
+/*-------------------------------------------------------------------------
+ FT Pre Auth Rsp PE<->SME
+ ------------------------------------------------------------------------*/
+typedef struct sSirFTPreAuthRsp
+{
+ tANI_U16 messageType; // eWNI_SME_FT_PRE_AUTH_RSP
+ tANI_U16 length;
+ tANI_U8 smeSessionId;
+ tSirMacAddr preAuthbssId; // BSSID to preauth to
+ tANI_U8 status;
+ tANI_U16 ft_ies_length;
+ tANI_U8 ft_ies[MAX_FTIE_SIZE];
+ tANI_U16 ric_ies_length;
+ tANI_U8 ric_ies[MAX_FTIE_SIZE];
+} tSirFTPreAuthRsp, *tpSirFTPreAuthRsp;
+
+/*--------------------------------------------------------------------------
+ FT Pre Auth Req SME<->PE
+ ------------------------------------------------------------------------*/
+typedef struct sSirFTUpdateKeyInfo
+{
+ tANI_U16 messageType;
+ tANI_U16 length;
+ tSirKeyMaterial keyMaterial;
+} tSirFTUpdateKeyInfo, *tpSirFTUpdateKeyInfo;
+
+/*-------------------------------------------------------------------------
+ Global FT Information
+ ------------------------------------------------------------------------*/
+typedef struct sFTPEContext
+{
+ tpSirFTPreAuthReq pFTPreAuthReq; // Saved FT Pre Auth Req
+ void *psavedsessionEntry;
+ tANI_U8 ftPreAuthStatus;
+ tANI_U16 saved_auth_rsp_length;
+ tANI_U8 saved_auth_rsp[MAX_FTIE_SIZE];
+
+ // Items created for the new FT, session
+ void *pftSessionEntry; // Saved session created for pre-auth
+ void *pAddBssReq; // Save add bss req.
+ void *pAddStaReq; // Save add sta req.
+
+} tftPEContext, *tpftPEContext;
+
+
+#endif /* __LIMFTDEFS_H__ */
+
+#endif /* WLAN_FEATURE_VOWIFI_11R */
diff --git a/CORE/MAC/src/pe/include/limGlobal.h b/CORE/MAC/src/pe/include/limGlobal.h
new file mode 100644
index 0000000..d35a6de
--- /dev/null
+++ b/CORE/MAC/src/pe/include/limGlobal.h
@@ -0,0 +1,716 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limGlobal.h contains the definitions exported by
+ * LIM module.
+ * Author: Chandra Modumudi
+ * Date: 02/11/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+#ifndef __LIM_GLOBAL_H
+#define __LIM_GLOBAL_H
+
+#include "wniApi.h"
+#include "sirApi.h"
+#include "sirMacProtDef.h"
+#include "sirMacPropExts.h"
+#include "sirCommon.h"
+#include "sirDebug.h"
+#include "wniCfgAp.h"
+#ifdef WLAN_SOFTAP_FEATURE
+#include "csrApi.h"
+#include "sapApi.h"
+#endif
+
+/// Maximum number of scan hash table entries
+#define LIM_MAX_NUM_OF_SCAN_RESULTS 256
+
+// Link Test Report Status. This appears in the report frame
+#define LINK_TEST_STATUS_SUCCESS 0x1
+#define LINK_TEST_STATUS_UNSUPPORTED_RATE 0x2
+#define LINK_TEST_STATUS_INVALID_ADDR 0x3
+
+// Amount of time in nanosec to be sleep-waited before
+// enabling RHP (1 millisec)
+#define LIM_RHP_WORK_AROUND_DURATION 1000000
+
+// Maximum amount of Quiet duration in millisec
+#define LIM_MAX_QUIET_DURATION 32
+
+#define LIM_TX_WQ_EMPTY_SLEEP_NS 100000
+
+// Sending Disassociate frames threshold
+#define LIM_SEND_DISASSOC_FRAME_THRESHOLD 2
+#define LIM_HASH_MISS_TIMER_MS 10000
+
+// Deferred Message Queue Length
+#define MAX_DEFERRED_QUEUE_LEN 20
+
+// Maximum Buffer size
+#define LIM_MAX_BUF_SIZE 8192
+
+// Maximum number of PS - TIM's to be sent with out wakeup from STA
+#define LIM_TIM_WAIT_COUNT_FACTOR 5
+
+/** Use this count if (LIM_TIM_WAIT_FACTOR * ListenInterval) is less than LIM_MIN_TIM_WAIT_CNT*/
+#define LIM_MIN_TIM_WAIT_COUNT 50
+
+#define GET_TIM_WAIT_COUNT(LIntrvl) ((LIntrvl * LIM_TIM_WAIT_COUNT_FACTOR) > LIM_MIN_TIM_WAIT_COUNT ? \
+ (LIntrvl * LIM_TIM_WAIT_COUNT_FACTOR) : LIM_MIN_TIM_WAIT_COUNT)
+
+// enums exported by LIM are as follows
+
+/// System role definition
+typedef enum eLimSystemRole
+{
+ eLIM_UNKNOWN_ROLE,
+ eLIM_AP_ROLE,
+ eLIM_STA_IN_IBSS_ROLE,
+ eLIM_STA_ROLE,
+ eLIM_BT_AMP_STA_ROLE,
+ eLIM_BT_AMP_AP_ROLE
+#ifdef WLAN_FEATURE_P2P
+ ,eLIM_P2P_DEVICE_ROLE
+ ,eLIM_P2P_DEVICE_GO
+ ,eLIM_P2P_DEVICE_CLINET
+#endif
+} tLimSystemRole;
+
+/**
+ * SME state definition accessible across all Sirius modules.
+ * AP only states are LIM_SME_CHANNEL_SCAN_STATE &
+ * LIM_SME_NORMAL_CHANNEL_SCAN_STATE.
+ * Note that these states may also be present in STA
+ * side too when DFS support is present for a STA in IBSS mode.
+ */
+typedef enum eLimSmeStates
+{
+ eLIM_SME_OFFLINE_STATE,
+ eLIM_SME_IDLE_STATE,
+ eLIM_SME_SUSPEND_STATE,
+ eLIM_SME_WT_SCAN_STATE,
+ eLIM_SME_WT_JOIN_STATE,
+ eLIM_SME_WT_AUTH_STATE,
+ eLIM_SME_WT_ASSOC_STATE,
+ eLIM_SME_WT_REASSOC_STATE,
+ eLIM_SME_WT_REASSOC_LINK_FAIL_STATE,
+ eLIM_SME_JOIN_FAILURE_STATE,
+ eLIM_SME_ASSOCIATED_STATE,
+ eLIM_SME_REASSOCIATED_STATE,
+ eLIM_SME_LINK_EST_STATE,
+ eLIM_SME_LINK_EST_WT_SCAN_STATE,
+ eLIM_SME_WT_PRE_AUTH_STATE,
+ eLIM_SME_WT_DISASSOC_STATE,
+ eLIM_SME_WT_DEAUTH_STATE,
+ eLIM_SME_WT_START_BSS_STATE,
+ eLIM_SME_WT_STOP_BSS_STATE,
+ eLIM_SME_NORMAL_STATE,
+ eLIM_SME_CHANNEL_SCAN_STATE,
+ eLIM_SME_NORMAL_CHANNEL_SCAN_STATE
+} tLimSmeStates;
+
+/**
+ * MLM state definition.
+ * While these states are present on AP too when it is
+ * STA mode, per-STA MLM state exclusive to AP is:
+ * eLIM_MLM_WT_AUTH_FRAME3.
+ */
+typedef enum eLimMlmStates
+{
+ eLIM_MLM_OFFLINE_STATE,
+ eLIM_MLM_IDLE_STATE,
+ eLIM_MLM_WT_PROBE_RESP_STATE,
+ eLIM_MLM_PASSIVE_SCAN_STATE,
+ eLIM_MLM_WT_JOIN_BEACON_STATE,
+ eLIM_MLM_JOINED_STATE,
+ eLIM_MLM_BSS_STARTED_STATE,
+ eLIM_MLM_WT_AUTH_FRAME2_STATE,
+ eLIM_MLM_WT_AUTH_FRAME3_STATE,
+ eLIM_MLM_WT_AUTH_FRAME4_STATE,
+ eLIM_MLM_AUTH_RSP_TIMEOUT_STATE,
+ eLIM_MLM_AUTHENTICATED_STATE,
+ eLIM_MLM_WT_ASSOC_RSP_STATE,
+ eLIM_MLM_WT_REASSOC_RSP_STATE,
+ eLIM_MLM_ASSOCIATED_STATE,
+ eLIM_MLM_REASSOCIATED_STATE,
+ eLIM_MLM_LINK_ESTABLISHED_STATE,
+ eLIM_MLM_WT_ASSOC_CNF_STATE,
+ eLIM_MLM_LEARN_STATE,
+ eLIM_MLM_WT_ADD_BSS_RSP_STATE,
+ eLIM_MLM_WT_DEL_BSS_RSP_STATE,
+ eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE,
+ eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE,
+ eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE,
+ eLIM_MLM_WT_ADD_STA_RSP_STATE,
+ eLIM_MLM_WT_DEL_STA_RSP_STATE,
+ //MLM goes to this state when LIM initiates DELETE_STA as processing of Assoc req because
+ //the entry already exists. LIM comes out of this state when DELETE_STA response from
+ //HAL is received. LIM needs to maintain this state so that ADD_STA can be issued while
+ //processing DELETE_STA response from HAL.
+ eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE,
+ eLIM_MLM_WT_SET_BSS_KEY_STATE,
+ eLIM_MLM_WT_SET_STA_KEY_STATE,
+ eLIM_MLM_WT_SET_STA_BCASTKEY_STATE,
+ eLIM_MLM_WT_ADDBA_RSP_STATE,
+ eLIM_MLM_WT_REMOVE_BSS_KEY_STATE,
+ eLIM_MLM_WT_REMOVE_STA_KEY_STATE,
+ eLIM_MLM_WT_SET_MIMOPS_STATE,
+#if defined WLAN_FEATURE_VOWIFI_11R
+ eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE,
+ eLIM_MLM_WT_FT_REASSOC_RSP_STATE,
+#endif
+#ifdef WLAN_FEATURE_P2P
+ eLIM_MLM_P2P_LISTEN_STATE,
+#endif
+} tLimMlmStates;
+
+// 11h channel quiet states
+/* This enum indicates in which state the device is in
+ * when it receives quiet element in beacon or probe-response.
+ * The default quiet state of the device is always INIT
+ * eLIM_QUIET_BEGIN - When Quiet period is started
+ * eLIM_QUIET_CHANGED - When Quiet period is updated
+ * eLIM_QUIET_RUNNING - Between two successive Quiet updates
+ * eLIM_QUIET_END - When quiet period ends
+ */
+typedef enum eLimQuietStates
+{
+ eLIM_QUIET_INIT,
+ eLIM_QUIET_BEGIN,
+ eLIM_QUIET_CHANGED,
+ eLIM_QUIET_RUNNING,
+ eLIM_QUIET_END
+} tLimQuietStates;
+
+// 11h channel switch states
+/* This enum indicates in which state the channel-swith
+ * is presently operating.
+ * eLIM_11H_CHANSW_INIT - Default state
+ * eLIM_11H_CHANSW_RUNNING - When channel switch is running
+ * eLIM_11H_CHANSW_END - After channel switch is complete
+ */
+typedef enum eLimDot11hChanSwStates
+{
+ eLIM_11H_CHANSW_INIT,
+ eLIM_11H_CHANSW_RUNNING,
+ eLIM_11H_CHANSW_END
+} tLimDot11hChanSwStates;
+
+#ifdef GEN4_SCAN
+
+//WLAN_SUSPEND_LINK Related
+typedef void (*SUSPEND_RESUME_LINK_CALLBACK)(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data);
+
+// LIM to HAL SCAN Management Message Interface states
+typedef enum eLimHalScanState
+{
+ eLIM_HAL_IDLE_SCAN_STATE,
+ eLIM_HAL_INIT_SCAN_WAIT_STATE,
+ eLIM_HAL_START_SCAN_WAIT_STATE,
+ eLIM_HAL_END_SCAN_WAIT_STATE,
+ eLIM_HAL_FINISH_SCAN_WAIT_STATE,
+ eLIM_HAL_INIT_LEARN_WAIT_STATE,
+ eLIM_HAL_START_LEARN_WAIT_STATE,
+ eLIM_HAL_END_LEARN_WAIT_STATE,
+ eLIM_HAL_FINISH_LEARN_WAIT_STATE,
+ eLIM_HAL_SCANNING_STATE,
+//WLAN_SUSPEND_LINK Related
+ eLIM_HAL_SUSPEND_LINK_WAIT_STATE,
+ eLIM_HAL_SUSPEND_LINK_STATE,
+ eLIM_HAL_RESUME_LINK_WAIT_STATE,
+//end WLAN_SUSPEND_LINK Related
+} tLimLimHalScanState;
+#endif // GEN4_SCAN
+
+// LIM states related to A-MPDU/BA
+// This is used for maintaining the state between PE and HAL only.
+typedef enum eLimBAState
+{
+ eLIM_BA_STATE_IDLE, // we are not waiting for anything from HAL.
+ eLIM_BA_STATE_WT_ADD_RSP, //We are waiting for Add rsponse from HAL.
+ eLIM_BA_STATE_WT_DEL_RSP // We are waiting for Del response from HAL.
+} tLimBAState;
+
+#if (WNI_POLARIS_FW_PRODUCT == AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+typedef struct sLimMeasParams
+{
+ TX_TIMER measurementIndTimer;
+ TX_TIMER learnIntervalTimer;
+ TX_TIMER learnDurationTimer;
+ tANI_U32 rssiAlpha;
+ tANI_U32 chanUtilAlpha;
+ tANI_U8 shortDurationCount;
+ tANI_U8 isMeasIndTimerActive:1;
+ tANI_U8 disableMeasurements:1;
+ tANI_U8 rsvd:6;
+ tANI_U8 nextLearnChannelId;
+} tLimMeasParams, *tpLimMeasParams;
+
+typedef struct tLimMeasMatrixNode tLimMeasMatrixNode,
+ *tpLimMeasMatrixNode;
+struct tLimMeasMatrixNode
+{
+ tSirMeasMatrixInfo matrix;
+ tANI_U32 avgRssi;
+ tpLimMeasMatrixNode next;
+};
+
+typedef struct tLimNeighborBssWdsNode tLimNeighborBssWdsNode,
+ *tpLimNeighborBssWdsNode;
+struct tLimNeighborBssWdsNode
+{
+ tSirNeighborBssWdsInfo info;
+ tpLimNeighborBssWdsNode next;
+};
+
+typedef struct sLimMeasData
+{
+ tANI_U32 duration;
+ tANI_U32 prevTsfLo;
+ tANI_U32 prevChannelUtilization;
+ tANI_U16 avgChannelUtilization;
+ tANI_U8 numMatrixNodes;
+ tpLimMeasMatrixNode pMeasMatrixInfo;
+ tANI_U32 numBssWds;
+ tANI_U16 totalBssSize;
+ tpLimNeighborBssWdsNode pNeighborWdsInfo;
+} tLimMeasData, *tpLimMeasData;
+#endif
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+/// Definition for Alternate BSS list
+typedef struct sSirMultipleAlternateRadioInfo
+{
+ tANI_U8 numBss;
+ tSirAlternateRadioInfo alternateRadio[SIR_MAX_NUM_ALTERNATE_RADIOS];
+} tSirMultipleAlternateRadioInfo, *tpSirMultipleAlternateRadioInfo;
+
+/// Definition for Neighbor BSS list
+typedef struct sSirMultipleNeighborBssInfo
+{
+ tANI_U32 numBss;
+ tSirNeighborBssInfo bssList[SIR_MAX_NUM_NEIGHBOR_BSS];
+} tSirMultipleNeighborBssInfo, *tpSirMultipleNeighborBssInfo;
+#endif
+
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+/**
+ * Following is definition of to-be-released AID list.
+ * When 'seen' AID is moved from to-be-released list
+ * to free pool.
+ */
+typedef struct sLimAIDtbr
+{
+ tANI_U8 tbr:1;
+ tANI_U8 seen:1;
+} tLimAIDtbr;
+#endif
+
+// MLM Req/Cnf structure definitions
+typedef struct sLimMlmAuthReq
+{
+ tSirMacAddr peerMacAddr;
+ tAniAuthType authType;
+ tANI_U32 authFailureTimeout;
+ tANI_U8 sessionId;
+} tLimMlmAuthReq, *tpLimMlmAuthReq;
+
+typedef struct sLimMlmJoinReq
+{
+ tANI_U32 joinFailureTimeout;
+ tSirMacRateSet operationalRateSet;
+ tANI_U8 sessionId;
+ tSirBssDescription bssDescription;
+} tLimMlmJoinReq, *tpLimMlmJoinReq;
+
+typedef struct sLimMlmScanReq
+{
+ tSirBssType bssType;
+ tSirMacAddr bssId;
+ tSirMacSSid ssId[SIR_SCAN_MAX_NUM_SSID];
+ tSirScanType scanType;
+ tANI_U32 minChannelTime;
+ tANI_U32 maxChannelTime;
+ tSirBackgroundScanMode backgroundScanMode;
+ tANI_U32 dot11mode;
+ /* Number of SSIDs to scan(send Probe request) */
+ tANI_U8 numSsid;
+
+#ifdef WLAN_FEATURE_P2P
+ tANI_BOOLEAN p2pSearch;
+#endif
+ tANI_U16 uIEFieldLen;
+ tANI_U16 uIEFieldOffset;
+
+ //channelList MUST be the last field of this structure
+ tSirChannelList channelList;
+ /*-----------------------------
+ tLimMlmScanReq....
+ -----------------------------
+ uIEFiledLen
+ -----------------------------
+ uIEFiledOffset ----+
+ ----------------------------- |
+ channelList.numChannels |
+ ----------------------------- |
+ ... variable size up to |
+ channelNumber[numChannels-1] |
+ This can be zero, if |
+ numChannel is zero. |
+ ----------------------------- <--+
+ ... variable size uIEFiled
+ up to uIEFieldLen (can be 0)
+ -----------------------------*/
+} tLimMlmScanReq, *tpLimMlmScanReq;
+
+typedef struct tLimScanResultNode tLimScanResultNode;
+struct tLimScanResultNode
+{
+ tLimScanResultNode *next;
+ tSirBssDescription bssDescription;
+};
+
+
+// Pre-authentication structure definition
+typedef struct tLimPreAuthNode
+{
+ struct tLimPreAuthNode *next;
+ tSirMacAddr peerMacAddr;
+ tAniAuthType authType;
+ tLimMlmStates mlmState;
+ tANI_U8 authNodeIdx;
+ tANI_U8 challengeText[SIR_MAC_AUTH_CHALLENGE_LENGTH];
+ tANI_U8 fTimerStarted:1;
+ tANI_U8 fSeen:1;
+ tANI_U8 fFree:1;
+ tANI_U8 rsvd:5;
+ TX_TIMER timer;
+}tLimPreAuthNode, *tpLimPreAuthNode;
+
+// Pre-authentication table definition
+typedef struct tLimPreAuthTable
+{
+ tANI_U32 numEntry;
+ tpLimPreAuthNode pTable;
+}tLimPreAuthTable, *tpLimPreAuthTable;
+
+/// Per STA context structure definition
+typedef struct sLimMlmStaContext
+{
+ tLimMlmStates mlmState;
+ tAniAuthType authType;
+ tANI_U16 listenInterval;
+ tSirMacCapabilityInfo capabilityInfo;
+ tSirMacPropRateSet propRateSet;
+ tSirMacReasonCodes disassocReason;
+ tANI_U16 cleanupTrigger;
+
+ tSirResultCodes resultCode;
+ tANI_U16 protStatusCode;
+
+ tANI_U8 subType:1; // Indicates ASSOC (0) or REASSOC (1)
+ tANI_U8 updateContext:1;
+ tANI_U8 schClean:1;
+ // 802.11n HT Capability in Station: Enabled 1 or DIsabled 0
+ tANI_U8 htCapability:1;
+} tLimMlmStaContext, *tpLimMlmStaContext;
+
+// Structure definition to hold deferred messages queue parameters
+typedef struct sLimDeferredMsgQParams
+{
+ tSirMsgQ deferredQueue[MAX_DEFERRED_QUEUE_LEN];
+ tANI_U16 size;
+ tANI_U16 read;
+ tANI_U16 write;
+} tLimDeferredMsgQParams, *tpLimDeferredMsgQParams;
+
+typedef struct sLimTraceQ
+{
+ tANI_U32 type;
+ tLimSmeStates smeState;
+ tLimMlmStates mlmState;
+ tANI_U32 value;
+ tANI_U32 value2;
+} tLimTraceQ;
+
+typedef struct sLimTraceParams
+{
+ tLimTraceQ traceQueue[1024];
+ tANI_U16 write;
+ tANI_U16 enabled;
+} tLimTraceParams;
+
+typedef struct sCfgProtection
+{
+ tANI_U32 overlapFromlla:1;
+ tANI_U32 overlapFromllb:1;
+ tANI_U32 overlapFromllg:1;
+ tANI_U32 overlapHt20:1;
+ tANI_U32 overlapNonGf:1;
+ tANI_U32 overlapLsigTxop:1;
+ tANI_U32 overlapRifs:1;
+ tANI_U32 overlapOBSS:1; /* added for obss */
+ tANI_U32 fromlla:1;
+ tANI_U32 fromllb:1;
+ tANI_U32 fromllg:1;
+ tANI_U32 ht20:1;
+ tANI_U32 nonGf:1;
+ tANI_U32 lsigTxop:1;
+ tANI_U32 rifs:1;
+ tANI_U32 obss:1; /* added for Obss */
+}tCfgProtection, *tpCfgProtection;
+
+typedef enum eLimProtStaCacheType
+{
+ eLIM_PROT_STA_CACHE_TYPE_INVALID,
+ eLIM_PROT_STA_CACHE_TYPE_llB,
+ eLIM_PROT_STA_CACHE_TYPE_llG,
+ eLIM_PROT_STA_CACHE_TYPE_HT20
+}tLimProtStaCacheType;
+
+typedef struct sCacheParams
+{
+ tANI_U8 active;
+ tSirMacAddr addr;
+ tLimProtStaCacheType protStaCacheType;
+
+} tCacheParams, *tpCacheParams;
+
+#ifdef ANI_PRODUCT_TYPE_AP
+#define LIM_PROT_STA_OVERLAP_CACHE_SIZE 10
+#define LIM_PROT_STA_CACHE_SIZE 256
+#else
+#ifdef WLAN_SOFTAP_FEATURE
+#define LIM_PROT_STA_OVERLAP_CACHE_SIZE HAL_NUM_ASSOC_STA
+#define LIM_PROT_STA_CACHE_SIZE HAL_NUM_ASSOC_STA
+#else
+#define LIM_PROT_STA_OVERLAP_CACHE_SIZE 5
+#define LIM_PROT_STA_CACHE_SIZE 5
+#endif
+#endif
+
+typedef struct sLimProtStaParams
+{
+ tANI_U8 numSta;
+ tANI_U8 protectionEnabled;
+} tLimProtStaParams, *tpLimProtStaParams;
+
+
+typedef struct sLimNoShortParams
+{
+ tANI_U8 numNonShortPreambleSta;
+ tCacheParams staNoShortCache[LIM_PROT_STA_CACHE_SIZE];
+} tLimNoShortParams, *tpLimNoShortParams;
+
+typedef struct sLimNoShortSlotParams
+{
+ tANI_U8 numNonShortSlotSta;
+ tCacheParams staNoShortSlotCache[LIM_PROT_STA_CACHE_SIZE];
+} tLimNoShortSlotParams, *tpLimNoShortSlotParams;
+
+
+typedef struct tLimIbssPeerNode tLimIbssPeerNode;
+struct tLimIbssPeerNode
+{
+ tLimIbssPeerNode *next;
+ tSirMacAddr peerMacAddr;
+ tANI_U8 aniIndicator:1;
+ tANI_U8 extendedRatesPresent:1;
+ tANI_U8 edcaPresent:1;
+ tANI_U8 wmeEdcaPresent:1;
+ tANI_U8 wmeInfoPresent:1;
+ tANI_U8 htCapable:1;
+ tANI_U8 rsvd:2;
+ tSirMacCapabilityInfo capabilityInfo;
+ tSirMacRateSet supportedRates;
+ tSirMacRateSet extendedRates;
+ tANI_U8 supportedMCSSet[SIZE_OF_SUPPORTED_MCS_SET];
+ tSirMacEdcaParamSetIE edcaParams;
+ tANI_U16 propCapability;
+ tANI_U8 erpIePresent;
+
+ //HT Capabilities of IBSS Peer
+ tANI_U8 htGreenfield;
+ tANI_U8 htShortGI40Mhz;
+ tANI_U8 htShortGI20Mhz;
+
+ // DSSS/CCK at 40 MHz: Enabled 1 or Disabled
+ tANI_U8 htDsssCckRate40MHzSupport;
+
+ // MIMO Power Save
+ tSirMacHTMIMOPowerSaveState htMIMOPSState;
+
+ //
+ // A-MPDU Density
+ // 000 - No restriction
+ // 001 - 1/8 usec
+ // 010 - 1/4 usec
+ // 011 - 1/2 usec
+ // 100 - 1 usec
+ // 101 - 2 usec
+ // 110 - 4 usec
+ // 111 - 8 usec
+ //
+ tANI_U8 htAMpduDensity;
+
+ // Maximum Rx A-MPDU factor
+ tANI_U8 htMaxRxAMpduFactor;
+
+ //Set to 0 for 3839 octets
+ //Set to 1 for 7935 octets
+ tANI_U8 htMaxAmsduLength;
+
+ //
+ // Recommended Tx Width Set
+ // 0 - use 20 MHz channel (control channel)
+ // 1 - use 40 Mhz channel
+ //
+ tANI_U8 htSupportedChannelWidthSet;
+
+ tANI_U8 beaconHBCount;
+ tANI_U8 heartbeatFailure;
+
+ tANI_U8 *beacon; //Hold beacon to be sent to HDD/CSR
+ tANI_U16 beaconLen;
+
+};
+
+// Enums used for channel switching.
+typedef enum eLimChannelSwitchState
+{
+ eLIM_CHANNEL_SWITCH_IDLE,
+ eLIM_CHANNEL_SWITCH_PRIMARY_ONLY,
+ eLIM_CHANNEL_SWITCH_SECONDARY_ONLY,
+ eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY
+} tLimChannelSwitchState;
+
+
+// Channel Switch Info
+typedef struct sLimChannelSwitchInfo
+{
+ tLimChannelSwitchState state;
+ tANI_U8 primaryChannel;
+ tAniCBSecondaryMode secondarySubBand;
+ tANI_U32 switchCount;
+ tANI_U32 switchTimeoutValue;
+ tANI_U8 switchMode;
+} tLimChannelSwitchInfo, *tpLimChannelSwitchInfo;
+
+// Enums used when stopping the Tx.
+typedef enum eLimQuietTxMode
+{
+ eLIM_TX_ALL = 0, /* Stops/resumes the transmission of all stations, Uses the global flag. */
+ eLIM_TX_STA, /* Stops/resumes the transmission of specific stations identified by staId. */
+ eLIM_TX_BSS, /* Stops/resumes the transmission of all the packets in BSS */
+ eLIM_TX_BSS_BUT_BEACON /* Stops/resumes the transmission of all packets except beacons in BSS
+ * This is used when radar is detected in the current operating channel.
+ * Beacon has to be sent to notify the stations associated about the
+ * scheduled channel switch */
+} tLimQuietTxMode;
+
+typedef enum eLimControlTx
+{
+ eLIM_RESUME_TX = 0,
+ eLIM_STOP_TX
+} tLimControlTx;
+
+#ifdef ANI_AP_SDK
+typedef struct sLimScanDurationConvert
+{
+ tANI_U32 shortChannelScanDuration_tick; /* Used to update timers, for optimization purposes. Value converted to TICKS once */
+ tANI_U32 shortChannelScanDuration_TU; /* Used by quietBSS duration. Converted to TU once */
+ tANI_U32 longChannelScanDuration_tick; /* Used to update timers, for optimization purposes. Value converted to TICKS once */
+ tANI_U32 longChannelScanDuration_TU; /* Used by quietBSS duration. Converted to TU once */
+} tLimScanDurationConvert, *tpLimScanDurationConvert;
+#endif /* ANI_AP_SDK */
+
+// --------------------------------------------------------------------
+
+typedef __ani_attr_pre_packed struct sLimTspecInfo
+{
+ tANI_U8 inuse; // 0==free, else used
+ tANI_U8 idx; // index in list
+ tANI_U8 staAddr[6];
+ tANI_U16 assocId;
+ tSirMacTspecIE tspec;
+ tANI_U8 numTclas; // number of Tclas elements
+ tSirTclasInfo tclasInfo[SIR_MAC_TCLASIE_MAXNUM];
+ tANI_U8 tclasProc;
+ tANI_U8 tclasProcPresent:1; //tclassProc is valid only if this is set to 1.
+} __ani_attr_packed tLimTspecInfo, *tpLimTspecInfo;
+
+typedef struct sLimAdmitPolicyInfo
+{
+ tANI_U8 type; // admit control policy type
+ tANI_U8 bw_factor; // oversubscription factor : 0 means nothing is allowed
+ // valid only when 'type' is set BW_FACTOR
+} tLimAdmitPolicyInfo, *tpLimAdmitPolicyInfo;
+
+
+typedef enum eLimWscEnrollState
+{
+ eLIM_WSC_ENROLL_NOOP,
+ eLIM_WSC_ENROLL_BEGIN,
+ eLIM_WSC_ENROLL_IN_PROGRESS,
+ eLIM_WSC_ENROLL_END
+
+} tLimWscEnrollState;
+
+#define WSC_PASSWD_ID_PUSH_BUTTON (0x0004)
+
+typedef struct sLimWscIeInfo
+{
+ tANI_BOOLEAN apSetupLocked;
+ tANI_BOOLEAN selectedRegistrar;
+ tANI_U16 selectedRegistrarConfigMethods;
+ tLimWscEnrollState wscEnrollmentState;
+ tLimWscEnrollState probeRespWscEnrollmentState;
+ tANI_U8 reqType;
+ tANI_U8 respType;
+} tLimWscIeInfo, *tpLimWscIeInfo;
+
+// maximum number of tspec's supported
+#define LIM_NUM_TSPEC_MAX 4
+
+
+//structure to hold all 11h specific data
+typedef struct sLimSpecMgmtInfo
+{
+ tLimQuietStates quietState;
+ tANI_U32 quietCount;
+ tANI_U32 quietDuration; /* This is in units of system TICKS */
+ tANI_U32 quietDuration_TU; /* This is in units of TU, for over the air transmission */
+ tANI_U32 quietTimeoutValue; /* After this timeout, actual quiet starts */
+ tANI_BOOLEAN fQuietEnabled; /* Used on AP, if quiet is enabled during learning */
+
+ tLimDot11hChanSwStates dot11hChanSwState;
+
+ tANI_BOOLEAN fRadarDetCurOperChan; /* Radar detected in cur oper chan on AP */
+ tANI_BOOLEAN fRadarIntrConfigured; /* Whether radar interrupt has been configured */
+}tLimSpecMgmtInfo, *tpLimSpecMgmtInfo;
+#endif
diff --git a/CORE/MAC/src/pe/include/limSession.h b/CORE/MAC/src/pe/include/limSession.h
new file mode 100644
index 0000000..8412849
--- /dev/null
+++ b/CORE/MAC/src/pe/include/limSession.h
@@ -0,0 +1,419 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if !defined( __LIM_SESSION_H )
+#define __LIM_SESSION_H
+
+
+/**=========================================================================
+
+ \file limSession.h
+
+ \brief prototype for lim Session related APIs
+
+ \author Sunit Bhatia
+
+ Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
+ Qualcomm Confidential and Proprietary.
+
+ ========================================================================*/
+
+
+/*--------------------------------------------------------------------------
+ Include Files
+ ------------------------------------------------------------------------*/
+
+
+
+/*--------------------------------------------------------------------------
+ Preprocessor definitions and constants
+ ------------------------------------------------------------------------*/
+#ifdef WLAN_SOFTAP_FEATURE
+#define NUM_WEP_KEYS 4
+#endif
+
+/*--------------------------------------------------------------------------
+ Type declarations
+ ------------------------------------------------------------------------*/
+typedef struct
+{
+ tSirMacBeaconInterval beaconInterval;
+ tANI_U8 fShortPreamble;
+ tANI_U8 llaCoexist;
+ tANI_U8 llbCoexist;
+ tANI_U8 llgCoexist;
+ tANI_U8 ht20Coexist;
+ tANI_U8 llnNonGFCoexist;
+ tANI_U8 fRIFSMode;
+ tANI_U8 fLsigTXOPProtectionFullSupport;
+ tANI_U8 gHTObssMode;
+}tBeaconParams, *tpBeaconParams;
+
+typedef struct sPESession // Added to Support BT-AMP
+{
+ /* To check session table is in use or free*/
+ tANI_U8 available;
+ tANI_U8 peSessionId;
+ tANI_U8 smeSessionId;
+ tANI_U16 transactionId;
+
+ //In AP role: BSSID and selfMacAddr will be the same.
+ //In STA role: they will be different
+ tSirMacAddr bssId;
+ tSirMacAddr selfMacAddr;
+ tSirMacSSid ssId;
+ tANI_U8 bssIdx;
+ tANI_U8 valid;
+ tLimMlmStates limMlmState; //MLM State
+ tLimMlmStates limPrevMlmState; //Previous MLM State
+ tLimSmeStates limSmeState; //SME State
+ tLimSmeStates limPrevSmeState; //Previous SME State
+ tLimSystemRole limSystemRole;
+ tSirBssType bssType;
+ tANI_U8 operMode; // AP - 0; STA - 1 ;
+ tSirNwType nwType;
+ tpSirSmeStartBssReq pLimStartBssReq; //handle to smestart bss req
+ tpSirSmeJoinReq pLimJoinReq; // handle to sme join req
+ tpSirSmeReassocReq pLimReAssocReq; //handle to sme reassoc req
+ tpLimMlmJoinReq pLimMlmJoinReq; //handle to MLM join Req
+ void *pLimMlmReassocReq; //handle to MLM reassoc Req
+ tANI_U16 channelChangeReasonCode;
+ tANI_U8 dot11mode;
+ tANI_U8 htCapabality;
+ tSirRFBand limRFBand;
+ tANI_U8 limIbssActive; //TO SUPPORT CONCURRENCY
+
+ /* These global varibales moved to session Table to support BT-AMP : Oct 9th review */
+ tAniAuthType limCurrentAuthType;
+ tANI_U16 limCurrentBssCaps;
+ tANI_U8 limCurrentBssQosCaps;
+ tANI_U16 limCurrentBssPropCap;
+ tANI_U8 limSentCapsChangeNtf;
+ tANI_U32 limCurrentTitanHtCaps;
+ tANI_U16 limAID;
+
+ /* Parameters For Reassociation */
+ tSirMacAddr limReAssocbssId;
+ tSirMacChanNum limReassocChannelId;
+ tSirMacSSid limReassocSSID;
+ tANI_U16 limReassocBssCaps;
+ tANI_U8 limReassocBssQosCaps;
+ tANI_U16 limReassocBssPropCap;
+ tANI_U32 limReassocTitanHtCaps;
+
+ // Assoc or ReAssoc Response Data/Frame
+ void *limAssocResponseData;
+
+
+
+ /** BSS Table parameters **/
+
+
+ /*
+ * staId: Start BSS: this is the Sta Id for the BSS.
+ Join: this is the selfStaId
+ In both cases above, the peer STA ID wll be stored in dph hash table.
+ */
+ tANI_U16 staId;
+ tANI_U16 statypeForBss; //to know session is for PEER or SELF
+ tANI_U8 shortSlotTimeSupported;
+ tANI_U8 dtimPeriod;
+ tSirMacRateSet rateSet;
+ tSirMacRateSet extRateSet;
+ tSirMacHTOperatingMode htOperMode;
+ tANI_U8 currentOperChannel;
+ tANI_U8 currentReqChannel;
+ tANI_U8 LimRxedBeaconCntDuringHB;
+
+ //Time stamp of the last beacon received from the BSS to which STA is connected.
+ tANI_U64 lastBeaconTimeStamp;
+ //RX Beacon count for the current BSS to which STA is connected.
+ tANI_U32 currentBssBeaconCnt;
+ tANI_U8 lastBeaconDtimCount;
+ tANI_U8 lastBeaconDtimPeriod;
+
+ tANI_U32 bcnLen;
+ tANI_U8 *beacon; //Used to store last beacon / probe response before assoc.
+
+ tANI_U32 assocReqLen;
+ tANI_U8 *assocReq; //Used to store association request frame sent out while associating.
+
+ tANI_U32 assocRspLen;
+ tANI_U8 *assocRsp; //Used to store association response received while associating
+ tAniSirDph dph;
+ void * *parsedAssocReq; //Used to store parsed assoc req from various requesting station
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ tANI_U32 RICDataLen; //Used to store the Ric data received in the assoc response
+ tANI_U8 *ricData;
+#endif
+#ifdef FEATURE_WLAN_CCX
+ tANI_U32 tspecLen; //Used to store the TSPEC IEs received in the assoc response
+ tANI_U8 *tspecIes;
+#endif
+ tANI_U32 encryptType;
+
+#ifdef WLAN_SOFTAP_FEATURE
+ tANI_BOOLEAN bTkipCntrMeasActive; // Used to keep record of TKIP counter measures start/stop
+
+ tANI_U8 gLimProtectionControl; //used for 11n protection
+
+ tANI_U8 gHTNonGFDevicesPresent;
+
+ //protection related config cache
+ tCfgProtection cfgProtection;
+
+ // Number of legacy STAs associated
+ tLimProtStaParams gLim11bParams;
+
+ // Number of 11A STAs associated
+ tLimProtStaParams gLim11aParams;
+
+ // Number of non-ht non-legacy STAs associated
+ tLimProtStaParams gLim11gParams;
+
+ //Number of nonGf STA associated
+ tLimProtStaParams gLimNonGfParams;
+
+ //Number of HT 20 STAs associated
+ tLimProtStaParams gLimHt20Params;
+
+ //Number of Lsig Txop not supported STAs associated
+ tLimProtStaParams gLimLsigTxopParams;
+
+ // Number of STAs that do not support short preamble
+ tLimNoShortParams gLimNoShortParams;
+
+ // Number of STAs that do not support short slot time
+ tLimNoShortSlotParams gLimNoShortSlotParams;
+
+
+ // OLBC parameters
+ tLimProtStaParams gLimOlbcParams;
+
+ // OLBC parameters
+ tLimProtStaParams gLimOverlap11gParams;
+
+ tLimProtStaParams gLimOverlap11aParams;
+ tLimProtStaParams gLimOverlapHt20Params;
+ tLimProtStaParams gLimOverlapNonGfParams;
+
+ //cache for each overlap
+ tCacheParams protStaCache[LIM_PROT_STA_CACHE_SIZE];
+
+ tANI_U8 privacy;
+ tAniAuthType authType;
+ tSirKeyMaterial WEPKeyMaterial[NUM_WEP_KEYS];
+
+ tDot11fIERSN gStartBssRSNIe;
+ tDot11fIEWPA gStartBssWPAIe;
+ tSirAPWPSIEs APWPSIEs;
+ tANI_U8 apUapsdEnable;
+ tSirWPSPBCSession *pAPWPSPBCSession;
+ tANI_U32 DefProbeRspIeBitmap[8];
+ tANI_U32 proxyProbeRspEn;
+ tDot11fProbeResponse probeRespFrame;
+ tANI_U8 ssidHidden;
+ tANI_BOOLEAN fwdWPSPBCProbeReq;
+ tANI_U8 wps_state;
+#endif
+
+ tANI_U8 limQosEnabled:1; //11E
+ tANI_U8 limWmeEnabled:1; //WME
+ tANI_U8 limWsmEnabled:1; //WSM
+ tANI_U8 limHcfEnabled:1;
+ tANI_U8 lim11dEnabled:1;
+
+ tANI_U32 lim11hEnable;
+
+ tPowerdBm maxTxPower; //MIN (Regulatory and local power constraint)
+ tVOS_CON_MODE pePersona;
+#if defined WLAN_FEATURE_VOWIFI
+ tPowerdBm txMgmtPower;
+#endif
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ tAniBool is11Rconnection;
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+ tAniBool isCCXconnection;
+ tCcxPEContext ccxContext;
+#endif
+#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX
+ tAniBool isFastTransitionEnabled;
+#endif
+#ifdef WLAN_FEATURE_P2P
+ tSirNoAParam p2pNoA;
+ tSirP2PNoaAttr p2pGoPsUpdate;
+#endif
+
+ /* EDCA QoS parameters
+ * gLimEdcaParams - These EDCA parameters are used locally on AP or STA.
+ * If STA, then these are values taken from the Assoc Rsp when associating,
+ * or Beacons/Probe Response after association. If AP, then these are
+ * values originally set locally on AP.
+ *
+ * gLimEdcaParamsBC - These EDCA parameters are use by AP to broadcast
+ * to other STATIONs in the BSS.
+ *
+ * gLimEdcaParamsActive: These EDCA parameters are what's actively being
+ * used on station. Specific AC values may be downgraded depending on
+ * admission control for that particular AC.
+ */
+ tSirMacEdcaParamRecord gLimEdcaParams[MAX_NUM_AC]; //used locally
+ tSirMacEdcaParamRecord gLimEdcaParamsBC[MAX_NUM_AC]; //used for broadcast
+ tSirMacEdcaParamRecord gLimEdcaParamsActive[MAX_NUM_AC];
+
+ tANI_U8 gLimEdcaParamSetCount;
+
+ tBeaconParams beaconParams;
+
+ tANI_U8 spectrumMgtEnabled;
+
+ /*Flag to Track Status/Indicate HBFailure on this session */
+ tANI_BOOLEAN LimHBFailureStatus;
+ tANI_U32 gLimPhyMode;
+}tPESession, *tpPESession;
+
+#define LIM_MAX_ACTIVE_SESSIONS 4
+
+
+/*-------------------------------------------------------------------------
+ Function declarations and documenation
+ ------------------------------------------------------------------------*/
+
+
+/*--------------------------------------------------------------------------
+
+ \brief peCreateSession() - creates a new PE session given the BSSID
+
+ This function returns the session context and the session ID if the session
+ corresponding to the passed BSSID is found in the PE session table.
+
+ \param pMac - pointer to global adapter context
+ \param bssid - BSSID of the new session
+ \param sessionId -session ID is returned here, if session is created.
+
+ \return tpPESession - pointer to the session context or NULL if session can not be created.
+
+ \sa
+
+ --------------------------------------------------------------------------*/
+tpPESession peCreateSession(tpAniSirGlobal pMac, tANI_U8 *bssid , tANI_U8* sessionId, tANI_U16 numSta);
+
+
+/*--------------------------------------------------------------------------
+ \brief peFindSessionByBssid() - looks up the PE session given the BSSID.
+
+ This function returns the session context and the session ID if the session
+ corresponding to the given BSSID is found in the PE session table.
+
+ \param pMac - pointer to global adapter context
+ \param bssid - BSSID of the session
+ \param sessionId -session ID is returned here, if session is found.
+
+ \return tpPESession - pointer to the session context or NULL if session is not found.
+
+ \sa
+ --------------------------------------------------------------------------*/
+tpPESession peFindSessionByBssid(tpAniSirGlobal pMac, tANI_U8* bssid, tANI_U8* sessionId);
+
+
+
+/*--------------------------------------------------------------------------
+ \brief peFindSessionByPeerSta() - looks up the PE session given the Peer Station Address.
+
+ This function returns the session context and the session ID if the session
+ corresponding to the given destination address is found in the PE session table.
+
+ \param pMac - pointer to global adapter context
+ \param sa - Peer STA Address of the session
+ \param sessionId -session ID is returned here, if session is found.
+
+ \return tpPESession - pointer to the session context or NULL if session is not found.
+
+ \sa
+ --------------------------------------------------------------------------*/
+tpPESession peFindSessionByPeerSta(tpAniSirGlobal pMac, tANI_U8* sa, tANI_U8* sessionId);
+
+/*--------------------------------------------------------------------------
+ \brief peFindSessionBySessionId() - looks up the PE session given the session ID.
+
+ This function returns the session context if the session
+ corresponding to the given session ID is found in the PE session table.
+
+ \param pMac - pointer to global adapter context
+ \param sessionId -session ID for which session context needs to be looked up.
+
+ \return tpPESession - pointer to the session context or NULL if session is not found.
+
+ \sa
+ --------------------------------------------------------------------------*/
+ tpPESession peFindSessionBySessionId(tpAniSirGlobal pMac , tANI_U8 sessionId);
+
+/*--------------------------------------------------------------------------
+ \brief peFindSessionByBssid() - looks up the PE session given staid.
+
+ This function returns the session context and the session ID if the session
+ corresponding to the given StaId is found in the PE session table.
+
+ \param pMac - pointer to global adapter context
+ \param staid - StaId of the session
+ \param sessionId - session ID is returned here, if session is found.
+
+ \return tpPESession - pointer to the session context or NULL if session is not found.
+
+--------------------------------------------------------------------------*/
+ tpPESession peFindSessionByStaId(tpAniSirGlobal pMac, tANI_U8 staid, tANI_U8* sessionId);
+
+
+
+
+
+/*--------------------------------------------------------------------------
+ \brief peDeleteSession() - deletes the PE session given the session ID.
+
+
+ \param pMac - pointer to global adapter context
+ \param sessionId -session ID of the session which needs to be deleted.
+
+ \sa
+ --------------------------------------------------------------------------*/
+void peDeleteSession(tpAniSirGlobal pMac, tpPESession psessionEntry);
+
+
+/*--------------------------------------------------------------------------
+ \brief peDeleteSession() - Returns the SME session ID and Transaction ID .
+
+
+ \param pMac - pointer to global adapter context
+ \param sessionId -session ID of the session which needs to be deleted.
+
+ \sa
+ --------------------------------------------------------------------------*/
+
+
+#endif //#if !defined( __LIM_SESSION_H )
+
+
+
+
+
diff --git a/CORE/MAC/src/pe/include/limTrace.h b/CORE/MAC/src/pe/include/limTrace.h
new file mode 100644
index 0000000..f0c2a1b
--- /dev/null
+++ b/CORE/MAC/src/pe/include/limTrace.h
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**=========================================================================
+
+ \file limTrace.h
+
+ \brief definition for trace related APIs
+
+ \author Sunit Bhatia
+
+ Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
+
+ Qualcomm Confidential and Proprietary.
+
+ ========================================================================*/
+
+
+
+#ifndef __LIM_TRACE_H
+#define __LIM_TRACE_H
+
+#include "limGlobal.h"
+#include "macTrace.h"
+#ifdef LIM_TRACE_RECORD
+
+#define CASE_RETURN_STRING( str ) \
+ case ( ( str ) ): return( #str ); break \
+
+
+#define LIM_TRACE_GET_SSN(data) (((data) >> 16) & 0xff)
+#define LIM_TRACE_GET_SUBTYPE(data) (data & 0xff)
+#define LIM_TRACE_GET_DEFERRED(data) (data & 0x80000000)
+#define LIM_TRACE_GET_DEFRD_OR_DROPPED(data) (data & 0xc0000000)
+
+#define LIM_MSG_PROCESSED 0
+#define LIM_MSG_DEFERRED 1
+#define LIM_MSG_DROPPED 2
+
+#define LIM_TRACE_MAKE_RXMGMT(type, ssn) \
+ ((ssn << 16) | (type) )
+#define LIM_TRACE_MAKE_RXMSG(msg, action) \
+ ((msg) | (action << 30) )
+
+
+
+
+typedef enum {
+ TRACE_CODE_MLM_STATE,
+ TRACE_CODE_SME_STATE,
+ TRACE_CODE_TX_MGMT,
+ TRACE_CODE_RX_MGMT,
+ TRACE_CODE_RX_MGMT_TSF,
+ TRACE_CODE_TX_COMPLETE,
+ TRACE_CODE_TX_SME_MSG,
+ TRACE_CODE_RX_SME_MSG,
+ TRACE_CODE_TX_HAL_MSG,
+ TRACE_CODE_RX_HAL_MSG,
+ TRACE_CODE_TX_LIM_MSG,
+ TRACE_CODE_RX_LIM_MSG,
+ TRACE_CODE_TX_CFG_MSG,
+ TRACE_CODE_RX_CFG_MSG,
+ TRACE_CODE_RX_MGMT_DROP,
+
+ TRACE_CODE_TIMER_ACTIVATE,
+ TRACE_CODE_TIMER_DEACTIVATE,
+};
+
+
+
+
+
+
+void limTraceInit(tpAniSirGlobal pMac);
+void limTraceReset(tpAniSirGlobal pMac);
+void limTraceUpdateMgmtStat(tpAniSirGlobal pMac, tANI_U8 subtype);
+void limTraceDumpMgmtStat(tpAniSirGlobal pMac, tANI_U8 subtype);
+tANI_U8* limTraceGetMlmStateString( tANI_U32 mlmState );
+tANI_U8* limTraceGetSmeStateString( tANI_U32 smeState );
+void limTraceDump(tpAniSirGlobal pMac, tpTraceRecord pRecord, tANI_U16 recIndex);
+void macTraceMsgTx(tpAniSirGlobal pMac, tANI_U8 session, tANI_U32 data);
+void macTraceMsgRx(tpAniSirGlobal pMac, tANI_U8 session, tANI_U32 data);
+
+void macTraceMsgRxNew(tpAniSirGlobal pMac, tANI_U8 module, tANI_U8 session, tANI_U32 data);
+void macTraceMsgTxNew(tpAniSirGlobal pMac, tANI_U8 module, tANI_U8 session, tANI_U32 data);
+
+
+
+
+
+#define MTRACE(p) p
+
+#else
+#define MTRACE(p) { }
+
+#endif
+
+#endif
+
diff --git a/CORE/MAC/src/pe/include/pmmApi.h b/CORE/MAC/src/pe/include/pmmApi.h
new file mode 100644
index 0000000..8ca992c
--- /dev/null
+++ b/CORE/MAC/src/pe/include/pmmApi.h
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * Author: Sandesh Goel
+ * Date: 02/25/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#ifndef __PMM_API_H__
+#define __PMM_API_H__
+
+#include "sirCommon.h"
+#include "schApi.h"
+#include "halMsgApi.h"
+
+
+/// Initialize PMM
+extern tSirRetStatus pmmInitialize(tpAniSirGlobal pMac);
+
+/// Post a message to PMM module
+extern tSirRetStatus pmmPostMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg);
+
+/// Reset PMM beacon mode power save statistics
+extern void pmmResetStats(void *pvMac);
+
+/// Process the next PM message
+extern void pmmProcessMessage(tpAniSirGlobal, tpSirMsgQ);
+
+/// Process the PM message queue
+extern void pmmProcessMessageQueue(tpAniSirGlobal pMac);
+
+extern void pmmProcessPSPoll(tpAniSirGlobal, tANI_U8 *);
+extern void pmmUpdatePSPollState(tpAniSirGlobal);
+extern void pmmProcessRxActivity(tpAniSirGlobal, tANI_U16, tANI_U8);
+
+#ifdef WLAN_SOFTAP_FEATURE
+extern void pmmGenerateTIM(tpAniSirGlobal, tANI_U8 **, tANI_U16 *, tANI_U8);
+#else
+extern void pmmGenerateTIM(tpAniSirGlobal, tANI_U8 **, tANI_U16 *);
+#endif
+
+
+void pmmUpdateTIM(tpAniSirGlobal pMac, tpBeaconGenParams pBeaconGenParams);
+
+/// Update the PM mode
+extern void pmmUpdatePMMode(tpAniSirGlobal pMac, tANI_U16 staId, tANI_U8 pmMode);
+
+/// Update Power Mode
+extern void pmmUpdatePollablePMMode(tpAniSirGlobal, tANI_U16, tANI_U8, tANI_U16);
+extern void pmmUpdateNonPollablePMMode(tpAniSirGlobal, tANI_U16, tANI_U8, tANI_U16);
+
+/** Monitor the STA in PS*/
+void pmmHandleTimBasedDisassociation(tpAniSirGlobal pMac, tpPESession psessionEntry);
+
+//go into sleep state
+void pmmInitBmpsPwrSave(tpAniSirGlobal pMac);
+tSirRetStatus pmmSendInitPowerSaveMsg(tpAniSirGlobal pMac,tpPESession);
+void pmmInitBmpsResponseHandler(tpAniSirGlobal pMac, eHalStatus rspStatus);
+tSirRetStatus pmmSendChangePowerSaveMsg(tpAniSirGlobal pMac);
+tSirRetStatus pmmSendSleepIndicationToHal(tpAniSirGlobal pMac);
+
+//go into wakeup state
+void pmmExitBmpsRequestHandler(tpAniSirGlobal pMac, tpExitBmpsInfo pExitBmpsInfo);
+void pmmExitBmpsResponseHandler(tpAniSirGlobal pMac, tpSirMsgQ limMsg) ;
+void pmmMissedBeaconHandler(tpAniSirGlobal pMac);
+
+//handlling all UAPSD messages
+void pmmEnterUapsdRequestHandler (tpAniSirGlobal pMac);
+void pmmEnterUapsdResponseHandler(tpAniSirGlobal pMac, tpSirMsgQ limMsg);
+void pmmExitUapsdRequestHandler (tpAniSirGlobal pMac);
+void pmmExitUapsdResponseHandler(tpAniSirGlobal pMac, eHalStatus rspStatus);
+tSirRetStatus pmmUapsdSendChangePwrSaveMsg (tpAniSirGlobal pMac, tANI_U8 mode);
+
+// handling of all idle mode power save messages
+void pmmEnterImpsRequestHandler(tpAniSirGlobal pMac);
+void pmmEnterImpsResponseHandler(tpAniSirGlobal pMac, eHalStatus rspStatus);
+void pmmExitImpsRequestHandler(tpAniSirGlobal pMac);
+void pmmExitImpsResponseHandler(tpAniSirGlobal pMac, eHalStatus rspStatus);
+
+// handling WOWLAN messages
+void pmmSendWowlAddBcastPtrn(tpAniSirGlobal pMac, tpSirMsgQ pMsg);
+void pmmSendWowlDelBcastPtrn(tpAniSirGlobal pMac, tpSirMsgQ pMsg);
+void pmmEnterWowlRequestHandler(tpAniSirGlobal pMac, tpSirMsgQ pMsg);
+tSirRetStatus pmmSendWowlEnterRequest(tpAniSirGlobal pMac, tpSirHalWowlEnterParams pHalWowlParams);
+void pmmEnterWowlanResponseHandler(tpAniSirGlobal pMac, tpSirMsgQ limMsg);
+tSirRetStatus pmmSendExitWowlReq(tpAniSirGlobal pMac);
+void pmmExitWowlanRequestHandler(tpAniSirGlobal pMac);
+void pmmExitWowlanResponseHandler(tpAniSirGlobal pMac, eHalStatus rspStatus);
+
+// update idle mode statistics
+void pmmImpsUpdatePwrSaveStats(tpAniSirGlobal pMac);
+void pmmImpsUpdateWakeupStats(tpAniSirGlobal pMac);
+tSirRetStatus pmmImpsSendChangePwrSaveMsg(tpAniSirGlobal pMac, tANI_U8 mode);
+void pmmImpsUpdateSleepErrStats(tpAniSirGlobal pMac, tSirRetStatus retStatus);
+void pmmImpsUpdateWakeupErrStats(tpAniSirGlobal pMac, tSirRetStatus retStatus);
+void pmmImpsUpdateErrStateStats(tpAniSirGlobal pMac);
+void pmmImpsUpdatePktDropStats(tpAniSirGlobal pMac);
+
+void pmmUpdatePwrSaveStats(tpAniSirGlobal pMac);
+void pmmUpdateWakeupStats(tpAniSirGlobal pMac);
+void pmmBmpsUpdatePktDropStats(tpAniSirGlobal pMac);
+void pmmBmpsUpdateHalReqFailureCnt(tpAniSirGlobal pMac);
+void pmmBmpsUpdateInitFailureCnt(tpAniSirGlobal pMac);
+void pmmBmpsUpdateInvalidStateCnt(tpAniSirGlobal pMac);
+void pmmBmpsUpdatePktDropStats(tpAniSirGlobal pMac);
+void pmmBmpsUpdateReqInInvalidRoleCnt(tpAniSirGlobal pMac);
+void pmmBmpsUpdateSleepReqFailureCnt(tpAniSirGlobal pMac);
+void pmmBmpsUpdateWakeupIndCnt(tpAniSirGlobal pMac);
+void pmmBmpsUpdateWakeupReqFailureCnt(tpAniSirGlobal pMac);
+void pmmResetPmmState(tpAniSirGlobal pMac);
+void pmmSendMessageToLim(tpAniSirGlobal pMac, tANI_U32 msgId);
+
+//Power Save CFG
+tSirRetStatus pmmSendPowerSaveCfg(tpAniSirGlobal pMac, tpSirPowerSaveCfg pUpdatedPwrSaveCfg);
+
+//Handle Low RSSI Indication
+void pmmLowRssiHandler(tpAniSirGlobal pMac);
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+void pmmFilterMatchCountResponseHandler(tpAniSirGlobal pMac, tpSirMsgQ limMsg);
+#endif // WLAN_FEATURE_PACKET_FILTERING
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+void pmmGTKOffloadGetInfoResponseHandler(tpAniSirGlobal pMac, tpSirMsgQ limMsg);
+#endif // WLAN_FEATURE_GTK_OFFLOAD
+
+#endif
diff --git a/CORE/MAC/src/pe/include/pmmGlobal.h b/CORE/MAC/src/pe/include/pmmGlobal.h
new file mode 100644
index 0000000..e98a344
--- /dev/null
+++ b/CORE/MAC/src/pe/include/pmmGlobal.h
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ *
+ * Author: Sandesh Goel
+ * Date: 02/25/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#ifndef __PMM_GLOBAL_H__
+#define __PMM_GLOBAL_H__
+
+#include "sirApi.h"
+
+typedef struct sPmmStaState
+{
+ /// Whether this STA is in powersave or not
+ tANI_U8 powerSave : 1;
+ /// Whether this STA is CF-pollable or not
+ tANI_U8 cfPollable : 1;
+ /// counter to indicate PS state update due to asynchronous PS Poll
+ tANI_U8 psPollUpdate:2;
+
+ /// Reserved
+ tANI_U8 rsvd : 4;
+
+ /// Index of the next STA in PS closest to this one
+ tANI_U8 nextPS;
+} tPmmStaState, *tpPmmStaState;
+
+
+#define NO_STATE_CHANGE 0xFF
+
+typedef enum ePmmState
+{
+ ePMM_STATE_INVALID,
+ ePMM_STATE_READY,
+ //BMPS
+ ePMM_STATE_BMPS_WT_INIT_RSP,
+ ePMM_STATE_BMPS_WT_SLEEP_RSP,
+ ePMM_STATE_BMPS_SLEEP,
+ ePMM_STATE_BMPS_WT_WAKEUP_RSP,
+ ePMM_STATE_BMPS_WAKEUP,
+ //IMPS
+ ePMM_STATE_IMPS_WT_SLEEP_RSP,
+ ePMM_STATE_IMPS_SLEEP,
+ ePMM_STATE_IMPS_WT_WAKEUP_RSP,
+ ePMM_STATE_IMPS_WAKEUP,
+ //UAPSD
+ ePMM_STATE_UAPSD_WT_SLEEP_RSP,
+ ePMM_STATE_UAPSD_SLEEP,
+ ePMM_STATE_UAPSD_WT_WAKEUP_RSP,
+
+ //WOWLAN
+ ePMM_STATE_WOWLAN,
+
+ ePMM_STATE_ERROR,
+ ePMM_STATE_LAST,
+}tPmmState;
+
+typedef struct sPmmStaInfo
+{
+ tANI_U16 assocId;
+ tANI_U32 staTxAckCnt;
+}tPmmStaInfo, *tpPmmStaInfo;
+
+typedef struct sPmmTim
+{
+ tANI_U8 *pTim; /** Tim Bit Array*/
+ tANI_U8 minAssocId;
+ tANI_U8 maxAssocId;
+ tANI_U8 dtimCount;
+ /** Remaining Members are needed for LinkMonitaring of the STA in PS*/
+ tANI_U8 numStaWithData; /** Number of stations in power save, who have data pending*/
+ tpPmmStaInfo pStaInfo; /** Points to 1st Instant of the Array of MaxSTA StaInfo */
+} tPmmTim, *tpPmmTim;
+
+typedef struct sAniSirPmm
+{
+
+
+ //tANI_U32 disModeBeforeSleeping;
+ //tANI_U32 txMCastCtrl;
+ //tANI_U32 nListenBeforeSleeping;
+ //tANI_U32 txTrafficIdleThreshold;
+ //tANI_U32 rxTrafficIdleThreshold;
+ //tANI_U32 ledInfoBeforeSleeping;
+
+
+ tANI_U64 BmpsmaxSleepTime;
+ tANI_U64 BmpsavgSleepTime;
+ tANI_U64 BmpsminSleepTime;
+ tANI_U64 BmpscntSleep;
+
+ tANI_U64 BmpsmaxTimeAwake;
+ tANI_U64 BmpsavgTimeAwake;
+ tANI_U64 BmpsminTimeAwake;
+ tANI_U64 BmpscntAwake;
+
+ tANI_U64 BmpsWakeupTimeStamp;
+ tANI_U64 BmpsSleepTimeStamp;
+
+ // debug statistics
+ tANI_U64 BmpsPktDrpInSleepMode;
+ tANI_U64 BmpsInitFailCnt;
+ tANI_U64 BmpsSleeReqFailCnt;
+ tANI_U64 BmpsWakeupReqFailCnt;
+ tANI_U64 BmpsInvStateCnt;
+ tANI_U64 BmpsWakeupIndCnt;
+ tANI_U64 BmpsHalReqFailCnt;
+ tANI_U64 BmpsReqInInvalidRoleCnt;
+
+ /* Add wakeup and sleep time stamps here */
+ tANI_U64 ImpsWakeupTimeStamp;
+ tANI_U64 ImpsSleepTimeStamp;
+
+ tANI_U64 ImpsMaxTimeAwake;
+ tANI_U64 ImpsMinTimeAwake;
+ tANI_U64 ImpsAvgTimeAwake;
+ tANI_U64 ImpsCntAwake;
+
+ tANI_U64 ImpsCntSleep;
+ tANI_U64 ImpsMaxSleepTime;
+ tANI_U64 ImpsMinSleepTime;
+ tANI_U64 ImpsAvgSleepTime;
+
+ tANI_U64 ImpsSleepErrCnt;
+ tANI_U64 ImpsWakeupErrCnt;
+ tANI_U64 ImpsLastErr;
+
+ tANI_U64 ImpsInvalidStateCnt;
+ tANI_U64 ImpsPktDrpInSleepMode;
+
+
+ /// Next STA to be serviced in PS state
+ tANI_U16 gPmmNextSta;
+
+ /// Next CF-pollable STA to be serviced in PS state
+ tANI_U16 gPmmNextCFPSta;
+
+ /// Number of STAs in PS state
+ tANI_U16 gPmmNumSta;
+
+ tANI_U8 gPmmPsPollUpdate:1; // set when any sta state is update due to PS-Poll
+ tANI_U8 rsvd: 7;
+
+ /// STA Power management state array
+ /**
+ * An entry in this array records the power save state for an STA
+ * It also points to the next closest STA in power save state.
+ */
+
+ tANI_U32 gPmmBeaconInterval; //pmm keeps its won copy of beacon interval, default to 100ms
+ tSirPowerSaveCfg gPmmCfg; //pmm keeps a copy of Power Save config parameters sent to softmac.
+ /// Current PM state of the station
+ tPmmState gPmmState;
+ /// Flag to track if we are in a missed beacon scenario
+ tANI_U8 inMissedBeaconScenario;
+
+#ifdef ANI_PRODUCT_TYPE_AP
+ tPmmStaState *gpPmmStaState; // Used for HCF - PS Poll
+ tANI_U8 *gpPmmPSState; // To Store the PS States in AP
+#endif
+#ifdef WLAN_SOFTAP_FEATURE
+ tPmmTim gPmmTim;
+#endif
+
+
+ //Reason for which PMC is sending an EXIT_BMPS_REQ to PE
+ tExitBmpsReason gPmmExitBmpsReasonCode;
+ tANI_U8 sessionId; //This sessio Id is added to know the bsstype , infra/btamp .......in power save mode
+
+} tAniSirPmm, *tpAniSirPmm;
+
+#endif
diff --git a/CORE/MAC/src/pe/include/rrmApi.h b/CORE/MAC/src/pe/include/rrmApi.h
new file mode 100644
index 0000000..1855ed5
--- /dev/null
+++ b/CORE/MAC/src/pe/include/rrmApi.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * */
+/**=========================================================================
+
+ \file rrmApi.h
+
+ \brief RRM APIs
+
+ Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
+
+ Qualcomm Confidential and Proprietary.
+
+ ========================================================================*/
+
+/* $Header$ */
+
+#ifndef __RRM_API_H__
+#define __RRM_API_H__
+
+
+extern tSirRetStatus rrmInitialize(tpAniSirGlobal pMac);
+
+extern tSirRetStatus rrmCleanup(tpAniSirGlobal pMac);
+
+
+extern tSirRetStatus rrmProcessLinkMeasurementRequest( tpAniSirGlobal pMac,
+ tANI_U8 *pRxPacketInfo,
+ tDot11fLinkMeasurementRequest *pLinkReq,
+ tpPESession pSessionEntry );
+
+extern tSirRetStatus rrmProcessRadioMeasurementRequest( tpAniSirGlobal pMac,
+ tSirMacAddr peer,
+ tDot11fRadioMeasurementRequest *pRRMReq,
+ tpPESession pSessionEntry );
+
+extern tSirRetStatus rrmProcessNeighborReportResponse( tpAniSirGlobal pMac,
+ tDot11fNeighborReportResponse *pNeighborRep,
+ tpPESession pSessionEntry );
+
+extern void rrmProcessMessage(tpAniSirGlobal pMac,
+ tpSirMsgQ pMsg);
+
+extern tSirRetStatus rrmSendSetMaxTxPowerReq ( tpAniSirGlobal pMac,
+ tPowerdBm txPower,
+ tpPESession pSessionEntry );
+
+extern tPowerdBm rrmGetMgmtTxPower ( tpAniSirGlobal pMac,
+ tpPESession pSessionEntry );
+
+extern void rrmCacheMgmtTxPower ( tpAniSirGlobal pMac,
+ tPowerdBm txPower,
+ tpPESession pSessionEntry );
+
+extern tpRRMCaps rrmGetCapabilities ( tpAniSirGlobal pMac,
+ tpPESession pSessionEntry );
+
+extern void rrmUpdateConfig ( tpAniSirGlobal pMac,
+ tpPESession pSessionEntry );
+
+extern void rrmGetStartTSF ( tpAniSirGlobal pMac,
+ tANI_U32 *pStartTSF );
+
+extern void rrmUpdateStartTSF ( tpAniSirGlobal pMac,
+ tANI_U32 startTSF[2] );
+
+extern tSirRetStatus rrmSetMaxTxPowerRsp ( tpAniSirGlobal pMac,
+ tpSirMsgQ limMsgQ );
+
+extern tSirRetStatus
+rrmProcessNeighborReportReq( tpAniSirGlobal pMac,
+ tpSirNeighborReportReqInd pNeighborReq );
+extern tSirRetStatus
+rrmProcessBeaconReportXmit( tpAniSirGlobal pMac,
+ tpSirBeaconReportXmitInd pBcnReport);
+#endif
diff --git a/CORE/MAC/src/pe/include/rrmGlobal.h b/CORE/MAC/src/pe/include/rrmGlobal.h
new file mode 100644
index 0000000..5e240b2
--- /dev/null
+++ b/CORE/MAC/src/pe/include/rrmGlobal.h
@@ -0,0 +1,222 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * */
+
+#if !defined( __RRMGLOBAL_H )
+#define __RRMGLOBAL_H
+
+/**=========================================================================
+
+ \file rrmGlobal.h
+
+ \brief Definitions for SME APIs
+
+ Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
+
+ Qualcomm Confidential and Proprietary.
+
+ ========================================================================*/
+
+#define SIR_BCN_REPORT_MAX_BSS_DESC 4
+
+typedef enum eRrmRetStatus
+{
+ eRRM_SUCCESS,
+ eRRM_INCAPABLE,
+ eRRM_REFUSED,
+ eRRM_FAILURE
+} tRrmRetStatus;
+
+typedef struct sSirChannelInfo
+{
+ tANI_U8 regulatoryClass;
+ tANI_U8 channelNum;
+} tSirChannelInfo, * tpSirChannelInfo;
+
+typedef struct sSirBeaconReportReqInd
+{
+ tANI_U16 messageType; // eWNI_SME_BEACON_REPORT_REQ_IND
+ tANI_U16 length;
+ tSirMacAddr bssId;
+ tANI_U16 measurementDuration; //ms
+ tANI_U16 randomizationInterval; //ms
+ tSirChannelInfo channelInfo;
+ tSirMacAddr macaddrBssid; //0: wildcard
+ tANI_U8 fMeasurementtype; //0:Passive, 1: Active, 2: table mode
+ tAniSSID ssId; //May be wilcard.
+ tANI_U16 uDialogToken;
+ tSirChannelList channelList; //From AP channel report.
+} tSirBeaconReportReqInd, * tpSirBeaconReportReqInd;
+
+
+typedef struct sSirBeaconReportXmitInd
+{
+ tANI_U16 messageType; // eWNI_SME_BEACON_REPORT_RESP_XMIT_IND
+ tANI_U16 length;
+ tSirMacAddr bssId;
+ tANI_U16 uDialogToken;
+ tANI_U8 fMeasureDone;
+ tANI_U16 duration;
+ tANI_U8 regClass;
+ tANI_U8 numBssDesc;
+ tpSirBssDescription pBssDescription[SIR_BCN_REPORT_MAX_BSS_DESC];
+} tSirBeaconReportXmitInd, * tpSirBeaconReportXmitInd;
+
+typedef struct sSirNeighborReportReqInd
+{
+ tANI_U16 messageType; // eWNI_SME_NEIGHBOR_REPORT_REQ_IND
+ tANI_U16 length;
+ tSirMacAddr bssId; //For the session.
+ tANI_U16 noSSID; //TRUE - dont include SSID in the request.
+ //FALSE include the SSID. It may be null (wildcard)
+ tSirMacSSid ucSSID;
+} tSirNeighborReportReqInd, * tpSirNeighborReportReqInd;
+
+
+typedef struct sSirNeighborBssDescription
+{
+ tANI_U16 length;
+ tSirMacAddr bssId;
+ tANI_U8 regClass;
+ tANI_U8 channel;
+ tANI_U8 phyType;
+ union sSirNeighborBssidInfo {
+ struct _rrmInfo {
+ tANI_U32 fApPreauthReachable:2; //see IEEE 802.11k Table 7-43a
+ tANI_U32 fSameSecurityMode:1;
+ tANI_U32 fSameAuthenticator:1;
+ tANI_U32 fCapSpectrumMeasurement:1; //see IEEE 802.11k Table 7-95d
+ tANI_U32 fCapQos:1;
+ tANI_U32 fCapApsd:1;
+ tANI_U32 fCapRadioMeasurement:1;
+ tANI_U32 fCapDelayedBlockAck:1;
+ tANI_U32 fCapImmediateBlockAck:1;
+ tANI_U32 fMobilityDomain:1;
+ tANI_U32 reserved:21;
+ } rrmInfo;
+ struct _ccxInfo {
+ tANI_U32 channelBand:8;
+ tANI_U32 minRecvSigPower:8;
+ tANI_U32 apTxPower:8;
+ tANI_U32 roamHysteresis:8;
+ tANI_U32 adaptScanThres:8;
+
+ tANI_U32 transitionTime:8;
+ tANI_U32 tsfOffset:16;
+
+ tANI_U32 beaconInterval:16;
+ tANI_U32 reserved: 16;
+ } ccxInfo;
+ } bssidInfo;
+
+ //Optional sub IEs....ignoring for now.
+}tSirNeighborBssDescription, *tpSirNeighborBssDescripton;
+
+typedef struct sSirNeighborReportInd
+{
+ tANI_U16 messageType; // eWNI_SME_NEIGHBOR_REPORT_IND
+ tANI_U16 length;
+ tANI_U16 numNeighborReports;
+ tSirMacAddr bssId; //For the session.
+ //tSirResultCodes statusCode;
+ tSirNeighborBssDescription sNeighborBssDescription[1];
+} tSirNeighborReportInd, * tpSirNeighborReportInd;
+
+typedef struct sRRMBeaconReportRequestedIes
+{
+ tANI_U8 num;
+ tANI_U8 *pElementIds;
+}tRRMBeaconReportRequestedIes, *tpRRMBeaconReportRequestedIes;
+
+//Reporting detail defines.
+//Reference - IEEE Std 802.11k-2008 section 7.3.2.21.6 Table 7-29h
+#define BEACON_REPORTING_DETAIL_NO_FF_IE 0
+#define BEACON_REPORTING_DETAIL_ALL_FF_REQ_IE 1
+#define BEACON_REPORTING_DETAIL_ALL_FF_IE 2
+
+
+typedef struct sRRMReq
+{
+ tANI_U8 dialog_token; //In action frame;
+ tANI_U8 token; //Within individual request;
+ tANI_U8 type;
+ union {
+ struct {
+ tANI_U8 reportingDetail;
+ tRRMBeaconReportRequestedIes reqIes;
+ }Beacon;
+ }request;
+}tRRMReq, *tpRRMReq;
+
+typedef struct sRRMCaps
+{
+ tANI_U8 LinkMeasurement: 1;
+ tANI_U8 NeighborRpt: 1;
+ tANI_U8 parallel: 1;
+ tANI_U8 repeated: 1;
+ tANI_U8 BeaconPassive: 1;
+ tANI_U8 BeaconActive: 1;
+ tANI_U8 BeaconTable: 1;
+ tANI_U8 BeaconRepCond: 1;
+ tANI_U8 FrameMeasurement: 1;
+ tANI_U8 ChannelLoad: 1;
+ tANI_U8 NoiseHistogram: 1;
+ tANI_U8 statistics: 1;
+ tANI_U8 LCIMeasurement: 1;
+ tANI_U8 LCIAzimuth: 1;
+ tANI_U8 TCMCapability: 1;
+ tANI_U8 triggeredTCM: 1;
+ tANI_U8 APChanReport: 1;
+ tANI_U8 RRMMIBEnabled: 1;
+ tANI_U8 MeasurementPilotEnabled: 1;
+ tANI_U8 NeighborTSFOffset: 1;
+ tANI_U8 RCPIMeasurement: 1;
+ tANI_U8 RSNIMeasurement: 1;
+ tANI_U8 BssAvgAccessDelay: 1;
+ tANI_U8 BSSAvailAdmission: 1;
+ tANI_U8 AntennaInformation: 1;
+
+ tANI_U8 operatingChanMax;
+ tANI_U8 nonOperatingChanMax;
+ tANI_U8 MeasurementPilot;
+}tRRMCaps, *tpRRMCaps;
+
+typedef struct sRrmPEContext
+{
+ tANI_U8 rrmEnable;
+ //tChannelList APchannelReport;
+ tANI_U32 startTSF[2]; //Used during scan/measurement to store the start TSF. this is not used directly in beacon reports.
+ //This value is stored into bssdescription and beacon report gets it from bss decsription.
+ tRRMCaps rrmEnabledCaps;
+ tPowerdBm txMgmtPower;
+ tANI_U8 DialogToken; //Dialog token for the request initiated from station.
+ tpRRMReq pCurrentReq;
+}tRrmPEContext, *tpRrmPEContext;
+
+// 2008 11k spec reference: 18.4.8.5 RCPI Measurement
+#define RCPI_LOW_RSSI_VALUE (-110)
+#define RCPI_MAX_VALUE (220)
+#define CALCULATE_RCPI(rssi) (((rssi) + 110) * 2)
+
+
+#endif //#if defined __RRMGLOBAL_H
diff --git a/CORE/MAC/src/pe/include/schApi.h b/CORE/MAC/src/pe/include/schApi.h
new file mode 100644
index 0000000..9d76898
--- /dev/null
+++ b/CORE/MAC/src/pe/include/schApi.h
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * Author: Sandesh Goel
+ * Date: 02/25/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#ifndef __SCH_API_H__
+#define __SCH_API_H__
+
+#include "sirCommon.h"
+#include "sirMacProtDef.h"
+
+#include "aniGlobal.h"
+
+/// Send start scan response message
+extern void schSendStartScanRsp(tpAniSirGlobal pMac);
+
+/// Set init time params
+extern void schSetInitParams(tpAniSirGlobal pMac);
+
+/// Set qos default params
+extern void schUpdateQosInfo(tpAniSirGlobal pMac);
+
+// update only the broadcast qos params
+extern void schQosUpdateBroadcast(tpAniSirGlobal pMac, tpPESession psessionEntry);
+
+// fill in the default local edca parameter into gLimEdcaParams[]
+extern void schSetDefaultEdcaParams(tpAniSirGlobal pMac, tpPESession psessionE);
+
+// update only local qos params
+extern void schQosUpdateLocal(tpAniSirGlobal pMac, tpPESession psessionEntry);
+
+// update the edca profile parameters
+extern void schEdcaProfileUpdate(tpAniSirGlobal pMac, tpPESession psessionEntry);
+
+/// Check for RR timer expiry
+extern void schCheckRRTimerExpiry(tpAniSirGlobal pMac);
+
+/// Set the fixed fields in a beacon frame
+extern tSirRetStatus schSetFixedBeaconFields(tpAniSirGlobal pMac,tpPESession psessionEntry);
+
+/// Initializations
+extern void schInitialize(tpAniSirGlobal pMac);
+
+/// Initialize globals
+extern void schInitGlobals(tpAniSirGlobal pMac);
+
+/// Initialize CF Poll template
+extern void schInitializeCfPollTemplate(tpAniSirGlobal pMac);
+
+/// Initialize CF End template
+extern void schInitializeCfEndTemplate(tpAniSirGlobal pMac);
+
+/// Process the transmit activity queue
+extern void schProcessTxActivityQueue(tpAniSirGlobal pMac);
+
+/// Add to the DPH activity queue
+extern void schAddDphActivityQueue(tpAniSirGlobal pMac, tANI_U16, tANI_U8);
+
+/// Add to the TX IN (DPH) activity queue
+extern void schAddTxInActivityQueue(tpAniSirGlobal pMac, void *ptr);
+
+/// Process the scheduler message queue
+extern void schProcessMessageQueue(tpAniSirGlobal pMac);
+
+/// Process the scheduler messages
+extern void schProcessMessage(tpAniSirGlobal pMac,tpSirMsgQ pSchMsg);
+
+/// Process the DPH activity queue
+extern void schProcessDphActivityQueue(tpAniSirGlobal pMac);
+
+/// The beacon Indication handler function
+extern void schProcessPreBeaconInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg);
+
+/// Post a message to the scheduler message queue
+extern tSirRetStatus schPostMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg);
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+/// The scheduling interrupt handler
+extern void schSchedulingInterruptHandler(tpAniSirGlobal pMac);
+
+/// The scheduling end interrupt function
+extern void schSchedulingEndInterruptHandler(tpAniSirGlobal pMac);
+
+/// Function used by other Sirius modules to read CFPcount
+extern tANI_U8 schGetCFPCount(tpAniSirGlobal pMac);
+
+/// Function used by other Sirius modules to read CFPDuration remaining
+extern tANI_U16 schGetCFPDurRemaining(tpAniSirGlobal pMac);
+
+#endif
+
+extern void schBeaconProcess(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tpPESession psessionEntry);
+extern tSirRetStatus schBeaconEdcaProcess(tpAniSirGlobal pMac, tSirMacEdcaParamSetIE *edca, tpPESession psessionEntry);
+
+
+#define SCH_RR_TIMEOUT (SCH_RR_TIMEOUT_MS / SYS_TICK_DUR_MS)
+
+void schSetBeaconInterval(tpAniSirGlobal pMac,tpPESession psessionEntry);
+
+tSirRetStatus schSendBeaconReq( tpAniSirGlobal, tANI_U8 *, tANI_U16, tpPESession psessionEntry );
+
+#ifdef WLAN_SOFTAP_FEATURE
+void limUpdateProbeRspTemplateIeBitmapBeacon1(tpAniSirGlobal,tDot11fBeacon1*,tANI_U32*,tDot11fProbeResponse*);
+void limUpdateProbeRspTemplateIeBitmapBeacon2(tpAniSirGlobal,tDot11fBeacon2*,tANI_U32*,tDot11fProbeResponse*);
+void SetProbeRspIeBitmap(tANI_U32*,tANI_U32);
+tANI_U32 limSendProbeRspTemplateToHal(tpAniSirGlobal,tpPESession,
+ tANI_U32*);
+#endif
+
+
+#endif
diff --git a/CORE/MAC/src/pe/include/schGlobal.h b/CORE/MAC/src/pe/include/schGlobal.h
new file mode 100644
index 0000000..176ce65
--- /dev/null
+++ b/CORE/MAC/src/pe/include/schGlobal.h
@@ -0,0 +1,223 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ *
+ * Author: Sandesh Goel
+ * Date: 02/25/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#ifndef __SCH_GLOBAL_H__
+#define __SCH_GLOBAL_H__
+
+#include "sirMacPropExts.h"
+#include "limGlobal.h"
+
+#include "parserApi.h"
+
+
+#define ANI_SCH_ADAPTIVE_THRESHOLD_TH_CD 0x00000001
+#define ANI_SCH_ADAPTIVE_THRESHOLD_TH_D0 0x00000002
+
+#define ANI_SCH_ADAPTIVE_THRESHOLD_ALL (ANI_SCH_ADAPTIVE_THRESHOLD_TH_CD | ANI_SCH_ADAPTIVE_THRESHOLD_TH_D0)
+
+#define ANI_SCH_ADAPTIVE_ALGO_BAND_2GHZ 0x00000001
+#define ANI_SCH_ADAPTIVE_ALGO_BAND_5GHZ 0x00000002
+
+#define ANI_SCH_ADAPTIVE_ALGO_BAND_ALL (ANI_SCH_ADAPTIVE_ALGO_BAND_2GHZ | ANI_SCH_ADAPTIVE_ALGO_BAND_5GHZ)
+
+
+// Diagnostic bitmap defines
+
+#define SCH_DIAG_RR_TIMEOUT_DELETE 0x1
+#define SCH_DIAG_RR_LOWER_RATE 0x2
+
+#define TIM_IE_SIZE 0x6
+
+// ----------------------- Beacon processing ------------------------
+
+/// Beacon structure
+#define tSchBeaconStruct tSirProbeRespBeacon
+#define tpSchBeaconStruct struct sSirProbeRespBeacon *
+
+// -------------------------------------------------------------------
+
+//****************** MISC defs *********************************
+
+/// Maximum allowable size of a beacon frame
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+#define SCH_MAX_BEACON_SIZE 2048
+#else
+#define SCH_MAX_BEACON_SIZE 512
+#endif
+
+#define SCH_MAX_PROBE_RESP_SIZE 512
+
+struct schMisc {
+
+ tANI_U8 *gSchProbeRspTemplate;
+
+ /// Beginning portion of the beacon frame to be written to TFP
+ tANI_U8 *gSchBeaconFrameBegin;
+
+ /// Trailing portion of the beacon frame to be written to TFP
+ tANI_U8 *gSchBeaconFrameEnd;
+
+ /// Size of the beginning portion
+ tANI_U16 gSchBeaconOffsetBegin;
+ /// Size of the trailing portion
+ tANI_U16 gSchBeaconOffsetEnd;
+
+ tANI_U16 gSchBeaconInterval;
+
+ /// Current CFP count
+ tANI_U8 gSchCFPCount;
+
+ /// CFP Duration remaining
+ tANI_U8 gSchCFPDurRemaining;
+
+ /// CFP Maximum Duration
+ tANI_U8 gSchCFPMaxDuration;
+
+ /// Current DTIM count
+ tANI_U8 gSchDTIMCount;
+
+ /// Whether we have initiated a CFP or not
+ tANI_U8 gSchCFPInitiated;
+
+ /// Whether we have initiated a CFB or not
+ tANI_U8 gSchCFBInitiated;
+
+ /// CFP is enabled and AP is configured as HCF
+ tANI_U8 gSchCFPEnabled;
+
+ /// CFB is enabled and AP is configured as HCF
+ tANI_U8 gSchCFBEnabled;
+
+ // --------- STA ONLY state -----------
+
+ /// Indicates whether RR timer is running or not
+ tANI_U8 rrTimer[8];
+
+ /// Indicates the remaining RR timeout value if the RR timer is running
+ tANI_U16 rrTimeout[8];
+
+ /// Number of RRs transmitted
+ tANI_U16 numRR[8];
+ tANI_U16 numRRtimeouts[8];
+
+ /// flag to indicate that beacon template has been updated
+ tANI_U8 fBeaconChanged;
+
+#if defined(WLAN_SOFTAP_FEATURE) && defined(WLAN_FEATURE_P2P)
+ tANI_U16 p2pIeOffset;
+#endif
+
+};
+
+//****************** MISC defs *********************************
+
+typedef struct schStaWaitList
+{
+ tANI_U16 staId;
+ tANI_U16 count;
+} tStaWaitList, *tpStaWaitList;
+
+
+/// Global SCH structure
+typedef struct sAniSirSch
+{
+ /// The scheduler object
+ struct schMisc schObject;
+
+ // schQoSClass unsolicited;
+
+ /// Whether HCF is enabled or not
+ tANI_U8 gSchHcfEnabled;
+
+ /// Whether scan is requested by LIM or not
+ tANI_U8 gSchScanRequested;
+
+ /// Whether scan request is received by SCH or not
+ tANI_U8 gSchScanReqRcvd;
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ tANI_U8 gSchRRRecd;
+#endif
+
+ /// Debug flag to disable beacon generation
+ tANI_U32 gSchGenBeacon;
+
+#define SCH_MAX_ARR 100
+ tANI_U32 gSchBeaconsWritten;
+ tANI_U32 gSchBeaconsSent;
+ tANI_U32 gSchBBXportRcvCnt;
+ tANI_U32 gSchRRRcvCnt, qosNullCnt;
+ tANI_U32 gSchBcnRcvCnt;
+ tANI_U32 gSchUnknownRcvCnt;
+
+ tANI_U32 gSchBcnParseErrorCnt;
+ tANI_U32 gSchBcnIgnored;
+
+ // tTmpInstBuffer TIB;
+ // tANI_U16 gSchQuantum[8];
+
+ tANI_U32 numPoll, numData, numCorrupt;
+ tANI_U32 numBogusInt, numTxAct0;
+
+#define SCH_MAX_NUM_SCH 21
+ // tANI_U32 numSchHist[SCH_MAX_NUM_SCH];
+ // tANI_U32 defaultTxop;
+
+ tANI_U32 lastBeaconLength;
+ tANI_U16 rrTimeout;
+ tANI_U32 pollPeriod;
+ tANI_U32 keepAlive;
+ tANI_U32 multipleSched;
+ tANI_U32 pollFeedbackHist[8];
+ tANI_U32 dataFeedbackHist[8];
+ tANI_U32 maxPollTimeouts;
+ tANI_U32 checkCfbFlagStuck;
+
+ /// Sta Wait list
+ tpStaWaitList pStaWaitList;
+
+ /// Pointer to next available entry in sta wait list
+ tANI_U16 staWaitListIn;
+ /// Pointer to first waiting sta in sta wait list
+ tANI_U16 staWaitListOut;
+ /// Total number of waiting STAs in sta wait list
+ tANI_U16 staWaitListCount;
+ /// Total number of schedules to be waited
+ tANI_U16 staWaitListTotalWait;
+
+ /// Number of entries in DPH activity queue that were ignored
+ tANI_U32 ignoreDph;
+
+} tAniSirSch, *tpAniSirSch;
+
+
+#endif
diff --git a/CORE/MAC/src/pe/include/wmmApsd.h b/CORE/MAC/src/pe/include/wmmApsd.h
new file mode 100644
index 0000000..f133104
--- /dev/null
+++ b/CORE/MAC/src/pe/include/wmmApsd.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+#ifndef __WMMAPSD_H__
+#define __WMMAPSD_H__
+
+#include "aniGlobal.h"
+
+// WMM Info Element OUI subtypes
+#define WMM_APSD_INFO_ELEMENT 0
+#define WMM_APSD_PARAM_ELEMENT 1
+
+// Length of IEs (Including the EID byte).
+#define WMM_INFO_ELEMENT_LENGTH_TOTAL 8
+#define WMM_PARAM_ELEMENT_LENGTH_TOTAL 25
+
+// IE lenght.
+#define WMM_INFO_ELEMENT_LENGTH 7
+#define WMM_PARAM_ELEMENT_LENGTH 24
+
+
+// UAPSD Flag for each AC (WMM spec 2.2.1)
+#define LIM_UAPSD_BITOFFSET_ACVO 0
+#define LIM_UAPSD_BITOFFSET_ACVI 1
+#define LIM_UAPSD_BITOFFSET_ACBK 2
+#define LIM_UAPSD_BITOFFSET_ACBE 3
+
+#define LIM_UAPSD_FLAG_ACVO (1 << LIM_UAPSD_BITOFFSET_ACVO)
+#define LIM_UAPSD_FLAG_ACVI (1 << LIM_UAPSD_BITOFFSET_ACVI)
+#define LIM_UAPSD_FLAG_ACBK (1 << LIM_UAPSD_BITOFFSET_ACBK)
+#define LIM_UAPSD_FLAG_ACBE (1 << LIM_UAPSD_BITOFFSET_ACBE)
+
+#define LIM_UAPSD_GET(ac, mask) (((mask) & (LIM_UAPSD_FLAG_ ## ac)) >> LIM_UAPSD_BITOFFSET_ ## ac)
+
+// Definitions for AC mode.
+#define AC_DELIVERY_ENABLED 0x1
+#define AC_TRIGGER_ENABLED 0x2
+#define ALL_AC_UAPSD_SET 0x0F
+
+// Definition for setting/clearing Uapsd Mask
+#define SET_UAPSD_MASK 1
+#define CLEAR_UAPSD_MASK 0
+
+#define ac2tcId(ac) (ac << 1)
+
+// Function prototypes.
+extern void apsdSendQosNull(tpAniSirGlobal pMac, tANI_U16 staId, tANI_U8 tcId, tANI_U8 *staAddr);
+
+
+#endif /* __WMMAPSD_H__ */
diff --git a/CORE/MAC/src/pe/lim/limAIDmgmt.c b/CORE/MAC/src/pe/lim/limAIDmgmt.c
new file mode 100644
index 0000000..7e78eb6
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limAIDmgmt.c
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limAIDmgmt.cc contains the functions related to
+ * AID pool management like initialization, assignment etc.
+ * Author: Chandra Modumudi
+ * Date: 03/20/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+
+#include "palTypes.h"
+#include "wniCfgSta.h"
+#include "aniGlobal.h"
+#include "cfgApi.h"
+#include "sirParams.h"
+#include "limUtils.h"
+#include "limTimerUtils.h"
+#include "limSession.h"
+
+#define LIM_START_AID 1
+
+
+/**
+ * limInitAIDpool()
+ *
+ *FUNCTION:
+ * This function is called while starting a BSS at AP
+ * to initialize AID pool. This may also be called while
+ * starting/joining an IBSS if 'Association' is allowed
+ * in IBSS.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limInitAIDpool(tpAniSirGlobal pMac,tpPESession sessionEntry)
+{
+ tANI_U8 i;
+ tANI_U8 maxAssocSta = pMac->lim.gLimAssocStaLimit;
+
+ pMac->lim.gpLimAIDpool[0]=0;
+ pMac->lim.freeAidHead=LIM_START_AID;
+
+ for (i=pMac->lim.freeAidHead;i<maxAssocSta; i++)
+ {
+ pMac->lim.gpLimAIDpool[i] = i+1;
+ }
+ pMac->lim.gpLimAIDpool[i] = 0;
+
+ pMac->lim.freeAidTail=i;
+
+}
+
+
+/**
+ * limAssignAID()
+ *
+ *FUNCTION:
+ * This function is called during Association/Reassociation
+ * frame handling to assign association ID (aid) to a STA.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return aid - assigned Association ID for STA
+ */
+
+tANI_U16
+limAssignAID(tpAniSirGlobal pMac)
+{
+ tANI_U16 aid;
+
+ // make sure we haven't exceeded the configurable limit on associations
+ if (pMac->lim.gLimNumOfCurrentSTAs >= pMac->lim.gLimAssocStaLimit)
+ {
+ // too many associations already active
+ return 0;
+ }
+
+ /* return head of free list */
+
+ if (pMac->lim.freeAidHead)
+ {
+ aid=pMac->lim.freeAidHead;
+ pMac->lim.freeAidHead=pMac->lim.gpLimAIDpool[pMac->lim.freeAidHead];
+ if (pMac->lim.freeAidHead==0)
+ pMac->lim.freeAidTail=0;
+ pMac->lim.gLimNumOfCurrentSTAs++;
+ //PELOG2(limLog(pMac, LOG2,FL("Assign aid %d, numSta %d, head %d tail %d \n"),aid,pMac->lim.gLimNumOfCurrentSTAs,pMac->lim.freeAidHead,pMac->lim.freeAidTail);)
+ return aid;
+ }
+
+ return 0; /* no more free aids */
+}
+
+
+/**
+ * limReleaseAID()
+ *
+ *FUNCTION:
+ * This function is called when a STA context is removed
+ * at AP (or at a STA in IBSS mode) to return association ID (aid)
+ * to free pool.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param aid - Association ID that need to return to free pool
+ *
+ * @return None
+ */
+
+void
+limReleaseAID(tpAniSirGlobal pMac, tANI_U16 aid)
+{
+ pMac->lim.gLimNumOfCurrentSTAs--;
+
+ /* insert at tail of free list */
+ if (pMac->lim.freeAidTail)
+ {
+ pMac->lim.gpLimAIDpool[pMac->lim.freeAidTail]=(tANI_U8)aid;
+ pMac->lim.freeAidTail=(tANI_U8)aid;
+ }
+ else
+ {
+ pMac->lim.freeAidTail=pMac->lim.freeAidHead=(tANI_U8)aid;
+ }
+ pMac->lim.gpLimAIDpool[(tANI_U8)aid]=0;
+ //PELOG2(limLog(pMac, LOG2,FL("Release aid %d, numSta %d, head %d tail %d \n"),aid,pMac->lim.gLimNumOfCurrentSTAs,pMac->lim.freeAidHead,pMac->lim.freeAidTail);)
+
+}
diff --git a/CORE/MAC/src/pe/lim/limAdmitControl.c b/CORE/MAC/src/pe/lim/limAdmitControl.c
new file mode 100644
index 0000000..d14e56a
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limAdmitControl.c
@@ -0,0 +1,1254 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file contains TSPEC and STA admit control related functions
+ * NOTE: applies only to AP builds
+ *
+ * Author: Sandesh Goel
+ * Date: 02/25/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+#include "limDebug.h"
+#include "sysDef.h"
+#include "limApi.h"
+#include "cfgApi.h" // wlan_cfgGetInt()
+#include "limTrace.h"
+#include "limSendSmeRspMessages.h"
+#include "limTypes.h"
+
+
+#define ADMIT_CONTROL_LOGLEVEL LOG1
+#define ADMIT_CONTROL_POLICY_LOGLEVEL LOG1
+#define ADMIT_CONTROL_MIN_INTERVAL 1000 // min acceptable service interval 1mSec
+
+/* total available bandwidth in bps in each phy mode
+ * these should be defined in hal or dph - replace these later
+ */
+#define LIM_TOTAL_BW_11A 54000000
+#define LIM_MIN_BW_11A 6000000
+#define LIM_TOTAL_BW_11B 11000000
+#define LIM_MIN_BW_11B 1000000
+#define LIM_TOTAL_BW_11G LIM_TOTAL_BW_11A
+#define LIM_MIN_BW_11G LIM_MIN_BW_11B
+
+// conversion factors
+#define LIM_CONVERT_SIZE_BITS(numBytes) ((numBytes) * 8)
+#define LIM_CONVERT_RATE_MBPS(rate) ((rate)/1000000)
+
+/* ANI sta's support enhanced rates, so the effective medium time used is
+ * half that of other stations. This is the same as if they were requesting
+ * half the badnwidth - so we adjust ANI sta's accordingly for bandwidth
+ * calculations. Also enhanced rates apply only in case of non 11B mode.
+ */
+#define LIM_STA_BW_ADJUST(aniPeer, phyMode, bw) \
+ (((aniPeer) && ((phyMode) != WNI_CFG_PHY_MODE_11B)) \
+ ? ((bw)/2) : (bw))
+
+
+//------------------------------------------------------------------------------
+// local protos
+
+static tSirRetStatus
+limCalculateSvcInt(tpAniSirGlobal, tSirMacTspecIE *, tANI_U32 *);
+#if 0 //only EDCA is supported now
+static tSirRetStatus
+limValidateTspecHcca(tpAniSirGlobal, tSirMacTspecIE *);
+#endif
+static tSirRetStatus
+limValidateTspecEdca(tpAniSirGlobal, tSirMacTspecIE *, tpPESession);
+static tSirRetStatus
+limValidateTspec(tpAniSirGlobal, tSirMacTspecIE *, tpPESession);
+static void
+limComputeMeanBwUsed(tpAniSirGlobal, tANI_U32 *, tANI_U32, tpLimTspecInfo, tpPESession);
+static void
+limGetAvailableBw(tpAniSirGlobal, tANI_U32 *, tANI_U32 *, tANI_U32, tANI_U32);
+static tSirRetStatus
+limAdmitPolicyOversubscription(tpAniSirGlobal, tSirMacTspecIE *, tpLimAdmitPolicyInfo, tpLimTspecInfo, tpPESession);
+static tSirRetStatus
+limTspecFindByStaAddr(tpAniSirGlobal, tANI_U8 *, tSirMacTspecIE*, tpLimTspecInfo, tpLimTspecInfo *);
+static tSirRetStatus
+limValidateAccessPolicy(tpAniSirGlobal, tANI_U8, tANI_U16, tpPESession);
+
+
+/** -------------------------------------------------------------
+\fn limCalculateSvcInt
+\brief TSPEC validation and servcie interval determination
+\param tpAniSirGlobal pMac
+\param tSirMacTspecIE *pTspec
+\param tANI_U32 *pSvcInt
+\return eSirRetStatus - status of the comparison
+ -------------------------------------------------------------*/
+
+static tSirRetStatus
+limCalculateSvcInt(
+ tpAniSirGlobal pMac,
+ tSirMacTspecIE *pTspec,
+ tANI_U32 *pSvcInt)
+{
+ tANI_U32 msduSz, dataRate;
+ *pSvcInt = 0;
+
+ // if a service interval is already specified, we are done
+ if ((pTspec->minSvcInterval != 0) || (pTspec->maxSvcInterval != 0))
+ {
+ *pSvcInt = (pTspec->maxSvcInterval != 0)
+ ? pTspec->maxSvcInterval : pTspec->minSvcInterval;
+ return eSIR_SUCCESS;
+ }
+
+ /* Masking off the fixed bits according to definition of MSDU size
+ * in IEEE 802.11-2007 spec (section 7.3.2.30). Nominal MSDU size
+ * is defined as: Bit[0:14]=Size, Bit[15]=Fixed
+ */
+ if (pTspec->nomMsduSz != 0)
+ msduSz = (pTspec->nomMsduSz & 0x7fff);
+ else if (pTspec->maxMsduSz != 0)
+ msduSz = pTspec->maxMsduSz;
+ else
+ {
+ PELOGE(limLog(pMac, LOGE, FL("MsduSize not specified\n"));)
+ return eSIR_FAILURE;
+ }
+
+ /* need to calculate a reasonable service interval
+ * this is simply the msduSz/meanDataRate
+ */
+ if (pTspec->meanDataRate != 0) dataRate = pTspec->meanDataRate;
+ else if (pTspec->peakDataRate != 0) dataRate = pTspec->peakDataRate;
+ else if (pTspec->minDataRate != 0) dataRate = pTspec->minDataRate;
+ else
+ {
+ PELOGE(limLog(pMac, LOGE, FL("DataRate not specified\n"));)
+ return eSIR_FAILURE;
+ }
+
+ *pSvcInt = LIM_CONVERT_SIZE_BITS(msduSz) / LIM_CONVERT_RATE_MBPS(dataRate);
+ return eSIR_FAILURE;
+}
+
+#if 0 //only EDCA is supported now
+/** -------------------------------------------------------------
+\fn limValidateTspecHcca
+\brief validate the parameters in the hcca tspec
+ mandatory fields are derived from 11e Annex I (Table I.1)
+\param tpAniSirGlobal pMac
+\param tSirMacTspecIE *pTspec
+\return eSirRetStatus - status
+ -------------------------------------------------------------*/
+static tSirRetStatus
+limValidateTspecHcca(
+ tpAniSirGlobal pMac,
+ tSirMacTspecIE *pTspec)
+{
+ tANI_U32 maxPhyRate, minPhyRate;
+ tANI_U32 phyMode;
+
+ tSirRetStatus retval = eSIR_SUCCESS;
+ /* make sure a TSID is being requested */
+ if (pTspec->tsinfo.traffic.tsid < SIR_MAC_HCCA_TSID_MIN)
+ {
+ limLog(pMac, LOGW, FL("tsid %d must be >%d)\n"),
+ pTspec->tsinfo.traffic.tsid, SIR_MAC_HCCA_TSID_MIN);
+ retval = eSIR_FAILURE;
+ }
+ /*
+ * With Polaris, there is a limitation in that the tsid cannot be arbitary
+ * but is based on the qid. Thus, we cannot have a tspec which requests
+ * a tsid of 13 and userPrio of 7, the bottom three bits of the tsid must
+ * correspond to the userPrio
+ */
+ if (pTspec->tsinfo.traffic.userPrio !=
+ (pTspec->tsinfo.traffic.tsid - SIR_MAC_HCCA_TSID_MIN))
+ {
+ limLog(pMac, LOGE, FL("TSid=0x%x, userPrio=%d: is not allowed\n"),
+ pTspec->tsinfo.traffic.tsid, pTspec->tsinfo.traffic.userPrio);
+ retval = eSIR_FAILURE;
+ }
+ // an inactivity interval is mandatory
+ if (pTspec->inactInterval == 0)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("inactInterval unspecified!\n"));)
+ retval = eSIR_FAILURE;
+ }
+ // surplus BW must be specified if a delay Bound is specified
+ if ((pTspec->delayBound != 0) && (pTspec->surplusBw == 0))
+ {
+ limLog(pMac, LOGW, FL("delayBound %d, but surplusBw unspecified!\n"),
+ pTspec->delayBound);
+ retval = eSIR_FAILURE;
+ }
+ // minPhyRate must always be specified and cannot exceed maximum supported
+ limGetPhyMode(pMac, &phyMode);
+ //limGetAvailableBw(pMac, &maxPhyRate, &minPhyRate, pMac->dph.gDphPhyMode,
+ // 1 /* bandwidth mult factor */);
+ limGetAvailableBw(pMac, &maxPhyRate, &minPhyRate, phyMode,
+ 1 /* bandwidth mult factor */);
+ if ((pTspec->minPhyRate == 0)
+ || (pTspec->minPhyRate > maxPhyRate)
+ || (pTspec->minPhyRate < minPhyRate))
+ {
+ limLog(pMac, LOGW, FL("minPhyRate (%d) invalid\n"),
+ pTspec->minPhyRate);
+ retval = eSIR_FAILURE;
+ }
+ /* NOTE: we will require all Tspec's to specify a mean data rate (and so
+ * also the min and peak data rates)
+ */
+ if ((pTspec->minDataRate == 0) ||
+ (pTspec->meanDataRate == 0) ||
+ (pTspec->peakDataRate == 0))
+ {
+ limLog(pMac, LOGW, FL("DataRate must be specified (min %d, mean %d, peak %d)\n"),
+ pTspec->minDataRate, pTspec->meanDataRate, pTspec->peakDataRate);
+ retval = eSIR_FAILURE;
+ }
+
+ // mean data rate can't be more than the min phy rate
+ if (pTspec->meanDataRate > pTspec->minPhyRate)
+ {
+ limLog(pMac, LOGW, FL("Data rate (%d) is more than Phyrate %d\n"),
+ pTspec->meanDataRate, pTspec->minPhyRate);
+ return eSIR_FAILURE;
+ }
+
+ /* if the tspec specifies a service interval, we won't accept tspec's
+ * with service interval less than our allowed minimum, also either both
+ * min and max must be specified or neither should be specified (in which
+ * case, HC determines the appropriate service interval
+ */
+ if ((pTspec->minSvcInterval != 0) || (pTspec->maxSvcInterval != 0))
+ {
+ // max < min is ridiculous
+ if (pTspec->maxSvcInterval < pTspec->minSvcInterval)
+ {
+ limLog(pMac, LOGW, FL("maxSvcInt %d > minSvcInterval %d!!\n"),
+ pTspec->maxSvcInterval, pTspec->minSvcInterval);
+ retval = eSIR_FAILURE;
+ }
+ if (pTspec->maxSvcInterval < ADMIT_CONTROL_MIN_INTERVAL)
+ {
+ limLog(pMac, LOGW, FL("maxSvcInt %d must be >%d\n"),
+ pTspec->maxSvcInterval, ADMIT_CONTROL_MIN_INTERVAL);
+ retval = eSIR_FAILURE;
+ }
+ }
+ else // min and max both unspecified
+ {
+ /* no service interval is specified, so make sure the parameters
+ * needed to determine one are specified in the tspec
+ * minPhyRate, meanDataRate and nomMsduSz are needed, only nomMsduSz
+ * must be checked here since the other two are already validated
+ */
+ if (pTspec->nomMsduSz == 0)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("No svcInt and no MsduSize specified\n"));)
+ retval = eSIR_FAILURE;
+ }
+ }
+
+ limLog(pMac, ADMIT_CONTROL_LOGLEVEL, FL("return status %d\n"), retval);
+ return retval;
+}
+
+#endif //only edca is supported now.
+
+/** -------------------------------------------------------------
+\fn limValidateTspecEdca
+\brief validate the parameters in the edca tspec
+ mandatory fields are derived from 11e Annex I (Table I.1)
+\param tpAniSirGlobal pMac
+\param tSirMacTspecIE *pTspec
+\return eSirRetStatus - status
+ -------------------------------------------------------------*/
+static tSirRetStatus
+limValidateTspecEdca(
+ tpAniSirGlobal pMac,
+ tSirMacTspecIE *pTspec,
+ tpPESession psessionEntry)
+{
+ tANI_U32 maxPhyRate, minPhyRate;
+ tANI_U32 phyMode;
+ tSirRetStatus retval = eSIR_SUCCESS;
+
+ limGetPhyMode(pMac, &phyMode, psessionEntry);
+
+ //limGetAvailableBw(pMac, &maxPhyRate, &minPhyRate, pMac->dph.gDphPhyMode,
+ // 1 /* bandwidth mult factor */);
+ limGetAvailableBw(pMac, &maxPhyRate, &minPhyRate, phyMode,
+ 1 /* bandwidth mult factor */);
+ // mandatory fields are derived from 11e Annex I (Table I.1)
+ if ((pTspec->nomMsduSz == 0) ||
+ (pTspec->meanDataRate == 0) ||
+ (pTspec->surplusBw == 0) ||
+ (pTspec->minPhyRate == 0) ||
+ (pTspec->minPhyRate > maxPhyRate))
+ {
+ limLog(pMac, LOGW, FL("Invalid EDCA Tspec: NomMsdu %d, meanDataRate %d, surplusBw %d, minPhyRate %d\n"),
+ pTspec->nomMsduSz, pTspec->meanDataRate, pTspec->surplusBw, pTspec->minPhyRate);
+ retval = eSIR_FAILURE;
+ }
+
+ limLog(pMac, ADMIT_CONTROL_LOGLEVEL, FL("return status %d\n"), retval);
+ return retval;
+}
+
+/** -------------------------------------------------------------
+\fn limValidateTspec
+\brief validate the offered tspec
+\param tpAniSirGlobal pMac
+\param tSirMacTspecIE *pTspec
+\return eSirRetStatus - status
+ -------------------------------------------------------------*/
+
+static tSirRetStatus
+limValidateTspec(
+ tpAniSirGlobal pMac,
+ tSirMacTspecIE *pTspec,
+ tpPESession psessionEntry)
+{
+ tSirRetStatus retval = eSIR_SUCCESS;
+ switch (pTspec->tsinfo.traffic.accessPolicy)
+ {
+ case SIR_MAC_ACCESSPOLICY_EDCA:
+ if ((retval = limValidateTspecEdca(pMac, pTspec, psessionEntry)) != eSIR_SUCCESS)
+ PELOGW(limLog(pMac, LOGW, FL("EDCA tspec invalid\n"));)
+ break;
+
+ case SIR_MAC_ACCESSPOLICY_HCCA:
+#if 0 //Not supported right now.
+ if ((retval = limValidateTspecHcca(pMac, pTspec)) != eSIR_SUCCESS)
+ PELOGW(limLog(pMac, LOGW, FL("HCCA tspec invalid\n"));)
+ break;
+#endif
+ case SIR_MAC_ACCESSPOLICY_BOTH:
+ // TBD: should we support hybrid tspec as well?? for now, just fall through
+ default:
+ limLog(pMac, LOGW, FL("AccessType %d not supported\n"),
+ pTspec->tsinfo.traffic.accessPolicy);
+ retval = eSIR_FAILURE;
+ break;
+ }
+ return retval;
+}
+
+//-----------------------------------------------------------------------------
+// Admit Control Policy
+
+
+/** -------------------------------------------------------------
+\fn limComputeMeanBwUsed
+\brief determime the used/allocated bandwidth
+\param tpAniSirGlobal pMac
+\param tANI_U32 *pBw
+\param tANI_U32 phyMode
+\param tpLimTspecInfo pTspecInfo
+\return eSirRetStatus - status
+ -------------------------------------------------------------*/
+
+static void
+limComputeMeanBwUsed(
+ tpAniSirGlobal pMac,
+ tANI_U32 *pBw,
+ tANI_U32 phyMode,
+ tpLimTspecInfo pTspecInfo,
+ tpPESession psessionEntry)
+{
+ tANI_U32 ctspec;
+ *pBw = 0;
+ for (ctspec = 0; ctspec < LIM_NUM_TSPEC_MAX; ctspec++, pTspecInfo++)
+ {
+ if (pTspecInfo->inuse)
+ {
+ tpDphHashNode pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
+ if (pSta == NULL)
+ {
+ // maybe we should delete the tspec??
+ limLog(pMac, LOGE, FL("Tspec %d (assocId %d): dphNode not found\n"),
+ ctspec, pTspecInfo->assocId);
+ continue;
+ }
+ //FIXME: need to take care of taurusPeer, titanPeer, 11npeer too.
+ *pBw += LIM_STA_BW_ADJUST(pSta->aniPeer, phyMode, pTspecInfo->tspec.meanDataRate);
+ }
+ }
+}
+
+/** -------------------------------------------------------------
+\fn limGetAvailableBw
+\brief based on the phy mode and the bw_factor, determine the total bandwidth that
+ can be supported
+\param tpAniSirGlobal pMac
+\param tANI_U32 *pMaxBw
+\param tANI_U32 *pMinBw
+\param tANI_U32 phyMode
+\param tANI_U32 bw_factor
+\return eSirRetStatus - status
+ -------------------------------------------------------------*/
+
+static void
+limGetAvailableBw(
+ tpAniSirGlobal pMac,
+ tANI_U32 *pMaxBw,
+ tANI_U32 *pMinBw,
+ tANI_U32 phyMode,
+ tANI_U32 bw_factor)
+{
+ switch (phyMode)
+ {
+ case WNI_CFG_PHY_MODE_11B:
+ *pMaxBw = LIM_TOTAL_BW_11B;
+ *pMinBw = LIM_MIN_BW_11B;
+ break;
+
+ case WNI_CFG_PHY_MODE_11A:
+ *pMaxBw = LIM_TOTAL_BW_11A;
+ *pMinBw = LIM_MIN_BW_11A;
+ break;
+
+ case WNI_CFG_PHY_MODE_11G:
+ case WNI_CFG_PHY_MODE_NONE:
+ default:
+ *pMaxBw = LIM_TOTAL_BW_11G;
+ *pMinBw = LIM_MIN_BW_11G;
+ break;
+ }
+ *pMaxBw *= bw_factor;
+}
+
+/** -------------------------------------------------------------
+\fn limAdmitPolicyOversubscription
+\brief simple admission control policy based on oversubscription
+ if the total bandwidth of all admitted tspec's exceeds (factor * phy-bw) then
+ reject the tspec, else admit it. The phy-bw is the peak available bw in the
+ current phy mode. The 'factor' is the configured oversubscription factor.
+\param tpAniSirGlobal pMac
+\param tSirMacTspecIE *pTspec
+\param tpLimAdmitPolicyInfo pAdmitPolicy
+\param tpLimTspecInfo pTspecInfo
+\return eSirRetStatus - status
+ -------------------------------------------------------------*/
+
+/*
+ * simple admission control policy based on oversubscription
+ * if the total bandwidth of all admitted tspec's exceeds (factor * phy-bw) then
+ * reject the tspec, else admit it. The phy-bw is the peak available bw in the
+ * current phy mode. The 'factor' is the configured oversubscription factor.
+ */
+static tSirRetStatus
+limAdmitPolicyOversubscription(
+ tpAniSirGlobal pMac,
+ tSirMacTspecIE *pTspec,
+ tpLimAdmitPolicyInfo pAdmitPolicy,
+ tpLimTspecInfo pTspecInfo,
+ tpPESession psessionEntry)
+{
+ tANI_U32 totalbw, minbw, usedbw;
+ tANI_U32 phyMode;
+
+ // determine total bandwidth used so far
+ limGetPhyMode(pMac, &phyMode, psessionEntry);
+
+ //limComputeMeanBwUsed(pMac, &usedbw, pMac->dph.gDphPhyMode, pTspecInfo);
+ limComputeMeanBwUsed(pMac, &usedbw, phyMode, pTspecInfo, psessionEntry);
+
+ // determine how much bandwidth is available based on the current phy mode
+ //limGetAvailableBw(pMac, &totalbw, &minbw, pMac->dph.gDphPhyMode, pAdmitPolicy->bw_factor);
+ limGetAvailableBw(pMac, &totalbw, &minbw, phyMode, pAdmitPolicy->bw_factor);
+
+ if (usedbw > totalbw) // this can't possibly happen
+ return eSIR_FAILURE;
+
+ if ((totalbw - usedbw) < pTspec->meanDataRate)
+ {
+ limLog(pMac, ADMIT_CONTROL_POLICY_LOGLEVEL,
+ FL("Total BW %d, Used %d, Tspec request %d not possible\n"),
+ totalbw, usedbw, pTspec->meanDataRate);
+ return eSIR_FAILURE;
+ }
+ return eSIR_SUCCESS;
+}
+
+/** -------------------------------------------------------------
+\fn limAdmitPolicy
+\brief determine the current admit control policy and apply it for the offered tspec
+\param tpAniSirGlobal pMac
+\param tSirMacTspecIE *pTspec
+\return eSirRetStatus - status
+ -------------------------------------------------------------*/
+
+tSirRetStatus limAdmitPolicy(
+ tpAniSirGlobal pMac,
+ tSirMacTspecIE *pTspec,
+ tpPESession psessionEntry)
+{
+ tSirRetStatus retval = eSIR_FAILURE;
+ tpLimAdmitPolicyInfo pAdmitPolicy = &pMac->lim.admitPolicyInfo;
+
+ switch (pAdmitPolicy->type)
+ {
+ case WNI_CFG_ADMIT_POLICY_ADMIT_ALL:
+ retval = eSIR_SUCCESS;
+ break;
+
+ case WNI_CFG_ADMIT_POLICY_BW_FACTOR:
+ retval = limAdmitPolicyOversubscription(pMac, pTspec,
+ &pMac->lim.admitPolicyInfo, &pMac->lim.tspecInfo[0], psessionEntry);
+ if (retval != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("rejected by BWFactor policy\n"));)
+ break;
+
+ case WNI_CFG_ADMIT_POLICY_REJECT_ALL:
+ retval = eSIR_FAILURE;
+ break;
+
+ default:
+ retval = eSIR_SUCCESS;
+ limLog(pMac, LOGE, FL("Admit Policy %d unknown, admitting all traffic\n"),
+ pAdmitPolicy->type);
+ break;
+ }
+ return retval;
+}
+
+/** -------------------------------------------------------------
+\fn limTspecDelete
+\brief delete the specified tspec
+\param tpAniSirGlobal pMac
+\param tpLimTspecInfo pInfo
+\return eSirRetStatus - status
+ -------------------------------------------------------------*/
+
+//-----------------------------------------------------------------------------
+// delete the specified tspec
+void limTspecDelete(tpAniSirGlobal pMac, tpLimTspecInfo pInfo)
+{
+ if (pInfo == NULL)
+ return;
+ //pierre
+ limLog(pMac, ADMIT_CONTROL_LOGLEVEL, FL("tspec entry = %d\n"), pInfo->idx);
+ limLog(pMac, ADMIT_CONTROL_LOGLEVEL, FL("delete tspec %08X\n"),pInfo);
+ pInfo->inuse = 0;
+
+ // clear the hcca/parameterized queue indicator
+#if 0
+ if ((pInfo->tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK) ||
+ (pInfo->tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR))
+ queue[pInfo->staid][pInfo->tspec.tsinfo.traffic.userPrio][SCH_UL_QUEUE].ts = 0;
+#endif
+
+ return;
+}
+
+/** -------------------------------------------------------------
+\fn limTspecFindByStaAddr
+\brief Send halMsg_AddTs to HAL
+\param tpAniSirGlobal pMac
+\param \param tANI_U8 *pAddr
+\param tSirMacTspecIE *pTspecIE
+\param tpLimTspecInfo pTspecList
+\param tpLimTspecInfo *ppInfo
+\return eSirRetStatus - status
+ -------------------------------------------------------------*/
+
+// find the specified tspec in the list
+static tSirRetStatus
+limTspecFindByStaAddr(
+ tpAniSirGlobal pMac,
+ tANI_U8 *pAddr,
+ tSirMacTspecIE *pTspecIE,
+ tpLimTspecInfo pTspecList,
+ tpLimTspecInfo *ppInfo)
+{
+ int ctspec;
+
+ *ppInfo = NULL;
+
+ for (ctspec = 0; ctspec < LIM_NUM_TSPEC_MAX; ctspec++, pTspecList++)
+ {
+ if ((pTspecList->inuse)
+ && (palEqualMemory( pMac->hHdd,pAddr, pTspecList->staAddr, sizeof(pTspecList->staAddr)))
+ && (palEqualMemory( pMac->hHdd,(tANI_U8 *) pTspecIE, (tANI_U8 *) &pTspecList->tspec, sizeof(tSirMacTspecIE))))
+ {
+ *ppInfo = pTspecList;
+ return eSIR_SUCCESS;
+ }
+ }
+ return eSIR_FAILURE;
+}
+
+/** -------------------------------------------------------------
+\fn limTspecFindByAssocId
+\brief find tspec with matchin staid and Tspec
+\param tpAniSirGlobal pMac
+\param tANI_U32 staid
+\param tSirMacTspecIE *pTspecIE
+\param tpLimTspecInfo pTspecList
+\param tpLimTspecInfo *ppInfo
+\return eSirRetStatus - status
+ -------------------------------------------------------------*/
+
+tSirRetStatus
+limTspecFindByAssocId(
+ tpAniSirGlobal pMac,
+ tANI_U16 assocId,
+ tSirMacTspecIE *pTspecIE,
+ tpLimTspecInfo pTspecList,
+ tpLimTspecInfo *ppInfo)
+{
+ int ctspec;
+
+ *ppInfo = NULL;
+
+ limLog(pMac, ADMIT_CONTROL_LOGLEVEL, FL("Trying to find tspec entry for assocId = %d\n"), assocId);
+ limLog(pMac, ADMIT_CONTROL_LOGLEVEL, FL("pTsInfo->traffic.direction = %d, pTsInfo->traffic.tsid = %d\n"),
+ pTspecIE->tsinfo.traffic.direction, pTspecIE->tsinfo.traffic.tsid);
+
+ for (ctspec = 0; ctspec < LIM_NUM_TSPEC_MAX; ctspec++, pTspecList++)
+ {
+ if ((pTspecList->inuse)
+ && (assocId == pTspecList->assocId)
+ && (palEqualMemory( pMac->hHdd,(tANI_U8 *) pTspecIE, (tANI_U8 *) &pTspecList->tspec, sizeof(tSirMacTspecIE))))
+ {
+ *ppInfo = pTspecList;
+ return eSIR_SUCCESS;
+ }
+ }
+ return eSIR_FAILURE;
+}
+
+/** -------------------------------------------------------------
+\fn limFindTspec
+\brief finding a TSPEC entry with assocId, tsinfo.direction and tsinfo.tsid
+\param tANI_U16 assocId
+\param tpAniSirGlobal pMac
+\param tSirMacTSInfo *pTsInfo
+\param tpLimTspecInfo pTspecList
+\param tpLimTspecInfo *ppInfo
+\return eSirRetStatus - status of the comparison
+ -------------------------------------------------------------*/
+
+tSirRetStatus
+limFindTspec(
+ tpAniSirGlobal pMac,
+ tANI_U16 assocId,
+ tSirMacTSInfo *pTsInfo,
+ tpLimTspecInfo pTspecList,
+ tpLimTspecInfo *ppInfo)
+{
+ int ctspec;
+
+ *ppInfo = NULL;
+
+ limLog(pMac, ADMIT_CONTROL_LOGLEVEL, FL("Trying to find tspec entry for assocId = %d\n"), assocId);
+ limLog(pMac, ADMIT_CONTROL_LOGLEVEL, FL("pTsInfo->traffic.direction = %d, pTsInfo->traffic.tsid = %d\n"),
+ pTsInfo->traffic.direction, pTsInfo->traffic.tsid);
+
+ for (ctspec = 0; ctspec < LIM_NUM_TSPEC_MAX; ctspec++, pTspecList++)
+ {
+ if ((pTspecList->inuse)
+ && (assocId == pTspecList->assocId)
+ && (pTsInfo->traffic.direction == pTspecList->tspec.tsinfo.traffic.direction)
+ && (pTsInfo->traffic.tsid == pTspecList->tspec.tsinfo.traffic.tsid))
+ {
+ *ppInfo = pTspecList;
+ return eSIR_SUCCESS;
+ }
+ }
+ return eSIR_FAILURE;
+}
+
+/** -------------------------------------------------------------
+\fn limTspecAdd
+\brief add or update the specified tspec to the tspec list
+\param tpAniSirGlobal pMac
+\param tANI_U8 *pAddr
+\param tANI_U16 assocId
+\param tSirMacTspecIE *pTspec
+\param tANI_U32 interval
+\param tpLimTspecInfo *ppInfo
+
+\return eSirRetStatus - status of the comparison
+ -------------------------------------------------------------*/
+
+tSirRetStatus limTspecAdd(
+ tpAniSirGlobal pMac,
+ tANI_U8 *pAddr,
+ tANI_U16 assocId,
+ tSirMacTspecIE *pTspec,
+ tANI_U32 interval,
+ tpLimTspecInfo *ppInfo)
+{
+ tpLimTspecInfo pTspecList = &pMac->lim.tspecInfo[0];
+ *ppInfo = NULL;
+
+ // validate the assocId
+ if (assocId >= pMac->lim.maxStation)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Invalid assocId 0x%x\n"), assocId);)
+ return eSIR_FAILURE;
+ }
+
+ //decide whether to add/update
+ {
+ *ppInfo = NULL;
+
+ if(eSIR_SUCCESS == limFindTspec(pMac, assocId, &pTspec->tsinfo, pTspecList, ppInfo))
+ {
+ //update this entry.
+ limLog(pMac, ADMIT_CONTROL_LOGLEVEL, FL("updating TSPEC table entry = %d"),
+ (*ppInfo)->idx);
+ }
+ else
+ {
+ /* We didn't find one to update. So find a free slot in the
+ * LIM TSPEC list and add this new entry
+ */
+ tANI_U8 ctspec = 0;
+ for (ctspec = 0 , pTspecList = &pMac->lim.tspecInfo[0]; ctspec < LIM_NUM_TSPEC_MAX; ctspec++, pTspecList++)
+ {
+ if (! pTspecList->inuse)
+ {
+ limLog(pMac, LOG1, FL("Found free slot in TSPEC list. Add to TSPEC table entry %d"), ctspec);
+ break;
+ }
+ }
+
+ if (ctspec >= LIM_NUM_TSPEC_MAX)
+ return eSIR_FAILURE;
+
+ //Record the new index entry
+ pTspecList->idx = ctspec;
+ }
+ }
+
+ // update the tspec info
+ pTspecList->tspec = *pTspec;
+ pTspecList->assocId = assocId;
+ palCopyMemory( pMac->hHdd, pTspecList->staAddr, pAddr, sizeof(pTspecList->staAddr));
+
+ // for edca tspec's, we are all done
+ if (pTspec->tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA)
+ {
+ pTspecList->inuse = 1;
+ *ppInfo = pTspecList;
+ limLog(pMac, ADMIT_CONTROL_LOGLEVEL, FL("added entry for EDCA AccessPolicy\n"));
+ return eSIR_SUCCESS;
+ }
+
+ /*
+ * for hcca tspec's, must set the parameterized bit in the queues
+ * the 'ts' bit in the queue data structure indicates that the queue is
+ * parameterized (hcca). When the schedule is written this bit is used
+ * in the tsid field (bit 3) and the other three bits (0-2) are simply
+ * filled in as the user priority (or qid). This applies only to uplink
+ * polls where the qos control field must contain the tsid specified in the
+ * tspec.
+ */
+#if 0
+ if ((pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK) ||
+ (pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR))
+ queue[staid][pTspec->tsinfo.traffic.userPrio][SCH_UL_QUEUE].ts = 1;
+#endif
+ pTspecList->inuse = 1;
+ *ppInfo = pTspecList;
+ limLog(pMac, ADMIT_CONTROL_LOGLEVEL, FL("added entry for HCCA AccessPolicy\n"));
+ return eSIR_SUCCESS;
+}
+
+/** -------------------------------------------------------------
+\fn limValidateAccessPolicy
+\brief Validates Access policy
+\param tpAniSirGlobal pMac
+\param tANI_U8 accessPolicy
+\param tANI_U16 assocId
+\return eSirRetStatus - status
+ -------------------------------------------------------------*/
+
+static tSirRetStatus
+limValidateAccessPolicy(
+ tpAniSirGlobal pMac,
+ tANI_U8 accessPolicy,
+ tANI_U16 assocId,
+ tpPESession psessionEntry)
+{
+ tSirRetStatus retval = eSIR_FAILURE;
+ tpDphHashNode pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
+
+ if ((pSta == NULL) || (! pSta->valid))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("invalid station address passed\n"));)
+ return eSIR_FAILURE;
+ }
+
+ switch (accessPolicy)
+ {
+ case SIR_MAC_ACCESSPOLICY_EDCA:
+ if (pSta->wmeEnabled || pSta->lleEnabled)
+ retval = eSIR_SUCCESS;
+ break;
+
+ case SIR_MAC_ACCESSPOLICY_HCCA:
+ case SIR_MAC_ACCESSPOLICY_BOTH:
+#if 0 //only EDCA supported for now.
+ // TBD: check wsm doesn't support the hybrid access policy
+ if (pSta->wsmEnabled || pSta->lleEnabled)
+ retval = eSIR_SUCCESS;
+ break;
+#endif //only EDCA supported for now.
+ default:
+ PELOGE(limLog(pMac, LOGE, FL("Invalid accessPolicy %d\n"), accessPolicy);)
+ break;
+ }
+
+ if (retval != eSIR_SUCCESS)
+ limLog(pMac, LOGW, FL("failed (accPol %d, staId %d, lle %d, wme %d, wsm %d)\n"),
+ accessPolicy, pSta->staIndex, pSta->lleEnabled, pSta->wmeEnabled, pSta->wsmEnabled);
+
+ return retval;
+}
+
+/** -------------------------------------------------------------
+\fn limAdmitControlAddTS
+\brief Determine if STA with the specified TSPEC can be admitted. If it can,
+ a schedule element is provided
+\param tpAniSirGlobal pMac
+\param tANI_U8 *pAddr,
+\param tSirAddtsReqInfo *pAddts,
+\param tSirMacQosCapabilityIE *pQos,
+\param tANI_U16 assocId, // assocId, valid only if alloc==true
+\param tANI_U8 alloc, // true=>allocate bw for this tspec,
+ // else determine only if space is available
+\param tSirMacScheduleIE *pSch,
+\param tANI_U8 *pTspecIdx //index to the lim tspec table.
+\return eSirRetStatus - status
+ -------------------------------------------------------------*/
+
+tSirRetStatus limAdmitControlAddTS(
+ tpAniSirGlobal pMac,
+ tANI_U8 *pAddr,
+ tSirAddtsReqInfo *pAddts,
+ tSirMacQosCapabilityStaIE *pQos,
+ tANI_U16 assocId, // assocId, valid only if alloc==true
+ tANI_U8 alloc, // true=>allocate bw for this tspec,
+ // else determine only if space is available
+ tSirMacScheduleIE *pSch,
+ tANI_U8 *pTspecIdx, //index to the lim tspec table.
+ tpPESession psessionEntry
+ )
+{
+ tpLimTspecInfo pTspecInfo;
+ tSirRetStatus retval;
+ tANI_U32 svcInterval;
+ (void) pQos;
+
+ // TBD: modify tspec as needed
+ // EDCA: need to fill in the medium time and the minimum phy rate
+ // to be consistent with the desired traffic parameters.
+
+ limLog(pMac, ADMIT_CONTROL_LOGLEVEL, FL("tsid %d, directn %d, start %d, intvl %d, accPolicy %d, up %d\n"),
+ pAddts->tspec.tsinfo.traffic.tsid, pAddts->tspec.tsinfo.traffic.direction,
+ pAddts->tspec.svcStartTime, pAddts->tspec.minSvcInterval,
+ pAddts->tspec.tsinfo.traffic.accessPolicy, pAddts->tspec.tsinfo.traffic.userPrio);
+
+ // check for duplicate tspec
+ retval = (alloc)
+ ? limTspecFindByAssocId(pMac, assocId, &pAddts->tspec, &pMac->lim.tspecInfo[0], &pTspecInfo)
+ : limTspecFindByStaAddr(pMac, pAddr, &pAddts->tspec, &pMac->lim.tspecInfo[0], &pTspecInfo);
+
+ if (retval == eSIR_SUCCESS)
+ {
+ limLog(pMac, ADMIT_CONTROL_LOGLEVEL, FL("duplicate tspec (index %d)!\n"), pTspecInfo->idx);
+ return eSIR_FAILURE;
+ }
+
+ // check that the tspec's are well formed and acceptable
+ if (limValidateTspec(pMac, &pAddts->tspec, psessionEntry) != eSIR_SUCCESS)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("tspec validation failed\n"));)
+ return eSIR_FAILURE;
+ }
+
+ // determine a service interval for the tspec
+ if (limCalculateSvcInt(pMac, &pAddts->tspec, &svcInterval) != eSIR_SUCCESS)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("SvcInt calculate failed\n"));)
+ return eSIR_FAILURE;
+ }
+
+ // determine if the tspec can be admitted or not based on current policy
+ if (limAdmitPolicy(pMac, &pAddts->tspec, psessionEntry) != eSIR_SUCCESS)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("tspec rejected by admit control policy\n"));)
+ return eSIR_FAILURE;
+ }
+
+ // fill in a schedule if requested
+ if (pSch != NULL)
+ {
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pSch, sizeof(*pSch));
+ pSch->svcStartTime = pAddts->tspec.svcStartTime;
+ pSch->svcInterval = svcInterval;
+ pSch->maxSvcDuration = (tANI_U16) pSch->svcInterval; // use SP = SI
+ pSch->specInterval = 0x1000; // fixed for now: TBD
+
+ pSch->info.direction = pAddts->tspec.tsinfo.traffic.direction;
+ pSch->info.tsid = pAddts->tspec.tsinfo.traffic.tsid;
+ pSch->info.aggregation = 0; // no support for aggregation for now: TBD
+ }
+
+ // if no allocation is requested, done
+ if (! alloc)
+ return eSIR_SUCCESS;
+
+ // check that we are in the proper mode to deal with the tspec type
+ if (limValidateAccessPolicy(pMac, (tANI_U8) pAddts->tspec.tsinfo.traffic.accessPolicy, assocId, psessionEntry) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGW, FL("AccessPolicy %d is not valid in current mode\n"),
+ pAddts->tspec.tsinfo.traffic.accessPolicy);
+ return eSIR_FAILURE;
+ }
+
+ // add tspec to list
+ if (limTspecAdd(pMac, pAddr, assocId, &pAddts->tspec, svcInterval, &pTspecInfo)
+ != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("no space in tspec list\n"));)
+ return eSIR_FAILURE;
+ }
+
+ //passing lim tspec table index to the caller
+ *pTspecIdx = pTspecInfo->idx;
+
+ return eSIR_SUCCESS;
+}
+
+/** -------------------------------------------------------------
+\fn limAdmitControlDeleteTS
+\brief Delete the specified Tspec for the specified STA
+\param tpAniSirGlobal pMac
+\param tANI_U16 assocId
+\param tSirMacTSInfo *pTsInfo
+\param tANI_U8 *pTsStatus
+\param tANI_U8 *ptspecIdx
+\return eSirRetStatus - status
+ -------------------------------------------------------------*/
+
+tSirRetStatus
+limAdmitControlDeleteTS(
+ tpAniSirGlobal pMac,
+ tANI_U16 assocId,
+ tSirMacTSInfo *pTsInfo,
+ tANI_U8 *pTsStatus,
+ tANI_U8 *ptspecIdx)
+{
+ tpLimTspecInfo pTspecInfo = NULL;
+
+ if (pTsStatus != NULL)
+ *pTsStatus = 0;
+
+ if (limFindTspec(pMac, assocId, pTsInfo, &pMac->lim.tspecInfo[0], &pTspecInfo) == eSIR_SUCCESS)
+ {
+ if(pTspecInfo != NULL)
+ {
+ limLog(pMac, ADMIT_CONTROL_LOGLEVEL, FL("Tspec entry %d found\n"), pTspecInfo->idx);
+
+ *ptspecIdx = pTspecInfo->idx;
+ limTspecDelete(pMac, pTspecInfo);
+ return eSIR_SUCCESS;
+ }
+ }
+ return eSIR_FAILURE;
+}
+
+/** -------------------------------------------------------------
+\fn limAdmitControlDeleteSta
+\brief Delete all TSPEC for the specified STA
+\param tpAniSirGlobal pMac
+\param tANI_U16 assocId
+\return eSirRetStatus - status
+ -------------------------------------------------------------*/
+
+tSirRetStatus
+limAdmitControlDeleteSta(
+ tpAniSirGlobal pMac,
+ tANI_U16 assocId)
+{
+ tpLimTspecInfo pTspecInfo = &pMac->lim.tspecInfo[0];
+ int ctspec;
+
+ for (ctspec = 0; ctspec < LIM_NUM_TSPEC_MAX; ctspec++, pTspecInfo++)
+ {
+ if (assocId == pTspecInfo->assocId)
+ {
+ limTspecDelete(pMac, pTspecInfo);
+ limLog(pMac, ADMIT_CONTROL_LOGLEVEL, FL("Deleting TSPEC %d for assocId %d\n"),
+ ctspec, assocId);
+ }
+ }
+ limLog(pMac, ADMIT_CONTROL_LOGLEVEL, FL("assocId %d done\n"), assocId);
+
+ return eSIR_SUCCESS;
+}
+
+/** -------------------------------------------------------------
+\fn limAdmitControlInit
+\brief init tspec table
+\param tpAniSirGlobal pMac
+\return eSirRetStatus - status
+ -------------------------------------------------------------*/
+tSirRetStatus limAdmitControlInit(tpAniSirGlobal pMac)
+{
+ palZeroMemory(pMac->hHdd, pMac->lim.tspecInfo , LIM_NUM_TSPEC_MAX * sizeof(tLimTspecInfo));
+ return eSIR_SUCCESS;
+}
+
+/** -------------------------------------------------------------
+\fn limUpdateAdmitPolicy
+\brief Set the admit control policy based on CFG parameters
+\param tpAniSirGlobal pMac
+\return eSirRetStatus - status
+ -------------------------------------------------------------*/
+
+tSirRetStatus limUpdateAdmitPolicy(tpAniSirGlobal pMac)
+{
+ tANI_U32 val;
+ if (wlan_cfgGetInt(pMac, WNI_CFG_ADMIT_POLICY, &val) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Unable to get CFG_ADMIT_POLICY\n"));
+ return eSIR_FAILURE;
+ }
+ pMac->lim.admitPolicyInfo.type = (tANI_U8) val;
+ if (wlan_cfgGetInt(pMac, WNI_CFG_ADMIT_BWFACTOR, &val) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Unable to get CFG_ADMIT_BWFACTOR\n"));
+ return eSIR_FAILURE;
+ }
+ pMac->lim.admitPolicyInfo.bw_factor = (tANI_U8) val;
+
+ PELOG1(limLog(pMac, LOG1, FL("LIM: AdmitPolicy %d, bw_factor %d\n"),
+ pMac->lim.admitPolicyInfo.type, pMac->lim.admitPolicyInfo.bw_factor);)
+
+ return eSIR_SUCCESS;
+}
+
+
+/** -------------------------------------------------------------
+\fn limSendHalMsgAddTs
+\brief Send halMsg_AddTs to HAL
+\param tpAniSirGlobal pMac
+\param tANI_U16 staIdx
+\param tANI_U8 tspecIdx
+\param tSirMacTspecIE tspecIE
+\param tSirTclasInfo *tclasInfo
+\param tANI_U8 tclasProc
+\return eSirRetStatus - status
+ -------------------------------------------------------------*/
+
+tSirRetStatus
+limSendHalMsgAddTs(
+ tpAniSirGlobal pMac,
+ tANI_U16 staIdx,
+ tANI_U8 tspecIdx,
+ tSirMacTspecIE tspecIE,
+ tANI_U8 sessionId)
+{
+ tSirMsgQ msg;
+ tpAddTsParams pAddTsParam;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pAddTsParam, sizeof(tAddTsParams)))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("palAllocateMemory() failed\n"));)
+ return eSIR_MEM_ALLOC_FAILED;
+ }
+
+ palZeroMemory( pMac->hHdd, (tANI_U8 *)pAddTsParam, sizeof(tAddTsParams));
+ pAddTsParam->staIdx = staIdx;
+ pAddTsParam->tspecIdx = tspecIdx;
+ palCopyMemory(pMac->hHdd, &pAddTsParam->tspec, &tspecIE, sizeof(tSirMacTspecIE));
+ pAddTsParam->sessionId = sessionId;
+
+ msg.type = WDA_ADD_TS_REQ;
+ msg.bodyptr = pAddTsParam;
+ msg.bodyval = 0;
+
+ /* We need to defer any incoming messages until we get a
+ * WDA_ADD_TS_RSP from HAL.
+ */
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+ MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+
+ if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed\n"));)
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+ palFreeMemory(pMac->hHdd, (tANI_U8*)pAddTsParam);
+ return eSIR_FAILURE;
+ }
+ return eSIR_SUCCESS;
+}
+
+/** -------------------------------------------------------------
+\fn limSendHalMsgDelTs
+\brief Send halMsg_AddTs to HAL
+\param tpAniSirGlobal pMac
+\param tANI_U16 staIdx
+\param tANI_U8 tspecIdx
+\param tSirAddtsReqInfo addts
+\return eSirRetStatus - status
+ -------------------------------------------------------------*/
+
+tSirRetStatus
+limSendHalMsgDelTs(
+ tpAniSirGlobal pMac,
+ tANI_U16 staIdx,
+ tANI_U8 tspecIdx,
+ tSirDeltsReqInfo delts)
+{
+ tSirMsgQ msg;
+ tpDelTsParams pDelTsParam;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pDelTsParam, sizeof(tDelTsParams)))
+ {
+ limLog(pMac, LOGP, FL("palAllocateMemory() failed\n"));
+ return eSIR_MEM_ALLOC_FAILED;
+ }
+
+ msg.type = WDA_DEL_TS_REQ;
+ msg.bodyptr = pDelTsParam;
+ msg.bodyval = 0;
+ palZeroMemory( pMac->hHdd, (tANI_U8 *)pDelTsParam, sizeof(tDelTsParams));
+
+ //filling message parameters.
+ pDelTsParam->staIdx = staIdx;
+ pDelTsParam->tspecIdx = tspecIdx;
+
+ PELOGW(limLog(pMac, LOGW, FL("calling wdaPostCtrlMsg()\n"));)
+ MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+
+ if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed\n"));)
+ palFreeMemory(pMac->hHdd, (tANI_U8*)pDelTsParam);
+ return eSIR_FAILURE;
+ }
+ return eSIR_SUCCESS;
+}
+
+/** -------------------------------------------------------------
+\fn limProcessHalAddTsRsp
+\brief This function process the WDA_ADD_TS_RSP from HAL.
+\ If response is successful, then send back SME_ADDTS_RSP.
+\ Otherwise, send DELTS action frame to peer and then
+\ then send back SME_ADDTS_RSP.
+\
+\param tpAniSirGlobal pMac
+\param tpSirMsgQ limMsg
+-------------------------------------------------------------*/
+void limProcessHalAddTsRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
+{
+ tpAddTsParams pAddTsRspMsg = NULL;
+ tpDphHashNode pSta = NULL;
+ tANI_U16 assocId =0;
+ tSirMacAddr peerMacAddr;
+ tANI_U8 rspReqd = 1;
+ tpPESession psessionEntry = NULL;
+
+
+ /* Need to process all the deferred messages enqueued
+ * since sending the WDA_ADD_TS_REQ.
+ */
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+
+ if (NULL == limMsg->bodyptr)
+ {
+ limLog(pMac, LOGP, FL("Received WDA_ADD_TS_RSP with NULL "));
+ goto end;
+ }
+
+ pAddTsRspMsg = (tpAddTsParams) (limMsg->bodyptr);
+
+ // 090803: Use peFindSessionBySessionId() to obtain the PE session context
+ // from the sessionId in the Rsp Msg from HAL
+ psessionEntry = peFindSessionBySessionId(pMac, pAddTsRspMsg->sessionId);
+
+ if(psessionEntry == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Session does Not exist with given sessionId :%d \n"), pAddTsRspMsg->sessionId);)
+ limSendSmeAddtsRsp(pMac, rspReqd, eSIR_SME_ADDTS_RSP_FAILED, psessionEntry, pAddTsRspMsg->tspec,
+ pMac->lim.gLimAddtsReq.sessionId, pMac->lim.gLimAddtsReq.transactionId);
+ goto end;
+ }
+
+ if(pAddTsRspMsg->status == eHAL_STATUS_SUCCESS)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Received successful ADDTS response from HAL \n"));)
+ // Use the smesessionId and smetransactionId from the PE session context
+ limSendSmeAddtsRsp(pMac, rspReqd, eSIR_SME_SUCCESS, psessionEntry, pAddTsRspMsg->tspec,
+ psessionEntry->smeSessionId, psessionEntry->transactionId);
+ goto end;
+ }
+ else
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Received failure ADDTS response from HAL \n"));)
+
+ // Send DELTS action frame to AP
+ // 090803: Get peer MAC addr from session
+#if 0
+ cfgLen = sizeof(tSirMacAddr);
+ if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &cfgLen) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Fail to retrieve BSSID \n"));
+ goto end;
+ }
+#endif //TO SUPPORT BT-AMP
+ sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
+
+ // 090803: Add the SME Session ID
+ limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd, &pAddTsRspMsg->tspec.tsinfo, &pAddTsRspMsg->tspec,
+ //psessionEntry->smeSessionId);
+ psessionEntry);
+
+ // Delete TSPEC
+ // 090803: Pull the hash table from the session
+ pSta = dphLookupAssocId(pMac, pAddTsRspMsg->staIdx, &assocId,
+ &psessionEntry->dph.dphHashTable);
+ if (pSta != NULL)
+ limAdmitControlDeleteTS(pMac, assocId, &pAddTsRspMsg->tspec.tsinfo, NULL, (tANI_U8 *)&pAddTsRspMsg->tspecIdx);
+
+ // Send SME_ADDTS_RSP
+ // 090803: Use the smesessionId and smetransactionId from the PE session context
+ limSendSmeAddtsRsp(pMac, rspReqd, eSIR_SME_ADDTS_RSP_FAILED, psessionEntry, pAddTsRspMsg->tspec,
+ psessionEntry->smeSessionId, psessionEntry->transactionId);
+ goto end;
+ }
+
+end:
+ if( pAddTsRspMsg != NULL )
+ palFreeMemory( pMac->hHdd, (void *)pAddTsRspMsg );
+ return;
+}
+
diff --git a/CORE/MAC/src/pe/lim/limApi.c b/CORE/MAC/src/pe/lim/limApi.c
new file mode 100644
index 0000000..9bc6c19
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limApi.c
@@ -0,0 +1,2738 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limApi.cc contains the functions that are
+ * exported by LIM to other modules.
+ *
+ * Author: Chandra Modumudi
+ * Date: 02/11/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+#include "palTypes.h"
+#ifdef ANI_PRODUCT_TYPE_AP
+#include "wniCfgAp.h"
+#else
+#include "wniCfgSta.h"
+#include "wniApi.h"
+#endif
+#include "sirCommon.h"
+#include "sirDebug.h"
+#include "aniParam.h"
+#include "cfgApi.h"
+
+#include "schApi.h"
+#include "utilsApi.h"
+#include "limApi.h"
+#include "limGlobal.h"
+#include "limTypes.h"
+#include "limUtils.h"
+#include "limAssocUtils.h"
+#include "limPropExtsUtils.h"
+#include "limSerDesUtils.h"
+#include "limIbssPeerMgmt.h"
+#include "limAdmitControl.h"
+#include "pmmApi.h"
+#include "logDump.h"
+#include "limSendSmeRspMessages.h"
+#include "wmmApsd.h"
+#include "limTrace.h"
+#include "limSession.h"
+#include "wlan_qct_wda.h"
+
+#if defined WLAN_FEATURE_VOWIFI
+#include "rrmApi.h"
+#endif
+
+#include <limFT.h>
+
+#ifdef VOSS_ENABLED
+#include "vos_types.h"
+#include "vos_packet.h"
+#include "wlan_qct_tl.h"
+#include "sysStartup.h"
+#endif
+
+
+static void __limInitScanVars(tpAniSirGlobal pMac)
+{
+ pMac->lim.gLimUseScanModeForLearnMode = 1;
+
+ pMac->lim.gLimSystemInScanLearnMode = 0;
+
+ // Scan related globals on STA
+ pMac->lim.gLimReturnAfterFirstMatch = 0;
+ pMac->lim.gLim24Band11dScanDone = 0;
+ pMac->lim.gLim50Band11dScanDone = 0;
+ pMac->lim.gLimReturnUniqueResults = 0;
+
+ // Background Scan related globals on STA
+ pMac->lim.gLimNumOfBackgroundScanSuccess = 0;
+ pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
+ pMac->lim.gLimNumOfForcedBkgndScan = 0;
+ pMac->lim.gLimBackgroundScanDisable = false; //based on BG timer
+ pMac->lim.gLimForceBackgroundScanDisable = false; //debug control flag
+ pMac->lim.gLimBackgroundScanTerminate = TRUE; //controlled by SME
+ pMac->lim.gLimReportBackgroundScanResults = FALSE; //controlled by SME
+
+ pMac->lim.gLimCurrentScanChannelId = 0;
+ pMac->lim.gpLimMlmScanReq = NULL;
+ pMac->lim.gLimMlmScanResultLength = 0;
+ pMac->lim.gLimSmeScanResultLength = 0;
+
+ palZeroMemory(pMac->hHdd, pMac->lim.gLimCachedScanHashTable,
+ sizeof(pMac->lim.gLimCachedScanHashTable));
+
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ pMac->lim.gLimBackgroundScanChannelId = 0;
+ pMac->lim.gLimBackgroundScanStarted = 0;
+ pMac->lim.gLimRestoreCBNumScanInterval = LIM_RESTORE_CB_NUM_SCAN_INTERVAL_DEFAULT;
+ pMac->lim.gLimRestoreCBCount = 0;
+ palZeroMemory(pMac->hHdd, pMac->lim.gLimLegacyBssidList, sizeof(pMac->lim.gLimLegacyBssidList));
+#endif
+
+ /* Fill in default values */
+ pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = 0;
+
+#ifdef ANI_AP_SDK
+ palZeroMemory(pMac->hHdd, &pMac->lim.gLimScanDurationConvert, sizeof(tLimScanDurationConvert)); /* Used to store converted scan duration values in TU and TICKS */
+#endif /* ANI_AP_SDK */
+
+ // abort scan is used to abort an on-going scan
+ pMac->lim.abortScan = 0;
+ palZeroMemory(pMac->hHdd, &pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo));
+
+//WLAN_SUSPEND_LINK Related
+ pMac->lim.gpLimSuspendCallback = NULL;
+ pMac->lim.gpLimResumeCallback = NULL;
+//end WLAN_SUSPEND_LINK Related
+}
+
+
+static void __limInitBssVars(tpAniSirGlobal pMac)
+{
+
+ palZeroMemory(pMac->hHdd, (void*)pMac->lim.gpSession, sizeof(*pMac->lim.gpSession)*pMac->lim.maxBssId);
+
+
+ //pMac->lim.gpLimStartBssReq = NULL;
+
+#if defined(ANI_PRODUCT_TYPE_AP)
+ palZeroMemory(pMac->hHdd, &pMac->lim.gLimNeighborBssList, sizeof(tSirMultipleNeighborBssInfo));
+#endif
+
+
+
+/* These global variables are moved to session table and intialization is done during session creation Oct 9th Review */
+#if 0
+
+ // Place holder for BSS description that we're
+ // currently joined with
+ palZeroMemory(pMac->hHdd, &pMac->lim.gLimCurrentBssId, sizeof(tSirMacAddr));
+ pMac->lim.gLimCurrentChannelId = HAL_INVALID_CHANNEL_ID;
+ palZeroMemory(pMac->hHdd, &pMac->lim.gLimCurrentSSID, sizeof(tSirMacSSid));
+ pMac->lim.gLimCurrentBssCaps = 0;
+ QosCaps is a bit map of various qos capabilities - see defn above
+ pMac->lim.gLimCurrentBssQosCaps = 0;
+ pMac->lim.gLimCurrentBssPropCap = 0;
+ pMac->lim.gLimSentCapsChangeNtf = 0;
+
+ // Place holder for BSS description that
+ // we're currently Reassociating
+ palZeroMemory(pMac->hHdd, &pMac->lim.gLimReassocBssId, sizeof(tSirMacAddr));
+ pMac->lim.gLimReassocChannelId = 0;
+ palZeroMemory(pMac->hHdd, &pMac->lim.gLimReassocSSID, sizeof(tSirMacSSid));
+ pMac->lim.gLimReassocBssCaps = 0;
+ pMac->lim.gLimReassocBssQosCaps = 0;
+ pMac->lim.gLimReassocBssPropCap = 0;
+ #endif
+
+ /* This is for testing purposes only, be default should always be off */
+ pMac->lim.gLimForceNoPropIE = 0;
+
+ // pMac->lim.gLimBssIdx = 0;
+
+ pMac->lim.gpLimMlmSetKeysReq = NULL;
+ pMac->lim.gpLimMlmRemoveKeyReq = NULL;
+ // pMac->lim.gLimStaid = 0; //TO SUPPORT BT-AMP
+
+}
+
+
+static void __limInitStatsVars(tpAniSirGlobal pMac)
+{
+ pMac->lim.gLimNumBeaconsRcvd = 0;
+ pMac->lim.gLimNumBeaconsIgnored = 0;
+
+ pMac->lim.gLimNumDeferredMsgs = 0;
+
+ /// Variable to keep track of number of currently associated STAs
+ pMac->lim.gLimNumOfCurrentSTAs = 0;
+ pMac->lim.gLimNumOfAniSTAs = 0; // count of ANI peers
+
+ /// This indicates number of RXed Beacons during HB period
+ //pMac->lim.gLimRxedBeaconCntDuringHB = 0;
+
+ // Heart-Beat interval value
+ pMac->lim.gLimHeartBeatCount = 0;
+
+ // Statistics to keep track of no. beacons rcvd in heart beat interval
+ palZeroMemory(pMac->hHdd, pMac->lim.gLimHeartBeatBeaconStats, sizeof(pMac->lim.gLimHeartBeatBeaconStats));
+
+#ifdef WLAN_DEBUG
+ // Debug counters
+ pMac->lim.numTot = 0;
+ pMac->lim.numBbt = 0;
+ pMac->lim.numProtErr = 0;
+ pMac->lim.numLearn = 0;
+ pMac->lim.numLearnIgnore = 0;
+ pMac->lim.numSme = 0;
+ palZeroMemory(pMac->hHdd, pMac->lim.numMAC, sizeof(pMac->lim.numMAC));
+ pMac->lim.gLimNumAssocReqDropInvldState = 0;
+ pMac->lim.gLimNumAssocReqDropACRejectTS = 0;
+ pMac->lim.gLimNumAssocReqDropACRejectSta = 0;
+ pMac->lim.gLimNumReassocReqDropInvldState = 0;
+ pMac->lim.gLimNumHashMissIgnored = 0;
+ pMac->lim.gLimUnexpBcnCnt = 0;
+ pMac->lim.gLimBcnSSIDMismatchCnt = 0;
+ pMac->lim.gLimNumLinkEsts = 0;
+ pMac->lim.gLimNumRxCleanup = 0;
+ pMac->lim.gLim11bStaAssocRejectCount = 0;
+#endif
+}
+
+
+
+static void __limInitStates(tpAniSirGlobal pMac)
+{
+ // Counts Heartbeat failures
+ pMac->lim.gLimHBfailureCntInLinkEstState = 0;
+ pMac->lim.gLimProbeFailureAfterHBfailedCnt = 0;
+ pMac->lim.gLimHBfailureCntInOtherStates = 0;
+ pMac->lim.gLimRspReqd = 0;
+ pMac->lim.gLimPrevSmeState = eLIM_SME_OFFLINE_STATE;
+
+ /// MLM State visible across all Sirius modules
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_IDLE_STATE));
+ pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
+
+ /// Previous MLM State
+ pMac->lim.gLimPrevMlmState = eLIM_MLM_OFFLINE_STATE;
+
+#ifdef GEN4_SCAN
+ // LIM to HAL SCAN Management Message Interface states
+ pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
+#endif // GEN4_SCAN
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+ /**
+ * Initialize state to eLIM_MLM_OFFLINE_STATE
+ */
+ pMac->lim.gLimSmeState = eLIM_MLM_OFFLINE_STATE;
+#else
+ /**
+ * Initialize state to suspended state and wait for
+ * HAL to send LIM_RESUME_ACTIVITY_NTF message.
+ */
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+ pMac->lim.gLimSmeState = eLIM_SME_SUSPEND_STATE;
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+ /**
+ * By default assume 'unknown' role. This will be updated
+ * when SME_START_BSS_REQ is received.
+ */
+
+ palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlap11gParams, sizeof(tLimProtStaParams));
+ palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlap11aParams, sizeof(tLimProtStaParams));
+ palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlapHt20Params, sizeof(tLimProtStaParams));
+ palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlapNonGfParams, sizeof(tLimProtStaParams));
+ palZeroMemory(pMac->hHdd, &pMac->lim.gLimNoShortParams, sizeof(tLimNoShortParams));
+ palZeroMemory(pMac->hHdd, &pMac->lim.gLimNoShortSlotParams, sizeof(tLimNoShortSlotParams));
+
+ pMac->lim.gLimPhyMode = 0;
+ pMac->lim.scanStartTime = 0; // used to measure scan time
+
+ palZeroMemory(pMac->hHdd, pMac->lim.gLimBssid, sizeof(pMac->lim.gLimBssid));
+ palZeroMemory(pMac->hHdd, pMac->lim.gLimMyMacAddr, sizeof(pMac->lim.gLimMyMacAddr));
+ pMac->lim.ackPolicy = 0;
+
+#if 0 /* Moving all these to session specific elements */
+ pMac->lim.gLimQosEnabled = 0; //11E
+ pMac->lim.gLimWmeEnabled = 0; //WME
+ pMac->lim.gLimWsmEnabled = 0; //WSM
+ pMac->lim.gLimHcfEnabled = 0;
+ pMac->lim.gLim11dEnabled = 0;
+#endif
+
+ pMac->lim.gLimProbeRespDisableFlag = 0; // control over probe response
+}
+
+static void __limInitVars(tpAniSirGlobal pMac)
+{
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ palZeroMemory(pMac->hHdd, &pMac->lim.gLimAlternateRadioList, sizeof(tSirMultipleAlternateRadioInfo));
+#endif
+
+ // Place holder for Measurement Req/Rsp/Ind related info
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+ pMac->lim.gpLimMeasReq = NULL;
+ palZeroMemory(pMac->hHdd, &pMac->lim.gLimMeasParams, sizeof(tLimMeasParams));
+ pMac->lim.gpLimMeasData = NULL;
+#endif
+
+ // WDS info
+ pMac->lim.gLimNumWdsInfoInd = 0;
+ pMac->lim.gLimNumWdsInfoSet = 0;
+ palZeroMemory(pMac->hHdd, &pMac->lim.gLimWdsInfo, sizeof(tSirWdsInfo));
+ /* initialize some parameters */
+ limInitWdsInfoParams(pMac);
+
+ // Deferred Queue Paramters
+ palZeroMemory(pMac->hHdd, &pMac->lim.gLimDeferredMsgQ, sizeof(tSirAddtsReq));
+
+ // addts request if any - only one can be outstanding at any time
+ palZeroMemory(pMac->hHdd, &pMac->lim.gLimAddtsReq, sizeof(tSirAddtsReq));
+ pMac->lim.gLimAddtsSent = 0;
+ pMac->lim.gLimAddtsRspTimerCount = 0;
+
+ //protection related config cache
+ palZeroMemory(pMac->hHdd, &pMac->lim.cfgProtection, sizeof(tCfgProtection));
+ pMac->lim.gLimProtectionControl = 0;
+ palZeroMemory(pMac->hHdd, &pMac->lim.gLimAlternateRadio, sizeof(tSirAlternateRadioInfo));
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+
+ // 11h Spectrum Management Related Flag
+ //pMac->lim.gLim11hEnable = 0;
+ pMac->lim.gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
+ LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
+ pMac->sys.gSysEnableLearnMode = eANI_BOOLEAN_TRUE;
+
+ // 11h Quiet Element Related Flag
+ pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+ // A count-down value, used on the AP, to send out the
+ // Quiet BSS IE in that many Beacon's
+ pMac->lim.gLimSpecMgmt.quietCount = 0;
+ pMac->lim.gLimSpecMgmt.fQuietEnabled = eANI_BOOLEAN_FALSE;
+ pMac->lim.gLimSpecMgmt.fRadarIntrConfigured = eANI_BOOLEAN_FALSE;
+
+ // WMM Related Flag
+ pMac->lim.gUapsdEnable = 0;
+ pMac->lim.gUapsdPerAcBitmask = 0;
+ pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
+ pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
+
+ // QoS-AC Downgrade: Initially, no AC is admitted
+ pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] = 0;
+ pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] = 0;
+
+ //dialogue token List head/tail for Action frames request sent.
+ pMac->lim.pDialogueTokenHead = NULL;
+ pMac->lim.pDialogueTokenTail = NULL;
+
+ palZeroMemory(pMac->hHdd, &pMac->lim.tspecInfo, sizeof(tLimTspecInfo) * LIM_NUM_TSPEC_MAX);
+
+ // admission control policy information
+ palZeroMemory(pMac->hHdd, &pMac->lim.admitPolicyInfo, sizeof(tLimAdmitPolicyInfo));
+
+ pMac->lim.gLastBeaconDtimCount = 0;
+ pMac->lim.gLastBeaconDtimPeriod = 0;
+
+ //Scan in Power Save Flag
+ pMac->lim.gScanInPowersave = 0;
+}
+
+static void __limInitAssocVars(tpAniSirGlobal pMac)
+{
+ palZeroMemory(pMac->hHdd, pMac->lim.gpLimAIDpool,
+ sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1));
+ pMac->lim.freeAidHead = 0;
+ pMac->lim.freeAidTail = 0;
+ pMac->lim.gLimAssocStaLimit = WNI_CFG_ASSOC_STA_LIMIT_STADEF;
+
+ // Place holder for current authentication request
+ // being handled
+ pMac->lim.gpLimMlmAuthReq = NULL;
+ pMac->lim.gpLimMlmJoinReq = NULL;
+
+ /// MAC level Pre-authentication related globals
+ pMac->lim.gLimPreAuthChannelNumber = 0;
+ pMac->lim.gLimPreAuthType = eSIR_OPEN_SYSTEM;
+ palZeroMemory(pMac->hHdd, &pMac->lim.gLimPreAuthPeerAddr, sizeof(tSirMacAddr));
+ pMac->lim.gLimNumPreAuthContexts = 0;
+ palZeroMemory(pMac->hHdd, &pMac->lim.gLimPreAuthTimerTable, sizeof(tLimPreAuthTable));
+
+ // Placed holder to deauth reason
+ pMac->lim.gLimDeauthReasonCode = 0;
+
+ // Place holder for Pre-authentication node list
+ pMac->lim.pLimPreAuthList = NULL;
+
+ // Send Disassociate frame threshold parameters
+ pMac->lim.gLimDisassocFrameThreshold = LIM_SEND_DISASSOC_FRAME_THRESHOLD;
+ pMac->lim.gLimDisassocFrameCredit = 0;
+
+ //One cache for each overlap and associated case.
+ palZeroMemory(pMac->hHdd, pMac->lim.protStaOverlapCache, sizeof(tCacheParams) * LIM_PROT_STA_OVERLAP_CACHE_SIZE);
+ palZeroMemory(pMac->hHdd, pMac->lim.protStaCache, sizeof(tCacheParams) * LIM_PROT_STA_CACHE_SIZE);
+
+ // Initialize Assoc/ReAssoc Response Data/Frame
+ //pMac->lim.gLimAssocResponseData = NULL;
+
+}
+
+
+static void __limInitTitanVars(tpAniSirGlobal pMac)
+{
+ pMac->lim.gCbMode = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
+ SET_CB_STATE_DISABLE( pMac->lim.gCbState );
+ palZeroMemory(pMac->hHdd, &pMac->lim.gLimChannelSwitch, sizeof(tLimChannelSwitchInfo));
+
+ pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
+ pMac->lim.gLimChannelSwitch.secondarySubBand = eANI_CB_SECONDARY_NONE;
+
+ // Debug workaround for BEACON's
+ // State change triggered by "dump 222"
+ pMac->lim.gLimScanOverride = 1;
+ pMac->lim.gLimScanOverrideSaved = eSIR_ACTIVE_SCAN;
+
+
+ // Caches the CB State as desired by SME
+ SET_CB_STATE_DISABLE( pMac->lim.gCbStateProtected );
+
+ // TODO - This needs to be read off of a CFG variable
+
+ pMac->lim.gLimTitanStaCount = 0;
+ pMac->lim.gLimBlockNonTitanSta = 0;
+}
+
+static void __limInitHTVars(tpAniSirGlobal pMac)
+{
+ pMac->lim.htCapabilityPresentInBeacon = 0;
+ pMac->lim.htCapability = 0;
+ pMac->lim.gHTGreenfield = 0;
+ pMac->lim.gHTSupportedChannelWidthSet = 0;
+ pMac->lim.gHTShortGI40Mhz = 0;
+ pMac->lim.gHTShortGI20Mhz = 0;
+ pMac->lim.gHTMaxAmsduLength = 0;
+ pMac->lim.gHTDsssCckRate40MHzSupport = 0;
+ pMac->lim.gHTPSMPSupport = 0;
+ pMac->lim.gHTLsigTXOPProtection = 0;
+ pMac->lim.gHTMIMOPSState = eSIR_HT_MIMO_PS_STATIC;
+ pMac->lim.gHTAMpduDensity = 0;
+
+ pMac->lim.gMaxAmsduSizeEnabled = false;
+ pMac->lim.gHTMaxRxAMpduFactor = 0;
+ pMac->lim.gHTServiceIntervalGranularity = 0;
+ pMac->lim.gHTControlledAccessOnly = 0;
+ pMac->lim.gHTRecommendedTxWidthSet = 0;
+ pMac->lim.gHTSecondaryChannelOffset = eHT_SECONDARY_CHANNEL_OFFSET_NONE;
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
+ pMac->lim.gHTPCOActive = 0;
+
+ pMac->lim.gHTPCOPhase = 0;
+ pMac->lim.gHTSecondaryBeacon = 0;
+ pMac->lim.gHTDualCTSProtection = 0;
+ pMac->lim.gHTSTBCBasicMCS = 0;
+ pMac->lim.gAddBA_Declined = 0; // Flag to Decline the BAR if the particular bit (0-7) is being set
+}
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+static tSirRetStatus __limInitConfig( tpAniSirGlobal pMac )
+{
+ tANI_U32 val1, val2, val3, len;
+ tANI_U16 val16;
+ tANI_U8 val8;
+ tSirMacHTCapabilityInfo *pHTCapabilityInfo;
+ tSirMacHTInfoField1 *pHTInfoField1;
+ tpSirPowerSaveCfg pPowerSaveConfig;
+ tSirMacHTParametersInfo *pAmpduParamInfo;
+
+ /* Read all the CFGs here that were updated before peStart is called */
+
+ /* WNI_CFG_CHANNEL_BONDING_MODE */
+
+ handleCBCFGChange( pMac, WNI_CFG_CHANNEL_BONDING_MODE );
+
+ //for Secondary channel, change setupCBMode function OR the caller of that
+ //function during Join (STA) or Start BSS(AP/IBSS) Now update the HT Capability
+ //CFG based on Channel Bonding CFG
+ if(wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG\n"));)
+ return eSIR_FAILURE;
+ }
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, &val2) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve Channel Bonding CFG\n"));)
+ return eSIR_FAILURE;
+ }
+ val16 = ( tANI_U16 ) val1;
+ pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
+
+ //channel bonding mode could be set to anything from 0 to 4(Titan had these
+ // modes But for Taurus we have only two modes: enable(>0) or disable(=0)
+ pHTCapabilityInfo->supportedChannelWidthSet = val2 ?
+ WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
+ if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo)
+ != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
+ return eSIR_FAILURE;
+ }
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &val1) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT INFO Field1 CFG\n"));)
+ return eSIR_FAILURE;
+ }
+
+ val8 = ( tANI_U8 ) val1;
+ pHTInfoField1 = ( tSirMacHTInfoField1* ) &val8;
+ pHTInfoField1->recommendedTxWidthSet =
+ (tANI_U8)pHTCapabilityInfo->supportedChannelWidthSet;
+ pMac->lim.gHTRecommendedTxWidthSet = pHTInfoField1->recommendedTxWidthSet;
+ if(cfgSetInt(pMac, WNI_CFG_HT_INFO_FIELD1, *(tANI_U8*)pHTInfoField1)
+ != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not update HT Info Field\n"));)
+ return eSIR_FAILURE;
+ }
+
+ /* WNI_CFG_HEART_BEAT_THRESHOLD */
+
+ if( wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
+ eSIR_SUCCESS )
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve WNI_CFG_HEART_BEAT_THRESHOLD CFG\n"));)
+ return eSIR_FAILURE;
+ }
+ if(!val1)
+ {
+ limDeactivateAndChangeTimer(pMac, eLIM_HEART_BEAT_TIMER);
+ pMac->sys.gSysEnableLinkMonitorMode = 0;
+ }
+ else
+ {
+ //No need to activate the timer during init time.
+ pMac->sys.gSysEnableLinkMonitorMode = 1;
+ }
+
+ /* WNI_CFG_SHORT_GI_20MHZ */
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG\n"));)
+ return eSIR_FAILURE;
+ }
+ if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_20MHZ, &val2) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz CFG\n"));)
+ return eSIR_FAILURE;
+ }
+ if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_40MHZ, &val3) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz CFG\n"));)
+ return eSIR_FAILURE;
+ }
+
+ val16 = ( tANI_U16 ) val1;
+ pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
+ pHTCapabilityInfo->shortGI20MHz = (tANI_U16)val2;
+ pHTCapabilityInfo->shortGI40MHz = (tANI_U16)val3;
+
+ if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) !=
+ eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
+ return eSIR_FAILURE;
+ }
+
+ /* WNI_CFG_MAX_RX_AMPDU_FACTOR */
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &val1) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT AMPDU Param CFG\n"));)
+ return eSIR_FAILURE;
+ }
+ if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_RX_AMPDU_FACTOR, &val2) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve AMPDU Factor CFG\n"));)
+ return eSIR_FAILURE;
+ }
+ val16 = ( tANI_U16 ) val1;
+ pAmpduParamInfo = ( tSirMacHTParametersInfo* ) &val16;
+ pAmpduParamInfo->maxRxAMPDUFactor = (tANI_U8)val2;
+ if(cfgSetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, *(tANI_U8*)pAmpduParamInfo) !=
+ eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not update HT AMPDU Param CFG\n"));)
+ return eSIR_FAILURE;
+ }
+
+ /* WNI_CFG_SHORT_PREAMBLE - this one is not updated in
+ limHandleCFGparamUpdate do we want to update this? */
+ if(wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val1) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("cfg get short preamble failed\n"));
+ return eSIR_FAILURE;
+ }
+
+ /* WNI_CFG_BSSID - this one is not updated in limHandleCFGparamUpdate do we
+ want to update this? */
+ len = 6;
+ if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, pMac->lim.gLimBssid, &len) !=
+ eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("cfg get bssid failed\n"));
+ return eSIR_FAILURE;
+ }
+
+ /* WNI_CFG_MAX_PS_POLL */
+
+ /* Allocate and fill in power save configuration. */
+ if (palAllocateMemory(pMac->hHdd, (void **)&pPowerSaveConfig,
+ sizeof(tSirPowerSaveCfg)) != eHAL_STATUS_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("LIM: Cannot allocate memory for power save "
+ "configuration\n"));)
+ return eSIR_FAILURE;
+ }
+
+ /* This context should be valid if power-save configuration message has been
+ * already dispatched during initialization process. Re-using the present
+ * configuration mask
+ */
+ palCopyMemory(pMac->hHdd, pPowerSaveConfig, (tANI_U8 *)&pMac->pmm.gPmmCfg,
+ sizeof(tSirPowerSaveCfg));
+
+ /* Note: it is okay to do this since DAL/HAL is alrady started */
+ if ( (pmmSendPowerSaveCfg(pMac, pPowerSaveConfig)) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("LIM: pmmSendPowerSaveCfg() failed \n"));)
+ return eSIR_FAILURE;
+ }
+
+ /* WNI_CFG_BG_SCAN_CHANNEL_LIST_CHANNEL_LIST */
+
+#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA) || defined(ANI_AP_CLIENT_SDK)
+ PELOG1(limLog(pMac, LOG1,
+ FL("VALID_CHANNEL_LIST has changed, reset next bg scan channel\n"));)
+ pMac->lim.gLimBackgroundScanChannelId = 0;
+#endif
+
+ /* WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA - not needed */
+
+ /* This was initially done after resume notification from HAL. Now, DAL is
+ started before PE so this can be done here */
+ handleCBCFGChange( pMac, ANI_IGNORE_CFG_ID );
+ handleHTCapabilityandHTInfo(pMac);
+
+ return eSIR_SUCCESS;
+}
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+/*
+ limStart
+ This function is to replace the __limProcessSmeStartReq since there is no
+ eWNI_SME_START_REQ post to PE.
+*/
+tSirRetStatus limStart(tpAniSirGlobal pMac)
+{
+ tSirResultCodes retCode = eSIR_SUCCESS;
+
+ PELOG1(limLog(pMac, LOG1, FL(" enter\n"));)
+
+ if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
+ {
+ pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
+
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+
+ // By default do not return after first scan match
+ pMac->lim.gLimReturnAfterFirstMatch = 0;
+
+ // Initialize MLM state machine
+ limInitMlm(pMac);
+
+ // By default return unique scan results
+ pMac->lim.gLimReturnUniqueResults = true;
+ pMac->lim.gLimSmeScanResultLength = 0;
+ }
+ else
+ {
+ /**
+ * Should not have received eWNI_SME_START_REQ in states
+ * other than OFFLINE. Return response to host and
+ * log error
+ */
+ limLog(pMac, LOGE, FL("Invalid SME state %X\n"),pMac->lim.gLimSmeState );
+ retCode = eSIR_FAILURE;
+ }
+
+ return retCode;
+}
+
+/**
+ * limInitialize()
+ *
+ *FUNCTION:
+ * This function is called from LIM thread entry function.
+ * LIM related global data structures are initialized in this function.
+ *
+ *LOGIC:
+ * NA
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to global MAC structure
+ * @return None
+ */
+
+tSirRetStatus
+limInitialize(tpAniSirGlobal pMac)
+{
+ tSirRetStatus status = eSIR_SUCCESS;
+
+ __limInitAssocVars(pMac);
+ __limInitVars(pMac);
+ __limInitStates(pMac);
+ __limInitStatsVars(pMac);
+ __limInitBssVars(pMac);
+ __limInitScanVars(pMac);
+ __limInitHTVars(pMac);
+ __limInitTitanVars(pMac);
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+ status = limStart(pMac);
+ if(eSIR_SUCCESS != status)
+ {
+ return status;
+ }
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+ /*
+ * MLM will be intitalized when 'START' request comes from SME.
+ * limInitMlm calls limCreateTimers, which actually relies on
+ * CFG to be downloaded. So it should not be called as part of
+ * peStart, as CFG download is happening after peStart.
+ */
+ //limInitMlm(pMac);
+ // Initializations for maintaining peers in IBSS
+ limIbssInit(pMac);
+
+ pmmInitialize(pMac);
+
+
+#if defined WLAN_FEATURE_VOWIFI
+ rrmInitialize(pMac);
+#endif
+#if defined WLAN_FEATURE_VOWIFI_11R
+ limFTOpen(pMac);
+#endif
+
+#ifdef WLAN_FEATURE_P2P
+ vos_list_init(&pMac->lim.gLimMgmtFrameRegistratinQueue);
+#endif
+
+#if 0
+
+ vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR);
+ vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_WARN);
+ vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_FATAL);
+
+ vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_WARN);
+ vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_ERROR);
+
+ vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_WARN);
+ vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR);
+ vos_trace_setLevel(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR);
+
+ vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
+
+ vos_trace_setLevel(VOS_MODULE_ID_SSC, VOS_TRACE_LEVEL_ERROR);
+
+ vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
+ vos_trace_setLevel(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR);
+
+ vos_trace_setLevel(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR);
+
+
+ vos_trace_setLevel(VOS_MODULE_ID_BAL, VOS_TRACE_LEVEL_ERROR);
+
+ vos_trace_setLevel(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR);
+#endif
+ MTRACE(limTraceInit(pMac));
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+ //Initialize the configurations needed by PE
+ if( eSIR_FAILURE == __limInitConfig(pMac))
+ {
+ //We need to undo everything in limStart
+ limCleanupMlm(pMac);
+ return eSIR_FAILURE;
+ }
+
+ //initialize the TSPEC admission control table.
+ //Note that this was initially done after resume notification from HAL.
+ //Now, DAL is started before PE so this can be done here
+ limAdmitControlInit(pMac);
+ limRegisterHalIndCallBack(pMac);
+#endif /*FEATURE_WLAN_INTEGRATED_SOC*/
+
+ return status;
+
+} /*** end limInitialize() ***/
+
+
+
+/**
+ * limCleanup()
+ *
+ *FUNCTION:
+ * This function is called upon reset or persona change
+ * to cleanup LIM state
+ *
+ *LOGIC:
+ * NA
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limCleanup(tpAniSirGlobal pMac)
+{
+#ifdef VOSS_ENABLED
+ v_PVOID_t pvosGCTx;
+ VOS_STATUS retStatus;
+#endif
+
+#ifdef WLAN_FEATURE_P2P
+//Before destroying the list making sure all the nodes have been deleted.
+//Which should be the normal case, but a memory leak has been reported.
+
+ tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL;
+
+ while(vos_list_remove_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
+ (vos_list_node_t**)&pLimMgmtRegistration) == VOS_STATUS_SUCCESS)
+ {
+ VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+ FL("Fixing leak! Deallocating pLimMgmtRegistration node"));
+
+ palFreeMemory(pMac, pLimMgmtRegistration);
+ }
+
+ vos_list_destroy(&pMac->lim.gLimMgmtFrameRegistratinQueue);
+#endif
+
+ limCleanupMlm(pMac);
+ limCleanupLmm(pMac);
+
+ // free up preAuth table
+ if (pMac->lim.gLimPreAuthTimerTable.pTable != NULL)
+ {
+ palFreeMemory(pMac->hHdd, pMac->lim.gLimPreAuthTimerTable.pTable);
+ pMac->lim.gLimPreAuthTimerTable.pTable = NULL;
+ pMac->lim.gLimPreAuthTimerTable.numEntry = 0;
+ }
+
+ if(NULL != pMac->lim.pDialogueTokenHead)
+ {
+ limDeleteDialogueTokenList(pMac);
+ }
+
+ if(NULL != pMac->lim.pDialogueTokenTail)
+ {
+ palFreeMemory(pMac->hHdd, (void *) pMac->lim.pDialogueTokenTail);
+ pMac->lim.pDialogueTokenTail = NULL;
+ }
+
+ # if 0
+ if (pMac->lim.gpLimStartBssReq != NULL)
+ {
+ palFreeMemory(pMac->hHdd, pMac->lim.gpLimStartBssReq);
+ pMac->lim.gpLimStartBssReq = NULL;
+ }
+ #endif
+
+ if (pMac->lim.gpLimMlmSetKeysReq != NULL)
+ {
+ palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmSetKeysReq);
+ pMac->lim.gpLimMlmSetKeysReq = NULL;
+ }
+
+ #if 0
+ if (pMac->lim.gpLimJoinReq != NULL)
+ {
+ palFreeMemory(pMac->hHdd, pMac->lim.gpLimJoinReq);
+ pMac->lim.gpLimJoinReq = NULL;
+ }
+ #endif
+
+ if (pMac->lim.gpLimMlmAuthReq != NULL)
+ {
+ palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmAuthReq);
+ pMac->lim.gpLimMlmAuthReq = NULL;
+ }
+
+ if (pMac->lim.gpLimMlmJoinReq != NULL)
+ {
+ palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmJoinReq);
+ pMac->lim.gpLimMlmJoinReq = NULL;
+ }
+
+ #if 0
+ if (pMac->lim.gpLimReassocReq != NULL)
+ {
+ palFreeMemory(pMac->hHdd, pMac->lim.gpLimReassocReq);
+ pMac->lim.gpLimReassocReq = NULL;
+ }
+ #endif
+
+ if (pMac->lim.gpLimMlmRemoveKeyReq != NULL)
+ {
+ palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmRemoveKeyReq);
+ pMac->lim.gpLimMlmRemoveKeyReq = NULL;
+ }
+
+ if (pMac->lim.gpLimMlmScanReq != NULL)
+ {
+ palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmScanReq);
+ pMac->lim.gpLimMlmScanReq = NULL;
+ }
+
+#if 0
+ if(NULL != pMac->lim.beacon)
+ {
+ palFreeMemory(pMac->hHdd, (void*) pMac->lim.beacon);
+ pMac->lim.beacon = NULL;
+ }
+#endif
+ #if 0
+ if(NULL != pMac->lim.assocReq)
+ {
+ palFreeMemory(pMac->hHdd, (void*) pMac->lim.assocReq);
+ pMac->lim.assocReq= NULL;
+ }
+ #endif
+
+#if 0
+ if(NULL != pMac->lim.assocRsp)
+ {
+ palFreeMemory(pMac->hHdd, (void*) pMac->lim.assocRsp);
+ pMac->lim.assocRsp= NULL;
+ }
+#endif
+ // Now, finally reset the deferred message queue pointers
+ limResetDeferredMsgQ(pMac);
+
+#ifdef VOSS_ENABLED
+
+ pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
+ retStatus = WLANTL_DeRegisterMgmtFrmClient(pvosGCTx);
+
+ if ( retStatus != VOS_STATUS_SUCCESS )
+ PELOGE(limLog(pMac, LOGE, FL("DeRegistering the PE Handle with TL has failed bailing out...\n"));)
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI
+ rrmCleanup(pMac);
+#endif
+#if defined WLAN_FEATURE_VOWIFI_11R
+ limFTCleanup(pMac);
+#endif
+
+} /*** end limCleanup() ***/
+
+
+/** -------------------------------------------------------------
+\fn peOpen
+\brief will be called in Open sequence from macOpen
+\param tpAniSirGlobal pMac
+\param tHalOpenParameters *pHalOpenParam
+\return tSirRetStatus
+ -------------------------------------------------------------*/
+
+tSirRetStatus peOpen(tpAniSirGlobal pMac, tMacOpenParameters *pMacOpenParam)
+{
+ pMac->lim.maxBssId = pMacOpenParam->maxBssId;
+ pMac->lim.maxStation = pMacOpenParam->maxStation;
+
+ if ((pMac->lim.maxBssId == 0) || (pMac->lim.maxStation == 0))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("max number of Bssid or Stations cannot be zero!\n"));)
+ return eSIR_FAILURE;
+ }
+
+ if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
+ (void **) &pMac->lim.limTimers.gpLimCnfWaitTimer, sizeof(TX_TIMER)*pMac->lim.maxStation))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
+ return eSIR_FAILURE;
+ }
+
+ if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
+ (void **) &pMac->lim.gpLimAIDpool,
+ sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1)))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
+ return eSIR_FAILURE;
+ }
+
+ if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
+ (void **) &pMac->lim.gpSession, sizeof(tPESession)* pMac->lim.maxBssId))
+ {
+ limLog(pMac, LOGE, FL("memory allocate failed!\n"));
+ return eSIR_FAILURE;
+ }
+
+ palZeroMemory(pMac->hHdd, pMac->lim.gpSession, sizeof(tPESession)*pMac->lim.maxBssId);
+
+
+ /*
+ if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
+ (void **) &pMac->dph.dphHashTable.pHashTable, sizeof(tpDphHashNode)*pMac->lim.maxStation))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
+ return eSIR_FAILURE;
+ }
+
+ if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
+ (void **) &pMac->dph.dphHashTable.pDphNodeArray, sizeof(tDphHashNode)*pMac->lim.maxStation))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
+ return eSIR_FAILURE;
+ }
+ */
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
+ (void **) &pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("memory allocate failed for pTim!\n"));)
+ return eSIR_FAILURE;
+ }
+ palZeroMemory(pMac->hHdd, pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation);
+#endif
+
+#ifdef ANI_PRODUCT_TYPE_AP
+
+ if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
+ (void **) &pMac->pmm.gPmmTim.pStaInfo, sizeof(*pMac->pmm.gPmmTim.pStaInfo) * pMac->lim.maxStation))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("memory allocate failed for pStaInfo!\n"));)
+ return eSIR_FAILURE;
+ }
+
+ if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
+ (void **) &pMac->pmm.gpPmmStaState, sizeof(tPmmStaState)*pMac->lim.maxStation))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
+ return eSIR_FAILURE;
+ }
+
+ if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
+ (void **) &pMac->pmm.gpPmmPSState, sizeof(tANI_U8)*pMac->lim.maxStation))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
+ return eSIR_FAILURE;
+ }
+#endif
+
+
+ return eSIR_SUCCESS;
+}
+
+/** -------------------------------------------------------------
+\fn peClose
+\brief will be called in close sequence from macClose
+\param tpAniSirGlobal pMac
+\return tSirRetStatus
+ -------------------------------------------------------------*/
+
+tSirRetStatus peClose(tpAniSirGlobal pMac)
+{
+ tANI_U8 i;
+
+ if (ANI_DRIVER_TYPE(pMac) == eDRIVER_TYPE_MFG)
+ return eSIR_SUCCESS;
+
+ palFreeMemory(pMac->hHdd, pMac->lim.limTimers.gpLimCnfWaitTimer);
+ pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
+ palFreeMemory(pMac->hHdd, pMac->lim.gpLimAIDpool);
+ pMac->lim.gpLimAIDpool = NULL;
+
+
+ for(i =0; i < pMac->lim.maxBssId; i++)
+ {
+ if(pMac->lim.gpSession[i].valid == TRUE)
+ {
+ peDeleteSession(pMac,&pMac->lim.gpSession[i]);
+ }
+ }
+
+ palFreeMemory(pMac->hHdd, pMac->lim.gpSession);
+ pMac->lim.gpSession = NULL;
+ /*
+ palFreeMemory(pMac->hHdd, pMac->dph.dphHashTable.pHashTable);
+ pMac->dph.dphHashTable.pHashTable = NULL;
+ palFreeMemory(pMac->hHdd, pMac->dph.dphHashTable.pDphNodeArray);
+ pMac->dph.dphHashTable.pDphNodeArray = NULL;
+ */
+#ifdef WLAN_SOFTAP_FEATURE
+ palFreeMemory(pMac->hHdd, pMac->pmm.gPmmTim.pTim);
+ pMac->pmm.gPmmTim.pTim = NULL;
+#endif
+#ifdef ANI_PRODUCT_TYPE_AP
+ palFreeMemory(pMac->hHdd, pMac->pmm.gPmmTim.pStaInfo);
+ pMac->pmm.gPmmTim.pStaInfo = NULL;
+ palFreeMemory(pMac->hHdd, pMac->pmm.gpPmmStaState);
+ pMac->pmm.gpPmmStaState = NULL;
+ palFreeMemory(pMac->hHdd, pMac->pmm.gpPmmPSState);
+ pMac->pmm.gpPmmPSState = NULL;
+#endif
+
+ return eSIR_SUCCESS;
+}
+
+/** -------------------------------------------------------------
+\fn peStart
+\brief will be called in start sequence from macStart
+\param tpAniSirGlobal pMac
+\return none
+ -------------------------------------------------------------*/
+
+tSirRetStatus peStart(tpAniSirGlobal pMac)
+{
+ tSirRetStatus status = eSIR_SUCCESS;
+
+ status = limInitialize(pMac);
+#if defined(ANI_LOGDUMP)
+ limDumpInit(pMac);
+#endif //#if defined(ANI_LOGDUMP)
+
+ return status;
+}
+
+/** -------------------------------------------------------------
+\fn peStop
+\brief will be called in stop sequence from macStop
+\param tpAniSirGlobal pMac
+\return none
+ -------------------------------------------------------------*/
+
+void peStop(tpAniSirGlobal pMac)
+{
+ limCleanup(pMac);
+ SET_LIM_MLM_STATE(pMac, eLIM_MLM_OFFLINE_STATE);
+ return;
+}
+
+/** -------------------------------------------------------------
+\fn peFreeMsg
+\brief Called by VOS scheduler (function vos_sched_flush_mc_mqs)
+\ to free a given PE message on the TX and MC thread.
+\ This happens when there are messages pending in the PE
+\ queue when system is being stopped and reset.
+\param tpAniSirGlobal pMac
+\param tSirMsgQ pMsg
+\return none
+-----------------------------------------------------------------*/
+v_VOID_t peFreeMsg( tpAniSirGlobal pMac, tSirMsgQ* pMsg)
+{
+ if (pMsg != NULL)
+ {
+ if (NULL != pMsg->bodyptr)
+ {
+ if (SIR_BB_XPORT_MGMT_MSG == pMsg->type)
+ {
+ vos_pkt_return_packet((vos_pkt_t *)pMsg->bodyptr);
+ }
+ else
+ {
+ vos_mem_free((v_VOID_t*)pMsg->bodyptr);
+ }
+ }
+ pMsg->bodyptr = 0;
+ pMsg->bodyval = 0;
+ pMsg->type = 0;
+ }
+ return;
+}
+
+
+/**
+ * The function checks if a particular timer should be allowed
+ * into LIM while device is sleeping
+ */
+tANI_U8 limIsTimerAllowedInPowerSaveState(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
+{
+ tANI_U8 retStatus = TRUE;
+
+ if(!limIsSystemInActiveState(pMac))
+ {
+ switch(pMsg->type)
+ {
+ /* Don't allow following timer messages if in sleep */
+ case SIR_LIM_MIN_CHANNEL_TIMEOUT:
+ case SIR_LIM_MAX_CHANNEL_TIMEOUT:
+ case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
+ retStatus = FALSE;
+ break;
+ /* May allow following timer messages in sleep mode */
+ case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
+
+ /* Safe to allow as of today, this triggers background scan
+ * which will not be started if the device is in power-save mode
+ * might need to block in the future if we decide to implement
+ * spectrum management
+ */
+ case SIR_LIM_QUIET_TIMEOUT:
+
+ /* Safe to allow as of today, this triggers background scan
+ * which will not be started if the device is in power-save mode
+ * might need to block in the future if we decide to implement
+ * spectrum management
+ */
+ case SIR_LIM_QUIET_BSS_TIMEOUT:
+
+ /* Safe to allow this timermessage, triggers background scan
+ * which is blocked in sleep mode
+ */
+ case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
+
+ /* Safe to allow this timer, since, while in IMPS this timer will not
+ * be started. In case of BMPS sleep, SoftMAC handles the heart-beat
+ * when heart-beat control is handled back to PE, device would have
+ * already woken-up due to EXIT_BMPS_IND mesage from SoftMAC
+ */
+ case SIR_LIM_HEART_BEAT_TIMEOUT:
+ case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
+
+ /* Safe to allow, PE is not handling this message as of now. May need
+ * to block it, basically, free the buffer and restart the timer
+ */
+ case SIR_LIM_REASSOC_FAIL_TIMEOUT:
+ case SIR_LIM_JOIN_FAIL_TIMEOUT:
+ case SIR_LIM_ASSOC_FAIL_TIMEOUT:
+ case SIR_LIM_AUTH_FAIL_TIMEOUT:
+ case SIR_LIM_ADDTS_RSP_TIMEOUT:
+ retStatus = TRUE;
+ break;
+
+ /* by default allow rest of messages */
+ default:
+ retStatus = TRUE;
+ break;
+
+
+ }
+ }
+
+ return retStatus;
+
+}
+
+
+
+/**
+ * limPostMsgApi()
+ *
+ *FUNCTION:
+ * This function is called from other thread while posting a
+ * message to LIM message Queue gSirLimMsgQ.
+ *
+ *LOGIC:
+ * NA
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pMsg - Pointer to the message structure
+ * @return None
+ */
+
+tANI_U32
+limPostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
+{
+#ifdef VOSS_ENABLED
+ return vos_mq_post_message(VOS_MQ_ID_PE, (vos_msg_t *) pMsg);
+
+
+#elif defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_OSX)
+ return tx_queue_send(&pMac->sys.gSirLimMsgQ, pMsg, TX_WAIT_FOREVER);
+
+#else
+ /* Check if this is a timeout message from a timer
+ * and if the timeout message is allowed if the device is in power-save state
+ */
+ if(!limIsTimerAllowedInPowerSaveState(pMac, pMsg))
+ {
+ limLog(pMac, LOGW,
+ FL("Timeout message %d is not allowed while device is in Power-Save mode\n"),
+ pMsg->type);
+
+ return TX_SUCCESS;
+ }
+ if(pMac->gDriverType != eDRIVER_TYPE_MFG)
+ {
+ limMessageProcessor(pMac, pMsg);
+ }
+
+ return TX_SUCCESS;
+
+#endif
+} /*** end limPostMsgApi() ***/
+
+
+/*--------------------------------------------------------------------------
+
+ \brief pePostMsgApi() - A wrapper function to post message to Voss msg queues
+
+ This function can be called by legacy code to post message to voss queues OR
+ legacy code may keep on invoking 'limPostMsgApi' to post the message to voss queue
+ for dispatching it later.
+
+ \param pMac - Pointer to Global MAC structure
+ \param pMsg - Pointer to the message structure
+
+ \return tANI_U32 - TX_SUCCESS for success.
+
+ --------------------------------------------------------------------------*/
+
+tSirRetStatus pePostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
+{
+ return (tSirRetStatus)limPostMsgApi(pMac, pMsg);
+}
+
+/*--------------------------------------------------------------------------
+
+ \brief peProcessMessages() - Message Processor for PE
+
+ Voss calls this function to dispatch the message to PE
+
+ \param pMac - Pointer to Global MAC structure
+ \param pMsg - Pointer to the message structure
+
+ \return tANI_U32 - TX_SUCCESS for success.
+
+ --------------------------------------------------------------------------*/
+
+tSirRetStatus peProcessMessages(tpAniSirGlobal pMac, tSirMsgQ* pMsg)
+{
+ if(pMac->gDriverType == eDRIVER_TYPE_MFG)
+ {
+ return eSIR_SUCCESS;
+ }
+ /**
+ * If the Message to be handled is for CFG Module call the CFG Msg Handler and
+ * for all the other cases post it to LIM
+ */
+ if ( SIR_CFG_PARAM_UPDATE_IND != pMsg->type && IS_CFG_MSG(pMsg->type))
+ cfgProcessMbMsg(pMac, (tSirMbMsg*)pMsg->bodyptr);
+ else
+ limMessageProcessor(pMac, pMsg);
+ return eSIR_SUCCESS;
+}
+
+
+#ifdef VOSS_ENABLED
+
+// ---------------------------------------------------------------------------
+/**
+ * peHandleMgmtFrame
+ *
+ * FUNCTION:
+ * Process the Management frames from TL
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS: TL sends the packet along with the VOS GlobalContext
+ *
+ * NOTE:
+ *
+ * @param pvosGCtx Global Vos Context
+ * @param vossBuff Packet
+ * @return None
+ */
+
+VOS_STATUS peHandleMgmtFrame( v_PVOID_t pvosGCtx, v_PVOID_t vosBuff)
+{
+ tpAniSirGlobal pMac;
+ tpSirMacMgmtHdr mHdr;
+ tSirMsgQ msg;
+ vos_pkt_t *pVosPkt;
+ VOS_STATUS vosStatus;
+ v_U8_t *pRxPacketInfo;
+
+ pVosPkt = (vos_pkt_t *)vosBuff;
+ if (NULL == pVosPkt)
+ {
+ return VOS_STATUS_E_FAILURE;
+ }
+
+ pMac = (tpAniSirGlobal)vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
+ if (NULL == pMac)
+ {
+ // cannot log a failure without a valid pMac
+ vos_pkt_return_packet(pVosPkt);
+ return VOS_STATUS_E_FAILURE;
+ }
+
+ vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (void *)&pRxPacketInfo, VOS_FALSE );
+
+ if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+ {
+ vos_pkt_return_packet(pVosPkt);
+ return VOS_STATUS_E_FAILURE;
+ }
+
+
+ //
+ // The MPDU header is now present at a certain "offset" in
+ // the BD and is specified in the BD itself
+ //
+ mHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+ if(mHdr->fc.type == SIR_MAC_MGMT_FRAME)
+ {
+ PELOG1(limLog( pMac, LOG1,
+ FL ( "RxBd=%p mHdr=%p Type: %d Subtype: %d Sizes:FC%d Mgmt%d\n"),
+ pRxBd, mHdr, mHdr->fc.type, mHdr->fc.subType, sizeof(tSirMacFrameCtl), sizeof(tSirMacMgmtHdr) );)
+
+ MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT, 0,
+ LIM_TRACE_MAKE_RXMGMT(mHdr->fc.subType,
+ (tANI_U16) (((tANI_U16) (mHdr->seqControl.seqNumHi << 4)) | mHdr->seqControl.seqNumLo)));)
+ }
+
+
+ // Forward to MAC via mesg = SIR_BB_XPORT_MGMT_MSG
+ msg.type = SIR_BB_XPORT_MGMT_MSG;
+ msg.bodyptr = vosBuff;
+ msg.bodyval = 0;
+
+ if( eSIR_SUCCESS != sysBbtProcessMessageCore( pMac,
+ &msg,
+ mHdr->fc.type,
+ mHdr->fc.subType ))
+ {
+ vos_pkt_return_packet(pVosPkt);
+ limLog( pMac, LOGW,
+ FL ( "sysBbtProcessMessageCore failed to process SIR_BB_XPORT_MGMT_MSG\n" ));
+ return VOS_STATUS_E_FAILURE;
+ }
+
+ return VOS_STATUS_SUCCESS;
+}
+
+// ---------------------------------------------------------------------------
+/**
+ * peRegisterTLHandle
+ *
+ * FUNCTION:
+ * Registers the Handler which, process the Management frames from TL
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @return None
+ */
+
+void peRegisterTLHandle(tpAniSirGlobal pMac)
+{
+ v_PVOID_t pvosGCTx;
+ VOS_STATUS retStatus;
+
+ pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
+
+ retStatus = WLANTL_RegisterMgmtFrmClient(pvosGCTx, peHandleMgmtFrame);
+
+ if (retStatus != VOS_STATUS_SUCCESS)
+ limLog( pMac, LOGP, FL("Registering the PE Handle with TL has failed bailing out...\n"));
+
+}
+#endif
+
+
+/**
+ * limCheckStateForLearnMode()
+ *
+ *FUNCTION:
+ * This function is called by SCH to verify if LIM is in a state
+ * to put system into Learn mode
+ *
+ *LOGIC:
+ * NA
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return eSIR_SUCCESS - LIM is in a state to put system
+ * into Learn Mode
+ * eSIR_FAILURE - LIM is NOT in a state to put system
+ * into Learn Mode
+ */
+
+tSirRetStatus
+limCheckStateForLearnMode(tpAniSirGlobal pMac)
+{
+ switch (pMac->lim.gLimSmeState)
+ {
+ case eLIM_SME_OFFLINE_STATE:
+ case eLIM_SME_IDLE_STATE:
+ case eLIM_SME_JOIN_FAILURE_STATE:
+ case eLIM_SME_NORMAL_STATE:
+ case eLIM_SME_LINK_EST_STATE:
+ // LIM is in a state to put system into Learn mode
+ return eSIR_SUCCESS;
+
+ default:
+ // LIM is NOT in a state to put system into Learn mode
+ return eSIR_FAILURE;
+ }
+} /*** end limCheckStateForLearnMode() ***/
+
+
+
+/**
+ * limIsSystemInScanState()
+ *
+ *FUNCTION:
+ * This function is called by various MAC software modules to
+ * determine if System is in Scan/Learn state
+ *
+ *LOGIC:
+ * NA
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return true - System is in Scan/Learn state
+ * false - System is NOT in Scan/Learn state
+ */
+
+tANI_U8
+limIsSystemInScanState(tpAniSirGlobal pMac)
+{
+ switch (pMac->lim.gLimSmeState)
+ {
+ case eLIM_SME_CHANNEL_SCAN_STATE:
+ case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
+ case eLIM_SME_LINK_EST_WT_SCAN_STATE:
+ case eLIM_SME_WT_SCAN_STATE:
+ // System is in Learn mode
+ return true;
+
+ default:
+ // System is NOT in Learn mode
+ return false;
+ }
+} /*** end limIsSystemInScanState() ***/
+
+
+
+/**
+ * limIsSystemInActiveState()
+ *
+ *FUNCTION:
+ * This function is called by various MAC software modules to
+ * determine if System is in Active/Wakeup state
+ *
+ *LOGIC:
+ * NA
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return true - System is in Active state
+ * false - System is not in Active state
+ */
+
+tANI_U8 limIsSystemInActiveState(tpAniSirGlobal pMac)
+{
+ switch (pMac->pmm.gPmmState)
+ {
+ case ePMM_STATE_BMPS_WAKEUP:
+ case ePMM_STATE_IMPS_WAKEUP:
+ case ePMM_STATE_READY:
+ // System is in Active mode
+ return true;
+ default:
+ return false;
+ // System is NOT in Active mode
+ }
+}
+
+
+#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+/**
+ * limCheckAndQuietBSS()
+ *
+ *FUNCTION:
+ * This function is called by limSetLearnMode() to check
+ * if BSS needs to be quieted and call limQuietBSS() to
+ * send data frame to self for that purpose.
+ *
+ *LOGIC:
+ * NA
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limCheckAndQuietBSS(tpAniSirGlobal pMac)
+{
+ tANI_U32 dur;
+
+ if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
+ {
+ // LIM is in AP role. Quiet the BSS before
+ // switching to channel to be learned
+ if (pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration >
+ LIM_MAX_QUIET_DURATION)
+ {
+ // May need to quiet BSS multiple times.
+ // Quiet for a limit of 32 msecs on Learn
+ // duration for now.
+ dur = LIM_MAX_QUIET_DURATION;
+ }
+ else
+ {
+ dur =
+ pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration;
+ }
+ PELOG3(limLog(pMac, LOG3,
+ FL("*** Going to quiet BSS for duration=%d msec\n"),
+ dur);)
+
+ limQuietBss(pMac, dur);
+ }
+} /*** end limCheckAndQuietBSS() ***/
+#endif
+
+#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+/**
+ * limSetLearnMode()
+ *
+ *FUNCTION:
+ * This function is called to setup system into Learn mode
+ * to collect DFS measurements.
+ *
+ *LOGIC:
+ * NA
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limSetLearnMode(tpAniSirGlobal pMac)
+{
+ limSendHalInitScanReq(pMac, eLIM_HAL_INIT_LEARN_WAIT_STATE, eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN);
+ return;
+} /*** end limSetLearnMode() ***/
+
+/**
+ * limContinueChannelLearn()
+ *
+ *FUNCTION:
+ * This function is called to do measurement (learn) on current channel.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ *
+ * @return None
+ */
+
+void
+limContinueChannelLearn(tpAniSirGlobal pMac)
+{
+ tANI_U8 chanNum;
+ tSirMacSSid ssId;
+ tSirMacAddr bssId = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+
+ // Time to collect measurements
+ chanNum = limGetCurrentLearnChannel(pMac);
+
+ // Switch channel
+ pMac->lim.gLimSystemInScanLearnMode = 1;
+
+ if (pMac->lim.gpLimMeasReq->measControl.scanType == eSIR_ACTIVE_SCAN)
+ {
+ /// Prepare and send Probe Request frame
+ ssId.length = 0;
+ /* for learning channel, we don't include any additional IE */
+ limSendProbeReqMgmtFrame(pMac, &ssId, bssId, chanNum,pMac->lim.gSelfMacAddr, 0 , NULL);
+ }
+
+ // Activate Learn duration timer during which
+ // DFS measurements are made.
+ pMac->lim.gLimMeasParams.shortDurationCount++;
+ limDeactivateAndChangeTimer(pMac, eLIM_LEARN_DURATION_TIMER);
+
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_LEARN_DURATION_TIMER));
+ if (tx_timer_activate(&pMac->lim.gLimMeasParams.learnDurationTimer)
+ != TX_SUCCESS)
+ {
+ /// Could not activate learn duration timer.
+ // Log error
+ limLog(pMac, LOGP, FL("could not activate learn duration timer\n"));
+
+ return;
+ }
+} /*** end limContinueChannelLearn() ***/
+
+
+/**
+ * limReEnableLearnMode()
+ *
+ *FUNCTION:
+ * This function is called by various MAC software modules to
+ * re-enable Learn mode measurements.
+ *
+ *LOGIC:
+ * NA
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limReEnableLearnMode(tpAniSirGlobal pMac)
+{
+ PELOG4(limLog(pMac, LOG4, FL("quietEnabled = %d\n"),
+ pMac->lim.gLimSpecMgmt.fQuietEnabled);)
+
+ /** Stop measurement temperorily when radar is detected or channel
+ * switch is running as part of periodic DFS */
+ if (!pMac->lim.gpLimMeasReq || LIM_IS_RADAR_DETECTED(pMac) ||
+ (pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING))
+ {
+ return;
+ }
+
+ if (pMac->lim.gLimSpecMgmt.fQuietEnabled)
+ {
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_QUIET_BSS_TIMER));
+#ifdef GEN6_TODO
+ /* revisit this piece of code to assign the appropriate sessionId below
+ * priority - HIGH
+ */
+ pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
+#endif
+ if (tx_timer_activate(
+ &pMac->lim.limTimers.gLimQuietBssTimer)
+ != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("could not start Quiet Bss timer\n"));
+ return;
+ }
+ pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+ }
+ else
+ {
+ limDeactivateAndChangeTimer(pMac, eLIM_LEARN_INTERVAL_TIMER);
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_LEARN_INTERVAL_TIMER));
+#ifdef GEN6_TODO
+ /* revisit this piece of code to assign the appropriate sessionId below
+ */
+ pMac->lim.gLimMeasParams.learnIntervalTimer.sessionId = sessionId;
+#endif
+ if (tx_timer_activate(
+ &pMac->lim.gLimMeasParams.learnIntervalTimer)
+ != TX_SUCCESS)
+ {
+ /// Could not activate Learn Interval timer.
+ // Log error
+ limLog(pMac, LOGP, FL("could not start Learn Interval timer\n"));
+ return;
+ }
+ }
+
+ PELOG3(limLog(pMac, LOG3, FL("Re-enabled Learn mode Measurements\n"));)
+ pMac->lim.gLimMeasParams.disableMeasurements = 0;
+
+ return;
+} /*** end limReEnableLearnMode() ***/
+
+#endif //#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+
+
+/**
+*\brief limReceivedHBHandler()
+*
+* This function is called by schBeaconProcess() upon
+* receiving a Beacon on STA. This also gets called upon
+* receiving Probe Response after heat beat failure is
+* detected.
+*
+* param pMac - global mac structure
+* param channel - channel number indicated in Beacon, Probe Response
+* return - none
+*/
+
+
+void
+limReceivedHBHandler(tpAniSirGlobal pMac, tANI_U8 channelId, tpPESession psessionEntry)
+{
+ if((channelId == 0 ) || (channelId == psessionEntry->currentOperChannel) )
+ psessionEntry->LimRxedBeaconCntDuringHB++;
+
+ pMac->pmm.inMissedBeaconScenario = FALSE;
+} /*** end limReceivedHBHandler() ***/
+
+
+
+#if 0
+void limResetHBPktCount(tpPESession psessionEntry)
+{
+ psessionEntry->LimRxedBeaconCntDuringHB = 0;
+}
+#endif
+
+
+/*
+ * limProcessWdsInfo()
+ *
+ *FUNCTION:
+ * This function is called from schBeaconProcess in BP
+ *
+ *PARAMS:
+ * @param pMac - Pointer to Global MAC structure
+ * @param propIEInfo - proprietary IE info
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ *
+ *RETURNS:
+ *
+ */
+
+void limProcessWdsInfo(tpAniSirGlobal pMac,
+ tSirPropIEStruct propIEInfo)
+{
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+ tpSirSmeWdsInfoInd pSirSmeWdsInfoInd;
+ tANI_U8 *pTemp;
+ tSirMsgQ mmhMsg;
+
+ if (propIEInfo.wdsLength &&
+ propIEInfo.wdsLength <= ANI_WDS_INFO_MAX_LENGTH)
+ {
+ if (pMac->lim.gLimWdsInfo.wdsLength)
+ {
+ if ((propIEInfo.wdsLength ==
+ pMac->lim.gLimWdsInfo.wdsLength) &&
+ (palEqualMemory( pMac->hHdd,propIEInfo.wdsData,
+ pMac->lim.gLimWdsInfo.wdsBytes,
+ pMac->lim.gLimWdsInfo.wdsLength) ))
+
+ return; // no difference in WDS info
+ else
+ {
+ PELOG2(limLog(pMac, LOG2,
+ FL("Cached WDS Info: length %d bytes is: "),
+ pMac->lim.gLimWdsInfo.wdsLength);
+ sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2,
+ pMac->lim.gLimWdsInfo.wdsBytes,
+ pMac->lim.gLimWdsInfo.wdsLength);)
+
+ PELOG2(limLog(pMac, LOG2, FL("New WDS Info: length %d bytes is: "),
+ propIEInfo.wdsLength);
+ sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2,
+ propIEInfo.wdsData,
+ propIEInfo.wdsLength);)
+
+ pMac->lim.gLimWdsInfo.wdsLength = propIEInfo.wdsLength;
+ palCopyMemory( pMac->hHdd, pMac->lim.gLimWdsInfo.wdsBytes,
+ propIEInfo.wdsData,
+ propIEInfo.wdsLength);
+
+ // send IND to WSM
+ if (eHAL_STATUS_SUCCESS !=
+ palAllocateMemory(pMac->hHdd,
+ (void **) &pSirSmeWdsInfoInd,
+ sizeof(tSirSmeWdsInfoInd)))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("memory allocate failed for WDS_INFO_IND\n"));
+
+ return;
+ }
+
+ pSirSmeWdsInfoInd->messageType = eWNI_SME_WDS_INFO_IND;
+ pSirSmeWdsInfoInd->length = sizeof(tSirSmeWdsInfoInd);
+
+ pSirSmeWdsInfoInd->wdsInfo.wdsLength =
+ pMac->lim.gLimWdsInfo.wdsLength;
+
+ palCopyMemory( pMac->hHdd, pSirSmeWdsInfoInd->wdsInfo.wdsBytes,
+ pMac->lim.gLimWdsInfo.wdsBytes,
+ pMac->lim.gLimWdsInfo.wdsLength);
+
+ pTemp = (tANI_U8 *) pSirSmeWdsInfoInd;
+
+ PELOG2(limLog(pMac, LOG2,
+ FL("eWNI_SME_WDS_INFO_IND length %d bytes is: "),
+ pSirSmeWdsInfoInd->length);
+ sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, pTemp,
+ pSirSmeWdsInfoInd->length);)
+
+ mmhMsg.type = eWNI_SME_WDS_INFO_IND;
+ mmhMsg.bodyptr = pSirSmeWdsInfoInd;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+ pMac->lim.gLimNumWdsInfoInd++;
+ }
+ }
+ else
+ {
+ // first WDS info
+ pMac->lim.gLimWdsInfo.wdsLength = propIEInfo.wdsLength;
+ palCopyMemory( pMac->hHdd, pMac->lim.gLimWdsInfo.wdsBytes,
+ propIEInfo.wdsData,
+ propIEInfo.wdsLength);
+
+ PELOG1(limLog(pMac, LOG1, FL("First WDS Info: length %d bytes is:\n"),
+ pMac->lim.gLimWdsInfo.wdsLength);
+ sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1,
+ pMac->lim.gLimWdsInfo.wdsBytes,
+ pMac->lim.gLimWdsInfo.wdsLength);)
+
+ }
+ }
+ else
+ {
+ PELOG2(limLog(pMac, LOG2,
+ FL("Illegal WDS length = %d\n"),
+ propIEInfo.wdsLength);)
+ }
+#endif
+}
+
+
+
+/**
+ * limInitWdsInfoParams()
+ *
+ *FUNCTION:
+ * This function is called while processing
+ * START_BSS/JOIN/REASSOC_REQ to initialize WDS info
+ * ind/set related parameters.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limInitWdsInfoParams(tpAniSirGlobal pMac)
+{
+ pMac->lim.gLimWdsInfo.wdsLength = 0;
+ pMac->lim.gLimNumWdsInfoInd = 0;
+ pMac->lim.gLimNumWdsInfoSet = 0;
+} /*** limInitWdsInfoParams() ***/
+
+
+/** -------------------------------------------------------------
+\fn limUpdateOverlapStaParam
+\brief Updates overlap cache and param data structure
+\param tpAniSirGlobal pMac
+\param tSirMacAddr bssId
+\param tpLimProtStaParams pStaParams
+\return None
+ -------------------------------------------------------------*/
+void
+limUpdateOverlapStaParam(tpAniSirGlobal pMac, tSirMacAddr bssId, tpLimProtStaParams pStaParams)
+{
+ int i;
+ if (!pStaParams->numSta)
+ {
+ palCopyMemory( pMac->hHdd, pMac->lim.protStaOverlapCache[0].addr,
+ bssId,
+ sizeof(tSirMacAddr));
+ pMac->lim.protStaOverlapCache[0].active = true;
+
+ pStaParams->numSta = 1;
+
+ return;
+ }
+
+ for (i=0; i<LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
+ {
+ if (pMac->lim.protStaOverlapCache[i].active)
+ {
+ if (palEqualMemory( pMac->hHdd,pMac->lim.protStaOverlapCache[i].addr,
+ bssId,
+ sizeof(tSirMacAddr))) {
+ return; }
+ }
+ else
+ break;
+ }
+
+ if (i == LIM_PROT_STA_OVERLAP_CACHE_SIZE)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Overlap cache is full\n"));)
+ }
+ else
+ {
+ palCopyMemory( pMac->hHdd, pMac->lim.protStaOverlapCache[i].addr,
+ bssId,
+ sizeof(tSirMacAddr));
+ pMac->lim.protStaOverlapCache[i].active = true;
+
+ pStaParams->numSta++;
+ }
+}
+
+
+/**
+ * limHandleIBSScoalescing()
+ *
+ *FUNCTION:
+ * This function is called upon receiving Beacon/Probe Response
+ * while operating in IBSS mode.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pBeacon - Parsed Beacon Frame structure
+ * @param pRxPacketInfo - Pointer to RX packet info structure
+ *
+ * @return Status whether to process or ignore received Beacon Frame
+ */
+
+tSirRetStatus
+limHandleIBSScoalescing(
+ tpAniSirGlobal pMac,
+ tpSchBeaconStruct pBeacon,
+ tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
+{
+ tpSirMacMgmtHdr pHdr;
+ tSirRetStatus retCode;
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+ if ( (!pBeacon->capabilityInfo.ibss) || (limCmpSSid(pMac, &pBeacon->ssId,psessionEntry) != true) )
+ /* Received SSID does not match => Ignore received Beacon frame. */
+ retCode = eSIR_LIM_IGNORE_BEACON;
+ else
+ {
+ tANI_U32 ieLen;
+ tANI_U16 tsfLater;
+ tANI_U8 *pIEs;
+ ieLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
+ tsfLater = WDA_GET_RX_TSF_LATER(pRxPacketInfo);
+ pIEs = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
+ PELOG3(limLog(pMac, LOG3, FL("BEFORE Coalescing tsfLater val :%d"), tsfLater);)
+ retCode = limIbssCoalesce(pMac, pHdr, pBeacon, pIEs, ieLen, tsfLater,psessionEntry);
+ }
+ return retCode;
+} /*** end limHandleIBSScoalescing() ***/
+
+
+
+/**
+ * limDetectChangeInApCapabilities()
+ *
+ *FUNCTION:
+ * This function is called while SCH is processing
+ * received Beacon from AP on STA to detect any
+ * change in AP's capabilities. If there any change
+ * is detected, Roaming is informed of such change
+ * so that it can trigger reassociation.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ * Notification is enabled for STA product only since
+ * it is not a requirement on BP side.
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pBeacon Pointer to parsed Beacon structure
+ * @return None
+ */
+
+void
+limDetectChangeInApCapabilities(tpAniSirGlobal pMac,
+ tpSirProbeRespBeacon pBeacon,
+ tpPESession psessionEntry)
+{
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ tANI_U8 len;
+ tSirSmeApNewCaps apNewCaps;
+ tANI_U8 newChannel;
+ apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
+ newChannel = (tANI_U8) pBeacon->channelNumber;
+
+ if ((psessionEntry->limSentCapsChangeNtf == false) &&
+ (((!limIsNullSsid(&pBeacon->ssId)) && (limCmpSSid(pMac, &pBeacon->ssId, psessionEntry) == false)) ||
+ ((SIR_MAC_GET_ESS(apNewCaps.capabilityInfo) != SIR_MAC_GET_ESS(psessionEntry->limCurrentBssCaps)) ||
+ (SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) != SIR_MAC_GET_PRIVACY(psessionEntry->limCurrentBssCaps)) ||
+ (SIR_MAC_GET_SHORT_PREAMBLE(apNewCaps.capabilityInfo) != SIR_MAC_GET_SHORT_PREAMBLE(psessionEntry->limCurrentBssCaps)) ||
+ (SIR_MAC_GET_QOS(apNewCaps.capabilityInfo) != SIR_MAC_GET_QOS(psessionEntry->limCurrentBssCaps)) ||
+ (newChannel != psessionEntry->currentOperChannel)
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ || (LIM_BSS_CAPS_GET(HCF, psessionEntry->limCurrentBssQosCaps) !=
+ pBeacon->propIEinfo.hcfEnabled)
+#endif
+ )))
+ {
+
+ /**
+ * BSS capabilities have changed.
+ * Inform Roaming.
+ */
+ len = sizeof(tSirMacCapabilityInfo) +
+ sizeof(tSirMacAddr) + sizeof(tANI_U8) +
+ 3 * sizeof(tANI_U8) + // reserved fields
+ pBeacon->ssId.length + 1;
+
+ palCopyMemory( pMac->hHdd, apNewCaps.bssId,
+ psessionEntry->bssId,
+ sizeof(tSirMacAddr));
+ if (newChannel != psessionEntry->currentOperChannel)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Channel Change from %d --> %d - "
+ "Ignoring beacon!\n"),
+ psessionEntry->currentOperChannel, newChannel);)
+ return;
+ }
+ else
+ apNewCaps.channelId = psessionEntry->currentOperChannel;
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &apNewCaps.ssId,
+ (tANI_U8 *) &pBeacon->ssId,
+ pBeacon->ssId.length + 1);
+
+ psessionEntry->limSentCapsChangeNtf = true;
+ limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_AP_CAPS_CHANGED,
+ (tANI_U32 *) &apNewCaps,
+ len, psessionEntry->smeSessionId);
+ }
+#endif
+} /*** limDetectChangeInApCapabilities() ***/
+
+
+
+
+// ---------------------------------------------------------------------
+/**
+ * limUpdateShortSlot
+ *
+ * FUNCTION:
+ * Enable/Disable short slot
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param enable Flag to enable/disable short slot
+ * @return None
+ */
+
+tSirRetStatus limUpdateShortSlot(tpAniSirGlobal pMac, tpSirProbeRespBeacon pBeacon, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
+{
+
+ tSirSmeApNewCaps apNewCaps;
+ tANI_U32 cShortSlot, nShortSlot;
+
+ apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, &cShortSlot) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("unable to get short slot time\n"));
+
+ // Earlier implementation: determine the appropriate short slot mode based on AP advertised modes
+ // when erp is present, apply short slot always unless, prot=on && shortSlot=off
+ // if no erp present, use short slot based on current ap caps
+
+ // Issue with earlier implementation : Cisco 1231 BG has shortSlot = 0, erpIEPresent and useProtection = 0 (Case4);
+
+ //Resolution : always use the shortSlot setting the capability info to decide slot time.
+ // The difference between the earlier implementation and the new one is only Case4.
+ /*
+ ERP IE Present | useProtection | shortSlot = QC STA Short Slot
+ Case1 1 1 1 1 //AP should not advertise this combination.
+ Case2 1 1 0 0
+ Case3 1 0 1 1
+ Case4 1 0 0 0
+ Case5 0 1 1 1
+ Case6 0 1 0 0
+ Case7 0 0 1 1
+ Case8 0 0 0 0
+ */
+ nShortSlot = SIR_MAC_GET_SHORT_SLOT_TIME(apNewCaps.capabilityInfo);
+
+ if (nShortSlot != cShortSlot)
+ {
+ // Short slot time capability of AP has changed. Adopt to it.
+ PELOG1(limLog(pMac, LOG1, FL("Shortslot capability of AP changed: %d\n"), nShortSlot);)
+ ((tpSirMacCapabilityInfo)&psessionEntry->limCurrentBssCaps)->shortSlotTime = (tANI_U16)nShortSlot;
+ pBeaconParams->fShortSlotTime = (tANI_U8) nShortSlot;
+ pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
+
+ if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, nShortSlot) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("could not update short slot time at CFG\n"));)
+ }
+ return eSIR_SUCCESS;
+}
+
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+
+/**
+ * limUpdateQuietIEInBeacons()
+ *
+ *FUNCTION:
+ * This function is called by specialBeaconProcessing(),
+ * when it is time to generate the next beacon.
+ * If gLimQuietState is not in the INIT state, then it
+ * means that the next beacon may need to include some
+ * information about the Quiet BSS IE.
+ * This function makes that decision based on the current
+ * state of gLimQuietState
+ *
+ *LOGIC:
+ * This routine invokes schSetFixedBeaconFields() only
+ * if necessary, as it is expensive to update the fixed
+ * beacon fields during each beacon interval.
+ *
+ *ASSUMPTIONS:
+ * This Quiet BSS IE will be sent out as part of
+ * Proprietary IE's. If 802.11H is enabled, this IE
+ * will be sent out as defined in the 11H spec
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return true, if the beacon fields need updating
+ * false, if not
+ */
+tANI_BOOLEAN limUpdateQuietIEInBeacons( tpAniSirGlobal pMac )
+{
+ tANI_BOOLEAN fUpdateBeaconFields = eANI_BOOLEAN_TRUE;
+
+ limLog( pMac, LOG2, FL("Quiet BSS State = %d\n"),
+ pMac->lim.gLimSpecMgmt.quietState );
+ switch( pMac->lim.gLimSpecMgmt.quietState )
+ {
+ case eLIM_QUIET_BEGIN:
+ // We need to start broadcasting the Quiet BSS IE
+ // Transition to eLIM_QUIET_RUNNING
+ pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
+ break;
+
+ case eLIM_QUIET_RUNNING:
+ // Start down-counting...
+ pMac->lim.gLimSpecMgmt.quietCount--;
+ if( pMac->lim.gLimSpecMgmt.quietCount == 0 )
+ {
+ //
+ // We no longer need to broadcast the Quiet BSS IE
+ //
+ // NOTE - We still need to call schSetFixedBeaconFields()
+ // one last time, just to remove the Quiet BSS IE from
+ // the list of fixed beacon fields
+ //
+ // Transition to eLIM_QUIET_END
+ pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_END;
+ limProcessLearnIntervalTimeout(pMac);
+ }
+ break;
+
+ case eLIM_QUIET_CHANGED:
+ //
+ // State possibly changed via setupQuietBss().
+ // This means, gLimQuietCount has been changed!!
+ //
+ // NOTE - We still need to call schSetFixedBeaconFields()
+ // one last time, just to remove the Quiet BSS IE from
+ // the list of fixed beacon fields
+ //
+
+ // Transition to eLIM_QUIET_END
+ pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_END;
+ break;
+
+ case eLIM_QUIET_INIT:
+ case eLIM_QUIET_END:
+ // Transition to eLIM_QUIET_INIT
+ pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+ // Fall thru'...
+ default:
+ fUpdateBeaconFields = eANI_BOOLEAN_FALSE;
+ break;
+ }
+
+ return fUpdateBeaconFields;
+}
+
+#endif
+
+#if ((defined ANI_PRODUCT_TYPE_AP) && (defined ANI_AP_SDK))
+void limConvertScanDuration(tpAniSirGlobal pMac)
+{
+ tpSirSmeMeasurementReq pMeasReq = pMac->lim.gpLimMeasReq;
+ tpLimScanDurationConvert scanDurConv = &pMac->lim.gLimScanDurationConvert;
+
+ /* This is not a good idea to convert {long}shortChannelScanDuration from mS to TICKS *
+ * The reason is that {long}shortChannelScanDuration is used all over and a lot of code *
+ * that assumes the old mS definition was never changed to accommodate this new change to TICKS. *
+ * If optimization is needed, create another set of shadow variables to store the converted *
+ * values in Ticks, and TU. */
+ scanDurConv->shortChannelScanDuration_tick =
+ SYS_MS_TO_TICKS(pMeasReq->measDuration.shortChannelScanDuration +SYS_TICK_DUR_MS-1);
+
+ /* convert shortChannelScanDuration to TU also for CB scan, used to set gLimQuietDuration */
+ /* (shortChanneScanDuration * 1000) / 2^10 */
+ scanDurConv->shortChannelScanDuration_TU = (pMeasReq->measDuration.shortChannelScanDuration * 1000) >> 10;
+
+ scanDurConv->longChannelScanDuration_tick =
+ SYS_MS_TO_TICKS(pMeasReq->measDuration.longChannelScanDuration +SYS_TICK_DUR_MS-1);
+
+ /* convert shortChannelScanDuration to TU also for CB scan, used to set gLimQuietDuration */
+ /* (longChanneScanDuration * 1000) / 2^10 */
+ scanDurConv->longChannelScanDuration_TU = (pMeasReq->measDuration.longChannelScanDuration * 1000) >> 10;
+}
+#endif /* ((defined ANI_PRODUCT_TYPE_AP) && (defined ANI_AP_SDK)) */
+
+
+#ifdef ANI_PRODUCT_TYPE_AP
+/**-------------------------------------------------
+\fn limIsRadarEnabled
+
+\brief Checks if radar is enabled
+\param pMac
+\return true - if Both 11h and radar enabled
+ false - if either is not enabled.
+ --------------------------------------------------*/
+tANI_BOOLEAN limIsRadarEnabled(tpAniSirGlobal pMac)
+{
+ tANI_U32 fEnabled;
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &fEnabled) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("HAL: could not retrieve radar config from CFG"));
+ return eANI_BOOLEAN_FALSE;
+ }
+
+ if (!fEnabled)
+ return eANI_BOOLEAN_FALSE;
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_RDET_FLAG, &fEnabled) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("HAL: could not retrieve radar config from CFG"));
+ return eANI_BOOLEAN_FALSE;
+ }
+
+ if (fEnabled)
+ return eANI_BOOLEAN_TRUE;
+
+ return eANI_BOOLEAN_FALSE;
+}
+
+/**---------------------------------------
+\fn limRadarInit
+\brief Initialize Radar Interrupt.
+
+\param pMac
+\return None
+ ----------------------------------------*/
+void limRadarInit(tpAniSirGlobal pMac)
+{
+ tANI_U32 status;
+ tSirMsgQ msg;
+
+ PELOG3(limLog(pMac, LOG3, FL("Radar Interrupt Already configured? %s\n"),
+ pMac->lim.gLimSpecMgmt.fRadarIntrConfigured?"Yes":"No");)
+ /** To avoid configuring the radar multiple times */
+ if (pMac->lim.gLimSpecMgmt.fRadarIntrConfigured)
+ return;
+
+ if (!limIsRadarEnabled(pMac))
+ return;
+ // Prepare and post message to HAL Message Queue
+ msg.type = WDA_INIT_RADAR_IND;
+ msg.bodyptr = NULL;
+ msg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+ status = wdaPostCtrlMsg(pMac, &msg);
+ if (status != eHAL_STATUS_SUCCESS)
+ {
+ limLog(pMac, LOGP,
+ FL("posting to HAL failed, reason=%d\n"), status);
+ return;
+ }
+ pMac->lim.gLimSpecMgmt.fRadarIntrConfigured = eANI_BOOLEAN_TRUE;
+} /****** end limRadarInit() ******/
+
+#endif
+
+
+/** -----------------------------------------------------------------
+ \brief limHandleLowRssiInd() - handles low rssi indication
+
+ This function process the SIR_HAL_LOW_RSSI_IND message from
+ HAL, and sends a eWNI_SME_LOW_RSSI_IND to CSR.
+
+ \param pMac - global mac structure
+
+ \return
+
+ \sa
+ ----------------------------------------------------------------- */
+void limHandleLowRssiInd(tpAniSirGlobal pMac)
+{
+#if 0 //RSSI related indications will now go to TL and not PE
+ if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
+ (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
+ (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Sending LOW_RSSI_IND to SME \n"));)
+ limSendSmeRsp(pMac, eWNI_SME_LOW_RSSI_IND, eSIR_SME_SUCCESS, 0, 0);
+ }
+ else
+ {
+ limLog(pMac, LOGE,
+ FL("Received SIR_HAL_LOW_RSSI_IND while in incorrect state: %d\n"),
+ pMac->pmm.gPmmState);
+ }
+ return;
+#endif
+}
+
+
+/** -----------------------------------------------------------------
+ \brief limHandleBmpsStatusInd() - handles BMPS status indication
+
+ This function process the SIR_HAL_BMPS_STATUS_IND message from HAL,
+ and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
+ to SME with reason code 'eSME_EXIT_BMPS_IND_RCVD'.
+
+ HAL sends this message when Firmware fails to enter BMPS mode 'AFTER'
+ HAL had already send PE a SIR_HAL_ENTER_BMPS_RSP with status
+ code "success". Hence, HAL needs to notify PE to get out of BMPS mode.
+ This message can also come from FW anytime after we have entered BMPS.
+ This means we should handle it in WoWL and UAPSD states as well
+
+ \param pMac - global mac structure
+ \return - none
+ \sa
+ ----------------------------------------------------------------- */
+void limHandleBmpsStatusInd(tpAniSirGlobal pMac)
+{
+ switch(pMac->pmm.gPmmState)
+ {
+ case ePMM_STATE_BMPS_SLEEP:
+ case ePMM_STATE_UAPSD_WT_SLEEP_RSP:
+ case ePMM_STATE_UAPSD_SLEEP:
+ case ePMM_STATE_UAPSD_WT_WAKEUP_RSP:
+ case ePMM_STATE_WOWLAN:
+ PELOG1(limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME \n"));)
+ limSendExitBmpsInd(pMac, eSME_BMPS_STATUS_IND_RCVD);
+ break;
+
+ default:
+ limLog(pMac, LOGE,
+ FL("Received SIR_HAL_BMPS_STATUS_IND while in incorrect state: %d\n"),
+ pMac->pmm.gPmmState);
+ break;
+ }
+ return;
+}
+
+
+/** -----------------------------------------------------------------
+ \brief limHandleMissedBeaconInd() - handles missed beacon indication
+
+ This function process the SIR_HAL_MISSED_BEACON_IND message from HAL,
+ and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
+ to SME with reason code 'eSME_MISSED_BEACON_IND_RCVD'.
+
+ \param pMac - global mac structure
+ \return - none
+ \sa
+ ----------------------------------------------------------------- */
+void limHandleMissedBeaconInd(tpAniSirGlobal pMac)
+{
+ if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
+ (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
+ (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
+ {
+ pMac->pmm.inMissedBeaconScenario = TRUE;
+ PELOG1(limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME \n"));)
+ limSendExitBmpsInd(pMac, eSME_MISSED_BEACON_IND_RCVD);
+ }
+ else
+ {
+ limLog(pMac, LOGE,
+ FL("Received SIR_HAL_MISSED_BEACON_IND while in incorrect state: %d\n"),
+ pMac->pmm.gPmmState);
+ }
+ return;
+}
+
+/** -----------------------------------------------------------------
+ \brief limMicFailureInd() - handles mic failure indication
+
+ This function process the SIR_HAL_MIC_FAILURE_IND message from HAL,
+
+ \param pMac - global mac structure
+ \return - none
+ \sa
+ ----------------------------------------------------------------- */
+void limMicFailureInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
+{
+ tpSirSmeMicFailureInd pSirSmeMicFailureInd;
+ tpSirSmeMicFailureInd pSirMicFailureInd = (tpSirSmeMicFailureInd)pMsg->bodyptr;
+ tSirMsgQ mmhMsg;
+ tpPESession psessionEntry ;
+ tANI_U8 sessionId;
+
+ if((psessionEntry = peFindSessionByBssid(pMac,pSirMicFailureInd->bssId,&sessionId))== NULL)
+ {
+ limLog(pMac, LOGE,
+ FL("session does not exist for given BSSId\n"));
+ return;
+ }
+
+ if (eHAL_STATUS_SUCCESS !=
+ palAllocateMemory(pMac->hHdd,
+ (void **) &pSirSmeMicFailureInd,
+ sizeof(tSirSmeMicFailureInd)))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("memory allocate failed for eWNI_SME_MIC_FAILURE_IND\n"));
+ return;
+ }
+
+ pSirSmeMicFailureInd->messageType = eWNI_SME_MIC_FAILURE_IND;
+ pSirSmeMicFailureInd->length = sizeof(pSirSmeMicFailureInd);
+ pSirSmeMicFailureInd->sessionId = psessionEntry->smeSessionId;
+
+ vos_mem_copy(pSirSmeMicFailureInd->bssId,
+ pSirMicFailureInd->bssId,
+ sizeof(tSirMacAddr));
+
+ vos_mem_copy(pSirSmeMicFailureInd->info.srcMacAddr,
+ pSirMicFailureInd->info.srcMacAddr,
+ sizeof(tSirMacAddr));
+
+ vos_mem_copy(pSirSmeMicFailureInd->info.taMacAddr,
+ pSirMicFailureInd->info.taMacAddr,
+ sizeof(tSirMacAddr));
+
+ vos_mem_copy(pSirSmeMicFailureInd->info.dstMacAddr,
+ pSirMicFailureInd->info.dstMacAddr,
+ sizeof(tSirMacAddr));
+
+ vos_mem_copy(pSirSmeMicFailureInd->info.rxMacAddr,
+ pSirMicFailureInd->info.rxMacAddr,
+ sizeof(tSirMacAddr));
+
+ pSirSmeMicFailureInd->info.multicast =
+ pSirMicFailureInd->info.multicast;
+
+ pSirSmeMicFailureInd->info.keyId=
+ pSirMicFailureInd->info.keyId;
+
+ pSirSmeMicFailureInd->info.IV1=
+ pSirMicFailureInd->info.IV1;
+
+ vos_mem_copy(pSirSmeMicFailureInd->info.TSC,
+ pSirMicFailureInd->info.TSC,SIR_CIPHER_SEQ_CTR_SIZE);
+
+ mmhMsg.type = eWNI_SME_MIC_FAILURE_IND;
+ mmhMsg.bodyptr = pSirSmeMicFailureInd;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+ return;
+}
+
+
+/** -----------------------------------------------------------------
+ \brief limIsPktCandidateForDrop() - decides whether to drop the frame or not
+
+ This function is called before enqueuing the frame to PE queue for further processing.
+ This prevents unnecessary frames getting into PE Queue and drops them right away.
+ Frames will be droped in the following scenarios:
+
+ - In Scan State, drop the frames which are not marked as scan frames
+ - In non-Scan state, drop the frames which are marked as scan frames.
+ - Drop INFRA Beacons and Probe Responses in IBSS Mode
+ - Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
+
+ \param pMac - global mac structure
+ \return - none
+ \sa
+ ----------------------------------------------------------------- */
+
+tMgmtFrmDropReason limIsPktCandidateForDrop(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U32 subType)
+{
+ tANI_U32 framelen;
+ tANI_U8 *pBody;
+ tSirMacCapabilityInfo capabilityInfo;
+
+ /*
+ *
+ * In scan mode, drop only Beacon/Probe Response which are NOT marked as scan-frames.
+ * In non-scan mode, drop only Beacon/Probe Response which are marked as scan frames.
+ * Allow other mgmt frames, they must be from our own AP, as we don't allow
+ * other than beacons or probe responses in scan state.
+ */
+ if( (subType == SIR_MAC_MGMT_BEACON) ||
+ (subType == SIR_MAC_MGMT_PROBE_RSP))
+ {
+ if(pMac->pmm.inMissedBeaconScenario)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Do not drop beacon and probe response - Missed beacon sceanrio"));)
+ return eMGMT_DROP_NO_DROP;
+ }
+ if (limIsSystemInScanState(pMac))
+ {
+ if( WDA_IS_RX_IN_SCAN(pRxPacketInfo) )
+ return eMGMT_DROP_NO_DROP;
+ else
+ return eMGMT_DROP_NON_SCAN_MODE_FRAME;
+ }
+ else if (WDA_IS_RX_IN_SCAN(pRxPacketInfo))
+ {
+ return eMGMT_DROP_SCAN_MODE_FRAME;
+ }
+ }
+
+ framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
+ pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
+
+ /* Note sure if this is sufficient, basically this condition allows all probe responses and
+ * beacons from an infrastructure network
+ */
+ *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
+ if(!capabilityInfo.ibss)
+ return eMGMT_DROP_NO_DROP;
+#if 0
+ //Allow the mgmt frames to be queued if STA not in IBSS mode.
+ if (pMac->lim.gLimSystemRole != eLIM_STA_IN_IBSS_ROLE)
+ return eMGMT_DROP_NO_DROP;
+#endif
+
+ //Drop INFRA Beacons and Probe Responses in IBSS Mode
+ if( (subType == SIR_MAC_MGMT_BEACON) ||
+ (subType == SIR_MAC_MGMT_PROBE_RSP))
+ {
+ //drop the frame if length is less than 12
+ if(framelen < LIM_MIN_BCN_PR_LENGTH)
+ return eMGMT_DROP_INVALID_SIZE;
+
+ *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
+
+ //This can be enhanced to even check the SSID before deciding to enque the frame.
+ if(capabilityInfo.ess)
+ return eMGMT_DROP_INFRA_BCN_IN_IBSS;
+ }
+ else if( (subType == SIR_MAC_MGMT_PROBE_REQ) &&
+ (!WDA_GET_RX_BEACON_SENT(pRxPacketInfo)))
+ {
+ //Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
+ //In IBSS, the node which sends out the beacon, is supposed to respond to ProbeReq
+ return eMGMT_DROP_NOT_LAST_IBSS_BCN;
+ }
+
+ return eMGMT_DROP_NO_DROP;
+}
+
+
diff --git a/CORE/MAC/src/pe/lim/limAssocUtils.c b/CORE/MAC/src/pe/lim/limAssocUtils.c
new file mode 100644
index 0000000..9402dda
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limAssocUtils.c
@@ -0,0 +1,3799 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limAssocUtils.cc contains the utility functions
+ * LIM uses while processing (Re) Association messages.
+ * Author: Chandra Modumudi
+ * Date: 02/13/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ * 05/26/10 js WPA handling in (Re)Assoc frames
+ *
+ */
+
+#include "palTypes.h"
+#include "aniGlobal.h"
+#include "wniApi.h"
+#include "sirCommon.h"
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+#include "wniCfgAp.h"
+#else
+#include "wniCfgSta.h"
+#endif
+#include "pmmApi.h"
+#include "cfgApi.h"
+
+#include "schApi.h"
+#include "utilsApi.h"
+#include "limUtils.h"
+#include "limAssocUtils.h"
+#include "limSecurityUtils.h"
+#include "limSerDesUtils.h"
+#include "limStaHashApi.h"
+#include "limAdmitControl.h"
+#include "limSendMessages.h"
+#include "limIbssPeerMgmt.h"
+#include "limSession.h"
+
+#include "vos_types.h"
+#include "wlan_qct_wda.h"
+
+/*
+ * fill up the rate info properly based on what is actually supported by the peer
+ * TBD TBD TBD
+ */
+void
+limFillSupportedRatesInfo(
+ tpAniSirGlobal pMac,
+ tpDphHashNode pSta,
+ tpSirSupportedRates pRates,
+ tpPESession psessionEntry)
+{
+ //pSta will be NULL for self entry, so get the opRateMode based on the self mode.
+ //For the peer entry get it from the peer Capabilities present in hash table
+ if(pSta == NULL)
+ pRates->opRateMode = limGetStaRateMode((tANI_U8)psessionEntry->dot11mode);
+ else
+ pRates->opRateMode = limGetStaPeerType(pMac, pSta, psessionEntry);
+
+}
+
+
+/**
+ * limCmpSSid()
+ *
+ *FUNCTION:
+ * This function is called in various places within LIM code
+ * to determine whether received SSid is same as SSID in use.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param *prxSSid - pointer to SSID structure
+ *
+ * @return status - true for SSID match else false.
+ */
+
+tANI_U8
+limCmpSSid(tpAniSirGlobal pMac, tSirMacSSid *prxSSid,tpPESession psessionEntry)
+{
+
+ if( palEqualMemory( pMac->hHdd, (tANI_U8* ) prxSSid, (tANI_U8 *) &psessionEntry->ssId,
+ (tANI_U8) (psessionEntry->ssId.length + 1)))
+ return true;
+ else
+ return false;
+
+} /****** end limCmpSSid() ******/
+
+
+
+/**
+ * limCompareCapabilities()
+ *
+ *FUNCTION:
+ * This function is called during Association/Reassociation
+ * frame handling to determine whether received capabilities
+ * match with local capabilities or not.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pAssocReq - Pointer to received Assoc Req frame
+ * @param pLocalCapabs - Pointer to local capabilities
+ *
+ * @return status - true for Capabilitity match else false.
+ */
+
+tANI_U8
+limCompareCapabilities(tpAniSirGlobal pMac,
+ tSirAssocReq *pAssocReq,
+ tSirMacCapabilityInfo *pLocalCapabs,tpPESession psessionEntry)
+{
+ tANI_U32 val;
+
+
+ if ( ((psessionEntry->limSystemRole == eLIM_AP_ROLE)||
+ (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
+ (pAssocReq->capabilityInfo.ibss) )
+ {
+ // Requesting STA asserting IBSS capability.
+ return false;
+ }
+
+ // Compare CF capabilities
+ if (pAssocReq->capabilityInfo.cfPollable ||
+ pAssocReq->capabilityInfo.cfPollReq)
+ {
+ // AP does not support PCF functionality
+ return false;
+ }
+
+#if 0 //See CR24696 for analysis
+ // Compare privacy capability
+ if (pAssocReq->capabilityInfo.privacy != pLocalCapabs->privacy)
+ {
+ // AP does not support privacy
+ return false;
+ }
+#endif
+
+ // Compare short preamble capability
+ if (pAssocReq->capabilityInfo.shortPreamble &&
+ (pAssocReq->capabilityInfo.shortPreamble !=
+ pLocalCapabs->shortPreamble))
+ {
+ PELOG1(limLog(pMac, LOG1,
+ FL("Allowing a STA requesting short preamble while AP does not support it\n"));)
+#if 0
+ // AP does not support short preamable
+ return false;
+#endif
+ }
+
+
+ limLog(pMac, LOGW, "QoS in AssocReq: %d, local ShortP: %d\n",
+ pAssocReq->capabilityInfo.qos,
+ pLocalCapabs->qos);
+
+ // Compare QoS capability
+ if (pAssocReq->capabilityInfo.qos &&
+ (pAssocReq->capabilityInfo.qos != pLocalCapabs->qos))
+ {
+ /*Temporary hack for UPF to skip 11e capability check in order to interop with
+ CSR - proper fix needs to be put in place*/
+ if ( 0 != vos_get_skip_11e_check())
+ {
+ limLog(pMac, LOG1, FL("Received unmatched QOS but cfg to suppress - continuing\n"));
+ }
+ else
+ {
+ // AP does not support QoS capability
+ return false;
+ }
+ }
+
+
+ /*
+ * If AP supports shortSlot and if apple user has
+ * enforced association only from shortSlot station,
+ * then AP must reject any station that does not support
+ * shortSlot
+ */
+ if ( ((psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) && (pLocalCapabs->shortSlotTime == 1) )
+
+ {
+ if (wlan_cfgGetInt(pMac, WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY, &val) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("error getting WNI_CFG_FORCE_SHORT_SLOT_ASSOC_ONLY \n"));
+ return false;
+ }
+ if(val)
+ {
+ if (pAssocReq->capabilityInfo.shortSlotTime != pLocalCapabs->shortSlotTime)
+ return false;
+ }
+ }
+
+ return true;
+} /****** end limCompareCapabilities() ******/
+
+
+/**
+ * limCheckRxBasicRates()
+ *
+ *FUNCTION:
+ * This function is called during Association/Reassociation
+ * frame handling to determine whether received rates in
+ * Assoc/Reassoc request frames include all BSS basic rates
+ * or not.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param rxRateSet - pointer to SSID structure
+ *
+ * @return status - true if ALL BSS basic rates are present in the
+ * received rateset else false.
+ */
+
+tANI_U8
+limCheckRxBasicRates(tpAniSirGlobal pMac, tSirMacRateSet rxRateSet,tpPESession psessionEntry)
+{
+ tSirMacRateSet *pRateSet, basicRate;
+ tANI_U8 i, j, k, match;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pRateSet, sizeof(tSirMacRateSet)))
+ {
+ // Log error
+ limLog(pMac, LOGP, FL("call to palAllocateMemory failed for RATESET\n"));
+
+ return false;
+ }
+
+
+ #if 0
+ if (wlan_cfgGetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET,
+ (tANI_U8 *) &pRateSet->rate,
+ (tANI_U32 *) &cfgLen) != eSIR_SUCCESS)
+ {
+ /// Could not get Operational rateset from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve Operational rateset\n"));
+
+ // Free up memory allocated for rateset
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pRateSet);
+
+ return false;
+ }
+ #endif //TO SUPPORT BT-AMP
+
+ /* Copy operational rate set from session Entry */
+ palCopyMemory(pMac->hHdd, pRateSet->rate, (psessionEntry->rateSet.rate), psessionEntry->rateSet.numRates);
+
+ pRateSet->numRates = psessionEntry->rateSet.numRates;
+
+ // Extract BSS basic rateset from operational rateset
+ for (i = 0, j = 0; i < pRateSet->numRates; i++)
+ {
+ if ((pRateSet->rate[i] & 0x80) == 0x80)
+ {
+ // msb is set, so this is a basic rate
+ basicRate.rate[j++] = pRateSet->rate[i];
+ }
+ }
+
+ /*
+ * For each BSS basic rate, find if it is present in the
+ * received rateset.
+ */
+ for (k = 0; k < j; k++)
+ {
+ match = 0;
+ for (i = 0; i < rxRateSet.numRates; i++)
+ {
+ if ((rxRateSet.rate[i] | 0x80) == basicRate.rate[k])
+ match = 1;
+ }
+
+ if (!match)
+ {
+ // Free up memory allocated for rateset
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pRateSet);
+
+ return false;
+ }
+ }
+
+ // Free up memory allocated for rateset
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pRateSet);
+
+ return true;
+} /****** end limCheckRxBasicRates() ******/
+
+
+
+/**
+ * limCheckMCSSet()
+ *
+ *FUNCTION:
+ * This function is called during Association/Reassociation
+ * frame handling to determine whether received MCS rates in
+ * Assoc/Reassoc request frames includes all Basic MCS Rate Set or not.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param supportedMCSSet - pointer to Supported MCS Rate Set
+ *
+ * @return status - true if ALL MCS Basic Rate Set rates are present in the
+ * received rateset else false.
+ */
+
+tANI_U8
+limCheckMCSSet(tpAniSirGlobal pMac, tANI_U8* supportedMCSSet)
+{
+ tANI_U8 basicMCSSet[SIZE_OF_BASIC_MCS_SET] = {0};
+ tANI_U32 cfgLen = 0;
+ tANI_U8 i;
+ tANI_U8 validBytes;
+ tANI_U8 lastByteMCSMask = 0x1f;
+
+
+ cfgLen = WNI_CFG_BASIC_MCS_SET_LEN;
+ if (wlan_cfgGetStr(pMac, WNI_CFG_BASIC_MCS_SET,
+ (tANI_U8 *) basicMCSSet,
+ (tANI_U32 *) &cfgLen) != eSIR_SUCCESS)
+ {
+ /// Could not get Basic MCS rateset from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve Basic MCS rateset\n"));
+ return false;
+ }
+
+ validBytes = VALID_MCS_SIZE/8;
+
+ //check if all the Basic MCS Bits are set in supported MCS bitmap
+ for(i=0; i<validBytes; i++)
+ {
+ if( (basicMCSSet[i] & supportedMCSSet[i]) != basicMCSSet[i])
+ {
+ PELOGW(limLog(pMac, LOGW, FL("One of Basic MCS Set Rates is not supported by the Station."));)
+ return false;
+ }
+ }
+
+ //check the last 5 bits of the valid MCS bitmap
+ if( ((basicMCSSet[i] & lastByteMCSMask) & (supportedMCSSet[i] & lastByteMCSMask)) !=
+ (basicMCSSet[i] & lastByteMCSMask))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("One of Basic MCS Set Rates is not supported by the Station."));)
+ return false;
+ }
+
+ return true;
+}
+
+#ifdef WLAN_SOFTAP_FEATURE
+
+#define SECURITY_SUITE_TYPE_MASK 0xFF
+#define SECURITY_SUITE_TYPE_WEP40 0x1
+#define SECURITY_SUITE_TYPE_TKIP 0x2
+#define SECURITY_SUITE_TYPE_CCMP 0x4
+#define SECURITY_SUITE_TYPE_WEP104 0x4
+
+/**
+ * limCheckRxRSNIeMatch()
+ *
+ *FUNCTION:
+ * This function is called during Association/Reassociation
+ * frame handling to determine whether received RSN in
+ * Assoc/Reassoc request frames include supported cipher suites or not.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param rxRSNIe - received RSN IE in (Re)Assco req
+ *
+ * @return status - true if ALL BSS basic rates are present in the
+ * received rateset else false.
+ */
+
+tANI_U8
+limCheckRxRSNIeMatch(tpAniSirGlobal pMac, tDot11fIERSN rxRSNIe,tpPESession pSessionEntry, tANI_U8 staIsHT)
+{
+ tDot11fIERSN *pRSNIe;
+ tANI_U8 i, j, match, onlyNonHtCipher = 1;
+
+
+ //RSN IE should be received from PE
+ pRSNIe = &pSessionEntry->gStartBssRSNIe;
+
+ // Check groupwise cipher suite
+ for (i = 0; i < sizeof(rxRSNIe.gp_cipher_suite); i++)
+ {
+ if (pRSNIe->gp_cipher_suite[i] != rxRSNIe.gp_cipher_suite[i])
+ {
+ return eSIR_MAC_INVALID_GROUP_CIPHER_STATUS;
+ }
+ }
+
+ /*
+ * For each Pairwise cipher suite check whether we support
+ * received pairwise
+ */
+ match = 0;
+ for (i = 0; i < rxRSNIe.pwise_cipher_suite_count; i++)
+ {
+ for(j = 0; j < pRSNIe->pwise_cipher_suite_count; j++)
+ {
+ if(palEqualMemory(pMac,&rxRSNIe.pwise_cipher_suites[i],
+ &pRSNIe->pwise_cipher_suites[j],
+ sizeof(pRSNIe->pwise_cipher_suites[j])))
+ {
+ match = 1;
+ break;
+ }
+ }
+
+ if ((staIsHT)
+#ifdef ANI_LITTLE_BYTE_ENDIAN
+ &&( (rxRSNIe.pwise_cipher_suites[i][3] & SECURITY_SUITE_TYPE_MASK) == SECURITY_SUITE_TYPE_CCMP))
+#else
+ &&( (rxRSNIe.pwise_cipher_suites[i][0] & SECURITY_SUITE_TYPE_MASK) == SECURITY_SUITE_TYPE_CCMP))
+#endif
+ {
+ onlyNonHtCipher=0;
+ }
+
+ }
+
+ if ((!match) || ((staIsHT) && onlyNonHtCipher))
+ {
+ return eSIR_MAC_INVALID_PAIRWISE_CIPHER_STATUS;
+ }
+ /* Check RSN capabilities */
+ if(rxRSNIe.preauth == true) //this is supported by AP only
+ {
+ return eSIR_MAC_INVALID_RSN_IE_CAPABILITIES_STATUS;
+ }
+
+ return eSIR_SUCCESS;
+} /****** end limCheckRxRSNIeMatch() ******/
+
+/**
+ * limCheckRxWPAIeMatch()
+ *
+ *FUNCTION:
+ * This function is called during Association/Reassociation
+ * frame handling to determine whether received RSN in
+ * Assoc/Reassoc request frames include supported cipher suites or not.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param rxWPAIe - Received WPA IE in (Re)Assco req
+ *
+ * @return status - true if ALL BSS basic rates are present in the
+ * received rateset else false.
+ */
+
+tANI_U8
+limCheckRxWPAIeMatch(tpAniSirGlobal pMac, tDot11fIEWPA rxWPAIe,tpPESession pSessionEntry, tANI_U8 staIsHT)
+{
+ tDot11fIEWPA *pWPAIe;
+ tANI_U8 i, j, match, onlyNonHtCipher = 1;
+
+ // WPA IE should be received from PE
+ pWPAIe = &pSessionEntry->gStartBssWPAIe;
+
+ // Check groupwise cipher suite
+ for (i = 0; i < 4; i++)
+ {
+ if (pWPAIe->multicast_cipher[i] != rxWPAIe.multicast_cipher[i])
+ {
+ return eSIR_MAC_INVALID_GROUP_CIPHER_STATUS;
+ }
+ }
+
+ /*
+ * For each Pairwise cipher suite check whether we support
+ * received pairwise
+ */
+ match = 0;
+ for (i = 0; i < rxWPAIe.unicast_cipher_count; i++)
+ {
+ for(j = 0; j < pWPAIe->unicast_cipher_count; j++)
+ {
+ if(palEqualMemory(pMac,rxWPAIe.unicast_ciphers[i],
+ pWPAIe->unicast_ciphers[j],
+ 4))
+ {
+ match = 1;
+ break;
+ }
+ }
+
+ if ((staIsHT)
+#ifdef ANI_LITTLE_BYTE_ENDIAN
+ &&( (rxWPAIe.unicast_ciphers[i][3] & SECURITY_SUITE_TYPE_MASK) == SECURITY_SUITE_TYPE_CCMP))
+#else
+ &&( (rxWPAIe.unicast_ciphers[i][0] & SECURITY_SUITE_TYPE_MASK) == SECURITY_SUITE_TYPE_CCMP))
+#endif
+ {
+ onlyNonHtCipher=0;
+ }
+
+ }
+
+ if ((!match) || ((staIsHT) && onlyNonHtCipher))
+ {
+ return eSIR_MAC_CIPHER_SUITE_REJECTED_STATUS;
+ }
+
+ return eSIR_SUCCESS;
+} /****** end limCheckRxWPAIeMatch() ******/
+
+#endif /* WLAN_SOFTAP_FEATURE */
+
+/**
+ * limCleanupRxPath()
+ *
+ *FUNCTION:
+ * This function is called to cleanup STA state at SP & RFP.
+ *
+ *LOGIC:
+ * To circumvent RFP's handling of dummy packet when it does not
+ * have an incomplete packet for the STA to be deleted, a packet
+ * with 'more framgents' bit set will be queued to RFP's WQ before
+ * queuing 'dummy packet'.
+ * A 'dummy' BD is pushed into RFP's WQ with type=00, subtype=1010
+ * (Disassociation frame) and routing flags in BD set to eCPU's
+ * Low Priority WQ.
+ * RFP cleans up its local context for the STA id mentioned in the
+ * BD and then pushes BD to eCPU's low priority WQ.
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pStaDs Pointer to the per STA data structure
+ * initialized by LIM and maintained at DPH
+ *
+ * @return None
+ */
+
+tSirRetStatus
+limCleanupRxPath(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
+{
+ tSirRetStatus retCode = eSIR_SUCCESS;
+
+
+ PELOGE(limLog( pMac, LOGE, FL("**Initiate cleanup\n"));)
+
+ limAbortBackgroundScan( pMac );
+
+ if (pMac->lim.gLimAddtsSent)
+ {
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_ADDTS_RSP_TIMER));
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
+ }
+
+ if (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_ASSOC_CNF_STATE)
+ {
+ limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER,
+ pStaDs->assocId);
+
+ if (!pStaDs->mlmStaContext.updateContext)
+ {
+ /**
+ * There is no context at Polaris to delete.
+ * Release our assigned AID back to the free pool
+ */
+ if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
+ (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
+ {
+ limReleaseAID(pMac, pStaDs->assocId);
+ }
+ limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
+
+ return retCode;
+ }
+ }
+
+ //delete all tspecs associated with this sta.
+ limAdmitControlDeleteSta(pMac, pStaDs->assocId);
+
+#if (WNI_POLARIS_FW_PRODUCT==AP)
+ // Reset PMM state for this STA if it exists
+ if (psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
+ pmmUpdatePMMode(pMac, pStaDs->assocId, 0);
+#endif
+
+ /**
+ * Make STA hash entry invalid at eCPU so that DPH
+ * does not process any more data packets and
+ * releases those BDs
+ */
+ pStaDs->valid = 0;
+ pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE;
+
+ if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
+ {
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_WT_DEL_STA_RSP_STATE));
+ psessionEntry->limMlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_WT_DEL_STA_RSP_STATE));
+ /* Deactivating probe after heart beat timer */
+ limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
+ limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
+ limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER);
+ pMac->lim.gLastBeaconDtimCount = 0;
+ pMac->lim.gLastBeaconDtimPeriod = 0;
+
+#ifdef FEATURE_WLAN_CCX
+ limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
+#endif
+
+ /**
+ * Update the status for PMM module
+ */
+ pmmResetPmmState(pMac);
+ }
+#ifdef WLAN_DEBUG
+ // increment a debug count
+ pMac->lim.gLimNumRxCleanup++;
+#endif
+
+ if (psessionEntry->limSmeState == eLIM_SME_JOIN_FAILURE_STATE) {
+ retCode = limDelBss( pMac, pStaDs, psessionEntry->bssIdx, psessionEntry);
+ }
+ else
+ retCode = limDelSta( pMac, pStaDs, true, psessionEntry);
+
+ return retCode;
+
+} /*** end limCleanupRxPath() ***/
+
+
+/**
+ * limSendDelStaCnf()
+ *
+ *FUNCTION:
+ * This function is called to send appropriate CNF message to SME
+ *
+ *LOGIC:
+ *
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param tpAniSirGlobal pMac,
+ * @param tSirMacAddr staDsAddr,
+ * @param tANI_U16 staDsAssocId,
+ * @param tLimMlmStaContext mlmStaContext,
+ * @param tSirResultCodes statusCode
+ *
+ * @return None
+ */
+
+void
+limSendDelStaCnf(tpAniSirGlobal pMac, tSirMacAddr staDsAddr,
+ tANI_U16 staDsAssocId, tLimMlmStaContext mlmStaContext, tSirResultCodes statusCode,tpPESession psessionEntry)
+{
+
+ tLimMlmDisassocCnf mlmDisassocCnf;
+ tLimMlmDeauthCnf mlmDeauthCnf;
+ tLimMlmPurgeStaInd mlmPurgeStaInd;
+
+ if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
+ {
+ // Set BSSID at CFG to null
+ tSirMacAddr nullAddr = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ #if 0
+ if (cfgSetStr(pMac, WNI_CFG_BSSID, (tANI_U8 *) &nullAddr,
+ sizeof(tSirMacAddr)) != eSIR_SUCCESS)
+ {
+ /// Could not update BSSID at CFG. Log error.
+ limLog(pMac, LOGP, FL("could not update BSSID at CFG\n"));
+
+ return;
+ }
+ #endif//TO SUPPORT BT-AMP
+
+ sirCopyMacAddr(nullAddr,psessionEntry->bssId);
+
+ // Free up buffer allocated for JoinReq held by
+ // MLM state machine
+ if (psessionEntry->pLimMlmJoinReq)
+ {
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) psessionEntry->pLimMlmJoinReq);
+ psessionEntry->pLimMlmJoinReq = NULL;
+ }
+
+ psessionEntry->limAID = 0;
+
+
+ }
+
+ if ((mlmStaContext.cleanupTrigger ==
+ eLIM_HOST_DISASSOC) ||
+ (mlmStaContext.cleanupTrigger ==
+ eLIM_LINK_MONITORING_DISASSOC) ||
+ (mlmStaContext.cleanupTrigger ==
+ eLIM_PROMISCUOUS_MODE_DISASSOC))
+ {
+ /**
+ * Host or LMM driven Disassociation.
+ * Issue Disassoc Confirm to SME.
+ */
+ limLog( pMac, LOGW, FL("Lim Posting DISASSOC_CNF to Sme. Trigger: %X\n"), mlmStaContext.cleanupTrigger);
+
+
+ palCopyMemory( pMac->hHdd,
+ (tANI_U8 *) &mlmDisassocCnf.peerMacAddr,
+ (tANI_U8 *) staDsAddr,
+ sizeof(tSirMacAddr));
+ mlmDisassocCnf.resultCode = statusCode;
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ mlmDisassocCnf.aid = staDsAssocId;
+#endif
+ mlmDisassocCnf.disassocTrigger =
+ mlmStaContext.cleanupTrigger;
+ /* Update PE session Id*/
+ mlmDisassocCnf.sessionId = psessionEntry->peSessionId;
+
+ limPostSmeMessage(pMac,
+ LIM_MLM_DISASSOC_CNF,
+ (tANI_U32 *) &mlmDisassocCnf);
+ }
+ else if ((mlmStaContext.cleanupTrigger ==
+ eLIM_HOST_DEAUTH) ||
+ (mlmStaContext.cleanupTrigger ==
+ eLIM_LINK_MONITORING_DEAUTH))
+ {
+ /**
+ * Host or LMM driven Deauthentication.
+ * Issue Deauth Confirm to SME.
+ */
+ limLog( pMac, LOGW, FL("Lim Posting DEAUTH_CNF to Sme. Trigger: %X\n"), mlmStaContext.cleanupTrigger);
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDeauthCnf.peerMacAddr,
+ (tANI_U8 *) staDsAddr,
+ sizeof(tSirMacAddr));
+ mlmDeauthCnf.resultCode = statusCode;
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ mlmDeauthCnf.aid = staDsAssocId;
+#endif
+ mlmDeauthCnf.deauthTrigger =
+ mlmStaContext.cleanupTrigger;
+ /* PE session Id */
+ mlmDeauthCnf.sessionId = psessionEntry->peSessionId;
+
+ limPostSmeMessage(pMac,
+ LIM_MLM_DEAUTH_CNF,
+ (tANI_U32 *) &mlmDeauthCnf);
+ }
+ else if ((mlmStaContext.cleanupTrigger ==
+ eLIM_PEER_ENTITY_DISASSOC) ||
+ (mlmStaContext.cleanupTrigger ==
+ eLIM_PEER_ENTITY_DEAUTH))
+ {
+ /**
+ * Received Disassociation/Deauthentication from peer.
+ * Issue Purge Ind to SME.
+ */
+ limLog( pMac, LOGW, FL("Lim Posting PURGE_STA_IND to Sme. Trigger: %X\n"), mlmStaContext.cleanupTrigger) ;
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmPurgeStaInd.peerMacAddr,
+ (tANI_U8 *) staDsAddr,
+ sizeof(tSirMacAddr));
+ mlmPurgeStaInd.reasonCode = (tANI_U8) mlmStaContext.disassocReason;
+ mlmPurgeStaInd.aid = staDsAssocId;
+ mlmPurgeStaInd.purgeTrigger = mlmStaContext.cleanupTrigger;
+ mlmPurgeStaInd.sessionId = psessionEntry->peSessionId;
+
+ limPostSmeMessage(pMac,
+ LIM_MLM_PURGE_STA_IND,
+ (tANI_U32 *) &mlmPurgeStaInd);
+ }
+ else if(mlmStaContext.cleanupTrigger == eLIM_JOIN_FAILURE)
+ {
+ //PE setup the peer entry in HW upfront, right after join is completed.
+ //If there is a failure during rest of the assoc sequence, this context needs to be cleaned up.
+ tANI_U8 smesessionId;
+ tANI_U16 smetransactionId;
+
+ smesessionId = psessionEntry->smeSessionId;
+ smetransactionId = psessionEntry->transactionId;
+
+ psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+
+ palFreeMemory( pMac->hHdd, psessionEntry->pLimJoinReq);
+ psessionEntry->pLimJoinReq = NULL;
+
+ if(mlmStaContext.resultCode != eSIR_SME_SUCCESS)
+ {
+ peDeleteSession(pMac,psessionEntry);
+ psessionEntry = NULL;
+ }
+
+ limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, mlmStaContext.resultCode, mlmStaContext.protStatusCode,
+ psessionEntry, smesessionId, smetransactionId);
+
+ }
+
+ if((NULL != psessionEntry)
+#ifdef WLAN_SOFTAP_FEATURE
+ && (eLIM_AP_ROLE != psessionEntry->limSystemRole )
+#endif
+ )
+ {
+ peDeleteSession(pMac,psessionEntry);
+ psessionEntry = NULL;
+ }
+}
+
+/**
+ * limRejectAssociation()
+ *
+ *FUNCTION:
+ * This function is called whenever Re/Association Request need
+ * to be rejected due to failure in assigning an AID or failure
+ * in adding STA context at Polaris or reject by applications.
+ *
+ *LOGIC:
+ * Resources allocated if any are freedup and (Re) Association
+ * Response frame is sent to requesting STA. Pre-Auth context
+ * will be added for this STA if it does not exist already
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param *pBd - A pointer to Buffer descriptor + associated PDUs
+ * @param subType - Indicates whether it is Association Request (=0) or
+ * Reassociation Request (=1) frame
+ * @param addPreAuthContext - Indicates whether pre-auth context
+ * to be added for this STA
+ * @param authType - Indicates auth type to be added
+ * @param staId - Indicates staId of the STA being rejected
+ * association
+ * @param deleteSta - Indicates whether to delete STA context
+ * at Polaris
+ * @param rCode - Indicates what reasonCode to be sent in
+ * Re/Assoc response to STA
+ *
+ * @return None
+ */
+
+void
+limRejectAssociation(tpAniSirGlobal pMac, tSirMacAddr peerAddr, tANI_U8 subType,
+ tANI_U8 addPreAuthContext, tAniAuthType authType,
+ tANI_U16 staId, tANI_U8 deleteSta, tSirResultCodes rCode, tpPESession psessionEntry )
+{
+ tpDphHashNode pStaDs;
+
+ if (addPreAuthContext)
+ {
+ // Create entry for this STA in pre-auth list
+ struct tLimPreAuthNode *pAuthNode;
+
+ pAuthNode = limAcquireFreePreAuthNode(pMac, &pMac->lim.gLimPreAuthTimerTable);
+
+ if (pAuthNode)
+ {
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pAuthNode->peerMacAddr,
+ peerAddr,
+ sizeof(tSirMacAddr));
+ pAuthNode->fTimerStarted = 0;
+ pAuthNode->mlmState = eLIM_MLM_AUTHENTICATED_STATE;
+ pAuthNode->authType = (tAniAuthType) authType;
+ limAddPreAuthNode(pMac, pAuthNode);
+ }
+ }
+
+ if (deleteSta == true)
+ {
+ pStaDs = dphGetHashEntry(pMac, staId, &psessionEntry->dph.dphHashTable);
+
+ if (pStaDs == NULL)
+ {
+ limLog(pMac, LOGW,
+ FL("No STA context, yet rejecting Association\n"));
+
+ return;
+ }
+
+ /**
+ * Polaris has state for this STA.
+ * Trigger cleanup.
+ */
+ pStaDs->mlmStaContext.cleanupTrigger = eLIM_REASSOC_REJECT;
+
+ // Receive path cleanup
+ limCleanupRxPath(pMac, pStaDs, psessionEntry);
+
+ // Send Re/Association Response with
+ // status code to requesting STA.
+ limSendAssocRspMgmtFrame(pMac,
+ rCode,
+ 0,
+ peerAddr,
+ subType, 0,psessionEntry);
+
+ if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL)
+ {
+ // Assoction confirmation is complete, free the copy of association request frame
+ if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
+ {
+ palFreeMemory(pMac->hHdd,((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
+ ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
+ }
+ palFreeMemory(pMac->hHdd, psessionEntry->parsedAssocReq[pStaDs->assocId]);
+ psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
+ }
+ }
+ else
+ {
+ limSendAssocRspMgmtFrame(pMac,
+ eSIR_MAC_MAX_ASSOC_STA_REACHED_STATUS,
+ 1,
+ peerAddr,
+ subType, 0,psessionEntry);
+ // Log error
+ limLog(pMac, LOGW,
+ FL("received Re/Assoc req when max associated STAs reached from \n"));
+ limPrintMacAddr(pMac, peerAddr, LOGW);
+ limSendSmeMaxAssocExceededNtf(pMac, peerAddr, psessionEntry->smeSessionId);
+ }
+} /*** end limRejectAssociation() ***/
+
+#ifdef WLAN_SOFTAP_FEATURE
+
+/** -------------------------------------------------------------
+\fn limDecideApProtectionOnHt20Delete
+\brief protection related function while HT20 station is getting deleted.
+\param tpAniSirGlobal pMac
+\param tpDphHashNode pStaDs
+\param tpUpdateBeaconParams pBeaconParams
+\return None
+ -------------------------------------------------------------*/
+static void
+limDecideApProtectionOnHt20Delete(tpAniSirGlobal pMac,
+ tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
+{
+ tANI_U32 i = 0;
+ PELOG1( limLog(pMac, LOG1, FL("(%d) A HT 20 STA is disassociated. Addr is "),
+ psessionEntry->gLimHt20Params.numSta);
+ limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
+ if (psessionEntry->gLimHt20Params.numSta > 0)
+ {
+ for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
+ {
+ if (psessionEntry->protStaCache[i].active)
+ {
+ if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
+ pStaDs->staAddr, sizeof(tSirMacAddr)))
+ {
+ psessionEntry->gLimHt20Params.numSta--;
+ psessionEntry->protStaCache[i].active = false;
+ break;
+ }
+ }
+ }
+ }
+
+ if (psessionEntry->gLimHt20Params.numSta == 0)
+ {
+ // disable protection
+ limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
+ }
+}
+/** -------------------------------------------------------------
+\fn limDecideApProtectionOnDelete
+\brief Decides about protection related settings when a station is getting deleted.
+\param tpAniSirGlobal pMac
+\param tpDphHashNode pStaDs
+\param tpUpdateBeaconParams pBeaconParams
+\return None
+ -------------------------------------------------------------*/
+void
+limDecideApProtectionOnDelete(tpAniSirGlobal pMac,
+ tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
+{
+ tANI_U32 phyMode;
+ tHalBitVal erpEnabled = eHAL_CLEAR;
+ tSirRFBand rfBand = SIR_BAND_UNKNOWN;
+ tANI_U32 i;
+
+ if(NULL == pStaDs)
+ return;
+
+ limGetRfBand(pMac, &rfBand, psessionEntry);
+ if(SIR_BAND_5_GHZ == rfBand)
+ {
+ //we are HT. if we are 11A, then protection is not required.
+ if(true == psessionEntry->htCapabality)
+ {
+ //we are HT and 11A station is leaving.
+ //protection consideration required.
+ //HT station leaving ==> this case is commonly handled between both the bands below.
+ if((psessionEntry->beaconParams.llaCoexist) &&
+ (false == pStaDs->mlmStaContext.htCapability))
+ {
+ PELOG1(limLog(pMac, LOG1, FL("(%d) A 11A STA is disassociated. Addr is "),
+ psessionEntry->gLim11aParams.numSta);
+ limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
+ if (psessionEntry->gLim11aParams.numSta > 0)
+ {
+ for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
+ {
+ if (psessionEntry->protStaCache[i].active)
+ {
+ if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
+ pStaDs->staAddr, sizeof(tSirMacAddr)))
+ {
+ psessionEntry->gLim11aParams.numSta--;
+ psessionEntry->protStaCache[i].active = false;
+ break;
+ }
+ }
+ }
+ }
+
+ if(psessionEntry->gLim11aParams.numSta == 0)
+ {
+ // disable protection
+ limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
+ }
+ }
+ }
+ }
+ else if(SIR_BAND_2_4_GHZ == rfBand)
+ {
+ limGetPhyMode(pMac, &phyMode, psessionEntry);
+
+ erpEnabled = pStaDs->erpEnabled;
+ //we are HT or 11G and 11B station is getting deleted.
+ if (((phyMode == WNI_CFG_PHY_MODE_11G) ||
+ psessionEntry->htCapabality) &&
+ (erpEnabled == eHAL_CLEAR))
+ {
+ PELOG1(limLog(pMac, LOG1, FL("(%d) A legacy STA is disassociated. Addr is "),
+ psessionEntry->gLim11bParams.numSta);
+ limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
+ if (psessionEntry->gLim11bParams.numSta > 0)
+ {
+ for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
+ {
+ if (psessionEntry->protStaCache[i].active)
+ {
+ if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
+ pStaDs->staAddr, sizeof(tSirMacAddr)))
+ {
+ psessionEntry->gLim11bParams.numSta--;
+ psessionEntry->protStaCache[i].active = false;
+ break;
+ }
+ }
+ }
+ }
+
+ if (psessionEntry->gLim11bParams.numSta == 0)
+ {
+ // disable protection
+ PELOG1(limLog(pMac, LOG1, FL("No 11B STA exists\n"));)
+ limEnable11gProtection(pMac, false, false, pBeaconParams,psessionEntry);
+ }
+ }
+ //(non-11B station is leaving) or (we are not 11G or HT AP)
+ else if(psessionEntry->htCapabality)
+ { //we are HT AP and non-11B station is leaving.
+
+ //11g station is leaving
+ if(!pStaDs->mlmStaContext.htCapability)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("(%d) A 11g STA is disassociated. Addr is "),
+ psessionEntry->gLim11bParams.numSta);
+ limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
+ if (psessionEntry->gLim11gParams.numSta > 0)
+ {
+ for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
+ {
+ if (psessionEntry->protStaCache[i].active)
+ {
+ if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
+ pStaDs->staAddr, sizeof(tSirMacAddr)))
+ {
+ psessionEntry->gLim11gParams.numSta--;
+ psessionEntry->protStaCache[i].active = false;
+ break;
+ }
+ }
+ }
+ }
+
+ if (psessionEntry->gLim11gParams.numSta == 0)
+ {
+ // disable protection
+ limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
+ }
+ }
+ }
+ }
+
+ //LSIG TXOP not supporting staiton leaving. applies to 2.4 as well as 5 GHZ.
+ if((true == psessionEntry->htCapabality) &&
+ (true == pStaDs->mlmStaContext.htCapability))
+ {
+ //HT non-GF leaving
+ if(!pStaDs->htGreenfield)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("(%d) A non-GF STA is disassociated. Addr is "),
+ psessionEntry->gLimNonGfParams.numSta);
+ limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
+ if (psessionEntry->gLimNonGfParams.numSta > 0)
+ {
+ for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
+ {
+ if (psessionEntry->protStaCache[i].active)
+ {
+ if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
+ pStaDs->staAddr, sizeof(tSirMacAddr)))
+ {
+ psessionEntry->gLimNonGfParams.numSta--;
+ psessionEntry->protStaCache[i].active = false;
+ break;
+ }
+ }
+ }
+ }
+
+ if (psessionEntry->gLimNonGfParams.numSta == 0)
+ {
+ // disable protection
+ limEnableHTNonGfProtection(pMac, false, false, pBeaconParams,psessionEntry);
+ }
+ }
+ //HT 20Mhz station leaving.
+ if(psessionEntry->beaconParams.ht20Coexist &&
+ (eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet))
+ {
+ limDecideApProtectionOnHt20Delete(pMac, pStaDs, pBeaconParams,psessionEntry);
+ }
+
+ if(false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport &&
+ (false == pStaDs->htLsigTXOPProtection))
+ {
+ PELOG1( limLog(pMac, LOG1, FL("(%d) A HT LSIG not supporting STA is disassociated. Addr is "),
+ psessionEntry->gLimLsigTxopParams.numSta);
+ limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
+ if (psessionEntry->gLimLsigTxopParams.numSta > 0)
+ {
+ for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
+ {
+ if (psessionEntry->protStaCache[i].active)
+ {
+ if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
+ pStaDs->staAddr, sizeof(tSirMacAddr)))
+ {
+ psessionEntry->gLimLsigTxopParams.numSta--;
+ psessionEntry->protStaCache[i].active = false;
+ break;
+ }
+ }
+ }
+ }
+
+ if (psessionEntry->gLimLsigTxopParams.numSta == 0)
+ {
+ // disable protection
+ limEnableHTLsigTxopProtection(pMac, true, false, pBeaconParams,psessionEntry);
+ }
+ }
+ }
+}
+
+#endif
+
+
+/** -------------------------------------------------------------
+\fn limDecideShortPreamble
+\brief Decides about any short preamble reated change because of new station joining.
+\param tpAniSirGlobal pMac
+\param tpDphHashNode pStaDs
+\param tpUpdateBeaconParams pBeaconParams
+\return None
+ -------------------------------------------------------------*/
+void limDecideShortPreamble(tpAniSirGlobal pMac,
+ tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry )
+{
+ tANI_U32 i;
+
+ if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("(%d) A non-short preamble STA is disassociated. Addr is "),
+ psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
+ limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
+ if (psessionEntry->gLimNoShortParams.numNonShortPreambleSta > 0)
+ {
+ for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
+ {
+ if (psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
+ {
+ if (palEqualMemory( pMac->hHdd, psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
+ pStaDs->staAddr, sizeof(tSirMacAddr)))
+ {
+ psessionEntry->gLimNoShortParams.numNonShortPreambleSta--;
+ psessionEntry->gLimNoShortParams.staNoShortCache[i].active = false;
+ break;
+ }
+ }
+ }
+ }
+
+ if (psessionEntry->gLimNoShortParams.numNonShortPreambleSta == 0)
+ {
+ // enable short preamble
+ PELOG1(limLog(pMac, LOG1, FL("All associated STAs have short preamble support now.\n"));)
+ //reset the cache
+ palZeroMemory( pMac->hHdd, (tANI_U8 *)&psessionEntry->gLimNoShortParams , sizeof(tLimNoShortParams));
+ if (limEnableShortPreamble(pMac, true, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("Cannot enable short preamble\n"));)
+ }
+ }
+}
+
+/** -------------------------------------------------------------
+\fn limDecideShortSlot
+\brief Decides about any short slot time related change because of station leaving the BSS.
+\param tpAniSirGlobal pMac
+\param tpDphHashNode pStaDs
+\return None
+ -------------------------------------------------------------*/
+
+void
+limDecideShortSlot(tpAniSirGlobal pMac, tpDphHashNode pStaDs,
+ tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
+{
+ tANI_U32 i, val;
+ if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("(%d) A non-short slottime STA is disassociated. Addr is "),
+ pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
+ limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
+ psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta> 0)
+ {
+ for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
+ {
+ if (psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
+ {
+ if (palEqualMemory( pMac->hHdd, psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
+ pStaDs->staAddr, sizeof(tSirMacAddr)))
+ {
+ psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta--;
+ psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = false;
+ break;
+ }
+ }
+ }
+ }
+ else
+#endif
+ {
+ if (pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta> 0)
+ {
+ for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
+ {
+ if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
+ {
+ if (palEqualMemory( pMac->hHdd, pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
+ pStaDs->staAddr, sizeof(tSirMacAddr)))
+ {
+ pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta--;
+ pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = false;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
+ (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta == 0))
+ {
+ // enable short slot time
+ PELOG1(limLog(pMac, LOG1, FL("All associated STAs have short slot time support now.\n"));)
+ //reset the cache
+ palZeroMemory( pMac->hHdd, (tANI_U8 *)&psessionEntry->gLimNoShortSlotParams , sizeof(tLimNoShortSlotParams));
+ // in case of AP set SHORT_SLOT_TIME to enable
+ if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ {
+ pBeaconParams->fShortSlotTime = true;
+ pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
+
+ if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, true) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("could not update short slot time at CFG\n"));)
+ }
+ }
+ else
+#endif
+ {
+ if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta == 0)
+ {
+ // enable short slot time
+ PELOG1(limLog(pMac, LOG1, FL("All associated STAs have short slot time support now.\n"));)
+ //reset the cache
+ palZeroMemory( pMac->hHdd, (tANI_U8 *)&pMac->lim.gLimNoShortSlotParams , sizeof(tLimNoShortSlotParams));
+ // in case of AP set SHORT_SLOT_TIME to enable
+ if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ {
+ pBeaconParams->fShortSlotTime = true;
+ pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
+
+ if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, true) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("could not update short slot time at CFG\n"));)
+ }
+ }
+ }
+ }
+}
+
+/**
+ * limRestorePreReassocState()
+ *
+ *FUNCTION:
+ * This function is called on STA role whenever Reasociation
+ * Response with a reject code is received from AP.
+ *
+ *LOGIC:
+ * Reassociation failure timer is stopped, Old (or current) AP's
+ * context is restored both at Polaris & software
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param resultCode - Result code that specifies why Reassociation
+ * attemp failed
+ *
+ * @return None
+ */
+
+void
+limRestorePreReassocState(tpAniSirGlobal pMac,
+ tSirResultCodes resultCode,
+ tANI_U16 protStatusCode,tpPESession psessionEntry)
+{
+ tANI_U8 chanNum;
+ tLimMlmReassocCnf mlmReassocCnf;
+
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_LINK_ESTABLISHED_STATE));
+ psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_LINK_ESTABLISHED_STATE));
+
+ // 'Change' timer for future activations
+ limDeactivateAndChangeTimer(pMac, eLIM_REASSOC_FAIL_TIMER);
+
+ // Update BSSID at CFG database
+ #if 0
+ if (cfgSetStr(pMac, WNI_CFG_BSSID,
+ pMac->lim.gLimCurrentBssId,
+ sizeof(tSirMacAddr)) != eSIR_SUCCESS)
+ {
+ /// Could not update BSSID at CFG. Log error.
+ limLog(pMac, LOGP, FL("could not update BSSID at CFG\n"));
+ return;
+ }
+ #endif
+
+ // chanNum = pMac->lim.gLimCurrentChannelId;
+
+ /* To support BT-AMP */
+ chanNum = psessionEntry->currentOperChannel;
+
+ limSetChannel(pMac, psessionEntry->limCurrentTitanHtCaps, chanNum, psessionEntry->maxTxPower, psessionEntry->peSessionId);
+
+ /** @ToDo : Need to Integrate the STOP the DataTransfer to the AP from 11H code */
+
+ mlmReassocCnf.resultCode = resultCode;
+ mlmReassocCnf.protStatusCode = protStatusCode;
+ /* Update PE session Id */
+ mlmReassocCnf.sessionId = psessionEntry->peSessionId;
+ limPostSmeMessage(pMac,
+ LIM_MLM_REASSOC_CNF,
+ (tANI_U32 *) &mlmReassocCnf);
+} /*** end limRestorePreReassocState() ***/
+
+
+
+/**
+ * limIsReassocInProgress()
+ *
+ *FUNCTION:
+ * This function is called to see if STA is in wt-reassoc-rsp state.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ *
+ * @return eANI_BOOLEAN_TRUE When STA is waiting for Reassoc response from AP \n
+ * else eANI_BOOLEAN_FALSE
+ */
+
+eAniBoolean
+limIsReassocInProgress(tpAniSirGlobal pMac,tpPESession psessionEntry)
+{
+ if(((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
+ ((psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE) ||
+ (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_LINK_FAIL_STATE)))
+ return eANI_BOOLEAN_TRUE;
+
+ return eANI_BOOLEAN_FALSE;
+} /*** end limIsReassocInProgress() ***/
+
+
+
+/**
+ * limPopulateOwnRateSet
+ *
+ * FUNCTION:
+ * This function is called by limProcessAssocRsp() or
+ * limAddStaInIBSS()
+ * - It creates a combined rate set of 12 rates max which
+ * comprises the basic and extended rates read from CFG
+ * - It sorts the combined rate Set and copy it in the
+ * rate array of the pSTA descriptor
+ * - It sets the erpEnabled bit of the STA descriptor
+ *
+ * NOTE:
+ * ERP bit is set iff the dph PHY mode is 11G and there is at least
+ * an A rate in the supported or extended rate sets
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param basicOnly - When passed value is true, only basic
+ * rates are copied to DPH node else
+ * all supported rates are copied
+ * @return eSIR_SUCCESS or eSIR_FAILURE
+ *
+ */
+
+tSirRetStatus
+limPopulateOwnRateSet(tpAniSirGlobal pMac,
+ tpSirSupportedRates pRates,
+ tANI_U8* pSupportedMCSSet,
+ tANI_U8 basicOnly,
+ tpPESession psessionEntry)
+{
+ tSirMacRateSet tempRateSet;
+ tSirMacRateSet tempRateSet2;
+ tANI_U32 i,j,val,min,isArate;
+ tANI_U32 phyMode = 0;
+
+ isArate = 0;
+
+ limGetPhyMode(pMac, &phyMode, psessionEntry);
+
+ // Get own rate set
+ #if 0
+ val = WNI_CFG_OPERATIONAL_RATE_SET_LEN;
+ if (wlan_cfgGetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET,
+ (tANI_U8 *) &tempRateSet.rate,
+ &val) != eSIR_SUCCESS)
+ {
+ /// Could not get rateset from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve rateset\n"));
+ }
+ #endif // TO SUPPORT BT-AMP
+
+ /* copy operational rate set from psessionEntry */
+ palCopyMemory(pMac->hHdd,(tANI_U8 *)tempRateSet.rate,(tANI_U8*)(psessionEntry->rateSet.rate), psessionEntry->rateSet.numRates);
+ tempRateSet.numRates = psessionEntry->rateSet.numRates;
+
+ if (phyMode == WNI_CFG_PHY_MODE_11G)
+ {
+
+ // get own extended rate set
+ #if 0
+ val = WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN;
+ if (wlan_cfgGetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
+ (tANI_U8 *) &tempRateSet2.rate,
+ &val) != eSIR_SUCCESS)
+ {
+ /// Could not get extended rateset from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve extended rateset\n"));
+ }
+ tempRateSet2.numRates = (tANI_U8) val;
+ #endif
+
+ palCopyMemory(pMac->hHdd,(tANI_U8 *)tempRateSet2.rate, (tANI_U8*)(psessionEntry->extRateSet.rate), psessionEntry->extRateSet.numRates);
+ tempRateSet2.numRates = psessionEntry->extRateSet.numRates;
+
+ }
+ else
+ tempRateSet2.numRates = 0;
+
+
+ if ((tempRateSet.numRates + tempRateSet2.numRates) > 12)
+ {
+ //we are in big trouble
+ limLog(pMac, LOGP, FL("more than 12 rates in CFG\n"));
+ //panic
+ goto error;
+ }
+
+
+ //copy all rates in tempRateSet, there are 12 rates max
+ for (i = 0;i < tempRateSet2.numRates; i++)
+ tempRateSet.rate[i + tempRateSet.numRates] = tempRateSet2.rate[i];
+ tempRateSet.numRates += tempRateSet2.numRates;
+
+ /**
+ * Sort rates in tempRateSet (they are likely to be already sorted)
+ * put the result in pSupportedRates
+ */
+ {
+ tANI_U8 aRateIndex = 0;
+ tANI_U8 bRateIndex = 0;
+
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pRates, sizeof(tSirSupportedRates));
+ for(i = 0;i < tempRateSet.numRates; i++)
+ {
+ min = 0;
+ val = 0xff;
+ isArate = 0;
+ for(j = 0;j < tempRateSet.numRates; j++)
+ {
+ if ((tANI_U32) (tempRateSet.rate[j] & 0x7f) < val)
+ {
+ val = tempRateSet.rate[j] & 0x7f;
+ min = j;
+ }
+ }
+
+ if (sirIsArate(tempRateSet.rate[min] & 0x7f))
+ isArate = 1;
+
+ /*
+ * HAL needs to know whether the rate is basic rate or not, as it needs to
+ * update the response rate table accordingly. e.g. if one of the 11a rates is
+ * basic rate, then that rate can be used for sending control frames.
+ * HAL updates the response rate table whenever basic rate set is changed.
+ */
+ if (basicOnly)
+ {
+ if (tempRateSet.rate[min] & 0x80)
+ {
+ if (isArate)
+ pRates->llaRates[aRateIndex++] = tempRateSet.rate[min];
+ else
+ pRates->llbRates[bRateIndex++] = tempRateSet.rate[min];
+ }
+ }
+ else
+ {
+ if (isArate)
+ pRates->llaRates[aRateIndex++] = tempRateSet.rate[min];
+ else
+ pRates->llbRates[bRateIndex++] = tempRateSet.rate[min];
+ }
+ tempRateSet.rate[min] = 0xff;
+ }
+
+ }
+
+
+ if(IS_DOT11_MODE_HT(psessionEntry->dot11mode))
+ {
+ val = SIZE_OF_SUPPORTED_MCS_SET;
+ if (wlan_cfgGetStr(pMac, WNI_CFG_SUPPORTED_MCS_SET,
+ pRates->supportedMCSSet,
+ &val) != eSIR_SUCCESS)
+ {
+ /// Could not get rateset from CFG. Log error.
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve supportedMCSSet\n"));)
+ goto error;
+ }
+
+
+ //if supported MCS Set of the peer is passed in, then do the intersection
+ //else use the MCS set from local CFG.
+
+ if(pSupportedMCSSet != NULL)
+ {
+ for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
+ pRates->supportedMCSSet[i] &= pSupportedMCSSet[i];
+
+ }
+
+ PELOG2(limLog(pMac, LOG2, FL("MCS Rate Set Bitmap: \n"));)
+ for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
+ PELOGW(limLog(pMac, LOG2,FL("%x ") , pRates->supportedMCSSet[i]);)
+ }
+
+
+
+
+ return eSIR_SUCCESS;
+
+ error:
+
+ return eSIR_FAILURE;
+} /*** limPopulateOwnRateSet() ***/
+
+
+
+/**
+ * limPopulateMatchingRateSet
+ * FUNCTION:
+ * This is called at the time of Association Request
+ * processing on AP and while adding peer's context
+ * in IBSS role to process the CFG rate sets and
+ * the rate sets received in the Assoc request on AP
+ * or Beacon/Probe Response from peer in IBSS.
+ *
+ * LOGIC:
+ * 1. It makes the intersection between our own rate Sat
+ * and extemcded rate set and the ones received in the
+ * association request.
+ * 2. It creates a combined rate set of 12 rates max which
+ * comprised the basic and extended rates
+ * 3. It sorts the combined rate Set and copy it in the
+ * rate array of the pSTA descriptor
+ *
+ * ASSUMPTION:
+ * The parser has already ensured unicity of the rates in the
+ * association request structure
+ *
+ * @param: pMac - Pointer to Global MAC structure
+ * pStaDs - Pointer to DPH node
+ * pOperRateSet - Pointer to peer's supported rateset
+ * pExtRateSet - Pointer to peer's extended rateset
+ *
+ * @return: eSIR_SUCCESS or eSIR_FAILURE
+ */
+
+tSirRetStatus
+limPopulateMatchingRateSet(tpAniSirGlobal pMac,
+ tpDphHashNode pStaDs,
+ tSirMacRateSet *pOperRateSet,
+ tSirMacRateSet *pExtRateSet,
+ tANI_U8* pSupportedMCSSet,
+ tSirMacPropRateSet *pAniLegRateSet,
+ tpPESession psessionEntry)
+{
+ tSirMacRateSet tempRateSet;
+ tSirMacRateSet tempRateSet2;
+ tANI_U32 i,j,val,min,isArate;
+ tANI_U32 phyMode;
+ tANI_U8 mcsSet[SIZE_OF_SUPPORTED_MCS_SET];
+
+ isArate=0;
+
+ // limGetPhyMode(pMac, &phyMode);
+ limGetPhyMode(pMac, &phyMode, psessionEntry);
+
+ // get own rate set
+ // val = WNI_CFG_OPERATIONAL_RATE_SET_LEN;
+ #if 0
+ if (wlan_cfgGetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET,
+ (tANI_U8 *) &tempRateSet.rate,
+ &val) != eSIR_SUCCESS)
+ {
+ /// Could not get rateset from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve rateset\n"));
+ }
+
+ #endif // TO SUPPORT BT-AMP
+
+ /* copy operational rate set from psessionEntry */
+ palCopyMemory(pMac->hHdd,(tempRateSet.rate),(psessionEntry->rateSet.rate),psessionEntry->rateSet.numRates);
+ tempRateSet.numRates = (tANI_U8) psessionEntry->rateSet.numRates;
+
+ if (phyMode == WNI_CFG_PHY_MODE_11G)
+ {
+
+ #if 0
+ // get own extended rate set
+ val = WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN;
+ if (wlan_cfgGetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
+ (tANI_U8 *) &tempRateSet2.rate,
+ &val) != eSIR_SUCCESS)
+ #endif
+ palCopyMemory(pMac->hHdd,(tempRateSet2.rate),(psessionEntry->extRateSet.rate),psessionEntry->extRateSet.numRates);
+ tempRateSet2.numRates = (tANI_U8) psessionEntry->extRateSet.numRates;
+ }
+ else
+ tempRateSet2.numRates = 0;
+
+ if ((tempRateSet.numRates + tempRateSet2.numRates) > 12)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("more than 12 rates in CFG\n"));)
+ goto error;
+ }
+
+ /**
+ * Handling of the rate set IEs is the following:
+ * - keep only rates that we support and that the station supports
+ * - sort and the rates into the pSta->rate array
+ */
+
+ // Copy all rates in tempRateSet, there are 12 rates max
+ for(i = 0; i < tempRateSet2.numRates; i++)
+ tempRateSet.rate[i + tempRateSet.numRates] =
+ tempRateSet2.rate[i];
+
+ tempRateSet.numRates += tempRateSet2.numRates;
+
+ /**
+ * Sort rates in tempRateSet (they are likely to be already sorted)
+ * put the result in tempRateSet2
+ */
+ tempRateSet2.numRates = 0;
+
+ for(i = 0;i < tempRateSet.numRates; i++)
+ {
+ min = 0;
+ val = 0xff;
+
+ for(j = 0;j < tempRateSet.numRates; j++)
+ if ((tANI_U32) (tempRateSet.rate[j] & 0x7f) < val)
+ {
+ val = tempRateSet.rate[j] & 0x7f;
+ min = j;
+ }
+
+ tempRateSet2.rate[tempRateSet2.numRates++] =
+ tempRateSet.rate[min];
+ tempRateSet.rate[min] = 0xff;
+ }
+
+
+ /**
+ * Copy received rates in tempRateSet, the parser has ensured
+ * unicity of the rates so there cannot be more than 12
+ */
+ for(i = 0; i < pOperRateSet->numRates; i++)
+ {
+ tempRateSet.rate[i] = pOperRateSet->rate[i];
+ }
+
+ tempRateSet.numRates = pOperRateSet->numRates;
+
+ if (pExtRateSet->numRates)
+ {
+ if((tempRateSet.numRates + pExtRateSet->numRates) > 12 )
+ {
+ limLog( pMac, LOG2,
+ "Sum of SUPPORTED and EXTENDED Rate Set (%1d) exceeds 12!",
+ tempRateSet.numRates + pExtRateSet->numRates );
+
+ if( tempRateSet.numRates < 12 )
+ {
+ int found = 0;
+ int tail = tempRateSet.numRates;
+
+ for( i = 0; i < pExtRateSet->numRates; i++ )
+ {
+ found = 0;
+ for( j = 0; j < (tANI_U32) tail; j++ )
+ {
+ if((tempRateSet.rate[j] & 0x7F) ==
+ (pExtRateSet->rate[i] & 0x7F))
+ {
+ found = 1;
+ break;
+ }
+ }
+
+ if( !found )
+ {
+ tempRateSet.rate[tempRateSet.numRates++] =
+ pExtRateSet->rate[i];
+
+ if( tempRateSet.numRates >= 12 )
+ break;
+ }
+ }
+ }
+ else
+ limLog( pMac, LOG2,
+ "Relying only on the SUPPORTED Rate Set IE..." );
+ }
+ else
+ {
+ for(j = 0; j < pExtRateSet->numRates; j++)
+ tempRateSet.rate[i+j] = pExtRateSet->rate[j];
+
+ tempRateSet.numRates += pExtRateSet->numRates;
+ }
+ }
+
+ {
+ tpSirSupportedRates rates = &pStaDs->supportedRates;
+ tANI_U8 aRateIndex = 0;
+ tANI_U8 bRateIndex = 0;
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) rates, sizeof(tSirSupportedRates));
+ for(i = 0;i < tempRateSet2.numRates; i++)
+ {
+ for(j = 0;j < tempRateSet.numRates; j++)
+ {
+ if ((tempRateSet2.rate[i] & 0x7F) ==
+ (tempRateSet.rate[j] & 0x7F))
+ {
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+ if ((bRateIndex > HAL_NUM_11B_RATES) || (aRateIndex > HAL_NUM_11A_RATES))
+ {
+ limLog(pMac, LOGE, FL("Invalid number of rates (11b->%d, 11a->%d)\n"),
+ bRateIndex, aRateIndex);
+ return eSIR_FAILURE;
+ }
+#endif
+ if (sirIsArate(tempRateSet2.rate[i] & 0x7f))
+ {
+ isArate=1;
+ rates->llaRates[aRateIndex++] = tempRateSet2.rate[i];
+ }
+ else
+ rates->llbRates[bRateIndex++] = tempRateSet2.rate[i];
+ break;
+ }
+ }
+ }
+
+
+ //Now add the Polaris rates only when Proprietary rates are enabled.
+ val = 0;
+ if(wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_RATES_ENABLED, &val) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("could not retrieve prop rate enabled flag from CFG\n"));
+ }
+ else if(val)
+ {
+ for(i=0; i<pAniLegRateSet->numPropRates; i++)
+ rates->aniLegacyRates[i] = pAniLegRateSet->propRate[i];
+ }
+
+ }
+
+
+ //compute the matching MCS rate set, if peer is 11n capable and self mode is 11n
+ if(IS_DOT11_MODE_HT(psessionEntry->dot11mode) &&
+ (pStaDs->mlmStaContext.htCapability))
+ {
+ val = SIZE_OF_SUPPORTED_MCS_SET;
+ if (wlan_cfgGetStr(pMac, WNI_CFG_SUPPORTED_MCS_SET,
+ mcsSet,
+ &val) != eSIR_SUCCESS)
+ {
+ /// Could not get rateset from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve supportedMCSSet\n"));
+ goto error;
+ }
+
+ for(i=0; i<val; i++)
+ pStaDs->supportedRates.supportedMCSSet[i] = mcsSet[i] & pSupportedMCSSet[i];
+
+ PELOG2(limLog(pMac, LOG2, FL("limPopulateMatchingRateSet: MCS Rate Set Bitmap from CFG and DPH : \n"));)
+ for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
+ {
+ PELOG2(limLog(pMac, LOG2,FL("%x %x "), mcsSet[i], pStaDs->supportedRates.supportedMCSSet[i]);)
+ }
+ }
+
+ /**
+ * Set the erpEnabled bit iff the phy is in G mode and at least
+ * one A rate is supported
+ */
+ if ((phyMode == WNI_CFG_PHY_MODE_11G) && isArate)
+ pStaDs->erpEnabled = eHAL_SET;
+
+
+
+ return eSIR_SUCCESS;
+
+ error:
+
+ return eSIR_FAILURE;
+} /*** limPopulateMatchingRateSet() ***/
+
+
+
+/**
+ * limAddSta()
+ *
+ *FUNCTION:
+ * This function is called to add an STA context at hardware
+ * whenever a STA is (Re) Associated.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pStaDs - Pointer to the STA datastructure created by
+ * LIM and maintained by DPH
+ * @return retCode - Indicates success or failure return code
+ */
+
+tSirRetStatus
+limAddSta(
+ tpAniSirGlobal pMac,
+ tpDphHashNode pStaDs,tpPESession psessionEntry)
+{
+ tpAddStaParams pAddStaParams = NULL;
+ tSirMsgQ msgQ;
+ tSirRetStatus retCode = eSIR_SUCCESS;
+ tSirMacAddr staMac, *pStaAddr;
+ tANI_U8 i;
+#ifdef WLAN_FEATURE_P2P
+ tpSirAssocReq pAssocReq;
+ tANI_U8 *p2pIe = NULL;
+#endif
+ #if 0
+ retCode = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, staMac, &cfg);
+ if (retCode != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("could not retrieve STA MAC\n"));
+ #endif //To SUPPORT BT-AMP
+
+
+ sirCopyMacAddr(staMac,psessionEntry->selfMacAddr);
+
+ if( eHAL_STATUS_SUCCESS !=
+ palAllocateMemory( pMac->hHdd, (void **) &pAddStaParams, sizeof( tAddStaParams )))
+ {
+ limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA\n" ));
+ return eSIR_MEM_ALLOC_FAILED;
+ }
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams, sizeof(tAddStaParams));
+
+ if ((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) ||
+ (limGetSystemRole(psessionEntry) == eLIM_STA_IN_IBSS_ROLE) ||
+ (limGetSystemRole(psessionEntry) == eLIM_BT_AMP_AP_ROLE) )
+ pStaAddr = &pStaDs->staAddr;
+ else
+ pStaAddr = &staMac;
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->staMac,
+ (tANI_U8 *) *pStaAddr, sizeof(tSirMacAddr));
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->bssId,
+ psessionEntry->bssId, sizeof(tSirMacAddr));
+
+ limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry);
+
+ //Copy legacy rates
+ palCopyMemory(pMac->hHdd, (tANI_U8*)&pAddStaParams->supportedRates,
+ (tANI_U8*)&pStaDs->supportedRates, sizeof(tSirSupportedRates));
+
+ pAddStaParams->assocId = pStaDs->assocId;
+
+ pAddStaParams->wmmEnabled = pStaDs->qosMode;
+ pAddStaParams->listenInterval = pStaDs->mlmStaContext.listenInterval;
+ pAddStaParams->shortPreambleSupported = pStaDs->shortPreambleEnabled;
+#ifdef WLAN_SOFTAP_FEATURE
+ if((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) && (pStaDs->mlmStaContext.subType == LIM_REASSOC))
+ {
+ /* TBD - need to remove this REASSOC check after fixinf rmmod issue */
+ pAddStaParams->updateSta = pStaDs->mlmStaContext.updateContext;
+ }
+#endif
+ pStaDs->valid = 0;
+ pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
+
+ // This will indicate HAL to "allocate" a new STA index
+ pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
+ pAddStaParams->staType = pStaDs->staType;
+
+ pAddStaParams->status = eHAL_STATUS_SUCCESS;
+ pAddStaParams->respReqd = 1;
+ //Update HT Capability
+
+ if ((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) ||(limGetSystemRole(psessionEntry) == eLIM_BT_AMP_AP_ROLE) || (limGetSystemRole(psessionEntry) == eLIM_STA_IN_IBSS_ROLE))
+ pAddStaParams->htCapable = pStaDs->mlmStaContext.htCapability;
+ else
+ pAddStaParams->htCapable = psessionEntry->htCapabality;
+
+ pAddStaParams->greenFieldCapable = pStaDs->htGreenfield;
+ pAddStaParams->maxAmpduDensity= pStaDs->htAMpduDensity;
+ pAddStaParams->maxAmpduSize = pStaDs->htMaxRxAMpduFactor;
+ pAddStaParams->fDsssCckMode40Mhz = pStaDs->htDsssCckRate40MHzSupport;
+ pAddStaParams->fShortGI20Mhz = pStaDs->htShortGI20Mhz;
+ pAddStaParams->fShortGI40Mhz = pStaDs->htShortGI40Mhz;
+ pAddStaParams->lsigTxopProtection = pStaDs->htLsigTXOPProtection;
+ pAddStaParams->maxAmsduSize = pStaDs->htMaxAmsduLength;
+ pAddStaParams->txChannelWidthSet = pStaDs->htSupportedChannelWidthSet;
+ pAddStaParams->mimoPS = pStaDs->htMIMOPSState;
+ /* Update PE session ID*/
+ pAddStaParams->sessionId = psessionEntry->peSessionId;
+
+ if (psessionEntry->parsedAssocReq != NULL)
+ {
+#ifdef WLAN_FEATURE_P2P
+ // Get a copy of the already parsed Assoc Request
+ pAssocReq = (tpSirAssocReq) psessionEntry->parsedAssocReq[pStaDs->assocId];
+ if ( pAssocReq && pAssocReq->addIEPresent && pAssocReq->addIE.length ) {
+ p2pIe = limGetP2pIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
+ }
+ pAddStaParams->p2pCapableSta = (p2pIe != NULL);
+#endif
+ }
+
+ //Disable BA. It will be set as part of ADDBA negotiation.
+ for( i = 0; i < STACFG_MAX_TC; i++ )
+ {
+ pAddStaParams->staTCParams[i].txUseBA = eBA_DISABLE;
+ pAddStaParams->staTCParams[i].rxUseBA = eBA_DISABLE;
+ }
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if(pStaDs->wmeEnabled && (eLIM_AP_ROLE == psessionEntry->limSystemRole))
+ {
+ pAddStaParams->uAPSD = 0;
+ /* update UAPSD and send it to LIM to add STA */
+ // bitmap MSB <- LSB MSB 4 bits are for
+ // trigger enabled AC setting and LSB 4 bits
+ // are for delivery enabled AC setting
+ // 7 6 5 4 3 2 1 0
+ // BE BK VI VO BE BK VI VO
+ pAddStaParams->uAPSD |= pStaDs->qos.capability.qosInfo.acvo_uapsd;
+ pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acvi_uapsd << 1);
+ pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acbk_uapsd << 2);
+ pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acbe_uapsd << 3);
+ //making delivery enabled and trigger enabled setting the same.
+ pAddStaParams->uAPSD |= pAddStaParams->uAPSD << 4;
+
+ pAddStaParams->maxSPLen = pStaDs->qos.capability.qosInfo.maxSpLen;
+ limLog( pMac, LOGE, FL( "uAPSD = 0x%x, maxSpLen = %d" ),
+ pAddStaParams->uAPSD, pAddStaParams->maxSPLen);
+ }
+#endif
+ //we need to defer the message until we get the response back from HAL.
+ if (pAddStaParams->respReqd)
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+ msgQ.type = WDA_ADD_STA_REQ;
+
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pAddStaParams;
+ msgQ.bodyval = 0;
+
+ limLog( pMac, LOGE, FL( "Sending SIR_HAL_ADD_STA_REQ for assocId %d\n" ),
+ pStaDs->assocId);
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+
+ retCode = wdaPostCtrlMsg( pMac, &msgQ );
+ if( eSIR_SUCCESS != retCode)
+ {
+ limLog( pMac, LOGE, FL("ADD_STA_REQ for aId %d failed (reason %X)\n"),
+ pStaDs->assocId, retCode );
+ palFreeMemory(pMac->hHdd, (void*)pAddStaParams);
+ }
+
+ return retCode;
+}
+
+
+/**
+ * limDelSta()
+ *
+ *FUNCTION:
+ * This function is called to delete an STA context at hardware
+ * whenever a STA is disassociated
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pStaDs - Pointer to the STA datastructure created by
+ * LIM and maintained by DPH
+ * @param fRespReqd - flag to indicate whether the delete is synchronous (true)
+ * or not (false)
+ * @return retCode - Indicates success or failure return code
+ */
+
+tSirRetStatus
+limDelSta(
+ tpAniSirGlobal pMac,
+ tpDphHashNode pStaDs,
+ tANI_BOOLEAN fRespReqd,
+ tpPESession psessionEntry)
+{
+ tpDeleteStaParams pDelStaParams = NULL;
+ tSirMsgQ msgQ;
+ tSirRetStatus retCode = eSIR_SUCCESS;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **) &pDelStaParams, sizeof( tDeleteStaParams )))
+ {
+ limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during ADD_STA\n" ));
+ return eSIR_MEM_ALLOC_FAILED;
+ }
+
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pDelStaParams, sizeof(tDeleteStaParams));
+
+ //
+ // DPH contains the STA index only for "peer" STA entries.
+ // LIM global contains "self" STA index
+ // Thus,
+ // if( STA role )
+ // get STA index from LIM global
+ // else
+ // get STA index from DPH
+ //
+
+#if 0
+ /* Since we have not created any STA, no need to send msg to delete
+ * STA to HAL */
+ if (psessionEntry->limSmeState == eLIM_SME_JOIN_FAILURE_STATE) {
+ pDelStaParams->staIdx = 1; /* TODO : This is workaround. Need to find right STA Index before sending to HAL */
+ //return retCode;
+ }
+#endif
+
+ if( (eLIM_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) ||(eLIM_BT_AMP_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) )
+ pDelStaParams->staIdx= psessionEntry->staId;
+
+ else
+ pDelStaParams->staIdx= pStaDs->staIndex;
+
+ pDelStaParams->assocId = pStaDs->assocId;
+ pStaDs->valid = 0;
+
+ if (! fRespReqd)
+ pDelStaParams->respReqd = 0;
+ else
+ {
+ //when limDelSta is called from processSmeAssocCnf then mlmState is already set properly.
+ if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != GET_LIM_STA_CONTEXT_MLM_STATE(pStaDs))
+ {
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_WT_DEL_STA_RSP_STATE));
+ SET_LIM_STA_CONTEXT_MLM_STATE(pStaDs, eLIM_MLM_WT_DEL_STA_RSP_STATE);
+ }
+ if ( (eLIM_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) ||
+ (eLIM_BT_AMP_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) )
+ {
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_WT_DEL_STA_RSP_STATE));
+
+ psessionEntry->limMlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE;
+
+ }
+ pDelStaParams->respReqd = 1;
+ //we need to defer the message until we get the response back from HAL.
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+ }
+
+ /* Update PE session ID*/
+ pDelStaParams->sessionId = psessionEntry->peSessionId;
+
+ pDelStaParams->status = eHAL_STATUS_SUCCESS;
+ msgQ.type = WDA_DELETE_STA_REQ;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pDelStaParams;
+ msgQ.bodyval = 0;
+
+ limLog( pMac, LOGE, FL( "Sending SIR_HAL_DELETE_STA_REQ for STAID: %X and AssocID: %d\n" ),
+ pDelStaParams->staIdx, pDelStaParams->assocId);
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ retCode = wdaPostCtrlMsg( pMac, &msgQ );
+ if( eSIR_SUCCESS != retCode)
+ {
+ limLog( pMac, LOGE, FL("Posting DELETE_STA_REQ to HAL failed, reason=%X\n"),
+ retCode );
+ palFreeMemory(pMac->hHdd, (void*)pDelStaParams);
+ }
+
+ return retCode;
+}
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+/*------------------------------------------------------------------------
+ * limAddFTStaSelf()
+ *
+ * FUNCTION:
+ *
+ * This function is called to add a STA once we have connected with a new
+ * AP, that we have performed an FT to.
+ *
+ * The Add STA Response is created and now after the ADD Bss Is Successful
+ * we add the self sta. We update with the association id from the reassoc
+ * response from the AP.
+ *------------------------------------------------------------------------
+ */
+tSirRetStatus limAddFTStaSelf(tpAniSirGlobal pMac, tANI_U16 assocId, tpPESession psessionEntry)
+{
+ tpAddStaParams pAddStaParams = NULL;
+ tSirMsgQ msgQ;
+ tSirRetStatus retCode = eSIR_SUCCESS;
+
+ pAddStaParams = pMac->ft.ftPEContext.pAddStaReq;
+ pAddStaParams->assocId = assocId;
+
+ msgQ.type = SIR_HAL_ADD_STA_REQ;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pAddStaParams;
+ msgQ.bodyval = 0;
+
+
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+ limLog( pMac, LOGE, FL( "Sending SIR_HAL_ADD_STA_REQ... (aid %d)" ), pAddStaParams->assocId);
+#endif
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+
+ psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
+ psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ {
+ limLog( pMac, LOGE, FL("Posting ADD_STA_REQ to HAL failed, reason=%X\n"), retCode );
+ palFreeMemory(pMac->hHdd, (void*)pAddStaParams);
+ }
+ //
+ // Dont need it any more
+ pMac->ft.ftPEContext.pAddStaReq = NULL;
+ return retCode;
+}
+
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+/**
+ * limAddStaSelf()
+ *
+ *FUNCTION:
+ * This function is called to add an STA context at hardware
+ * whenever a STA is (Re) Associated.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pStaDs - Pointer to the STA datastructure created by
+ * LIM and maintained by DPH
+ * @return retCode - Indicates success or failure return code
+ */
+
+tSirRetStatus
+limAddStaSelf(tpAniSirGlobal pMac,tANI_U16 staIdx, tANI_U8 updateSta, tpPESession psessionEntry)
+{
+ tpAddStaParams pAddStaParams = NULL;
+ tSirMsgQ msgQ;
+ tSirRetStatus retCode = eSIR_SUCCESS;
+ tSirMacAddr staMac;
+ tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
+
+ #if 0
+ retCode =wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, staMac, &cfg);
+ if (retCode != eSIR_SUCCESS)
+ {
+ /// Could not get BSSID from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve STA MAC\n"));
+ return retCode;
+ }
+ #endif //TO SUPPORT BT-AMP
+ sirCopyMacAddr(staMac,psessionEntry->selfMacAddr);
+
+ if( eHAL_STATUS_SUCCESS !=
+ palAllocateMemory( pMac->hHdd, (void **) &pAddStaParams, sizeof( tAddStaParams )))
+ {
+ limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during ADD_STA\n" ));
+ return eSIR_MEM_ALLOC_FAILED;
+ }
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams, sizeof(tAddStaParams));
+
+ /// Add STA context at MAC HW (BMU, RHP & TFP)
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->staMac,
+ (tANI_U8 *) staMac, sizeof(tSirMacAddr));
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->bssId,
+ psessionEntry->bssId, sizeof(tSirMacAddr));
+
+ pAddStaParams->assocId = psessionEntry->limAID;
+ pAddStaParams->staType = STA_ENTRY_SELF;
+ pAddStaParams->status = eHAL_STATUS_SUCCESS;
+ pAddStaParams->respReqd = 1;
+
+ /* Update PE session ID */
+ pAddStaParams->sessionId = psessionEntry->peSessionId;
+
+ // This will indicate HAL to "allocate" a new STA index
+ pAddStaParams->staIdx = staIdx;
+ pAddStaParams->updateSta = updateSta;
+
+ pAddStaParams->shortPreambleSupported = psessionEntry->beaconParams.fShortPreamble;
+ limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
+
+ if( psessionEntry->htCapabality)
+ {
+ pAddStaParams->htCapable = psessionEntry->htCapabality;
+#ifdef DISABLE_GF_FOR_INTEROP
+ /*
+ * To resolve the interop problem with Broadcom AP,
+ * where TQ STA could not pass traffic with GF enabled,
+ * TQ STA will do Greenfield only with TQ AP, for
+ * everybody else it will be turned off.
+ */
+ if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
+ {
+ limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
+ pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
+ }
+ else
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE
+ pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
+ pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
+ pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
+ pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
+ pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
+ pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
+ pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
+ pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
+ pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
+ pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
+ pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry);
+ pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry);
+#else
+ pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD );
+ pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET );
+ pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE );
+ pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE );
+ pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION );
+ pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA );
+ pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY );
+ pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR);
+ pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH );
+ pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ);
+ pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ);
+ pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ);
+#endif
+ }
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL\n"));
+ pAddStaParams->listenInterval = (tANI_U16)listenInterval;
+
+#ifdef WLAN_FEATURE_P2P
+ if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona)
+ {
+ pAddStaParams->p2pCapableSta = 1;
+ }
+#endif
+
+ limFillSupportedRatesInfo(pMac, NULL, &pAddStaParams->supportedRates,psessionEntry);
+
+ msgQ.type = WDA_ADD_STA_REQ;
+ //
+ // FIXME_GEN4
+ // A global counter (dialog token) is required to keep track of
+ // all PE <-> HAL communication(s)
+ //
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pAddStaParams;
+ msgQ.bodyval = 0;
+
+ limLog( pMac, LOGW, FL( "Sending SIR_HAL_ADD_STA_REQ... (aid %d)" ),
+ pAddStaParams->assocId);
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ {
+ limLog( pMac, LOGE, FL("Posting ADD_STA_REQ to HAL failed, reason=%X\n"), retCode );
+ palFreeMemory(pMac->hHdd, (void*)pAddStaParams);
+ }
+ return retCode;
+}
+
+
+/**
+ * limTeardownInfraBSS()
+ *
+ *FUNCTION:
+ * This function is called by various LIM functions to teardown
+ * an established Infrastructure BSS
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limTeardownInfraBss(tpAniSirGlobal pMac,tpPESession psessionEntry)
+{
+ tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+
+ /**
+ * Send Broadcast Disassociate frame with
+ * 'leaving BSS' reason.
+ */
+ limSendDisassocMgmtFrame(pMac,
+ eSIR_MAC_DISASSOC_LEAVING_BSS_REASON,
+ bcAddr,psessionEntry);
+} /*** end limTeardownInfraBss() ***/
+
+
+/**
+ * limHandleCnfWaitTimeout()
+ *
+ *FUNCTION:
+ * This function is called by limProcessMessageQueue to handle
+ * various confirmation failure cases.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pStaDs - Pointer to a sta descriptor
+ * @return None
+ */
+
+void limHandleCnfWaitTimeout(tpAniSirGlobal pMac, tANI_U16 staId)
+{
+ tpDphHashNode pStaDs;
+ tLimSystemRole systemRole;
+ tpPESession psessionEntry = NULL;
+
+ if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId))== NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+ systemRole = limGetSystemRole(psessionEntry);
+ pStaDs = dphGetHashEntry(pMac, staId, &psessionEntry->dph.dphHashTable);
+
+ if (pStaDs == NULL)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("No STA context in SIR_LIM_CNF_WAIT_TIMEOUT.\n"));)
+ return;
+ }
+
+ switch (pStaDs->mlmStaContext.mlmState) {
+ case eLIM_MLM_WT_ASSOC_CNF_STATE:
+ PELOGW(limLog(pMac, LOGW, FL("Did not receive Assoc Cnf in eLIM_MLM_WT_ASSOC_CNF_STATE sta Assoc id %d\n"), pStaDs->assocId);)
+ limPrintMacAddr(pMac, pStaDs->staAddr, LOGW);
+
+ if ( (systemRole == eLIM_AP_ROLE)|| (systemRole == eLIM_BT_AMP_AP_ROLE) )
+ {
+ limRejectAssociation(
+ pMac,
+ pStaDs->staAddr,
+ pStaDs->mlmStaContext.subType,
+ true,
+ pStaDs->mlmStaContext.authType,
+ pStaDs->assocId,
+ true,
+ (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
+ psessionEntry);
+ }
+ break;
+
+ default:
+ limLog(pMac, LOGW, FL("Received CNF_WAIT_TIMEOUT in state %d\n"),
+ pStaDs->mlmStaContext.mlmState);
+ }
+}
+
+
+/**
+ * limDeleteDphHashEntry()
+ *
+ *FUNCTION:
+ * This function is called whenever we need to delete
+ * the dph hash entry
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param tANI_U16 staId
+ * @return None
+ */
+
+void
+limDeleteDphHashEntry(tpAniSirGlobal pMac, tSirMacAddr staAddr, tANI_U16 staId,tpPESession psessionEntry)
+{
+ tANI_U16 aid;
+ tpDphHashNode pStaDs;
+ tUpdateBeaconParams beaconParams;
+ tLimSystemRole systemRole;
+
+ beaconParams.paramChangeBitmap = 0;
+ limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, staId);
+ if (NULL == psessionEntry)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("NULL psessionEntry"));)
+ return;
+ }
+ systemRole = limGetSystemRole(psessionEntry);
+ beaconParams.bssIdx = psessionEntry->bssIdx;
+ pStaDs = dphLookupHashEntry(pMac, staAddr, &aid, &psessionEntry->dph.dphHashTable);
+ if (pStaDs != NULL)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Deleting DPH Hash entry for STAID: %X\n "), staId);)
+ // update the station count and perform associated actions
+ // do this before deleting the dph hash entry
+ limUtilCountStaDel(pMac, pStaDs, psessionEntry);
+
+ if((eLIM_AP_ROLE == psessionEntry->limSystemRole) ||
+ (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole))
+ {
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
+ if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE){
+ limDecideApProtectionOnDelete(pMac, pStaDs, &beaconParams,psessionEntry);
+ }
+ }
+#endif
+
+ if(eLIM_STA_IN_IBSS_ROLE == systemRole)
+ limIbssDecideProtectionOnDelete(pMac, pStaDs, &beaconParams, psessionEntry);
+
+ limDecideShortPreamble(pMac, pStaDs, &beaconParams, psessionEntry);
+ limDecideShortSlot(pMac, pStaDs, &beaconParams, psessionEntry);
+
+ //Send message to HAL about beacon parameter change.
+ PELOGW(limLog(pMac, LOGW, FL("param bitmap = %d \n"), beaconParams.paramChangeBitmap);)
+ if(beaconParams.paramChangeBitmap)
+ {
+ schSetFixedBeaconFields(pMac,psessionEntry);
+ limSendBeaconParams(pMac, &beaconParams, psessionEntry );
+ }
+ }
+ if (dphDeleteHashEntry(pMac, staAddr, staId, &psessionEntry->dph.dphHashTable) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("error deleting hash entry\n"));
+ }
+}
+
+
+
+/**
+ * limCheckAndAnnounceJoinSuccess()
+ *
+ *FUNCTION:
+ * This function is called upon receiving Beacon/Probe Response
+ * frame in WT_JOIN_BEACON_STATE to check if the received
+ * Beacon/Probe Response is from the BSS that we're attempting
+ * to join.
+ *
+ *LOGIC:
+ * If the Beacon/Probe Response is indeed from the BSS we're
+ * attempting to join, join success is sent to SME.
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pBPR Pointer to received Beacon/Probe Response
+ * @param pHdr Pointer to received Beacon/Probe Response
+ * MAC header
+ * @return None
+ */
+
+void
+limCheckAndAnnounceJoinSuccess(tpAniSirGlobal pMac,
+ tSirProbeRespBeacon *pBPR,
+ tpSirMacMgmtHdr pHdr,tpPESession psessionEntry)
+{
+ tSirMacSSid currentSSID;
+ tLimMlmJoinCnf mlmJoinCnf;
+
+ palCopyMemory( pMac->hHdd, currentSSID.ssId,
+ psessionEntry->ssId.ssId,
+ psessionEntry->ssId.length);
+
+ currentSSID.length = (tANI_U8)psessionEntry->ssId.length ;
+
+ if (
+ /* Check for SSID only in probe response. Beacons may not carry
+ SSID information in hidden SSID case */
+ ( (SIR_MAC_MGMT_FRAME == pHdr->fc.type) &&
+ (SIR_MAC_MGMT_PROBE_RSP == pHdr->fc.subType) ) &&
+ currentSSID.length &&
+ (!palEqualMemory( pMac->hHdd,(tANI_U8 *) &pBPR->ssId,
+ (tANI_U8 *) ¤tSSID,
+ (tANI_U8) (1 + currentSSID.length)) ))
+ {
+ /**
+ * Received SSID does not match with the one we've.
+ * Ignore received Beacon frame
+ */
+ PELOG1(limLog(pMac, LOG1, FL("SSID received in Beacon does not match\n"));)
+#ifdef WLAN_DEBUG
+ pMac->lim.gLimBcnSSIDMismatchCnt++;
+#endif
+ return;
+ }
+
+ if( (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_STA_ROLE))
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Received Beacon/PR with matching BSSID\n"));)
+
+ // Deactivate Join Failure timer
+ limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER);
+
+ // Update Beacon Interval at CFG database
+
+ if ( pBPR->HTCaps.present )
+ limUpdateStaRunTimeHTCapability( pMac, &pBPR->HTCaps );
+ if ( pBPR->HTInfo.present )
+ limUpdateStaRunTimeHTInfo( pMac, &pBPR->HTInfo, psessionEntry);
+ psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_JOINED_STATE));
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ // In case of BP, we need to adopt to all rates
+ // advertised by AP. Update the operational rates at CFG
+ if (cfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET,
+ (tANI_U8 *) &pBPR->supportedRates.rate,
+ pBPR->supportedRates.numRates)
+ != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("could not update Oper.rates at CFG\n"));
+
+#endif
+
+ /**
+ * Announce join success by sending
+ * Join confirm to SME.
+ */
+ mlmJoinCnf.resultCode = eSIR_SME_SUCCESS;
+ mlmJoinCnf.protStatusCode = eSIR_MAC_SUCCESS_STATUS;
+ /* Update PE sessionId*/
+ mlmJoinCnf.sessionId = psessionEntry->peSessionId;
+ limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
+ } // if ((pMac->lim.gLimSystemRole == IBSS....
+}
+
+/**
+ * limExtractApCapabilities()
+ *
+ *FUNCTION:
+ * This function is called to extract all of the AP's capabilities
+ * from the IEs received from it in Beacon/Probe Response frames
+ *
+ *LOGIC:
+ * This routine mimics the limExtractApCapability() API. The difference here
+ * is that this API returns the entire tSirProbeRespBeacon info as is. It is
+ * left to the caller of this API to use this info as required
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pIE Pointer to starting IE in Beacon/Probe Response
+ * @param ieLen Length of all IEs combined
+ * @param beaconStruct A pointer to tSirProbeRespBeacon that needs to be
+ * populated
+ * @return status A status reporting eSIR_SUCCESS or eSIR_FAILURE
+ */
+tSirRetStatus limExtractApCapabilities( tpAniSirGlobal pMac,
+ tANI_U8 *pIE,
+ tANI_U16 ieLen,
+ tpSirProbeRespBeacon beaconStruct )
+{
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) beaconStruct, sizeof( tSirProbeRespBeacon ));
+
+ PELOG3(limLog( pMac, LOG3,
+ FL( "In limExtractApCapabilities: The IE's being received are:\n" ));
+ sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG3, pIE, ieLen );)
+
+ // Parse the Beacon IE's, Don't try to parse if we dont have anything in IE
+ if (ieLen > 0) {
+ if( eSIR_SUCCESS != sirParseBeaconIE( pMac, beaconStruct, pIE, (tANI_U32)ieLen ))
+ {
+ limLog( pMac, LOGE, FL("APCapExtract: Beacon parsing error!\n"));
+ return eSIR_FAILURE;
+ }
+ }
+
+ return eSIR_SUCCESS;
+}
+
+
+/**
+ * limDelBss()
+ *
+ *FUNCTION:
+ * This function is called to delete BSS context at hardware
+ * whenever a STA is disassociated
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pStaDs - Pointer to the STA datastructure created by
+ * LIM and maintained by DPH
+ * @return retCode - Indicates success or failure return code
+ */
+
+tSirRetStatus
+limDelBss(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tANI_U16 bssIdx,tpPESession psessionEntry)
+{
+ tpDeleteBssParams pDelBssParams = NULL;
+ tSirMsgQ msgQ;
+ tSirRetStatus retCode = eSIR_SUCCESS;
+
+ if( eHAL_STATUS_SUCCESS !=
+ palAllocateMemory( pMac->hHdd, (void **) &pDelBssParams, sizeof( tDeleteBssParams )))
+ {
+ limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during ADD_BSS\n" ));
+ return eSIR_MEM_ALLOC_FAILED;
+ }
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pDelBssParams, sizeof(tDeleteBssParams));
+
+
+ pDelBssParams->sessionId = psessionEntry->peSessionId; //update PE session Id
+
+ //DPH was storing the AssocID in staID field,
+ //staID is actually assigned by HAL when AddSTA message is sent.
+ if (pStaDs != NULL)
+ {
+ pDelBssParams->bssIdx= pStaDs->bssId;
+ pStaDs->valid = 0;
+ pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE;
+ }
+ else
+ pDelBssParams->bssIdx = bssIdx;
+ psessionEntry->limMlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_WT_DEL_BSS_RSP_STATE));
+
+ pDelBssParams->status= eHAL_STATUS_SUCCESS;
+ pDelBssParams->respReqd = 1;
+ PELOGW(limLog( pMac, LOGW, FL("Sending HAL_DELETE_BSS_REQ for BSSID: %X\n"),
+ pDelBssParams->bssIdx);)
+
+ //we need to defer the message until we get the response back from HAL.
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+
+ msgQ.type = WDA_DELETE_BSS_REQ;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pDelBssParams;
+ msgQ.bodyval = 0;
+
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ {
+ limLog( pMac, LOGE, FL("Posting DELETE_BSS_REQ to HAL failed, reason=%X\n"), retCode );
+ palFreeMemory(pMac->hHdd, (void*)pDelBssParams);
+ }
+
+ return retCode;
+}
+
+
+#ifdef ANI_PRODUCT_TYPE_CLIENT
+
+/**
+ * limSendAddBss()
+ *
+ *FUNCTION:
+ *
+ *LOGIC:
+ * 1) LIM receives eWNI_SME_JOIN_REQ
+ * 2) For a valid eWNI_SME_JOIN_REQ, LIM sends
+ * SIR_HAL_ADD_BSS_REQ to HAL
+ *
+ *ASSUMPTIONS:
+ * JOIN REQ parameters are saved in pMac->lim.gLimMlmJoinReq
+ * ADD BSS parameters can be obtained from two sources:
+ * 1) pMac->lim.gLimMlmJoinReq
+ * 2) beaconStruct, passed as paramter
+ * So, if a reqd parameter is found in bssDescriptions
+ * then it is given preference over beaconStruct
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * pAssocRsp contains the structured assoc/reassoc Response got from AP
+ * beaconstruct Has the ProbeRsp/Beacon structured details
+ * bssDescription bssDescription passed to PE from the SME
+ * @return None
+ */
+
+tSirRetStatus limStaSendAddBss( tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp,
+ tpSchBeaconStruct pBeaconStruct, tpSirBssDescription bssDescription, tANI_U8 updateEntry,
+ tpPESession psessionEntry)
+
+{
+ tSirMsgQ msgQ;
+ tpAddBssParams pAddBssParams = NULL;
+ tANI_U32 retCode;
+ tANI_U8 i;
+ tpDphHashNode pStaDs = NULL;
+ tANI_U8 chanWidthSupp = 0;
+ // Package SIR_HAL_ADD_BSS_REQ message parameters
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pAddBssParams,
+ sizeof( tAddBssParams )))
+ {
+ limLog( pMac, LOGP,
+ FL( "Unable to PAL allocate memory during ADD_BSS\n" ));
+ retCode = eSIR_MEM_ALLOC_FAILED;
+ goto returnFailure;
+ }
+ else
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ));
+
+ palCopyMemory( pMac->hHdd, pAddBssParams->bssId,bssDescription->bssId,
+ sizeof( tSirMacAddr ));
+ // Fill in tAddBssParams selfMacAddr
+ palCopyMemory( pMac->hHdd, pAddBssParams->selfMacAddr,
+ psessionEntry->selfMacAddr,
+ sizeof( tSirMacAddr ));
+
+ if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
+ {
+ pAddBssParams->bssType = eSIR_BTAMP_AP_MODE;
+ }
+ else
+ {
+ pAddBssParams->bssType = eSIR_INFRASTRUCTURE_MODE;
+ }
+
+ pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
+
+ /* Update PE session ID */
+ pAddBssParams->sessionId = psessionEntry->peSessionId;
+
+ pAddBssParams->beaconInterval = bssDescription->beaconInterval;
+
+ pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
+ pAddBssParams->updateBss = updateEntry;
+
+
+ pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
+ pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
+ pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
+ pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
+
+ pAddBssParams->rateSet.numRates = pAssocRsp->supportedRates.numRates;
+ palCopyMemory( pMac->hHdd, pAddBssParams->rateSet.rate,
+ pAssocRsp->supportedRates.rate, pAssocRsp->supportedRates.numRates );
+
+ pAddBssParams->nwType = bssDescription->nwType;
+
+ pAddBssParams->shortSlotTimeSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortSlotTime;
+ pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;
+ pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
+ pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
+ pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist;
+
+
+ // Use the advertised capabilities from the received beacon/PR
+
+
+ if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pAssocRsp->HTCaps.present ))
+ {
+ pAddBssParams->htCapable = pAssocRsp->HTCaps.present;
+
+ if ( pBeaconStruct->HTInfo.present )
+ {
+ pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pAssocRsp->HTInfo.opMode;
+ pAddBssParams->dualCTSProtection = ( tANI_U8 ) pAssocRsp->HTInfo.dualCTSProtection;
+#ifdef WLAN_SOFTAP_FEATURE
+ chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
+#else
+ chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET);
+#endif
+ if( (pAssocRsp->HTCaps.supportedChannelWidthSet) &&
+ (chanWidthSupp) )
+ {
+ pAddBssParams->txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet;
+ pAddBssParams->currentExtChannel = pAssocRsp->HTInfo.secondaryChannelOffset;
+ }
+ else
+ {
+ pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
+ pAddBssParams->currentExtChannel = eHT_SECONDARY_CHANNEL_OFFSET_NONE;
+ }
+ pAddBssParams->llnNonGFCoexist = (tANI_U8)pAssocRsp->HTInfo.nonGFDevicesPresent;
+ pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pAssocRsp->HTInfo.lsigTXOPProtectionFullSupport;
+ pAddBssParams->fRIFSMode = pAssocRsp->HTInfo.rifsMode;
+ }
+ }
+
+ pAddBssParams->currentOperChannel = bssDescription->channelId;
+
+ // Populate the STA-related parameters here
+ // Note that the STA here refers to the AP
+ {
+ /* staType = PEER*/
+ pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
+
+ palCopyMemory( pMac->hHdd, pAddBssParams->staContext.bssId,
+ bssDescription->bssId,
+ sizeof( tSirMacAddr ));
+ pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
+
+ /* Fill Assoc id from the dph table */
+ pStaDs = dphLookupHashEntry(pMac, pAddBssParams->staContext.bssId,
+ &pAddBssParams->staContext.assocId, &psessionEntry->dph.dphHashTable);
+ if (pStaDs == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Couldn't get assoc id for"
+ "MAC ADDR: %02x:%02x:%02x:%02x:%02x:%02x"),
+ pAddBssParams->staContext.staMac[0],
+ pAddBssParams->staContext.staMac[1],
+ pAddBssParams->staContext.staMac[2],
+ pAddBssParams->staContext.staMac[3],
+ pAddBssParams->staContext.staMac[4],
+ pAddBssParams->staContext.staMac[5]
+ );)
+ }
+ pAddBssParams->staContext.uAPSD = 0;
+ pAddBssParams->staContext.maxSPLen = 0;
+ pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortPreamble;
+ pAddBssParams->staContext.updateSta = updateEntry;
+
+ if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
+ {
+ pAddBssParams->staContext.us32MaxAmpduDuration = 0;
+ pAddBssParams->staContext.htCapable = 1;
+ pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 )pAssocRsp->HTCaps.greenField;
+ pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 )pAssocRsp->HTCaps.lsigTXOPProtection;
+ if( (pAssocRsp->HTCaps.supportedChannelWidthSet) &&
+ (chanWidthSupp) )
+ {
+ pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet;
+ }
+ else
+ {
+ pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
+ }
+ pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pAssocRsp->HTCaps.mimoPowerSave;
+ pAddBssParams->staContext.delBASupport = ( tANI_U8 )pAssocRsp->HTCaps.delayedBA;
+ pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 )pAssocRsp->HTCaps.maximalAMSDUsize;
+ pAddBssParams->staContext.maxAmpduDensity = pAssocRsp->HTCaps.mpduDensity;
+ pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pAssocRsp->HTCaps.dsssCckMode40MHz;
+ pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI20MHz;
+ pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI40MHz;
+ pAddBssParams->staContext.maxAmpduSize= pAssocRsp->HTCaps.maxRxAMPDUFactor;
+
+ if( pBeaconStruct->HTInfo.present )
+ pAddBssParams->staContext.rifsMode = pAssocRsp->HTInfo.rifsMode;
+ }
+
+ if ((psessionEntry->limWmeEnabled && pAssocRsp->wmeEdcaPresent) ||
+ (psessionEntry->limQosEnabled && pAssocRsp->edcaPresent))
+ pAddBssParams->staContext.wmmEnabled = 1;
+ else
+ pAddBssParams->staContext.wmmEnabled = 0;
+
+ //Update the rates
+
+ pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
+ if (pStaDs != NULL)
+ {
+ limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry);
+ palCopyMemory(pMac->hHdd, (tANI_U8*)&pAddBssParams->staContext.supportedRates,
+ (tANI_U8*)&pStaDs->supportedRates,
+ sizeof(tSirSupportedRates));
+ }
+ else
+ PELOGE(limLog(pMac, LOGE, FL("could not Update the supported rates.\n"));)
+
+ }
+
+ //Disable BA. It will be set as part of ADDBA negotiation.
+ for( i = 0; i < STACFG_MAX_TC; i++ )
+ {
+ pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
+ pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
+ pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
+ pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
+ }
+
+ pAddBssParams->staContext.encryptType = psessionEntry->encryptType;
+
+#if defined WLAN_FEATURE_VOWIFI
+ pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
+#endif
+ // FIXME_GEN4 - Any other value that can be used for initialization?
+ pAddBssParams->status = eHAL_STATUS_SUCCESS;
+ pAddBssParams->respReqd = true;
+
+ pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona
+
+#ifdef WLAN_FEATURE_P2P
+ if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona)
+ {
+ pAddBssParams->staContext.p2pCapableSta = 1;
+ }
+#endif
+
+ pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled;
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+ pAddBssParams->extSetStaKeyParamValid = 0;
+#endif
+
+ // Set a new state for MLME
+ if( eLIM_MLM_WT_ASSOC_RSP_STATE == psessionEntry->limMlmState )
+ psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE;
+ else
+ psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+ //we need to defer the message until we get the response back from HAL.
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+
+ msgQ.type = WDA_ADD_BSS_REQ;
+ /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pAddBssParams;
+ msgQ.bodyval = 0;
+
+ limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+
+ retCode = wdaPostCtrlMsg( pMac, &msgQ );
+ if( eSIR_SUCCESS != retCode)
+ {
+ palFreeMemory(pMac->hHdd, pAddBssParams);
+ limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X\n"),
+ retCode );
+ goto returnFailure;
+
+ }
+ else
+ return retCode;
+
+ returnFailure:
+ // Clean-up will be done by the caller...
+ return retCode;
+}
+
+
+
+
+tSirRetStatus limStaSendAddBssPreAssoc( tpAniSirGlobal pMac, tANI_U8 updateEntry, tpPESession psessionEntry)
+{
+ tSirMsgQ msgQ;
+ tpAddBssParams pAddBssParams = NULL;
+ tANI_U32 retCode;
+ tANI_U8 i;
+ tSchBeaconStruct beaconStruct;
+ tANI_U8 chanWidthSupp = 0;
+ tpSirBssDescription bssDescription = &psessionEntry->pLimJoinReq->bssDescription;
+
+
+ // Package SIR_HAL_ADD_BSS_REQ message parameters
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pAddBssParams,
+ sizeof( tAddBssParams )))
+ {
+ limLog( pMac, LOGP,
+ FL( "Unable to PAL allocate memory during ADD_BSS\n" ));
+ retCode = eSIR_MEM_ALLOC_FAILED;
+ goto returnFailure;
+ }
+
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ));
+
+
+ limExtractApCapabilities( pMac,
+ (tANI_U8 *) bssDescription->ieFields,
+ limGetIElenFromBssDescription( bssDescription ),
+ &beaconStruct );
+
+ if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
+ limDecideStaProtectionOnAssoc(pMac, &beaconStruct, psessionEntry);
+ palCopyMemory( pMac->hHdd, pAddBssParams->bssId,bssDescription->bssId,
+ sizeof( tSirMacAddr ));
+
+ // Fill in tAddBssParams selfMacAddr
+ palCopyMemory( pMac->hHdd, pAddBssParams->selfMacAddr,
+ psessionEntry->selfMacAddr,
+ sizeof( tSirMacAddr ));
+
+ /* Incorrect BSS Type which caused UMA Descriptor to be overwritten on
+ * top of an already established Infra link. This lead to issues in
+ * concurrent data transfer.
+ */
+
+ pAddBssParams->bssType = psessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
+ pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
+
+ pAddBssParams->beaconInterval = bssDescription->beaconInterval;
+
+ pAddBssParams->dtimPeriod = beaconStruct.tim.dtimPeriod;
+ pAddBssParams->updateBss = updateEntry;
+
+
+ pAddBssParams->cfParamSet.cfpCount = beaconStruct.cfParamSet.cfpCount;
+ pAddBssParams->cfParamSet.cfpPeriod = beaconStruct.cfParamSet.cfpPeriod;
+ pAddBssParams->cfParamSet.cfpMaxDuration = beaconStruct.cfParamSet.cfpMaxDuration;
+ pAddBssParams->cfParamSet.cfpDurRemaining = beaconStruct.cfParamSet.cfpDurRemaining;
+
+
+ pAddBssParams->rateSet.numRates = beaconStruct.supportedRates.numRates;
+ palCopyMemory( pMac->hHdd, pAddBssParams->rateSet.rate,
+ beaconStruct.supportedRates.rate, beaconStruct.supportedRates.numRates );
+
+ pAddBssParams->nwType = bssDescription->nwType;
+
+ pAddBssParams->shortSlotTimeSupported = (tANI_U8)beaconStruct.capabilityInfo.shortSlotTime;
+ pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;
+ pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
+ pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
+ pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist;
+
+ // Use the advertised capabilities from the received beacon/PR
+ if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( beaconStruct.HTCaps.present ))
+ {
+ pAddBssParams->htCapable = beaconStruct.HTCaps.present;
+
+ if ( beaconStruct.HTInfo.present )
+ {
+ pAddBssParams->htOperMode = (tSirMacHTOperatingMode)beaconStruct.HTInfo.opMode;
+ pAddBssParams->dualCTSProtection = ( tANI_U8 ) beaconStruct.HTInfo.dualCTSProtection;
+
+#ifdef WLAN_SOFTAP_FEATURE
+ chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
+#else
+ chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET);
+#endif
+ if( (beaconStruct.HTCaps.supportedChannelWidthSet) &&
+ (chanWidthSupp) )
+ {
+ pAddBssParams->txChannelWidthSet = ( tANI_U8 ) beaconStruct.HTInfo.recommendedTxWidthSet;
+ pAddBssParams->currentExtChannel = beaconStruct.HTInfo.secondaryChannelOffset;
+ }
+ else
+ {
+ pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
+ pAddBssParams->currentExtChannel = eHT_SECONDARY_CHANNEL_OFFSET_NONE;
+ }
+ pAddBssParams->llnNonGFCoexist = (tANI_U8)beaconStruct.HTInfo.nonGFDevicesPresent;
+ pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)beaconStruct.HTInfo.lsigTXOPProtectionFullSupport;
+ pAddBssParams->fRIFSMode = beaconStruct.HTInfo.rifsMode;
+ }
+ }
+
+ pAddBssParams->currentOperChannel = bssDescription->channelId;
+
+ // Populate the STA-related parameters here
+ // Note that the STA here refers to the AP
+ {
+ pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
+
+ palCopyMemory( pMac->hHdd, pAddBssParams->staContext.bssId,
+ bssDescription->bssId,
+ sizeof( tSirMacAddr ));
+ pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
+
+ pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
+ pAddBssParams->staContext.uAPSD = 0;
+ pAddBssParams->staContext.maxSPLen = 0;
+ pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)beaconStruct.capabilityInfo.shortPreamble;
+ pAddBssParams->staContext.updateSta = updateEntry;
+
+ if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( beaconStruct.HTCaps.present ))
+ {
+ pAddBssParams->staContext.us32MaxAmpduDuration = 0;
+ pAddBssParams->staContext.htCapable = 1;
+ pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) beaconStruct.HTCaps.greenField;
+ pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) beaconStruct.HTCaps.lsigTXOPProtection;
+ if( (beaconStruct.HTCaps.supportedChannelWidthSet) &&
+ (chanWidthSupp) )
+ {
+ pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )beaconStruct.HTInfo.recommendedTxWidthSet;
+ }
+ else
+ {
+ pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
+ }
+ pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)beaconStruct.HTCaps.mimoPowerSave;
+ pAddBssParams->staContext.delBASupport = ( tANI_U8 ) beaconStruct.HTCaps.delayedBA;
+ pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) beaconStruct.HTCaps.maximalAMSDUsize;
+ pAddBssParams->staContext.maxAmpduDensity = beaconStruct.HTCaps.mpduDensity;
+ pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)beaconStruct.HTCaps.dsssCckMode40MHz;
+ pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)beaconStruct.HTCaps.shortGI20MHz;
+ pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)beaconStruct.HTCaps.shortGI40MHz;
+ pAddBssParams->staContext.maxAmpduSize= beaconStruct.HTCaps.maxRxAMPDUFactor;
+
+ if( beaconStruct.HTInfo.present )
+ pAddBssParams->staContext.rifsMode = beaconStruct.HTInfo.rifsMode;
+ }
+
+ if ((psessionEntry->limWmeEnabled && beaconStruct.wmeEdcaPresent) ||
+ (psessionEntry->limQosEnabled && beaconStruct.edcaPresent))
+ pAddBssParams->staContext.wmmEnabled = 1;
+ else
+ pAddBssParams->staContext.wmmEnabled = 0;
+
+ //Update the rates
+
+ limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates,
+ beaconStruct.HTCaps.supportedMCSSet, false,psessionEntry);
+ limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,psessionEntry);
+
+ }
+
+
+ //Disable BA. It will be set as part of ADDBA negotiation.
+ for( i = 0; i < STACFG_MAX_TC; i++ )
+ {
+ pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
+ pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
+ pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
+ pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
+ }
+
+ pAddBssParams->staContext.encryptType = psessionEntry->encryptType;
+
+#if defined WLAN_FEATURE_VOWIFI
+ pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
+#endif
+
+ pAddBssParams->status = eHAL_STATUS_SUCCESS;
+ pAddBssParams->respReqd = true;
+
+ pAddBssParams->staContext.sessionId = psessionEntry->peSessionId;
+ pAddBssParams->sessionId = psessionEntry->peSessionId;
+
+ pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona
+
+ pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled;
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+ pAddBssParams->extSetStaKeyParamValid = 0;
+#endif
+
+ // Set a new state for MLME
+
+ //pMac->lim.gLimMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE;
+ psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE;
+
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+ //we need to defer the message until we get the response back from HAL.
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+
+ msgQ.type = WDA_ADD_BSS_REQ;
+ /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pAddBssParams;
+ msgQ.bodyval = 0;
+
+ limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+
+ retCode = wdaPostCtrlMsg( pMac, &msgQ );
+ if( eSIR_SUCCESS != retCode)
+ {
+ palFreeMemory(pMac->hHdd, pAddBssParams);
+ limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X\n"),
+ retCode );
+ goto returnFailure;
+
+ }
+ else
+ return retCode;
+
+ returnFailure:
+ // Clean-up will be done by the caller...
+ return retCode;
+}
+
+
+
+
+
+#elif defined(ANI_AP_CLIENT_SDK)
+tSirRetStatus limStaSendAddBss( tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp,
+ tpSirNeighborBssInfo neighborBssInfo, tANI_U8 updateEntry,
+ tpPESession psessionEntry)
+{
+ tSirMsgQ msgQ;
+ tpAddBssParams pAddBssParams = NULL;
+ tANI_U32 retCode;
+ tANI_U8 i;
+ tpDphHashNode pStaDs = NULL;
+
+ // Package SIR_HAL_ADD_BSS_REQ message parameters
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pAddBssParams,
+ sizeof( tAddBssParams )))
+ {
+ limLog( pMac, LOGP,
+ FL( "Unable to PAL allocate memory during ADD_BSS\n" ));
+ retCode = eSIR_MEM_ALLOC_FAILED;
+ goto returnFailure;
+ }
+ else
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ));
+
+ palCopyMemory( pMac->hHdd, pAddBssParams->bssId,neighborBssInfo->bssId,
+ sizeof( tSirMacAddr ));
+
+#ifdef WLAN_SOFTAP_FEATURE
+ // Fill in tAddBssParams selfMacAddr
+ palCopyMemory( pMac->hHdd, pAddBssParams->selfMacAddr, psessionEntry->selfMacAddr,
+ sizeof( tSirMacAddr ));
+#endif
+
+ pAddBssParams->bssType = eSIR_INFRASTRUCTURE_MODE;
+ pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
+ pAddBssParams->beaconInterval = (tANI_U16) neighborBssInfo->beaconInterval;
+ pAddBssParams->dtimPeriod = neighborBssInfo->dtimPeriod;
+ pAddBssParams->updateBss = updateEntry;
+
+
+ /* The following parameters are commented since the information is not available from the
+ * neighborBssInfo. This needs to be fixed later */
+#if 0
+
+ pAddBssParams->cfParamSet.cfpCount = beaconStruct.cfParamSet.cfpCount;
+ pAddBssParams->cfParamSet.cfpPeriod = beaconStruct.cfParamSet.cfpPeriod;
+ pAddBssParams->cfParamSet.cfpMaxDuration = beaconStruct.cfParamSet.cfpMaxDuration;
+ pAddBssParams->cfParamSet.cfpDurRemaining = beaconStruct.cfParamSet.cfpDurRemaining;
+#endif
+ pAddBssParams->rateSet.numRates = pAssocRsp->supportedRates.numRates;
+ palCopyMemory( pMac->hHdd, pAddBssParams->rateSet.rate,
+ pAssocRsp->supportedRates.rate, pAssocRsp->supportedRates.numRates );
+
+ /* Update PE session ID */
+ pAddBssParams->sessionId = psessionEntry->peSessionId;
+
+ pAddBssParams->nwType = neighborBssInfo->nwType;
+
+ pAddBssParams->shortSlotTimeSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortSlotTime;
+ pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;
+ pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
+ pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
+ pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist;
+
+ // Use the advertised capabilities from the received beacon/PR
+ if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( neighborBssInfo->HTCapsPresent ))
+ {
+ pAddBssParams->htCapable = pAssocRsp->HTCaps.present;
+
+ if ( neighborBssInfo->HTInfoPresent )
+ {
+ pAddBssParams->htOperMode = pAssocRsp->HTInfo.opMode;
+ pAddBssParams->dualCTSProtection = ( tANI_U8 )pAssocRsp->HTInfo.dualCTSProtection;
+
+ if(pAssocRsp->HTCaps.supportedChannelWidthSet)
+ {
+ pAddBssParams->txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet;
+ pAddBssParams->currentExtChannel = pAssocRsp->HTInfo.secondaryChannelOffset;
+ }
+ else
+ {
+ pAddBssParams->txChannelWidthSet = (tANI_U8)pAssocRsp->HTCaps.supportedChannelWidthSet;
+ pAddBssParams->currentExtChannel = eHT_SECONDARY_CHANNEL_OFFSET_NONE;
+ }
+ pAddBssParams->llnNonGFCoexist = (tANI_U8)pAssocRsp->HTInfo.nonGFDevicesPresent;
+ pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pAssocRsp->HTInfo.lsigTXOPProtectionFullSupport;
+ pAddBssParams->fRIFSMode = pAssocRsp->HTInfo.rifsMode;
+ }
+ }
+
+ pAddBssParams->currentOperChannel = neighborBssInfo->channelId;
+
+ // Populate the STA-related parameters here
+ // Note that the STA here refers to the AP
+ {
+ pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
+
+ palCopyMemory( pMac->hHdd, pAddBssParams->staContext.bssId,
+ neighborBssInfo->bssId,
+ sizeof( tSirMacAddr ));
+ pAddBssParams->staContext.listenInterval = (tANI_U8) neighborBssInfo->beaconInterval;
+
+ pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
+ pAddBssParams->staContext.uAPSD = 0;
+ pAddBssParams->staContext.maxSPLen = 0;
+ pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortPreamble;
+ pAddBssParams->staContext.updateSta = updateEntry;
+
+
+ if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pAssocRsp->HTCaps.present ))
+ {
+ pAddBssParams->staContext.us32MaxAmpduDuration = 0;
+ pAddBssParams->staContext.htCapable = 1;
+ pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 )pAssocRsp->HTCaps.greenField;
+ pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 )pAssocRsp->HTCaps.lsigTXOPProtection;
+ pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )(pAssocRsp->HTCaps.supportedChannelWidthSet ?
+ pAssocRsp->HTInfo.recommendedTxWidthSet :
+ pAssocRsp->HTCaps.supportedChannelWidthSet );
+ pAddBssParams->staContext.mimoPS = pAssocRsp->HTCaps.mimoPowerSave;
+ pAddBssParams->staContext.delBASupport = ( tANI_U8 )pAssocRsp->HTCaps.delayedBA;
+ pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 )pAssocRsp->HTCaps.maximalAMSDUsize;
+ pAddBssParams->staContext.maxAmpduDensity = pAssocRsp->HTCaps.mpduDensity;
+ pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pAssocRsp->HTCaps.dsssCckMode40MHz;
+ pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI20MHz;
+ pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI40MHz;
+ pAddBssParams->staContext.maxAmpduSize= pAssocRsp->HTCaps.maxRxAMPDUFactor;
+
+ if( pAssocRsp->HTInfo.present )
+ pAddBssParams->staContext.rifsMode = pAssocRsp->HTInfo.rifsMode;
+ }
+
+ if ((psessionEntry->limWmeEnabled && pAssocRsp->wmeEdcaPresent) ||
+ (psessionEntry->limQosEnabled && pAssocRsp->edcaPresent))
+ pAddBssParams->staContext.wmmEnabled = 1;
+ else
+ pAddBssParams->staContext.wmmEnabled = 0;
+
+ //Update the rates
+
+ pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
+ if (pStaDs != NULL)
+ {
+ limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry);
+ palCopyMemory(pMac->hHdd, (tANI_U8*)&pAddBssParams->staContext.supportedRates,
+ (tANI_U8*)&pStaDs->supportedRates,
+ sizeof(tSirSupportedRates));
+ }
+ else
+ PELOGE(limLog(pMac, LOGE, FL("could not Update the supported rates.\n"));)
+
+ }
+
+ //Disable BA. It will be set as part of ADDBA negotiation.
+ for( i = 0; i < SMAC_STACFG_MAX_TC; i++ )
+ {
+ pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
+ pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
+ pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
+ pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
+ }
+
+#if defined WLAN_FEATURE_VOWIFI
+ pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
+#endif
+ // FIXME_GEN4 - Any other value that can be used for initialization?
+ pAddBssParams->status = eHAL_STATUS_SUCCESS;
+ pAddBssParams->respReqd = true;
+
+ pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+ pAddBssParams->extSetStaKeyParamValid = 0;
+#endif
+
+ // Set a new state for MLME
+ if( eLIM_MLM_WT_ASSOC_RSP_STATE == psessionEntry->limMlmState )
+ psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE;
+ else
+ psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+ //we need to defer the message until we get the response back from HAL.
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+
+ msgQ.type = SIR_HAL_ADD_BSS_REQ;
+ /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pAddBssParams;
+ msgQ.bodyval = 0;
+
+ limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+
+ retCode = halPostMsgApi( pMac, &msgQ );
+ if( eSIR_SUCCESS != retCode)
+ {
+ palFreeMemory(pMac->hHdd, pAddBssParams);
+ limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X\n"),
+ retCode );
+ }
+ else
+ return retCode;
+
+ returnFailure:
+ // Clean-up will be done by the caller...
+ return retCode;
+}
+
+#endif // ANI_PRODUCT_TYPE_CLIENT
+
+/** -------------------------------------------------------------
+\fn limPrepareAndSendDelStaCnf
+\brief deletes DPH entry
+ changes the MLM mode for station.
+ calls limSendDelStaCnf
+\param tpAniSirGlobal pMac
+\param tpDphHashNode pStaDs
+\return none
+ -------------------------------------------------------------*/
+
+
+void
+limPrepareAndSendDelStaCnf(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tSirResultCodes statusCode,tpPESession psessionEntry)
+{
+ tANI_U16 staDsAssocId = 0;
+ tSirMacAddr staDsAddr;
+ tLimMlmStaContext mlmStaContext;
+
+ if(pStaDs == NULL)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("pStaDs is NULL\n"));)
+ return;
+ }
+ staDsAssocId = pStaDs->assocId;
+ palCopyMemory( pMac->hHdd, (tANI_U8 *)staDsAddr,
+ pStaDs->staAddr,
+ sizeof(tSirMacAddr));
+
+ mlmStaContext = pStaDs->mlmStaContext;
+ if(eSIR_SME_SUCCESS == statusCode)
+ {
+ if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
+ (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
+ {
+ limReleaseAID(pMac, pStaDs->assocId);
+ }
+
+ limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
+ }
+ if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
+ {
+ psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+ }
+
+ limSendDelStaCnf(pMac, staDsAddr, staDsAssocId, mlmStaContext, statusCode,psessionEntry);
+}
+
+/** -------------------------------------------------------------
+\fn limGetStaRateMode
+\brief Gets the Station Rate Mode.
+\param tANI_U8 dot11Mode
+\return none
+ -------------------------------------------------------------*/
+tStaRateMode limGetStaRateMode(tANI_U8 dot11Mode)
+{
+ switch(dot11Mode)
+ {
+ case WNI_CFG_DOT11_MODE_11A:
+ return eSTA_11a;
+ case WNI_CFG_DOT11_MODE_11B:
+ return eSTA_11b;
+ case WNI_CFG_DOT11_MODE_11G:
+ return eSTA_11bg;
+ case WNI_CFG_DOT11_MODE_11N:
+ return eSTA_11n;
+ case WNI_CFG_DOT11_MODE_ALL:
+ default:
+ return eSTA_11n;
+
+ }
+}
+
+/** -------------------------------------------------------------
+\fn limInitPreAuthTimerTable
+\brief Initialize the Pre Auth Tanle and creates the timer for
+ each node for the timeout value got from cfg.
+\param tpAniSirGlobal pMac
+\param tpLimPreAuthTable pPreAuthTimerTable
+\return none
+ -------------------------------------------------------------*/
+void limInitPreAuthTimerTable(tpAniSirGlobal pMac, tpLimPreAuthTable pPreAuthTimerTable)
+{
+ tANI_U32 cfgValue;
+ tANI_U32 authNodeIdx;
+ tpLimPreAuthNode pAuthNode = pPreAuthTimerTable->pTable;
+
+ // Get AUTH_RSP Timers value
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_RSP_TIMEOUT,
+ &cfgValue) != eSIR_SUCCESS)
+ {
+ /*
+ ** Could not get AUTH_RSP timeout value
+ ** from CFG. Log error.
+ **/
+ limLog(pMac, LOGP,
+ FL("could not retrieve AUTH_RSP timeout value\n"));
+ return;
+ }
+
+ cfgValue = SYS_MS_TO_TICKS(cfgValue);
+ for(authNodeIdx=0; authNodeIdx<pPreAuthTimerTable->numEntry; authNodeIdx++, pAuthNode++)
+ {
+ if (tx_timer_create(&pAuthNode->timer,
+ "AUTH RESPONSE TIMEOUT",
+ limAuthResponseTimerHandler,
+ authNodeIdx,
+ cfgValue,
+ 0,
+ TX_NO_ACTIVATE) != TX_SUCCESS)
+ {
+ // Cannot create timer. Log error.
+ limLog(pMac, LOGP, FL("Cannot create Auth Rsp timer of Index :%d.\n"), authNodeIdx);
+ return;
+ }
+ pAuthNode->authNodeIdx = (tANI_U8)authNodeIdx;
+ pAuthNode->fFree = 1;
+ }
+
+}
+
+/** -------------------------------------------------------------
+\fn limAcquireFreePreAuthNode
+\brief Retrives a free Pre Auth node from Pre Auth Table.
+\param tpAniSirGlobal pMac
+\param tpLimPreAuthTable pPreAuthTimerTable
+\return none
+ -------------------------------------------------------------*/
+tLimPreAuthNode * limAcquireFreePreAuthNode(tpAniSirGlobal pMac, tpLimPreAuthTable pPreAuthTimerTable)
+{
+ tANI_U32 i;
+ tLimPreAuthNode *pTempNode = pPreAuthTimerTable->pTable;
+ for (i=0; i<pPreAuthTimerTable->numEntry; i++,pTempNode++)
+ {
+ if (pTempNode->fFree == 1)
+ {
+ pTempNode->fFree = 0;
+ return pTempNode;
+ }
+ }
+
+ return NULL;
+}
+
+/** -------------------------------------------------------------
+\fn limGetPreAuthNodeFromIndex
+\brief Depending on the Index this retrives the pre auth node.
+\param tpAniSirGlobal pMac
+\param tpLimPreAuthTable pAuthTable
+\param tANI_U32 authNodeIdx
+\return none
+ -------------------------------------------------------------*/
+tLimPreAuthNode * limGetPreAuthNodeFromIndex(tpAniSirGlobal pMac,
+ tpLimPreAuthTable pAuthTable, tANI_U32 authNodeIdx)
+{
+ if ((authNodeIdx >= pAuthTable->numEntry) || (pAuthTable->pTable == NULL))
+ {
+ limLog(pMac, LOGE, FL("Invalid Auth Timer Index : %d NumEntry : %d\n"),
+ authNodeIdx, pAuthTable->numEntry);
+ return NULL;
+ }
+
+ return pAuthTable->pTable + authNodeIdx;
+}
+
+/* Util API to check if the channels supported by STA is within range */
+tSirRetStatus limIsDot11hSupportedChannelsValid(tpAniSirGlobal pMac, tSirAssocReq *assoc)
+{
+ /*
+ * Allow all the stations to join with us.
+ * 802.11h-2003 11.6.1 => An AP may use the supported channels list for associated STAs
+ * as an input into an algorithm used to select a new channel for the BSS.
+ * The specification of the algorithm is beyond the scope of this amendment.
+ */
+
+ return (eSIR_SUCCESS);
+}
+
+/* Util API to check if the txpower supported by STA is within range */
+tSirRetStatus limIsDot11hPowerCapabilitiesInRange(tpAniSirGlobal pMac, tSirAssocReq *assoc,tpPESession psessionEntry)
+{
+ tPowerdBm localMaxTxPower;
+ tANI_U32 localPwrConstraint;
+
+ localMaxTxPower = cfgGetRegulatoryMaxTransmitPower(pMac, psessionEntry->currentOperChannel);
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
+ limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg\n" ));
+ return eSIR_FAILURE;
+ }
+ localMaxTxPower -= (tPowerdBm)localPwrConstraint;
+
+ /**
+ * The min Tx Power of the associating station should not be greater than (regulatory
+ * max tx power - local power constraint configured on AP).
+ */
+ if(assoc->powerCapability.minTxPower > localMaxTxPower)
+ {
+ limLog(pMac, LOGW, FL("minTxPower (STA) = %d, localMaxTxPower (AP) = %d\n"),
+ assoc->powerCapability.minTxPower, localMaxTxPower);
+ return (eSIR_FAILURE);
+ }
+
+ return (eSIR_SUCCESS);
+}
+
+/** -------------------------------------------------------------
+\fn limFillRxHighestSupportedRate
+\brief Fills in the Rx Highest Supported Data Rate field from
+\ the 'supported MCS set' field in HT capability element.
+\param tpAniSirGlobal pMac
+\param tpSirSupportedRates pRates
+\param tANI_U8* pSupportedMCSSet
+\return none
+ -------------------------------------------------------------*/
+void limFillRxHighestSupportedRate(tpAniSirGlobal pMac, tANI_U16 *rxHighestRate, tANI_U8* pSupportedMCSSet)
+{
+ tSirMacRxHighestSupportRate *pRxHighestRate;
+ tANI_U8 *pBuf;
+ tANI_U16 rate=0;
+
+ pBuf = pSupportedMCSSet + MCS_RX_HIGHEST_SUPPORTED_RATE_BYTE_OFFSET;
+ rate = limGetU16(pBuf);
+
+ pRxHighestRate = (tSirMacRxHighestSupportRate *) &rate;
+ *rxHighestRate = pRxHighestRate->rate;
+
+ return;
+}
diff --git a/CORE/MAC/src/pe/lim/limAssocUtils.h b/CORE/MAC/src/pe/lim/limAssocUtils.h
new file mode 100644
index 0000000..a46f7ab
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limAssocUtils.h
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * This file limAssocUtils.h contains the utility definitions
+ * LIM uses while processing Re/Association messages.
+ * Author: Chandra Modumudi
+ * Date: 02/13/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ * 05/26/10 js WPA handling in (Re)Assoc frames
+ *
+ */
+#ifndef __LIM_ASSOC_UTILS_H
+#define __LIM_ASSOC_UTILS_H
+
+#include "sirApi.h"
+#include "sirDebug.h"
+#include "cfgApi.h"
+
+#include "limTypes.h"
+
+
+tANI_U8 limCmpSSid(tpAniSirGlobal, tSirMacSSid *,tpPESession);
+tANI_U8 limCompareCapabilities(tpAniSirGlobal,
+ tSirAssocReq *,
+ tSirMacCapabilityInfo *,tpPESession);
+tANI_U8 limCheckRxBasicRates(tpAniSirGlobal, tSirMacRateSet,tpPESession);
+#ifdef WLAN_SOFTAP_FEATURE
+tANI_U8 limCheckRxRSNIeMatch(tpAniSirGlobal, tDot11fIERSN, tpPESession, tANI_U8);
+tANI_U8 limCheckRxWPAIeMatch(tpAniSirGlobal, tDot11fIEWPA, tpPESession, tANI_U8);
+#endif
+tANI_U8 limCheckMCSSet(tpAniSirGlobal pMac, tANI_U8* supportedMCSSet);
+void limPostDummyToTmRing(tpAniSirGlobal, tpDphHashNode);
+void limPostPacketToTdRing(tpAniSirGlobal,
+ tpDphHashNode,
+ tANI_U8);
+tSirRetStatus limCleanupRxPath(tpAniSirGlobal, tpDphHashNode,tpPESession);
+void limRejectAssociation(tpAniSirGlobal , tSirMacAddr, tANI_U8,
+ tANI_U8 , tAniAuthType,
+ tANI_U16, tANI_U8, tSirResultCodes, tpPESession);
+
+tSirRetStatus limPopulateOwnRateSet(tpAniSirGlobal pMac,
+ tpSirSupportedRates pRates,
+ tANI_U8* pSupportedMCSSet,
+ tANI_U8 basicOnly,
+ tpPESession psessionEntry);
+
+tSirRetStatus limPopulateMatchingRateSet(tpAniSirGlobal,
+ tpDphHashNode,
+ tSirMacRateSet *,
+ tSirMacRateSet *,
+ tANI_U8* pSupportedMCSSet,
+ tSirMacPropRateSet *, tpPESession);
+tSirRetStatus limAddSta(tpAniSirGlobal, tpDphHashNode,tpPESession);
+tSirRetStatus limDelBss(tpAniSirGlobal, tpDphHashNode, tANI_U16, tpPESession);
+tSirRetStatus limDelSta(tpAniSirGlobal, tpDphHashNode, tANI_BOOLEAN, tpPESession);
+#ifdef WLAN_FEATURE_VOWIFI_11R
+tSirRetStatus limAddFTStaSelf(tpAniSirGlobal pMac, tANI_U16 assocId,
+ tpPESession psessionEntry);
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+tSirRetStatus limAddStaSelf(tpAniSirGlobal, tANI_U16, tANI_U8, tpPESession);
+tStaRateMode limGetStaRateMode(tANI_U8 dot11Mode);
+
+
+void limTeardownInfraBss(tpAniSirGlobal,tpPESession);
+void limRestorePreReassocState(tpAniSirGlobal,
+ tSirResultCodes,
+ tANI_U16,tpPESession);
+eAniBoolean limIsReassocInProgress(tpAniSirGlobal,tpPESession);
+void
+limSendDelStaCnf(tpAniSirGlobal pMac, tSirMacAddr staDsAddr,
+ tANI_U16 staDsAssocId, tLimMlmStaContext mlmStaContext, tSirResultCodes statusCode,tpPESession psessionEntry);
+
+void limHandleCnfWaitTimeout(tpAniSirGlobal pMac, tANI_U16 staId);
+void limDeleteDphHashEntry(tpAniSirGlobal, tSirMacAddr, tANI_U16,tpPESession);
+void limCheckAndAnnounceJoinSuccess(tpAniSirGlobal,
+ tSirProbeRespBeacon *,
+ tpSirMacMgmtHdr,tpPESession);
+void limUpdateReAssocGlobals(tpAniSirGlobal pMac,
+ tpSirAssocRsp pAssocRsp,tpPESession psessionEntry);
+
+void limUpdateAssocStaDatas(tpAniSirGlobal pMac,
+ tpDphHashNode pStaDs,tpSirAssocRsp pAssocRsp,tpPESession psessionEntry);
+void
+limFillSupportedRatesInfo(
+ tpAniSirGlobal pMac,
+ tpDphHashNode pSta,
+ tpSirSupportedRates pRates,
+ tpPESession psessionEntry);
+
+#ifdef ANI_PRODUCT_TYPE_CLIENT
+//make non-conditional until the caller is #ifdefed
+tSirRetStatus limStaSendAddBss(tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp,
+ tpSchBeaconStruct pBeaconStruct, tpSirBssDescription bssDescription, tANI_U8 updateEntry, tpPESession psessionEntry);
+tSirRetStatus limStaSendAddBssPreAssoc( tpAniSirGlobal pMac, tANI_U8 updateEntry, tpPESession psessionEntry);
+
+
+
+#elif defined(ANI_AP_CLIENT_SDK)
+tSirRetStatus limStaSendAddBss(tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp,
+ tpSirNeighborBssInfo neighborBssInfo,tANI_U8 updateEntry,
+ tpPESession psessionEntry);
+#endif
+
+void limPrepareAndSendDelStaCnf(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tSirResultCodes statusCode,tpPESession);
+tSirRetStatus limExtractApCapabilities(tpAniSirGlobal pMac, tANI_U8 * pIE, tANI_U16 ieLen, tpSirProbeRespBeacon beaconStruct);
+void limInitPreAuthTimerTable(tpAniSirGlobal pMac, tpLimPreAuthTable pPreAuthTimerTable);
+tpLimPreAuthNode limAcquireFreePreAuthNode(tpAniSirGlobal pMac, tpLimPreAuthTable pPreAuthTimerTable);
+tpLimPreAuthNode limGetPreAuthNodeFromIndex(tpAniSirGlobal pMac, tpLimPreAuthTable pAuthTable, tANI_U32 authNodeIdx);
+
+/* Util API to check if the channels supported by STA is within range */
+tSirRetStatus limIsDot11hSupportedChannelsValid(tpAniSirGlobal pMac, tSirAssocReq *assoc);
+
+/* Util API to check if the txpower supported by STA is within range */
+tSirRetStatus limIsDot11hPowerCapabilitiesInRange(tpAniSirGlobal pMac, tSirAssocReq *assoc,tpPESession);
+
+/* API to re-add the same BSS during re-association */
+void limHandleAddBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry);
+
+/* API to fill in RX Highest Supported data Rate */
+void limFillRxHighestSupportedRate(tpAniSirGlobal pMac, tANI_U16 *rxHighestRate, tANI_U8* pSupportedMCSSet);
+
+
+#endif /* __LIM_ASSOC_UTILS_H */
+
diff --git a/CORE/MAC/src/pe/lim/limDebug.c b/CORE/MAC/src/pe/lim/limDebug.c
new file mode 100644
index 0000000..bece3ae
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limDebug.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**=========================================================================
+
+ \file limDebug.c
+
+ \brief implementation for log Debug related APIs
+
+ \author Sunit Bhatia
+
+ Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
+
+ Qualcomm Confidential and Proprietary.
+
+ ========================================================================*/
+
+#include "limDebug.h"
+
+void limLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
+{
+#ifdef WLAN_DEBUG
+ // Verify against current log level
+ if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_LIM_MODULE_ID )] )
+ return;
+ else
+ {
+ va_list marker;
+
+ va_start( marker, pString ); /* Initialize variable arguments. */
+
+ logDebug(pMac, SIR_LIM_MODULE_ID, loglevel, pString, marker);
+
+ va_end( marker ); /* Reset variable arguments. */
+ }
+#endif
+}
diff --git a/CORE/MAC/src/pe/lim/limDebug.h b/CORE/MAC/src/pe/lim/limDebug.h
new file mode 100644
index 0000000..9715fb6
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limDebug.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * This file limDebug.h contains log function called by LIM module.
+ *
+ * Author: Chandra Modumudi
+ * Date: 02/11/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#ifndef __LIM_DEBUG_H__
+#define __LIM_DEBUG_H__
+
+#include "utilsApi.h"
+#include "sirDebug.h"
+
+
+void limLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...) ;
+
+#endif
diff --git a/CORE/MAC/src/pe/lim/limFT.c b/CORE/MAC/src/pe/lim/limFT.c
new file mode 100644
index 0000000..37cf607
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limFT.c
@@ -0,0 +1,1424 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+/**=========================================================================
+
+ \brief implementation for PE 11r VoWiFi FT Protocol
+
+ Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
+
+ Qualcomm Confidential and Proprietary.
+
+ ========================================================================*/
+
+/* $Header$ */
+
+
+/*--------------------------------------------------------------------------
+ Include Files
+ ------------------------------------------------------------------------*/
+#include <limSendMessages.h>
+#include <limTypes.h>
+#include <limFT.h>
+#include <limFTDefs.h>
+#include <limUtils.h>
+#include <limPropExtsUtils.h>
+#include <limAssocUtils.h>
+#include <limSession.h>
+#include <limAdmitControl.h>
+#include "wmmApsd.h"
+
+#define LIM_FT_RIC_BA_SSN 1
+#define LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 248
+#define LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA 1
+
+/*--------------------------------------------------------------------------
+ Initialize the FT variables.
+ ------------------------------------------------------------------------*/
+void limFTOpen(tpAniSirGlobal pMac)
+{
+ pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
+ pMac->ft.ftPEContext.psavedsessionEntry = NULL;
+}
+
+/*--------------------------------------------------------------------------
+ Cleanup FT variables.
+ ------------------------------------------------------------------------*/
+void limFTCleanup(tpAniSirGlobal pMac)
+{
+ if (pMac->ft.ftPEContext.pFTPreAuthReq)
+ {
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p\n",
+ __FUNCTION__, pMac->ft.ftPEContext.pFTPreAuthReq);)
+#endif
+ vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
+ pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
+ }
+
+ // This is the old session, should be deleted else where.
+ // We should not be cleaning it here, just set it to NULL.
+ if (pMac->ft.ftPEContext.psavedsessionEntry)
+ {
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL\n",
+ __FUNCTION__, pMac->ft.ftPEContext.psavedsessionEntry);)
+#endif
+ pMac->ft.ftPEContext.psavedsessionEntry = NULL;
+ }
+
+ // This is the extra session we added as part of Auth resp
+ // clean it up.
+ if (pMac->ft.ftPEContext.pftSessionEntry)
+ {
+ if ((((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->valid) &&
+ (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limSmeState == eLIM_SME_WT_REASSOC_STATE))
+ {
+ PELOGE(limLog( pMac, LOGE, "%s: Deleting Preauth Session %d\n", __func__, ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);)
+ peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
+ }
+ pMac->ft.ftPEContext.pftSessionEntry = NULL;
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL\n",
+ __FUNCTION__, pMac->ft.ftPEContext.psavedsessionEntry);)
+#endif
+ }
+
+ if (pMac->ft.ftPEContext.pAddBssReq)
+ {
+ vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
+ pMac->ft.ftPEContext.pAddBssReq = NULL;
+ }
+
+ if (pMac->ft.ftPEContext.pAddStaReq)
+ {
+ vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
+ pMac->ft.ftPEContext.pAddStaReq = NULL;
+ }
+
+ pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
+
+}
+
+/*--------------------------------------------------------------------------
+ Init FT variables.
+ ------------------------------------------------------------------------*/
+void limFTInit(tpAniSirGlobal pMac)
+{
+ if (pMac->ft.ftPEContext.pFTPreAuthReq)
+ {
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p\n",
+ __FUNCTION__, pMac->ft.ftPEContext.pFTPreAuthReq);)
+#endif
+ vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
+ pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
+ }
+
+ // This is the old session, should be deleted else where.
+ // We should not be cleaning it here, just set it to NULL.
+ if (pMac->ft.ftPEContext.psavedsessionEntry)
+ {
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL\n",
+ __FUNCTION__, pMac->ft.ftPEContext.psavedsessionEntry);)
+#endif
+ pMac->ft.ftPEContext.psavedsessionEntry = NULL;
+ }
+
+ // This is the extra session we added as part of Auth resp
+ // clean it up.
+ if (pMac->ft.ftPEContext.pftSessionEntry)
+ {
+ /* Cannot delete sessions across associations */
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog( pMac, LOGE, "%s: Deleting session = %p \n",
+ __FUNCTION__, pMac->ft.ftPEContext.pftSessionEntry);)
+#endif
+ pMac->ft.ftPEContext.pftSessionEntry = NULL;
+ }
+
+ if (pMac->ft.ftPEContext.pAddBssReq)
+ {
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog( pMac, LOGE, "%s: Freeing AddBssReq = %p \n",
+ __FUNCTION__, pMac->ft.ftPEContext.pAddBssReq);)
+#endif
+ vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
+ pMac->ft.ftPEContext.pAddBssReq = NULL;
+ }
+
+
+ if (pMac->ft.ftPEContext.pAddStaReq)
+ {
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog( pMac, LOGE, "%s: Freeing AddStaReq = %p \n",
+ __FUNCTION__, pMac->ft.ftPEContext.pAddStaReq);)
+#endif
+ vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
+ pMac->ft.ftPEContext.pAddStaReq = NULL;
+ }
+
+ pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
+
+}
+
+/*------------------------------------------------------------------
+ *
+ * This is the handler after suspending the link.
+ * We suspend the link and then now proceed to switch channel.
+ *
+ *------------------------------------------------------------------*/
+void FTPreAuthSuspendLinkHandler(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
+{
+ tpPESession psessionEntry;
+
+ // The link is suspended of not ?
+ if (status != eHAL_STATUS_SUCCESS)
+ {
+ PELOGE(limLog( pMac, LOGE, "%s: Returning \n", __FUNCTION__);)
+ // Post the FT Pre Auth Response to SME
+ limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, (tpPESession)data);
+
+ return;
+ }
+
+ psessionEntry = (tpPESession)data;
+ // Suspended, now move to a different channel.
+ // Perform some sanity check before proceeding.
+ if ((pMac->ft.ftPEContext.pFTPreAuthReq) && psessionEntry)
+ {
+ limChangeChannelWithCallback(pMac,
+ pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum,
+ limPerformFTPreAuth, NULL, psessionEntry);
+ return;
+ }
+
+ // Else return error.
+ limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
+}
+
+
+/*--------------------------------------------------------------------------
+ In this function, we process the FT Pre Auth Req.
+ We receive Pre-Auth
+ Suspend link
+ Register a call back
+ In the call back, we will need to accept frames from the new bssid
+ Send out the auth req to new AP.
+ Start timer and when the timer is done or if we receive the Auth response
+ We change channel
+ Resume link
+ ------------------------------------------------------------------------*/
+int limProcessFTPreAuthReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
+{
+ int bufConsumed = FALSE;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId;
+
+ // Now we are starting fresh make sure all's cleanup.
+ limFTInit(pMac);
+ pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_FAILURE; // Can set it only after sending auth
+
+ // We need information from the Pre-Auth Req. Lets save that
+ pMac->ft.ftPEContext.pFTPreAuthReq = (tpSirFTPreAuthReq)pMsg->bodyptr;
+
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog( pMac, LOGE, "%s: PE Auth ft_ies_length=%02x%02x%02x\n", __FUNCTION__,
+ pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[0],
+ pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[1],
+ pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[2]);)
+#endif
+
+ // Get the current session entry
+ psessionEntry = peFindSessionByBssid(pMac,
+ pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &sessionId);
+ if (psessionEntry == NULL)
+ {
+ PELOGE(limLog( pMac, LOGE, "%s: Unable to find session for the following bssid\n",
+ __FUNCTION__);)
+ limPrintMacAddr( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, LOGE );
+ // Post the FT Pre Auth Response to SME
+ limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, NULL);
+ return TRUE;
+ }
+
+ // Dont need to suspend if APs are in same channel
+ if (psessionEntry->currentOperChannel != pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
+ {
+ // Need to suspend link only if the channels are different
+ limSuspendLink(pMac, eSIR_CHECK_LINK_TRAFFIC_BEFORE_SCAN, FTPreAuthSuspendLinkHandler,
+ (tANI_U32 *)psessionEntry);
+ }
+ else
+ {
+ PELOGE(limLog( pMac, LOGE, "%s: Performing pre-auth on same channel\n",
+ __FUNCTION__);)
+ // We are in the same channel. Perform pre-auth
+ limPerformFTPreAuth(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry);
+ }
+
+ return bufConsumed;
+}
+
+/*------------------------------------------------------------------
+ * Send the Auth1
+ * Receive back Auth2
+ *------------------------------------------------------------------*/
+void limPerformFTPreAuth(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
+ tpPESession psessionEntry)
+{
+ tSirMacAuthFrameBody authFrame;
+
+ if (psessionEntry->is11Rconnection)
+ {
+ // Only 11r assoc has FT IEs.
+ if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies == NULL)
+ {
+ PELOGE(limLog( pMac, LOGE, "%s: FTIEs for Auth Req Seq 1 is absent\n");)
+ return;
+ }
+ }
+ if (status != eHAL_STATUS_SUCCESS)
+ {
+ PELOGE(limLog( pMac, LOGE, "%s: Change channel not successful for FT pre-auth\n");)
+ return;
+ }
+ pMac->ft.ftPEContext.psavedsessionEntry = psessionEntry;
+
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog( pMac, LOGE, "Entered wait auth2 state for FT\n");)
+#endif
+
+
+ if (psessionEntry->is11Rconnection)
+ {
+ // Now we are on the right channel and need to send out Auth1 and
+ // receive Auth2.
+ authFrame.authAlgoNumber = eSIR_FT_AUTH; // Set the auth type to FT
+ }
+#if defined FEATURE_WLAN_CCX
+ else
+ {
+ // Will need to make isCCXconnection a enum may be for further
+ // improvements to this to match this algorithm number
+ authFrame.authAlgoNumber = eSIR_OPEN_SYSTEM; // For now if its CCX and 11r FT.
+ }
+#endif
+ authFrame.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
+ authFrame.authStatusCode = 0;
+
+ // Start timer here to come back to operating channel.
+ pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId = psessionEntry->peSessionId;
+ if(TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer))
+ {
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Start Failed\n", __FUNCTION__);)
+#endif
+ }
+
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Started\n", __FUNCTION__);)
+#endif
+
+ limSendAuthMgmtFrame(pMac, &authFrame,
+ pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId,
+ LIM_NO_WEP_IN_FC, psessionEntry);
+
+ return;
+}
+
+
+/*------------------------------------------------------------------
+ *
+ * Create the new Add Bss Req to the new AP.
+ * This will be used when we are ready to FT to the new AP.
+ * The newly created ft Session entry is passed to this function
+ *
+ *------------------------------------------------------------------*/
+tSirRetStatus limFTPrepareAddBssReq( tpAniSirGlobal pMac,
+ tANI_U8 updateEntry, tpPESession pftSessionEntry,
+ tpSirBssDescription bssDescription )
+{
+ tpAddBssParams pAddBssParams = NULL;
+ tANI_U8 i;
+ tANI_U8 chanWidthSupp = 0;
+ tSchBeaconStruct beaconStruct;
+
+
+ // Package SIR_HAL_ADD_BSS_REQ message parameters
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pAddBssParams, sizeof( tAddBssParams )))
+ {
+ limLog( pMac, LOGP,
+ FL( "Unable to PAL allocate memory for creating ADD_BSS\n" ));
+ return (eSIR_MEM_ALLOC_FAILED);
+ }
+
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ));
+
+
+ limExtractApCapabilities( pMac,
+ (tANI_U8 *) bssDescription->ieFields,
+ limGetIElenFromBssDescription( bssDescription ), &beaconStruct );
+
+ if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
+ limDecideStaProtectionOnAssoc(pMac, &beaconStruct, pftSessionEntry);
+
+ palCopyMemory( pMac->hHdd, pAddBssParams->bssId, bssDescription->bssId,
+ sizeof( tSirMacAddr ));
+
+ // Fill in tAddBssParams selfMacAddr
+ palCopyMemory( pMac->hHdd, pAddBssParams->selfMacAddr, pftSessionEntry->selfMacAddr,
+ sizeof( tSirMacAddr ));
+
+ pAddBssParams->bssType = pftSessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
+ pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
+
+ pAddBssParams->beaconInterval = bssDescription->beaconInterval;
+
+ pAddBssParams->dtimPeriod = beaconStruct.tim.dtimPeriod;
+ pAddBssParams->updateBss = updateEntry;
+
+
+ pAddBssParams->cfParamSet.cfpCount = beaconStruct.cfParamSet.cfpCount;
+ pAddBssParams->cfParamSet.cfpPeriod = beaconStruct.cfParamSet.cfpPeriod;
+ pAddBssParams->cfParamSet.cfpMaxDuration = beaconStruct.cfParamSet.cfpMaxDuration;
+ pAddBssParams->cfParamSet.cfpDurRemaining = beaconStruct.cfParamSet.cfpDurRemaining;
+
+
+ pAddBssParams->rateSet.numRates = beaconStruct.supportedRates.numRates;
+ palCopyMemory( pMac->hHdd, pAddBssParams->rateSet.rate,
+ beaconStruct.supportedRates.rate, beaconStruct.supportedRates.numRates );
+
+ pAddBssParams->nwType = bssDescription->nwType;
+
+ pAddBssParams->shortSlotTimeSupported = (tANI_U8)beaconStruct.capabilityInfo.shortSlotTime;
+ pAddBssParams->llaCoexist = (tANI_U8) pftSessionEntry->beaconParams.llaCoexist;
+ pAddBssParams->llbCoexist = (tANI_U8) pftSessionEntry->beaconParams.llbCoexist;
+ pAddBssParams->llgCoexist = (tANI_U8) pftSessionEntry->beaconParams.llgCoexist;
+ pAddBssParams->ht20Coexist = (tANI_U8) pftSessionEntry->beaconParams.ht20Coexist;
+
+ // Use the advertised capabilities from the received beacon/PR
+ if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( beaconStruct.HTCaps.present ))
+ {
+ pAddBssParams->htCapable = beaconStruct.HTCaps.present;
+
+ if ( beaconStruct.HTInfo.present )
+ {
+ pAddBssParams->htOperMode = (tSirMacHTOperatingMode)beaconStruct.HTInfo.opMode;
+ pAddBssParams->dualCTSProtection = ( tANI_U8 ) beaconStruct.HTInfo.dualCTSProtection;
+
+#ifdef WLAN_SOFTAP_FEATURE
+ chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, pftSessionEntry);
+#else
+ chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET);
+#endif
+ if( (beaconStruct.HTCaps.supportedChannelWidthSet) &&
+ (chanWidthSupp) )
+ {
+ pAddBssParams->txChannelWidthSet = ( tANI_U8 ) beaconStruct.HTInfo.recommendedTxWidthSet;
+ pAddBssParams->currentExtChannel = beaconStruct.HTInfo.secondaryChannelOffset;
+ }
+ else
+ {
+ pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
+ pAddBssParams->currentExtChannel = eHT_SECONDARY_CHANNEL_OFFSET_NONE;
+ }
+ pAddBssParams->llnNonGFCoexist = (tANI_U8)beaconStruct.HTInfo.nonGFDevicesPresent;
+ pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)beaconStruct.HTInfo.lsigTXOPProtectionFullSupport;
+ pAddBssParams->fRIFSMode = beaconStruct.HTInfo.rifsMode;
+ }
+ }
+
+ pAddBssParams->currentOperChannel = bssDescription->channelId;
+
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+ limLog( pMac, LOGE, FL( "SIR_HAL_ADD_BSS_REQ with channel = %d..." ),
+ pAddBssParams->currentOperChannel);
+#endif
+
+
+ // Populate the STA-related parameters here
+ // Note that the STA here refers to the AP
+ {
+ pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
+
+ palCopyMemory( pMac->hHdd, pAddBssParams->staContext.bssId,
+ bssDescription->bssId,
+ sizeof( tSirMacAddr ));
+ pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
+
+ pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
+ pAddBssParams->staContext.uAPSD = 0;
+ pAddBssParams->staContext.maxSPLen = 0;
+ pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)beaconStruct.capabilityInfo.shortPreamble;
+ pAddBssParams->staContext.updateSta = updateEntry;
+ pAddBssParams->staContext.encryptType = pftSessionEntry->encryptType;
+
+ if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( beaconStruct.HTCaps.present ))
+ {
+ pAddBssParams->staContext.us32MaxAmpduDuration = 0;
+ pAddBssParams->staContext.htCapable = 1;
+ pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) beaconStruct.HTCaps.greenField;
+ pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) beaconStruct.HTCaps.lsigTXOPProtection;
+ if( (beaconStruct.HTCaps.supportedChannelWidthSet) &&
+ (chanWidthSupp) )
+ {
+ pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )beaconStruct.HTInfo.recommendedTxWidthSet;
+ }
+ else
+ {
+ pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
+ }
+ pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)beaconStruct.HTCaps.mimoPowerSave;
+ pAddBssParams->staContext.delBASupport = ( tANI_U8 ) beaconStruct.HTCaps.delayedBA;
+ pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) beaconStruct.HTCaps.maximalAMSDUsize;
+ pAddBssParams->staContext.maxAmpduDensity = beaconStruct.HTCaps.mpduDensity;
+ pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)beaconStruct.HTCaps.dsssCckMode40MHz;
+ pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)beaconStruct.HTCaps.shortGI20MHz;
+ pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)beaconStruct.HTCaps.shortGI40MHz;
+ pAddBssParams->staContext.maxAmpduSize= beaconStruct.HTCaps.maxRxAMPDUFactor;
+
+ if( beaconStruct.HTInfo.present )
+ pAddBssParams->staContext.rifsMode = beaconStruct.HTInfo.rifsMode;
+ }
+
+ if ((pftSessionEntry->limWmeEnabled && beaconStruct.wmeEdcaPresent) ||
+ (pftSessionEntry->limQosEnabled && beaconStruct.edcaPresent))
+ pAddBssParams->staContext.wmmEnabled = 1;
+ else
+ pAddBssParams->staContext.wmmEnabled = 0;
+
+ //Update the rates
+
+ limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates,
+ beaconStruct.HTCaps.supportedMCSSet, false,pftSessionEntry);
+ limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,pftSessionEntry);
+
+ }
+
+
+ //Disable BA. It will be set as part of ADDBA negotiation.
+ for( i = 0; i < STACFG_MAX_TC; i++ )
+ {
+ pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
+ pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
+ pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
+ pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
+ }
+
+#if defined WLAN_FEATURE_VOWIFI
+ pAddBssParams->maxTxPower = pftSessionEntry->maxTxPower;
+#endif
+
+ pAddBssParams->status = eHAL_STATUS_SUCCESS;
+ pAddBssParams->respReqd = true;
+
+ pAddBssParams->staContext.sessionId = pftSessionEntry->peSessionId;
+ pAddBssParams->sessionId = pftSessionEntry->peSessionId;
+
+ // Set a new state for MLME
+
+ pftSessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE;
+
+ pAddBssParams->halPersona=(tANI_U8)pftSessionEntry->pePersona; //pass on the session persona to hal
+
+ pMac->ft.ftPEContext.pAddBssReq = pAddBssParams;
+
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+ limLog( pMac, LOGE, FL( "Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap..." ));
+#endif
+
+ return 0;
+}
+
+/*------------------------------------------------------------------
+ *
+ * Setup the new session for the pre-auth AP.
+ * Return the newly created session entry.
+ *
+ *------------------------------------------------------------------*/
+tpPESession limFillFTSession(tpAniSirGlobal pMac,
+ tpSirBssDescription pbssDescription, tpPESession psessionEntry)
+{
+ tpPESession pftSessionEntry;
+ tANI_U8 currentBssUapsd;
+ tANI_U8 sessionId;
+ tPowerdBm localPowerConstraint;
+ tPowerdBm regMax;
+ tSchBeaconStruct beaconStruct;
+
+ if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
+ &sessionId, pMac->lim.maxStation)) == NULL)
+ {
+ limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP\n"));
+ return NULL;
+ }
+
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX
+ limPrintMacAddr(pMac, pbssDescription->bssId, LOGE);
+#endif
+
+ /* Store PE session Id in session Table */
+ pftSessionEntry->peSessionId = sessionId;
+
+ pftSessionEntry->dot11mode = psessionEntry->dot11mode;
+ pftSessionEntry->htCapabality = psessionEntry->htCapabality;
+
+ pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
+ pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
+ pftSessionEntry->limWsmEnabled = psessionEntry->limWsmEnabled;
+ pftSessionEntry->lim11hEnable = psessionEntry->lim11hEnable;
+
+ // Fields to be filled later
+ pftSessionEntry->pLimJoinReq = NULL;
+ pftSessionEntry->smeSessionId = 0;
+ pftSessionEntry->transactionId = 0;
+
+ limExtractApCapabilities( pMac,
+ (tANI_U8 *) pbssDescription->ieFields,
+ limGetIElenFromBssDescription( pbssDescription ),
+ &beaconStruct );
+
+ pftSessionEntry->rateSet.numRates = beaconStruct.supportedRates.numRates;
+ palCopyMemory( pMac->hHdd, pftSessionEntry->rateSet.rate,
+ beaconStruct.supportedRates.rate, beaconStruct.supportedRates.numRates );
+
+ pftSessionEntry->extRateSet.numRates = beaconStruct.extendedRates.numRates;
+ palCopyMemory(pMac->hHdd, pftSessionEntry->extRateSet.rate,
+ beaconStruct.extendedRates.rate, pftSessionEntry->extRateSet.numRates);
+
+
+ pftSessionEntry->ssId.length = beaconStruct.ssId.length;
+ palCopyMemory( pMac->hHdd, pftSessionEntry->ssId.ssId, beaconStruct.ssId.ssId,
+ pftSessionEntry->ssId.length);
+
+
+ // Self Mac
+ sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
+ sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX
+ limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOGE);
+#endif
+
+ /* Store beaconInterval */
+ pftSessionEntry->beaconParams.beaconInterval = pbssDescription->beaconInterval;
+ pftSessionEntry->bssType = psessionEntry->bssType;
+
+ pftSessionEntry->statypeForBss = STA_ENTRY_PEER;
+ pftSessionEntry->nwType = pbssDescription->nwType;
+
+ /* Copy The channel Id to the session Table */
+ pftSessionEntry->limReassocChannelId = pbssDescription->channelId;
+ pftSessionEntry->currentOperChannel = pbssDescription->channelId;
+
+
+ if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
+ {
+ pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
+ }
+ else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
+ {
+ pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
+ }
+ else
+ {
+ /* Throw an error and return and make sure to delete the session.*/
+ limLog(pMac, LOGE, FL("Invalid bss type\n"));
+ }
+
+ pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
+ pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
+
+ pftSessionEntry->limCurrentTitanHtCaps=
+ pbssDescription->titanHtCaps;
+ pftSessionEntry->limReassocTitanHtCaps=
+ pftSessionEntry->limCurrentTitanHtCaps;
+
+ regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel );
+ localPowerConstraint = regMax;
+ limExtractApCapability( pMac, (tANI_U8 *) pbssDescription->ieFields,
+ limGetIElenFromBssDescription(pbssDescription),
+ &pftSessionEntry->limCurrentBssQosCaps,
+ &pftSessionEntry->limCurrentBssPropCap,
+ ¤tBssUapsd , &localPowerConstraint);
+
+ pftSessionEntry->limReassocBssQosCaps =
+ pftSessionEntry->limCurrentBssQosCaps;
+ pftSessionEntry->limReassocBssPropCap =
+ pftSessionEntry->limCurrentBssPropCap;
+
+
+ pftSessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
+
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+ limLog( pMac, LOGE, "%s: Regulatory max = %d, local power constraint = %d, max tx = %d",
+ __FUNCTION__, regMax, localPowerConstraint, pftSessionEntry->maxTxPower );
+#endif
+
+ pftSessionEntry->limRFBand = limGetRFBand(pftSessionEntry->currentOperChannel);
+
+ pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
+ pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
+
+ pftSessionEntry->encryptType = psessionEntry->encryptType;
+
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog( pMac, LOGE, "%s: Created session with the id = %d\n",
+ __FUNCTION__, pftSessionEntry->peSessionId);)
+#endif
+
+ return pftSessionEntry;
+}
+
+/*------------------------------------------------------------------
+ *
+ * Setup the session and the add bss req for the pre-auth AP.
+ *
+ *------------------------------------------------------------------*/
+void limFTSetupAuthSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
+{
+ tpPESession pftSessionEntry;
+
+ // Prepare the session right now with as much as possible.
+ pftSessionEntry = limFillFTSession(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription, psessionEntry);
+
+ if (pftSessionEntry)
+ {
+ pftSessionEntry->is11Rconnection = psessionEntry->is11Rconnection;
+#ifdef FEATURE_WLAN_CCX
+ pftSessionEntry->isCCXconnection = psessionEntry->isCCXconnection;
+#endif
+#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX
+ pftSessionEntry->isFastTransitionEnabled = psessionEntry->isFastTransitionEnabled;
+#endif
+ limFTPrepareAddBssReq( pMac, FALSE, pftSessionEntry,
+ pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription );
+ pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
+ }
+}
+
+/*------------------------------------------------------------------
+ * Resume Link Call Back
+ *------------------------------------------------------------------*/
+void limFTProcessPreAuthResult(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
+{
+ tpPESession psessionEntry;
+
+ psessionEntry = (tpPESession)data;
+
+ if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
+ {
+ limFTSetupAuthSession(pMac, psessionEntry);
+ }
+
+ // Post the FT Pre Auth Response to SME
+ limPostFTPreAuthRsp(pMac, pMac->ft.ftPEContext.ftPreAuthStatus,
+ pMac->ft.ftPEContext.saved_auth_rsp,
+ pMac->ft.ftPEContext.saved_auth_rsp_length, psessionEntry);
+
+}
+
+/*------------------------------------------------------------------
+ * Resume Link Call Back
+ *------------------------------------------------------------------*/
+void limPerformPostFTPreAuthAndChannelChange(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
+ tpPESession psessionEntry)
+{
+ //Set the resume channel to Any valid channel (invalid).
+ //This will instruct HAL to set it to any previous valid channel.
+ peSetResumeChannel(pMac, 0, 0);
+ limResumeLink(pMac, limFTProcessPreAuthResult, (tANI_U32 *)psessionEntry);
+}
+
+tSirRetStatus limCreateRICBlockAckIE(tpAniSirGlobal pMac, tANI_U8 tid, tCfgTrafficClass *pTrafficClass,
+ tANI_U8 *ric_ies, tANI_U32 *ieLength)
+{
+ tDot11fIERICDataDesc ricIe;
+ tDot11fFfBAStartingSequenceControl baSsnControl;
+ tDot11fFfAddBAParameterSet baParamSet;
+ tDot11fFfBATimeout baTimeout;
+
+ vos_mem_zero(&ricIe, sizeof(tDot11fIERICDataDesc));
+ vos_mem_zero(&baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
+ vos_mem_zero(&baParamSet, sizeof(tDot11fFfAddBAParameterSet));
+ vos_mem_zero(&baTimeout, sizeof(tDot11fFfBATimeout));
+
+ ricIe.present = 1;
+ ricIe.RICData.present = 1;
+ ricIe.RICData.resourceDescCount = 1;
+ ricIe.RICData.Identifier = LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 + tid;
+ ricIe.RICDescriptor.present = 1;
+ ricIe.RICDescriptor.resourceType = LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA;
+ baParamSet.tid = tid;
+ baParamSet.policy = pTrafficClass->fTxBApolicy; // Immediate Block Ack
+ baParamSet.bufferSize = pTrafficClass->txBufSize;
+ vos_mem_copy((v_VOID_t *)&baTimeout, (v_VOID_t *)&pTrafficClass->tuTxBAWaitTimeout, sizeof(baTimeout));
+ baSsnControl.fragNumber = 0;
+ baSsnControl.ssn = LIM_FT_RIC_BA_SSN;
+
+ dot11fPackFfAddBAParameterSet(pMac, &baParamSet, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
+ //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baParamSet, sizeof(tDot11fFfAddBAParameterSet));
+ ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfAddBAParameterSet);
+
+ dot11fPackFfBATimeout(pMac, &baTimeout, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
+ //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baTimeout, sizeof(tDot11fFfBATimeout));
+ ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBATimeout);
+
+ dot11fPackFfBAStartingSequenceControl(pMac, &baSsnControl, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
+ //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
+ ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBAStartingSequenceControl);
+
+ return (tSirRetStatus) dot11fPackIeRICDataDesc(pMac, &ricIe, ric_ies, sizeof(tDot11fIERICDataDesc), ieLength);
+}
+
+tSirRetStatus limFTFillRICBlockAckInfo(tpAniSirGlobal pMac, tANI_U8 *ric_ies, tANI_U32 *ric_ies_length)
+{
+ tANI_U8 tid = 0;
+ tpDphHashNode pSta;
+ tANI_U16 numBA = 0, aid = 0;
+ tpPESession psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry;
+ tANI_U32 offset = 0, ieLength = 0;
+ tSirRetStatus status = eSIR_SUCCESS;
+
+ // First, extract the DPH entry
+ pSta = dphLookupHashEntry( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &aid, &psessionEntry->dph.dphHashTable);
+ if( NULL == pSta )
+ {
+ PELOGE(limLog( pMac, LOGE,
+ FL( "STA context not found for saved session's BSSID %02x:%02x:%02x:%02x:%02x:%02x\n" ),
+ pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[0],
+ pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[1],
+ pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[2],
+ pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[3],
+ pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[4],
+ pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[5] );)
+ return eSIR_FAILURE;
+ }
+
+ for (tid = 0; tid < STACFG_MAX_TC; tid++)
+ {
+ if (pSta->tcCfg[tid].fUseBATx)
+ {
+ status = limCreateRICBlockAckIE(pMac, tid, &pSta->tcCfg[tid], ric_ies + offset, &ieLength);
+ if (eSIR_SUCCESS == status)
+ {
+ offset += ieLength;
+ *ric_ies_length += ieLength;
+ numBA++;
+ }
+ else
+ {
+ PELOGE(limLog(pMac, LOGE, FL("BA RIC IE creation for TID %d failed with status %d"), tid, status);)
+ }
+ }
+ }
+
+ PELOGE(limLog(pMac, LOGE, FL("Number of BA RIC IEs created = %d: Total length = %d\n"), numBA, *ric_ies_length);)
+ return status;
+}
+
+/*------------------------------------------------------------------
+ *
+ * Will post pre auth response to SME.
+ *
+ *------------------------------------------------------------------*/
+void limPostFTPreAuthRsp(tpAniSirGlobal pMac, eHalStatus status,
+ tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
+ tpPESession psessionEntry)
+{
+ tpSirFTPreAuthRsp pFTPreAuthRsp;
+ tSirMsgQ mmhMsg;
+ tANI_U16 rspLen = sizeof(tSirFTPreAuthRsp);
+ tSirRetStatus sirStatus = eSIR_SUCCESS;
+
+ pFTPreAuthRsp = (tpSirFTPreAuthRsp)vos_mem_malloc(rspLen);
+ if(NULL == pFTPreAuthRsp)
+ {
+ PELOGE(limLog( pMac, LOGE, "Failed to allocate memory\n");)
+ VOS_ASSERT(pFTPreAuthRsp != NULL);
+ return;
+ }
+ vos_mem_zero( pFTPreAuthRsp, rspLen);
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog( pMac, LOGE, "%s: Auth Rsp = %p\n", pFTPreAuthRsp);)
+#endif
+
+ palZeroMemory(pMac, (tANI_U8*)pFTPreAuthRsp, rspLen);
+ pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP;
+ pFTPreAuthRsp->length = (tANI_U16) rspLen;
+ pFTPreAuthRsp->status = status;
+ if (psessionEntry)
+ pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId;
+
+ // The bssid of the AP we are sending Auth1 to.
+ if (pMac->ft.ftPEContext.pFTPreAuthReq)
+ sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId,
+ pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId);
+
+ // Attach the auth response now back to SME
+ pFTPreAuthRsp->ft_ies_length = 0;
+ if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
+ {
+ // Only 11r assoc has FT IEs.
+ vos_mem_copy(pFTPreAuthRsp->ft_ies, auth_rsp, auth_rsp_length);
+ pFTPreAuthRsp->ft_ies_length = auth_rsp_length;
+ }
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ if ((psessionEntry) && (psessionEntry->is11Rconnection))
+ {
+ /* Fill in the Block Ack RIC IEs in the preAuthRsp */
+ sirStatus = limFTFillRICBlockAckInfo(pMac, pFTPreAuthRsp->ric_ies,
+ (tANI_U32 *)&pFTPreAuthRsp->ric_ies_length);
+ if (eSIR_SUCCESS != sirStatus)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Fill RIC BA Info failed with status %d"), sirStatus);)
+ }
+ }
+#endif
+
+ mmhMsg.type = pFTPreAuthRsp->messageType;
+ mmhMsg.bodyptr = pFTPreAuthRsp;
+ mmhMsg.bodyval = 0;
+
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog( pMac, LOGE, "Posted Auth Rsp to SME\n");)
+#endif
+ PELOGE(limLog( pMac, LOGE, "Posted Auth Rsp to SME with status of %d\n", status);)
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+}
+
+/*------------------------------------------------------------------
+ *
+ * Send the FT Pre Auth Response to SME when ever we have a status
+ * ready to be sent to SME
+ *
+ * SME will be the one to send it up to the supplicant to receive
+ * FTIEs which will be required for Reassoc Req.
+ *
+ *------------------------------------------------------------------*/
+void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, eHalStatus status,
+ tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
+ tpPESession psessionEntry)
+{
+
+ // Save the status of pre-auth
+ pMac->ft.ftPEContext.ftPreAuthStatus = status;
+
+ // Save the auth rsp, so we can send it to
+ // SME once we resume link.
+ pMac->ft.ftPEContext.saved_auth_rsp_length = 0;
+ if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
+ {
+ vos_mem_copy(pMac->ft.ftPEContext.saved_auth_rsp,
+ auth_rsp, auth_rsp_length);
+ pMac->ft.ftPEContext.saved_auth_rsp_length = auth_rsp_length;
+ }
+
+ if (psessionEntry->currentOperChannel !=
+ pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
+ {
+ // Need to move to the original AP channel
+ limChangeChannelWithCallback(pMac, psessionEntry->currentOperChannel,
+ limPerformPostFTPreAuthAndChannelChange, NULL, psessionEntry);
+ }
+ else
+ {
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog( pMac, LOGE, "Pre auth on same channel as connected AP channel %d\n",
+ pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum);)
+#endif
+ limFTProcessPreAuthResult(pMac, status, (tANI_U32 *)psessionEntry);
+ }
+}
+
+/*------------------------------------------------------------------
+ *
+ * This function handles the 11R Reassoc Req from SME
+ *
+ *------------------------------------------------------------------*/
+void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
+ tpPESession psessionEntry)
+{
+ tANI_U8 smeSessionId = 0;
+ tANI_U16 transactionId = 0;
+ tANI_U8 chanNum = 0;
+ tLimMlmReassocReq *pMlmReassocReq;
+ tANI_U16 caps;
+ tANI_U32 val;
+ tSirMsgQ msgQ;
+ tSirRetStatus retCode;
+ tANI_U32 teleBcnEn = 0;
+
+ chanNum = psessionEntry->currentOperChannel;
+ limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
+ psessionEntry->smeSessionId = smeSessionId;
+ psessionEntry->transactionId = transactionId;
+
+
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmReassocReq,
+ sizeof(tLimMlmReassocReq)))
+ {
+ // Log error
+ limLog(pMac, LOGE, FL("call to palAllocateMemory failed for mlmReassocReq\n"));
+ return;
+ }
+
+ palCopyMemory( pMac->hHdd, pMlmReassocReq->peerMacAddr,
+ psessionEntry->bssId,
+ sizeof(tSirMacAddr));
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
+ (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
+ != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get ReassocFailureTimeout value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value\n"));
+ return;
+ }
+
+ if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get Capabilities value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGE, FL("could not retrieve Capabilities value\n"));
+ return;
+ }
+ pMlmReassocReq->capabilityInfo = caps;
+
+ /* Update PE sessionId*/
+ pMlmReassocReq->sessionId = psessionEntry->peSessionId;
+
+ /* If telescopic beaconing is enabled, set listen interval to WNI_CFG_TELE_BCN_MAX_LI */
+ if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
+ eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN\n"));
+
+ if(teleBcnEn)
+ {
+ if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != eSIR_SUCCESS)
+ /**
+ * Could not get ListenInterval value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGE, FL("could not retrieve ListenInterval\n"));
+ return;
+ }
+ else
+ {
+ if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get ListenInterval value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGE, FL("could not retrieve ListenInterval\n"));
+ return;
+ }
+ }
+ if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
+ psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
+ {
+ return;
+ }
+
+ if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
+ psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
+ {
+ return;
+ }
+
+ if (limSetLinkState(pMac, eSIR_LINK_POSTASSOC_STATE, psessionEntry->bssId,
+ psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
+ {
+ return;
+ }
+
+ pMlmReassocReq->listenInterval = (tANI_U16) val;
+
+ psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
+
+
+ //we need to defer the message until we get the response back from HAL.
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+
+ msgQ.type = SIR_HAL_ADD_BSS_REQ;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pMac->ft.ftPEContext.pAddBssReq;
+ msgQ.bodyval = 0;
+
+
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+ limLog( pMac, LOGE, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
+#endif
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+
+ retCode = wdaPostCtrlMsg( pMac, &msgQ );
+ if( eSIR_SUCCESS != retCode)
+ {
+ vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
+ limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X\n"),
+ retCode );
+ }
+ // Dont need this anymore
+ pMac->ft.ftPEContext.pAddBssReq = NULL;
+ return;
+}
+
+/*------------------------------------------------------------------
+ *
+ * This function is called if preauth response is not received from the AP
+ * within this timeout while FT in progress
+ *
+ *------------------------------------------------------------------*/
+void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac)
+{
+ tpPESession psessionEntry;
+
+ // We have failed pre auth. We need to resume link and get back on
+ // home channel.
+
+ if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId))== NULL)
+ {
+ limLog(pMac, LOGE, FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+
+ // Ok, so attempted at Pre-Auth and failed. If we are off channel. We need
+ // to get back.
+ limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
+}
+
+
+/*------------------------------------------------------------------
+ *
+ * This function is called to process the update key request from SME
+ *
+ *------------------------------------------------------------------*/
+tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
+{
+ tAddBssParams * pAddBssParams;
+ tSirFTUpdateKeyInfo * pKeyInfo;
+ tANI_U32 val = 0;
+
+ /* Sanity Check */
+ if( pMac == NULL || pMsgBuf == NULL )
+ {
+ return TRUE;
+ }
+
+ pAddBssParams = pMac->ft.ftPEContext.pAddBssReq;
+ pKeyInfo = (tSirFTUpdateKeyInfo *)pMsgBuf;
+
+ /* Store the key information in the ADD BSS parameters */
+ pAddBssParams->extSetStaKeyParamValid = 1;
+ pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
+ (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof( tSirKeys ));
+ if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
+ {
+ limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC\n" ));
+ }
+
+ pAddBssParams->extSetStaKeyParam.singleTidRc = val;
+
+ return TRUE;
+}
+
+tSirRetStatus
+limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
+{
+ tSirMsgQ msg;
+ tSirAggrQosReq * aggrQosReq = (tSirAggrQosReq *)pMsgBuf;
+ tpAggrAddTsParams pAggrAddTsParam;
+ tpPESession psessionEntry = NULL;
+ tpLimTspecInfo tspecInfo;
+ tANI_U8 ac;
+ tpDphHashNode pSta;
+ tANI_U16 aid;
+ tANI_U8 sessionId;
+ int i;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **)&pAggrAddTsParam,
+ sizeof(tAggrAddTsParams)))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory() failed\n"));)
+ return eSIR_MEM_ALLOC_FAILED;
+ }
+
+ psessionEntry = peFindSessionByBssid(pMac, aggrQosReq->bssId, &sessionId);
+
+ if (psessionEntry == NULL) {
+ PELOGE(limLog(pMac, LOGE, FL("psession Entry Null for sessionId = %d\n"), aggrQosReq->sessionId);)
+ return eSIR_FAILURE;
+ }
+
+ pSta = dphLookupHashEntry(pMac, aggrQosReq->bssId, &aid, &psessionEntry->dph.dphHashTable);
+ if (pSta == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp\n"));)
+ return eSIR_FAILURE;
+ }
+
+ palZeroMemory( pMac->hHdd, (tANI_U8 *)pAggrAddTsParam,
+ sizeof(tAggrAddTsParams));
+ pAggrAddTsParam->staIdx = psessionEntry->staId;
+ // Fill in the sessionId specific to PE
+ pAggrAddTsParam->sessionId = sessionId;
+ pAggrAddTsParam->tspecIdx = aggrQosReq->aggrInfo.tspecIdx;
+
+ for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
+ {
+ if (aggrQosReq->aggrInfo.tspecIdx & (1<<i))
+ {
+ tSirMacTspecIE *pTspec = &aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
+ /* Since AddTS response was successful, check for the PSB flag
+ * and directional flag inside the TS Info field.
+ * An AC is trigger enabled AC if the PSB subfield is set to 1
+ * in the uplink direction.
+ * An AC is delivery enabled AC if the PSB subfield is set to 1
+ * in the downlink direction.
+ * An AC is trigger and delivery enabled AC if the PSB subfield
+ * is set to 1 in the bi-direction field.
+ */
+ if (pTspec->tsinfo.traffic.psb == 1)
+ {
+ limSetTspecUapsdMask(pMac, &pTspec->tsinfo, SET_UAPSD_MASK);
+ }
+ else
+ {
+ limSetTspecUapsdMask(pMac, &pTspec->tsinfo, CLEAR_UAPSD_MASK);
+ }
+ /* ADDTS success, so AC is now admitted. We shall now use the default
+ * EDCA parameters as advertised by AP and send the updated EDCA params
+ * to HAL.
+ */
+ ac = upToAc(pTspec->tsinfo.traffic.userPrio);
+ if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
+ {
+ pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
+ }
+ else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
+ {
+ pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
+ }
+ else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
+ {
+ pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
+ pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
+ }
+
+ limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
+
+ if (pSta->aniPeer == eANI_BOOLEAN_TRUE)
+ {
+ limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_TRUE);
+ }
+ else
+ {
+ limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_FALSE);
+ }
+
+ if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, pTspec, 0, &tspecInfo))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed \n"));)
+ pMac->lim.gLimAddtsSent = false;
+ return eSIR_FAILURE; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
+ }
+
+ // Copy the TSPEC paramters
+ pAggrAddTsParam->tspec[i] = aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
+ }
+ }
+
+ msg.type = WDA_AGGR_QOS_REQ;
+ msg.bodyptr = pAggrAddTsParam;
+ msg.bodyval = 0;
+
+ /* We need to defer any incoming messages until we get a
+ * WDA_AGGR_QOS_RSP from HAL.
+ */
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+ MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+
+ if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed\n"));)
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+ palFreeMemory(pMac->hHdd, (tANI_U8*)pAggrAddTsParam);
+ return eSIR_FAILURE;
+ }
+
+ return eSIR_SUCCESS;
+}
+
+void
+limFTSendAggrQosRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd,
+ tpAggrAddTsParams aggrQosRsp, tANI_U8 smesessionId)
+{
+ tpSirAggrQosRsp rsp;
+ int i = 0;
+
+ if (! rspReqd)
+ {
+ return;
+ }
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp,
+ sizeof(tSirAggrQosRsp)))
+ {
+ limLog(pMac, LOGP, FL("palAllocateMemory failed for tSirAggrQosRsp"));
+ return;
+ }
+
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
+ rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP;
+ rsp->sessionId = smesessionId;
+ rsp->length = sizeof(*rsp);
+ rsp->aggrInfo.tspecIdx = aggrQosRsp->tspecIdx;
+
+ for( i = 0; i < SIR_QOS_NUM_AC_MAX; i++ )
+ {
+ if( (1 << i) & aggrQosRsp->tspecIdx )
+ {
+ rsp->aggrInfo.aggrRsp[i].status = aggrQosRsp->status[i];
+ rsp->aggrInfo.aggrRsp[i].tspec = aggrQosRsp->tspec[i];
+ }
+ }
+
+ limSendSmeAggrQosRsp(pMac, rsp, smesessionId);
+ return;
+}
+
+
+void limProcessFTAggrQoSRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
+{
+ tpAggrAddTsParams pAggrQosRspMsg = NULL;
+ //tpAggrQosParams pAggrQosRspMsg = NULL;
+ tAddTsParams addTsParam = {0};
+ tpDphHashNode pSta = NULL;
+ tANI_U16 assocId =0;
+ tSirMacAddr peerMacAddr;
+ tANI_U8 rspReqd = 1;
+ tpPESession psessionEntry = NULL;
+ int i = 0;
+
+ PELOG1(limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL\n"));)
+
+ /* Need to process all the deferred messages enqueued since sending the
+ SIR_HAL_AGGR_ADD_TS_REQ */
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+
+ pAggrQosRspMsg = (tpAggrAddTsParams) (limMsg->bodyptr);
+ if (NULL == pAggrQosRspMsg)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("NULL pAggrQosRspMsg"));)
+ return;
+ }
+
+ psessionEntry = peFindSessionBySessionId(pMac, pAggrQosRspMsg->sessionId);
+ if (NULL == psessionEntry)
+ {
+ // Cant find session entry
+ PELOGE(limLog(pMac, LOGE, FL("Cant find session entry for %s\n"), __FUNCTION__);)
+ if( pAggrQosRspMsg != NULL )
+ {
+ palFreeMemory( pMac->hHdd, (void *)pAggrQosRspMsg );
+ }
+ return;
+ }
+
+ for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
+ {
+ if((((1 << i) & pAggrQosRspMsg->tspecIdx)) &&
+ (pAggrQosRspMsg->status[i] != eHAL_STATUS_SUCCESS))
+ {
+ /* send DELTS to the station */
+ sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
+
+ addTsParam.staIdx = pAggrQosRspMsg->staIdx;
+ addTsParam.sessionId = pAggrQosRspMsg->sessionId;
+ addTsParam.tspec = pAggrQosRspMsg->tspec[i];
+ addTsParam.tspecIdx = pAggrQosRspMsg->tspecIdx;
+
+ limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd,
+ &addTsParam.tspec.tsinfo,
+ &addTsParam.tspec, psessionEntry);
+
+ pSta = dphLookupAssocId(pMac, addTsParam.staIdx, &assocId,
+ &psessionEntry->dph.dphHashTable);
+ if (pSta != NULL)
+ {
+ limAdmitControlDeleteTS(pMac, assocId, &addTsParam.tspec.tsinfo,
+ NULL, (tANI_U8 *)&addTsParam.tspecIdx);
+ }
+ }
+ }
+
+ /* Send the Aggr QoS response to SME */
+
+ limFTSendAggrQosRsp(pMac, rspReqd, pAggrQosRspMsg,
+ psessionEntry->smeSessionId);
+ if( pAggrQosRspMsg != NULL )
+ {
+ palFreeMemory( pMac->hHdd, (void *)pAggrQosRspMsg );
+ }
+ return;
+}
+
+
+/*--------------------------------------------------------------------------
+ Determines if a session with ccx or 11r assoc is present.
+ If present it will return TRUE else FALSE
+ ------------------------------------------------------------------------*/
+int limisFastTransitionRequired(tpAniSirGlobal pMac, int sessionId)
+{
+ if(pMac->lim.gpSession[sessionId].valid == TRUE)
+ {
+ // If ccx or 11r connection is found we need to return TRUE
+ if((pMac->lim.gpSession[sessionId].bssType == eSIR_INFRASTRUCTURE_MODE) &&
+ (((pMac->lim.gpSession[sessionId].is11Rconnection)
+#ifdef FEATURE_WLAN_CCX
+ || (pMac->lim.gpSession[sessionId].isCCXconnection)
+#endif
+ )&&
+ pMac->lim.gpSession[sessionId].isFastTransitionEnabled))
+ {
+ // Make sure we have 11r/CCX and FT enabled only then we need
+ // the values to be altered from cfg for FW RSSI Period alteration.
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+#endif /* WLAN_FEATURE_VOWIFI_11R */
diff --git a/CORE/MAC/src/pe/lim/limIbssPeerMgmt.c b/CORE/MAC/src/pe/lim/limIbssPeerMgmt.c
new file mode 100644
index 0000000..e98aeae
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limIbssPeerMgmt.c
@@ -0,0 +1,1669 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limIbssPeerMgmt.cc contains the utility functions
+ * LIM uses to maintain peers in IBSS.
+ * Author: Chandra Modumudi
+ * Date: 03/12/04
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+#include "palTypes.h"
+#include "aniGlobal.h"
+#include "sirCommon.h"
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+#include "wniCfgAp.h"
+#else
+#include "wniCfgSta.h"
+#endif
+#include "limUtils.h"
+#include "limAssocUtils.h"
+#include "limStaHashApi.h"
+#include "schApi.h" // schSetFixedBeaconFields for IBSS coalesce
+#include "limSecurityUtils.h"
+#include "limSendMessages.h"
+#include "limSession.h"
+#include "limIbssPeerMgmt.h"
+
+
+/**
+ * ibss_peer_find
+ *
+ *FUNCTION:
+ * This function is called while adding a context at
+ * DPH & Polaris for a peer in IBSS.
+ * If peer is found in the list, capabilities from the
+ * returned BSS description are used at DPH node & Polaris.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param macAddr - MAC address of the peer
+ *
+ * @return Pointer to peer node if found, else NULL
+ */
+
+static tLimIbssPeerNode *
+ibss_peer_find(
+ tpAniSirGlobal pMac,
+ tSirMacAddr macAddr)
+{
+ tLimIbssPeerNode *pTempNode = pMac->lim.gLimIbssPeerList;
+
+ while (pTempNode != NULL)
+ {
+ if (palEqualMemory( pMac->hHdd,(tANI_U8 *) macAddr,
+ (tANI_U8 *) &pTempNode->peerMacAddr,
+ sizeof(tSirMacAddr)) )
+ break;
+ pTempNode = pTempNode->next;
+ }
+ return pTempNode;
+} /*** end ibss_peer_find() ***/
+
+/**
+ * ibss_peer_add
+ *
+ *FUNCTION:
+ * This is called on a STA in IBSS upon receiving Beacon/
+ * Probe Response from a peer.
+ *
+ *LOGIC:
+ * Node is always added to the front of the list
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pPeerNode - Pointer to peer node to be added to the list.
+ *
+ * @return None
+ */
+
+static tSirRetStatus
+ibss_peer_add(tpAniSirGlobal pMac, tLimIbssPeerNode *pPeerNode)
+{
+#ifdef ANI_SIR_IBSS_PEER_CACHING
+ tANI_U32 numIbssPeers = (2 * pMac->lim.maxStation);
+
+ if (pMac->lim.gLimNumIbssPeers >= numIbssPeers)
+ {
+ /**
+ * Reached max number of peers to be maintained.
+ * Delete last entry & add new entry at the beginning.
+ */
+ tLimIbssPeerNode *pTemp, *pPrev;
+ pTemp = pPrev = pMac->lim.gLimIbssPeerList;
+ while (pTemp->next != NULL)
+ {
+ pPrev = pTemp;
+ pTemp = pTemp->next;
+ }
+ if(pTemp->beacon)
+ {
+ palFreeMemory(pMac->hHdd, pTemp->beacon);
+ }
+
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pTemp);
+ pPrev->next = NULL;
+ }
+ else
+#endif
+ pMac->lim.gLimNumIbssPeers++;
+
+ pPeerNode->next = pMac->lim.gLimIbssPeerList;
+ pMac->lim.gLimIbssPeerList = pPeerNode;
+
+ return eSIR_SUCCESS;
+
+} /*** end limAddIbssPeerToList() ***/
+
+/**
+ * ibss_peer_collect
+ *
+ *FUNCTION:
+ * This is called to collect IBSS peer information
+ * from received Beacon/Probe Response frame from it.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pBeacon - Parsed Beacon Frame structure
+ * @param pBD - Pointer to received BD
+ * @param pPeer - Pointer to IBSS peer node
+ *
+ * @return None
+ */
+
+static void
+ibss_peer_collect(
+ tpAniSirGlobal pMac,
+ tpSchBeaconStruct pBeacon,
+ tpSirMacMgmtHdr pHdr,
+ tLimIbssPeerNode *pPeer,
+ tpPESession psessionEntry)
+{
+ palCopyMemory( pMac->hHdd, pPeer->peerMacAddr, pHdr->sa, sizeof(tSirMacAddr));
+
+ pPeer->capabilityInfo = pBeacon->capabilityInfo;
+ pPeer->extendedRatesPresent = pBeacon->extendedRatesPresent;
+ pPeer->edcaPresent = pBeacon->edcaPresent;
+ pPeer->wmeEdcaPresent = pBeacon->wmeEdcaPresent;
+ pPeer->wmeInfoPresent = pBeacon->wmeInfoPresent;
+
+ if(IS_DOT11_MODE_HT(psessionEntry->dot11mode) &&
+ (pBeacon->HTCaps.present))
+ {
+ pPeer->htCapable = pBeacon->HTCaps.present;
+ palCopyMemory(pMac->hHdd, (tANI_U8 *)pPeer->supportedMCSSet,
+ (tANI_U8 *)pBeacon->HTCaps.supportedMCSSet,
+ sizeof(pPeer->supportedMCSSet));
+ pPeer->htGreenfield = (tANI_U8)pBeacon->HTCaps.greenField;
+ pPeer->htSupportedChannelWidthSet = ( tANI_U8 ) pBeacon->HTCaps.supportedChannelWidthSet;
+ pPeer->htMIMOPSState = (tSirMacHTMIMOPowerSaveState)pBeacon->HTCaps.mimoPowerSave;
+ pPeer->htMaxAmsduLength = ( tANI_U8 ) pBeacon->HTCaps.maximalAMSDUsize;
+ pPeer->htAMpduDensity = pBeacon->HTCaps.mpduDensity;
+ pPeer->htDsssCckRate40MHzSupport = (tANI_U8)pBeacon->HTCaps.dsssCckMode40MHz;
+ pPeer->htShortGI20Mhz = (tANI_U8)pBeacon->HTCaps.shortGI20MHz;
+ pPeer->htShortGI40Mhz = (tANI_U8)pBeacon->HTCaps.shortGI40MHz;
+ pPeer->htMaxRxAMpduFactor = pBeacon->HTCaps.maxRxAMPDUFactor;
+ }
+
+ pPeer->erpIePresent = pBeacon->erpPresent;
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pPeer->supportedRates,
+ (tANI_U8 *) &pBeacon->supportedRates,
+ pBeacon->supportedRates.numRates + 1);
+ if (pPeer->extendedRatesPresent)
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pPeer->extendedRates,
+ (tANI_U8 *) &pBeacon->extendedRates,
+ pBeacon->extendedRates.numRates + 1);
+ else
+ pPeer->extendedRates.numRates = 0;
+
+ // TBD copy EDCA parameters
+ // pPeer->edcaParams;
+
+ pPeer->next = NULL;
+} /*** end ibss_peer_collect() ***/
+
+// handle change in peer qos/wme capabilities
+static void
+ibss_sta_caps_update(
+ tpAniSirGlobal pMac,
+ tLimIbssPeerNode *pPeerNode,
+ tpPESession psessionEntry)
+{
+ tANI_U16 aid;
+ tpDphHashNode pStaDs;
+
+ pPeerNode->beaconHBCount++; //Update beacon count.
+
+ // if the peer node exists, update its qos capabilities
+ if ((pStaDs = dphLookupHashEntry(pMac, pPeerNode->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable)) == NULL)
+ return;
+
+
+ //Update HT Capabilities
+ if(IS_DOT11_MODE_HT(psessionEntry->dot11mode))
+ {
+ pStaDs->mlmStaContext.htCapability = pPeerNode->htCapable;
+ if (pPeerNode->htCapable)
+ {
+ pStaDs->htGreenfield = pPeerNode->htGreenfield;
+ pStaDs->htSupportedChannelWidthSet = pPeerNode->htSupportedChannelWidthSet;
+ pStaDs->htMIMOPSState = pPeerNode->htMIMOPSState;
+ pStaDs->htMaxAmsduLength = pPeerNode->htMaxAmsduLength;
+ pStaDs->htAMpduDensity = pPeerNode->htAMpduDensity;
+ pStaDs->htDsssCckRate40MHzSupport = pPeerNode->htDsssCckRate40MHzSupport;
+ pStaDs->htShortGI20Mhz = pPeerNode->htShortGI20Mhz;
+ pStaDs->htShortGI40Mhz = pPeerNode->htShortGI40Mhz;
+ pStaDs->htMaxRxAMpduFactor = pPeerNode->htMaxRxAMpduFactor;
+ // In the future, may need to check for "delayedBA"
+ // For now, it is IMMEDIATE BA only on ALL TID's
+ pStaDs->baPolicyFlag = 0xFF;
+ }
+ }
+
+ if(IS_DOT11_MODE_PROPRIETARY(psessionEntry->dot11mode) &&
+ pPeerNode->aniIndicator)
+ {
+ pStaDs->aniPeer = pPeerNode->aniIndicator;
+ pStaDs->propCapability = pPeerNode->propCapability;
+ }
+
+
+ // peer is 11e capable but is not 11e enabled yet
+ // some STA's when joining Airgo IBSS, assert qos capability even when
+ // they don't suport qos. however, they do not include the edca parameter
+ // set. so let's check for edcaParam in addition to the qos capability
+ if (pPeerNode->capabilityInfo.qos && (psessionEntry->limQosEnabled) && pPeerNode->edcaPresent)
+ {
+ pStaDs->qosMode = 1;
+ pStaDs->wmeEnabled = 0;
+ if (! pStaDs->lleEnabled)
+ {
+ pStaDs->lleEnabled = 1;
+ //dphSetACM(pMac, pStaDs);
+ }
+ return;
+ }
+ // peer is not 11e capable now but was 11e enabled earlier
+ else if (pStaDs->lleEnabled)
+ {
+ pStaDs->qosMode = 0;
+ pStaDs->lleEnabled = 0;
+ }
+
+ // peer is wme capable but is not wme enabled yet
+ if (pPeerNode->wmeInfoPresent && psessionEntry->limWmeEnabled)
+ {
+ pStaDs->qosMode = 1;
+ pStaDs->lleEnabled = 0;
+ if (! pStaDs->wmeEnabled)
+ {
+ pStaDs->wmeEnabled = 1;
+ //dphSetACM(pMac, pStaDs);
+ }
+ return;
+ }
+ /* When the peer device supports EDCA parameters, then we were not
+ considering. Added this code when we saw that one of the Peer Device
+ was advertising WMM param where we were not honouring that. CR# 210756
+ */
+ if (pPeerNode->wmeEdcaPresent && psessionEntry->limWmeEnabled) {
+ pStaDs->qosMode = 1;
+ pStaDs->lleEnabled = 0;
+ if (! pStaDs->wmeEnabled) {
+ pStaDs->wmeEnabled = 1;
+ }
+ return;
+ }
+
+ // peer is not wme capable now but was wme enabled earlier
+ else if (pStaDs->wmeEnabled)
+ {
+ pStaDs->qosMode = 0;
+ pStaDs->wmeEnabled = 0;
+ }
+
+}
+
+static void
+ibss_sta_rates_update(
+ tpAniSirGlobal pMac,
+ tpDphHashNode pStaDs,
+ tLimIbssPeerNode *pPeer,
+ tpPESession psessionEntry)
+{
+ // Populate supported rateset
+ limPopulateMatchingRateSet(pMac, pStaDs, &pPeer->supportedRates,
+ &pPeer->extendedRates, pPeer->supportedMCSSet,
+ &pStaDs->mlmStaContext.propRateSet,psessionEntry);
+
+ pStaDs->mlmStaContext.capabilityInfo = pPeer->capabilityInfo;
+} /*** end ibss_sta_info_update() ***/
+
+/**
+ * ibss_sta_info_update
+ *
+ *FUNCTION:
+ * This is called to program both SW & Polaris context
+ * for peer in IBSS.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pStaDs - Pointer to DPH node
+ * @param pPeer - Pointer to IBSS peer node
+ *
+ * @return None
+ */
+
+static void
+ibss_sta_info_update(
+ tpAniSirGlobal pMac,
+ tpDphHashNode pStaDs,
+ tLimIbssPeerNode *pPeer,
+ tpPESession psessionEntry)
+{
+ pStaDs->staType = STA_ENTRY_PEER;
+ ibss_sta_caps_update(pMac, pPeer,psessionEntry);
+ ibss_sta_rates_update(pMac, pStaDs, pPeer,psessionEntry);
+} /*** end ibss_sta_info_update() ***/
+
+static void
+ibss_coalesce_free(
+ tpAniSirGlobal pMac)
+{
+ if (pMac->lim.ibssInfo.pHdr != NULL)
+ palFreeMemory(pMac->hHdd, pMac->lim.ibssInfo.pHdr);
+ if (pMac->lim.ibssInfo.pBeacon != NULL)
+ palFreeMemory(pMac->hHdd, pMac->lim.ibssInfo.pBeacon);
+
+ pMac->lim.ibssInfo.pHdr = NULL;
+ pMac->lim.ibssInfo.pBeacon = NULL;
+}
+
+/*
+ * save the beacon params for use when adding the bss
+ */
+static void
+ibss_coalesce_save(
+ tpAniSirGlobal pMac,
+ tpSirMacMgmtHdr pHdr,
+ tpSchBeaconStruct pBeacon)
+{
+ eHalStatus status;
+
+ // get rid of any saved info
+ ibss_coalesce_free(pMac);
+
+ status = palAllocateMemory(pMac->hHdd, (void **) &pMac->lim.ibssInfo.pHdr,
+ sizeof(*pHdr));
+ if (status != eHAL_STATUS_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("ibbs-save: Failed malloc pHdr\n"));)
+ return;
+ }
+ status = palAllocateMemory(pMac->hHdd, (void **) &pMac->lim.ibssInfo.pBeacon,
+ sizeof(*pBeacon));
+ if (status != eHAL_STATUS_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("ibbs-save: Failed malloc pBeacon\n"));)
+ ibss_coalesce_free(pMac);
+ return;
+ }
+
+ palCopyMemory(pMac->hHdd, pMac->lim.ibssInfo.pHdr, pHdr, sizeof(*pHdr));
+ palCopyMemory(pMac->hHdd, pMac->lim.ibssInfo.pBeacon, pBeacon, sizeof(*pBeacon));
+}
+
+/*
+ * tries to add a new entry to dph hash node
+ * if necessary, an existing entry is eliminated
+ */
+static tSirRetStatus
+ibss_dph_entry_add(
+ tpAniSirGlobal pMac,
+ tSirMacAddr peerAddr,
+ tpDphHashNode *ppSta,
+ tpPESession psessionEntry)
+{
+ tANI_U16 aid;
+ tpDphHashNode pStaDs;
+
+ *ppSta = NULL;
+
+ pStaDs = dphLookupHashEntry(pMac, peerAddr, &aid, &psessionEntry->dph.dphHashTable);
+ if (pStaDs != NULL)
+ {
+ /* Trying to add context for already existing STA in IBSS */
+ PELOGE(limLog(pMac, LOGE, FL("STA exists already "));)
+ limPrintMacAddr(pMac, peerAddr, LOGE);
+ return eSIR_FAILURE;
+ }
+
+ /**
+ * Assign an AID, delete context existing with that
+ * AID and then add an entry to hash table maintained
+ * by DPH module.
+ */
+ aid = limAssignAID(pMac);
+
+ pStaDs = dphGetHashEntry(pMac, aid, &psessionEntry->dph.dphHashTable);
+ if (pStaDs)
+ {
+ (void) limDelSta(pMac, pStaDs, false /*asynchronous*/,psessionEntry);
+ limDeleteDphHashEntry(pMac, pStaDs->staAddr, aid,psessionEntry);
+ }
+
+ pStaDs = dphAddHashEntry(pMac, peerAddr, aid, &psessionEntry->dph.dphHashTable);
+ if (pStaDs == NULL)
+ {
+ // Could not add hash table entry
+ PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for aid=%d MACaddr:\n"), aid);)
+ limPrintMacAddr(pMac, peerAddr, LOGE);
+ return eSIR_FAILURE;
+ }
+
+ *ppSta = pStaDs;
+ return eSIR_SUCCESS;
+}
+
+// send a status change notification
+static void
+ibss_status_chg_notify(
+ tpAniSirGlobal pMac,
+ tSirMacAddr peerAddr,
+ tANI_U16 staIndex,
+ tANI_U8 ucastSig,
+ tANI_U8 bcastSig,
+ tANI_U16 status,
+ tANI_U8 sessionId)
+{
+
+ tLimIbssPeerNode *peerNode;
+ tANI_U8 *beacon = NULL;
+ tANI_U16 bcnLen = 0;
+
+
+ peerNode = ibss_peer_find(pMac,peerAddr);
+ if(peerNode != NULL)
+ {
+ if(peerNode->beacon == NULL) peerNode->beaconLen = 0;
+ beacon = peerNode->beacon;
+ bcnLen = peerNode->beaconLen;
+ peerNode->beacon = NULL;
+ peerNode->beaconLen = 0;
+ }
+
+ limSendSmeIBSSPeerInd(pMac,peerAddr, staIndex, ucastSig, bcastSig,
+ beacon, bcnLen, status, sessionId);
+
+ if(beacon != NULL)
+ {
+ palFreeMemory(pMac->hHdd, beacon);
+ }
+}
+
+
+static void
+ibss_bss_add(
+ tpAniSirGlobal pMac,
+ tpPESession psessionEntry)
+{
+ tLimMlmStartReq mlmStartReq;
+ tANI_U32 cfg;
+ tpSirMacMgmtHdr pHdr = (tpSirMacMgmtHdr) pMac->lim.ibssInfo.pHdr;
+ tpSchBeaconStruct pBeacon = (tpSchBeaconStruct) pMac->lim.ibssInfo.pBeacon;
+ tANI_U8 numExtRates = 0;
+
+ if ((pHdr == NULL) || (pBeacon == NULL))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Unable to add BSS (no cached BSS info)\n"));)
+ return;
+ }
+
+ palCopyMemory( pMac->hHdd, psessionEntry->bssId, pHdr->bssId,
+ sizeof(tSirMacAddr));
+
+ #if 0
+ if (cfgSetStr(pMac, WNI_CFG_BSSID, (tANI_U8 *) pHdr->bssId, sizeof(tSirMacAddr))
+ != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("could not update BSSID at CFG\n"));
+ #endif //TO SUPPORT BT-AMP
+
+ sirCopyMacAddr(pHdr->bssId,psessionEntry->bssId);
+ /* We need not use global Mac address since per seesion BSSID is available */
+ //limSetBssid(pMac, pHdr->bssId);
+
+#if 0
+ if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &cfg) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("Can't read beacon interval\n"));
+#endif //TO SUPPORT BT-AMP
+ /* Copy beacon interval from sessionTable */
+ cfg = psessionEntry->beaconParams.beaconInterval;
+ if (cfg != pBeacon->beaconInterval)
+ #if 0
+ if (cfgSetInt(pMac, WNI_CFG_BEACON_INTERVAL, pBeacon->beaconInterval)
+ != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("Can't update beacon interval\n"));
+ #endif//TO SUPPORT BT-AMP
+ psessionEntry->beaconParams.beaconInterval = pBeacon->beaconInterval;
+
+ /* This function ibss_bss_add (and hence the below code) is only called during ibss coalescing. We need to
+ * adapt to peer's capability with respect to short slot time. Changes have been made to limApplyConfiguration()
+ * so that the IBSS doesnt blindly start with short slot = 1. If IBSS start is part of coalescing then it will adapt
+ * to peer's short slot using code below.
+ */
+ if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, &cfg)
+ != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("cfg get WNI_CFG_SHORT_SLOT_TIME failed\n"));
+ return;
+ }
+ /* If cfg is already set to current peer's capability then no need to set it again */
+ if (cfg != pBeacon->capabilityInfo.shortSlotTime)
+ {
+ if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, pBeacon->capabilityInfo.shortSlotTime) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("could not update short slot time at CFG\n"));
+ return;
+ }
+ }
+ palCopyMemory( pMac->hHdd,
+ (tANI_U8 *) &psessionEntry->pLimStartBssReq->operationalRateSet,
+ (tANI_U8 *) &pBeacon->supportedRates,
+ pBeacon->supportedRates.numRates);
+
+ #if 0
+ if (cfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET,
+ (tANI_U8 *) &pMac->lim.gpLimStartBssReq->operationalRateSet.rate,
+ pMac->lim.gpLimStartBssReq->operationalRateSet.numRates)
+ != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("could not update OperRateset at CFG\n"));
+ #endif //TO SUPPORT BT-AMP
+
+ /**
+ * WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET CFG needs to be reset, when
+ * there is no extended rate IE present in beacon. This is especially important when
+ * supportedRateSet IE contains all the extended rates as well and STA decides to coalesce.
+ * In this IBSS coalescing scenario LIM will tear down the BSS and Add a new one. So LIM needs to
+ * reset this CFG, just in case CSR originally had set this CFG when IBSS was started from the local profile.
+ * If IBSS was started by CSR from the BssDescription, then it would reset this CFG before StartBss is issued.
+ * The idea is that the count of OpRateSet and ExtendedOpRateSet rates should not be more than 12.
+ */
+
+ if(pBeacon->extendedRatesPresent)
+ numExtRates = pBeacon->extendedRates.numRates;
+ if (cfgSetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
+ (tANI_U8 *) &pBeacon->extendedRates.rate, numExtRates) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("could not update ExtendedOperRateset at CFG\n"));
+ return;
+ }
+
+
+ /*
+ * Each IBSS node will advertise its own HT Capabilities instead of adapting to the Peer's capabilities
+ * If we don't do this then IBSS may not go back to full capabilities when the STA with lower capabilities
+ * leaves the IBSS. e.g. when non-CB STA joins an IBSS and then leaves, the IBSS will be stuck at non-CB mode
+ * even though all the nodes are capable of doing CB.
+ * so it is decided to leave the self HT capabilties intact. This may change if some issues are found in interop.
+ */
+ palZeroMemory(pMac->hHdd, (void *) &mlmStartReq, sizeof(mlmStartReq));
+
+ palCopyMemory(pMac->hHdd, mlmStartReq.bssId, pHdr->bssId, sizeof(tSirMacAddr));
+ mlmStartReq.rateSet.numRates = psessionEntry->pLimStartBssReq->operationalRateSet.numRates;
+ palCopyMemory(pMac->hHdd, &mlmStartReq.rateSet.rate[0],
+ &psessionEntry->pLimStartBssReq->operationalRateSet.rate[0],
+ mlmStartReq.rateSet.numRates);
+ mlmStartReq.bssType = eSIR_IBSS_MODE;
+ mlmStartReq.beaconPeriod = pBeacon->beaconInterval;
+ mlmStartReq.nwType = psessionEntry->pLimStartBssReq->nwType; //psessionEntry->nwType is also OK????
+ mlmStartReq.htCapable = psessionEntry->htCapabality;
+ mlmStartReq.htOperMode = pMac->lim.gHTOperMode;
+ mlmStartReq.dualCTSProtection = pMac->lim.gHTDualCTSProtection;
+ mlmStartReq.txChannelWidthSet = pMac->lim.gHTRecommendedTxWidthSet;
+
+ #if 0
+ if (wlan_cfgGetInt(pMac, WNI_CFG_CURRENT_CHANNEL, &cfg) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("CurrentChannel CFG get fialed!\n"));
+ #endif
+
+ //mlmStartReq.channelNumber = (tSirMacChanNum) cfg;
+
+ /* reading the channel num from session Table */
+ mlmStartReq.channelNumber = psessionEntry->currentOperChannel;
+
+ mlmStartReq.cbMode = psessionEntry->pLimStartBssReq->cbMode;
+
+ // Copy the SSID for RxP filtering based on SSID.
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmStartReq.ssId,
+ (tANI_U8 *) &psessionEntry->pLimStartBssReq->ssId,
+ psessionEntry->pLimStartBssReq->ssId.length + 1);
+
+ PELOG1(limLog(pMac, LOG1, FL("invoking ADD_BSS as part of coalescing!\n"));)
+ if (limMlmAddBss(pMac, &mlmStartReq,psessionEntry) != eSIR_SME_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("AddBss failure\n"));)
+ return;
+ }
+
+ // Update fields in Beacon
+ if (schSetFixedBeaconFields(pMac,psessionEntry) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("*** Unable to set fixed Beacon fields ***\n"));)
+ return;
+ }
+
+}
+
+
+
+/* delete the current BSS */
+static void
+ibss_bss_delete(
+ tpAniSirGlobal pMac,
+ tpPESession psessionEntry)
+{
+ tSirRetStatus status;
+ PELOGW(limLog(pMac, LOGW, FL("Initiating IBSS Delete BSS\n"));)
+ if (psessionEntry->limMlmState != eLIM_MLM_BSS_STARTED_STATE)
+ {
+ limLog(pMac, LOGW, FL("Incorrect LIM MLM state for delBss (%d)\n"),
+ psessionEntry->limMlmState);
+ return;
+ }
+ status = limDelBss(pMac, NULL, psessionEntry->bssIdx, psessionEntry);
+ if (status != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d\n"), psessionEntry->bssIdx);)
+}
+
+/**
+ * limIbssInit
+ *
+ *FUNCTION:
+ * This function is called while starting an IBSS
+ * to initialize list used to maintain IBSS peers.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limIbssInit(
+ tpAniSirGlobal pMac)
+{
+ //pMac->lim.gLimIbssActive = 0;
+ pMac->lim.gLimIbssCoalescingHappened = 0;
+ pMac->lim.gLimIbssPeerList = NULL;
+ pMac->lim.gLimNumIbssPeers = 0;
+
+ // ibss info - params for which ibss to join while coalescing
+ palZeroMemory(pMac->hHdd, &pMac->lim.ibssInfo, sizeof(tAniSirLimIbss));
+} /*** end limIbssInit() ***/
+
+/**
+ * limIbssDeleteAllPeers
+ *
+ *FUNCTION:
+ * This function is called to delete all peers.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void limIbssDeleteAllPeers( tpAniSirGlobal pMac ,tpPESession psessionEntry)
+{
+ tLimIbssPeerNode *pCurrNode, *pTempNode;
+ tpDphHashNode pStaDs;
+ tANI_U16 aid;
+
+ pCurrNode = pTempNode = pMac->lim.gLimIbssPeerList;
+
+ while (pCurrNode != NULL)
+ {
+ if (!pMac->lim.gLimNumIbssPeers)
+ {
+ limLog(pMac, LOGP,
+ FL("Number of peers in the list is zero and node present"));
+ return;
+ }
+ /* Delete the dph entry for the station
+ * Since it is called to remove all peers, just delete from dph,
+ * no need to do any beacon related params i.e., dont call limDeleteDphHashEntry
+ */
+ pStaDs = dphLookupHashEntry(pMac, pCurrNode->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
+ if( pStaDs )
+ {
+
+ ibss_status_chg_notify( pMac, pCurrNode->peerMacAddr, pStaDs->staIndex,
+ pStaDs->ucUcastSig, pStaDs->ucBcastSig,
+ eWNI_SME_IBSS_PEER_DEPARTED_IND, psessionEntry->smeSessionId );
+ dphDeleteHashEntry(pMac, pStaDs->staAddr, aid, &psessionEntry->dph.dphHashTable);
+ }
+
+ pTempNode = pCurrNode->next;
+
+ /* TODO :Sessionize this code */
+ /* Fix CR 227642: PeerList should point to the next node since the current node is being
+ * freed in the next line. In ibss_peerfind in ibss_status_chg_notify above, we use this
+ * peer list to find the next peer. So this list needs to be updated with the no of peers left
+ * after each iteration in this while loop since one by one peers are deleted (freed) in this
+ * loop causing the lim.gLimIbssPeerList to point to some freed memory.
+ */
+ pMac->lim.gLimIbssPeerList = pTempNode;
+
+ if(pCurrNode->beacon)
+ {
+ palFreeMemory(pMac->hHdd, pCurrNode->beacon);
+ }
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pCurrNode);
+ if (pMac->lim.gLimNumIbssPeers > 0) // be paranoid
+ pMac->lim.gLimNumIbssPeers--;
+ pCurrNode = pTempNode;
+ }
+
+ if (pMac->lim.gLimNumIbssPeers)
+ limLog(pMac, LOGP, FL("Number of peers[%d] in the list is non-zero"),
+ pMac->lim.gLimNumIbssPeers);
+
+ pMac->lim.gLimNumIbssPeers = 0;
+ pMac->lim.gLimIbssPeerList = NULL;
+
+}
+/**
+ * limIbssDelete
+ *
+ *FUNCTION:
+ * This function is called while tearing down an IBSS.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limIbssDelete(
+ tpAniSirGlobal pMac,tpPESession psessionEntry)
+{
+ limIbssDeleteAllPeers(pMac,psessionEntry);
+
+ ibss_coalesce_free(pMac);
+} /*** end limIbssDelete() ***/
+
+/** Commenting this Code as from no where it is being invoked */
+#if 0
+/**
+ * limIbssPeerDelete
+ *
+ *FUNCTION:
+ * This may be called on a STA in IBSS to delete a peer
+ * from the list.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param peerMacAddr - MAC address of the peer STA that
+ * need to be deleted from peer list.
+ *
+ * @return None
+ */
+
+void
+limIbssPeerDelete(tpAniSirGlobal pMac, tSirMacAddr macAddr)
+{
+ tLimIbssPeerNode *pPrevNode, *pTempNode;
+
+ pTempNode = pPrevNode = pMac->lim.gLimIbssPeerList;
+
+ if (pTempNode == NULL)
+ return;
+
+ while (pTempNode != NULL)
+ {
+ if (palEqualMemory( pMac->hHdd,(tANI_U8 *) macAddr,
+ (tANI_U8 *) &pTempNode->peerMacAddr,
+ sizeof(tSirMacAddr)) )
+ {
+ // Found node to be deleted
+ if (pMac->lim.gLimIbssPeerList == pTempNode) /** First Node to be deleted*/
+ pMac->lim.gLimIbssPeerList = pTempNode->next;
+ else
+ pPrevNode->next = pTempNode->next;
+
+ if(pTempNode->beacon)
+ {
+ palFreeMemory(pMac->hHdd, pTempNode->beacon);
+ pTempNode->beacon = NULL;
+ }
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pTempNode);
+ pMac->lim.gLimNumIbssPeers--;
+ return;
+ }
+
+ pPrevNode = pTempNode;
+ pTempNode = pTempNode->next;
+ }
+
+ // Should not be here
+ PELOGE(limLog(pMac, LOGE, FL("peer not found in the list, addr= "));)
+ limPrintMacAddr(pMac, macAddr, LOGE);
+} /*** end limIbssPeerDelete() ***/
+
+#endif
+
+
+/** -------------------------------------------------------------
+\fn limIbssSetProtection
+\brief Decides all the protection related information.
+\
+\param tpAniSirGlobal pMac
+\param tSirMacAddr peerMacAddr
+\param tpUpdateBeaconParams pBeaconParams
+\return None
+ -------------------------------------------------------------*/
+static void
+limIbssSetProtection(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
+{
+
+ if(!pMac->lim.cfgProtection.fromllb)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled\n"));)
+ return;
+ }
+
+ if (enable)
+ {
+ psessionEntry->gLim11bParams.protectionEnabled = true;
+ if(false == psessionEntry->beaconParams.llbCoexist/*pMac->lim.llbCoexist*/)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("=> IBSS: Enable Protection \n"));)
+ pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
+ pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
+ }
+ }
+ else if (true == psessionEntry->beaconParams.llbCoexist/*pMac->lim.llbCoexist*/)
+ {
+ psessionEntry->gLim11bParams.protectionEnabled = false;
+ PELOGE(limLog(pMac, LOGE, FL("===> IBSS: Disable protection \n"));)
+ pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
+ pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
+ }
+ return;
+}
+
+
+/** -------------------------------------------------------------
+\fn limIbssUpdateProtectionParams
+\brief Decides all the protection related information.
+\
+\param tpAniSirGlobal pMac
+\param tSirMacAddr peerMacAddr
+\param tpUpdateBeaconParams pBeaconParams
+\return None
+ -------------------------------------------------------------*/
+static void
+limIbssUpdateProtectionParams(tpAniSirGlobal pMac,
+ tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType,
+ tpPESession psessionEntry)
+{
+ tANI_U32 i;
+
+ PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
+ limLog(pMac,LOG1, FL("Addr : "));
+ limPrintMacAddr(pMac, peerMacAddr, LOG1);)
+
+ for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
+ {
+ if (pMac->lim.protStaCache[i].active)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
+ PELOG1(limPrintMacAddr(pMac, pMac->lim.protStaCache[i].addr, LOG1);)
+
+ if (palEqualMemory( pMac->hHdd,
+ pMac->lim.protStaCache[i].addr,
+ peerMacAddr, sizeof(tSirMacAddr)))
+ {
+ PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active.\n"), i);)
+ return;
+ }
+ }
+ }
+
+ for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
+ {
+ if (!pMac->lim.protStaCache[i].active)
+ break;
+ }
+
+ if (i >= LIM_PROT_STA_CACHE_SIZE)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache\n"));)
+ return;
+ }
+
+ palCopyMemory( pMac->hHdd, pMac->lim.protStaCache[i].addr,
+ peerMacAddr,
+ sizeof(tSirMacAddr));
+
+ pMac->lim.protStaCache[i].protStaCacheType = protStaCacheType;
+ pMac->lim.protStaCache[i].active = true;
+ if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType)
+ {
+ psessionEntry->gLim11bParams.numSta++;
+ }
+ else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType)
+ {
+ psessionEntry->gLim11gParams.numSta++;
+ }
+}
+
+
+/** -------------------------------------------------------------
+\fn limIbssDecideProtection
+\brief Decides all the protection related information.
+\
+\param tpAniSirGlobal pMac
+\param tSirMacAddr peerMacAddr
+\param tpUpdateBeaconParams pBeaconParams
+\return None
+ -------------------------------------------------------------*/
+static void
+limIbssDecideProtection(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
+{
+ tSirRFBand rfBand = SIR_BAND_UNKNOWN;
+ tANI_U32 phyMode;
+ tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID;
+
+ pBeaconParams->paramChangeBitmap = 0;
+
+ if(NULL == pStaDs)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("pStaDs is NULL\n"));)
+ return;
+ }
+
+ limGetRfBand(pMac, &rfBand, psessionEntry);
+ if(SIR_BAND_2_4_GHZ== rfBand)
+ {
+ limGetPhyMode(pMac, &phyMode, psessionEntry);
+
+ //We are 11G or 11n. Check if we need protection from 11b Stations.
+ if ((phyMode == WNI_CFG_PHY_MODE_11G) || (pMac->lim.htCapability))
+ {
+ /* As we found in the past, it is possible that a 11n STA sends
+ * Beacon with HT IE but not ERP IE. So the absense of ERP IE
+ * in the Beacon is not enough to conclude that STA is 11b.
+ */
+ if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
+ (!pStaDs->mlmStaContext.htCapability))
+ {
+ protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
+ PELOGE(limLog(pMac, LOGE, FL("Enable protection from 11B\n"));)
+ limIbssSetProtection(pMac, true, pBeaconParams,psessionEntry);
+ }
+ }
+ }
+ limIbssUpdateProtectionParams(pMac, pStaDs->staAddr, protStaCacheType, psessionEntry);
+ return;
+}
+
+
+/**
+ * limIbssStaAdd()
+ *
+ *FUNCTION:
+ * This function is called to add an STA context in IBSS role
+ * whenever a data frame is received from/for a STA that failed
+ * hash lookup at DPH.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param peerAdddr MAC address of the peer being added
+ * @return retCode Indicates success or failure return code
+ * @return
+ */
+
+tSirRetStatus
+limIbssStaAdd(
+ tpAniSirGlobal pMac,
+ void *pBody,
+ tpPESession psessionEntry)
+{
+ tSirRetStatus retCode = eSIR_SUCCESS;
+ tpDphHashNode pStaDs;
+ tLimIbssPeerNode *pPeerNode;
+ tLimMlmStates prevState;
+ tSirMacAddr *pPeerAddr = (tSirMacAddr *) pBody;
+ tUpdateBeaconParams beaconParams;
+
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) &beaconParams, sizeof(tUpdateBeaconParams));
+
+ if (pBody == 0)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Invalid IBSS AddSta\n"));)
+ return eSIR_FAILURE;
+ }
+
+ PELOGE(limLog(pMac, LOGE, FL("Rx Add-Ibss-Sta for MAC:\n"));)
+ limPrintMacAddr(pMac, *pPeerAddr, LOGE);
+
+ pPeerNode = ibss_peer_find(pMac, *pPeerAddr);
+ if(NULL != pPeerNode)
+ {
+ retCode = ibss_dph_entry_add(pMac, *pPeerAddr, &pStaDs,psessionEntry);
+ if (eSIR_SUCCESS == retCode)
+ {
+ prevState = pStaDs->mlmStaContext.mlmState;
+ pStaDs->erpEnabled = pPeerNode->erpIePresent;
+
+ ibss_sta_info_update(pMac, pStaDs, pPeerNode,psessionEntry);
+ PELOGW(limLog(pMac, LOGW, FL("initiating ADD STA for the IBSS peer.\n"));)
+ retCode = limAddSta(pMac, pStaDs,psessionEntry);
+ if(retCode != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("ibss-sta-add failed (reason %x)\n"), retCode);)
+ limPrintMacAddr(pMac, *pPeerAddr, LOGE);
+ if(NULL != pStaDs)
+ {
+ pStaDs->mlmStaContext.mlmState = prevState;
+ dphDeleteHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, &psessionEntry->dph.dphHashTable);
+ }
+ }
+ else
+ {
+ if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
+ limIbssDecideProtection(pMac, pStaDs, &beaconParams , psessionEntry);
+
+ if(beaconParams.paramChangeBitmap)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("---> Update Beacon Params \n"));)
+ schSetFixedBeaconFields(pMac, psessionEntry);
+ limSendBeaconParams(pMac, &beaconParams, psessionEntry );
+ }
+ }
+ }
+ else
+ {
+ PELOGE(limLog(pMac, LOGE, FL("hashTblAdd failed (reason %x)\n"), retCode);)
+ limPrintMacAddr(pMac, *pPeerAddr, LOGE);
+ }
+ }
+ else
+ {
+ retCode = eSIR_FAILURE;
+ }
+
+ return retCode;
+}
+
+/* handle the response from HAL for an ADD STA request */
+tSirRetStatus
+limIbssAddStaRsp(
+ tpAniSirGlobal pMac,
+ void *msg,tpPESession psessionEntry)
+{
+ tpDphHashNode pStaDs;
+ tANI_U16 aid;
+ tpAddStaParams pAddStaParams = (tpAddStaParams) msg;
+
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+ if (pAddStaParams == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("IBSS: ADD_STA_RSP with no body!\n"));)
+ return eSIR_FAILURE;
+ }
+
+ pStaDs = dphLookupHashEntry(pMac, pAddStaParams->staMac, &aid, &psessionEntry->dph.dphHashTable);
+ if (pStaDs == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("IBSS: ADD_STA_RSP for unknown MAC addr "));)
+ limPrintMacAddr(pMac, pAddStaParams->staMac, LOGE);
+ palFreeMemory( pMac->hHdd, (void *) pAddStaParams );
+ return eSIR_FAILURE;
+ }
+
+ if (pAddStaParams->status != eHAL_STATUS_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("IBSS: ADD_STA_RSP error (%x) "), pAddStaParams->status);)
+ limPrintMacAddr(pMac, pAddStaParams->staMac, LOGE);
+ palFreeMemory( pMac->hHdd, (void *) pAddStaParams );
+ return eSIR_FAILURE;
+ }
+
+ pStaDs->bssId = pAddStaParams->bssIdx;
+ pStaDs->staIndex = pAddStaParams->staIdx;
+ pStaDs->ucUcastSig = pAddStaParams->ucUcastSig;
+ pStaDs->ucBcastSig = pAddStaParams->ucBcastSig;
+ pStaDs->valid = 1;
+ pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
+
+ PELOGW(limLog(pMac, LOGW, FL("IBSS: sending IBSS_NEW_PEER msg to SME!\n"));)
+
+ ibss_status_chg_notify(pMac, pAddStaParams->staMac, pStaDs->staIndex,
+ pStaDs->ucUcastSig, pStaDs->ucBcastSig,
+ eWNI_SME_IBSS_NEW_PEER_IND,
+ psessionEntry->smeSessionId);
+ palFreeMemory( pMac->hHdd, (void *) pAddStaParams );
+
+ return eSIR_SUCCESS;
+}
+
+
+
+void limIbssDelBssRspWhenCoalescing(tpAniSirGlobal pMac, void *msg,tpPESession psessionEntry)
+{
+ tpDeleteBssParams pDelBss = (tpDeleteBssParams) msg;
+
+ PELOGW(limLog(pMac, LOGW, FL("IBSS: DEL_BSS_RSP Rcvd during coalescing!\n"));)
+
+ if (pDelBss == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("IBSS: DEL_BSS_RSP(coalesce) with no body!\n"));)
+ goto end;
+ }
+
+ if (pDelBss->status != eHAL_STATUS_SUCCESS)
+ {
+ limLog(pMac, LOGE, FL("IBSS: DEL_BSS_RSP(coalesce) error (%x) Bss %d "),
+ pDelBss->status, pDelBss->bssIdx);
+ goto end;
+ }
+ //Delete peer entries.
+ limIbssDeleteAllPeers(pMac,psessionEntry);
+
+ /* add the new bss */
+ ibss_bss_add(pMac,psessionEntry);
+
+ end:
+ if(pDelBss != NULL)
+ palFreeMemory( pMac->hHdd, (void *) pDelBss );
+}
+
+
+
+void limIbssAddBssRspWhenCoalescing(tpAniSirGlobal pMac, void *msg, tpPESession pSessionEntry)
+{
+ tANI_U8 infoLen;
+ tSirSmeNewBssInfo newBssInfo;
+
+ tpAddBssParams pAddBss = (tpAddBssParams) msg;
+
+ tpSirMacMgmtHdr pHdr = (tpSirMacMgmtHdr) pMac->lim.ibssInfo.pHdr;
+ tpSchBeaconStruct pBeacon = (tpSchBeaconStruct) pMac->lim.ibssInfo.pBeacon;
+
+ if ((pHdr == NULL) || (pBeacon == NULL))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Unable to handle AddBssRspWhenCoalescing (no cached BSS info)\n"));)
+ goto end;
+ }
+
+ // Inform Host of IBSS coalescing
+ infoLen = sizeof(tSirMacAddr) + sizeof(tSirMacChanNum) +
+ sizeof(tANI_U8) + pBeacon->ssId.length + 1;
+
+ palZeroMemory(pMac->hHdd, (void *) &newBssInfo, sizeof(newBssInfo));
+ palCopyMemory( pMac->hHdd, newBssInfo.bssId, pHdr->bssId, sizeof(tSirMacAddr));
+ newBssInfo.channelNumber = (tSirMacChanNum) pAddBss->currentOperChannel;
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &newBssInfo.ssId,
+ (tANI_U8 *) &pBeacon->ssId, pBeacon->ssId.length + 1);
+
+ PELOGW(limLog(pMac, LOGW, FL("Sending JOINED_NEW_BSS notification to SME.\n"));)
+
+ limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_JOINED_NEW_BSS,
+ (tANI_U32 *) &newBssInfo,
+ infoLen,pSessionEntry->smeSessionId);
+#ifdef WLAN_SOFTAP_FEATURE
+ {
+ //Configure beacon and send beacons to HAL
+ limSendBeaconInd(pMac, pSessionEntry);
+ }
+#endif
+
+
+ end:
+ ibss_coalesce_free(pMac);
+}
+
+
+
+void
+limIbssDelBssRsp(
+ tpAniSirGlobal pMac,
+ void *msg,tpPESession psessionEntry)
+{
+ tSirResultCodes rc = eSIR_SME_SUCCESS;
+ tpDeleteBssParams pDelBss = (tpDeleteBssParams) msg;
+ tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+ if (pDelBss == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("IBSS: DEL_BSS_RSP with no body!\n"));)
+ rc = eSIR_SME_REFUSED;
+ goto end;
+ }
+
+ if((psessionEntry = peFindSessionBySessionId(pMac,pDelBss->sessionId))==NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ goto end;
+ }
+
+
+ /*
+ * If delBss was issued as part of IBSS Coalescing, gLimIbssCoalescingHappened flag will be true.
+ * BSS has to be added again in this scenario, so this case needs to be handled separately.
+ * If delBss was issued as a result of trigger from SME_STOP_BSS Request, then limSme state changes to
+ * 'IDLE' and gLimIbssCoalescingHappened flag will be false. In this case STOP BSS RSP has to be sent to SME.
+ */
+ if(true == pMac->lim.gLimIbssCoalescingHappened)
+ {
+
+ limIbssDelBssRspWhenCoalescing(pMac,msg,psessionEntry);
+ return;
+ }
+
+
+
+ if (pDelBss->status != eHAL_STATUS_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("IBSS: DEL_BSS_RSP error (%x) Bss %d "),
+ pDelBss->status, pDelBss->bssIdx);)
+ rc = eSIR_SME_STOP_BSS_FAILURE;
+ goto end;
+ }
+
+
+
+ if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid,
+ psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("IBSS: DEL_BSS_RSP setLinkState failed\n"));)
+ rc = eSIR_SME_REFUSED;
+ goto end;
+ }
+
+ dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);
+ limDeletePreAuthList(pMac);
+
+ limIbssDelete(pMac,psessionEntry);
+ psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
+
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+ psessionEntry->limSystemRole = eLIM_STA_ROLE;
+
+ /* Change the short slot operating mode to Default (which is 1 for now) so that when IBSS starts next time with Libra
+ * as originator, it picks up the default. This enables us to remove hard coding of short slot = 1 from limApplyConfiguration
+ */
+ if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, WNI_CFG_SHORT_SLOT_TIME_STADEF) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("could not update short slot time at CFG\n"));
+ return;
+ }
+
+ end:
+ if(pDelBss != NULL)
+ palFreeMemory( pMac->hHdd, (void *) pDelBss );
+ /* Delete PE session once BSS is deleted */
+ if (NULL != psessionEntry) {
+ limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, rc,psessionEntry->smeSessionId,psessionEntry->transactionId);
+ peDeleteSession(pMac, psessionEntry);
+ psessionEntry = NULL;
+ }
+}
+
+/**
+ * limIbssCoalesce()
+ *
+ *FUNCTION:
+ * This function is called upon receiving Beacon/Probe Response
+ * while operating in IBSS mode.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pBeacon - Parsed Beacon Frame structure
+ * @param pBD - Pointer to received BD
+ *
+ * @return Status whether to process or ignore received Beacon Frame
+ */
+
+tSirRetStatus
+limIbssCoalesce(
+ tpAniSirGlobal pMac,
+ tpSirMacMgmtHdr pHdr,
+ tpSchBeaconStruct pBeacon,
+ tANI_U8 *pIEs,
+ tANI_U32 ieLen,
+ tANI_U16 fTsfLater,
+ tpPESession psessionEntry)
+{
+ tANI_U16 aid;
+ tSirMacAddr currentBssId;
+ tLimIbssPeerNode *pPeerNode;
+ tpDphHashNode pStaDs;
+ tUpdateBeaconParams beaconParams;
+
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) &beaconParams, sizeof(tUpdateBeaconParams));
+
+ sirCopyMacAddr(currentBssId,psessionEntry->bssId);
+
+ /* Check for IBSS Coalescing only if Beacon is from different BSS */
+ if ( !palEqualMemory( pMac->hHdd, currentBssId, pHdr->bssId, sizeof( tSirMacAddr ) ) )
+ {
+ if (! fTsfLater) // No Coalescing happened.
+ return eSIR_LIM_IGNORE_BEACON;
+ /*
+ * IBSS Coalescing happened.
+ * save the received beacon, and delete the current BSS. The rest of the
+ * processing will be done in the delBss response processing
+ */
+ pMac->lim.gLimIbssCoalescingHappened = true;
+ PELOGW(limLog(pMac, LOGW, FL("IBSS Coalescing happened\n"));)
+ ibss_coalesce_save(pMac, pHdr, pBeacon);
+ ibss_bss_delete(pMac,psessionEntry);
+ return eSIR_SUCCESS;
+ }
+
+ // STA in IBSS mode and SSID matches with ours
+ pPeerNode = ibss_peer_find(pMac, pHdr->sa);
+ if (pPeerNode == NULL)
+ {
+ /* Peer not in the list - Collect BSS description & add to the list */
+ tANI_U32 frameLen;
+ tSirRetStatus retCode;
+ PELOGW(limLog(pMac, LOGW, FL("IBSS Peer node does not exist, adding it***\n"));)
+
+#ifndef ANI_SIR_IBSS_PEER_CACHING
+ /** Limit the Max number of IBSS Peers allowed as the max number of STA's allowed
+ */
+ if (pMac->lim.gLimNumIbssPeers >= pMac->lim.maxStation)
+ return eSIR_LIM_MAX_STA_REACHED_ERROR;
+#endif
+ frameLen = sizeof(tLimIbssPeerNode) + ieLen - sizeof(tANI_U32);
+
+ if (eHAL_STATUS_SUCCESS !=
+ palAllocateMemory(pMac->hHdd, (void **) &pPeerNode, (tANI_U16)frameLen))
+ {
+ limLog(pMac, LOGP, FL("alloc fail (%d bytes) storing IBSS peer info\n"),
+ frameLen);
+ return eSIR_MEM_ALLOC_FAILED;
+ }
+
+ pPeerNode->beacon = NULL;
+ pPeerNode->beaconLen = 0;
+
+ ibss_peer_collect(pMac, pBeacon, pHdr, pPeerNode,psessionEntry);
+ if(eHAL_STATUS_SUCCESS !=
+ palAllocateMemory(pMac->hHdd, (void**)&pPeerNode->beacon, ieLen))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store beacon"));)
+ }
+ else
+ {
+ palCopyMemory(pMac->hHdd, pPeerNode->beacon, pIEs, ieLen);
+ pPeerNode->beaconLen = (tANI_U16)ieLen;
+ }
+ ibss_peer_add(pMac, pPeerNode);
+
+ pStaDs = dphLookupHashEntry(pMac, pPeerNode->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
+ if (pStaDs != NULL)
+ {
+ /// DPH node already exists for the peer
+ PELOGW(limLog(pMac, LOGW, FL("DPH Node present for just learned peer\n"));)
+ PELOG1(limPrintMacAddr(pMac, pPeerNode->peerMacAddr, LOG1);)
+ ibss_sta_info_update(pMac, pStaDs, pPeerNode,psessionEntry);
+ }
+ retCode = limIbssStaAdd(pMac, pPeerNode->peerMacAddr,psessionEntry);
+ if (retCode != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("lim-ibss-sta-add failed (reason %x)\n"), retCode);)
+ limPrintMacAddr(pMac, pPeerNode->peerMacAddr, LOGE);
+ return retCode;
+ }
+
+ // Decide protection mode
+ pStaDs = dphLookupHashEntry(pMac, pPeerNode->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
+ if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
+ limIbssDecideProtection(pMac, pStaDs, &beaconParams, psessionEntry);
+
+ if(beaconParams.paramChangeBitmap)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("beaconParams.paramChangeBitmap=1 ---> Update Beacon Params \n"));)
+ schSetFixedBeaconFields(pMac, psessionEntry);
+ limSendBeaconParams(pMac, &beaconParams, psessionEntry );
+ }
+ }
+ else
+ ibss_sta_caps_update(pMac, pPeerNode,psessionEntry);
+
+ if (psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE)
+ return eSIR_SUCCESS;
+
+ // Received Beacon from same IBSS we're
+ // currently part of. Inform Roaming algorithm
+ // if not already that IBSS is active.
+ if (psessionEntry->limIbssActive == false)
+ {
+ limResetHBPktCount(psessionEntry);
+ PELOGW(limLog(pMac, LOGW, FL("Partner joined our IBSS, Sending IBSS_ACTIVE Notification to SME\n"));)
+ psessionEntry->limIbssActive = true;
+ limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_IBSS_ACTIVE, NULL, 0, psessionEntry->smeSessionId);
+ limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
+ if (limActivateHearBeatTimer(pMac) != TX_SUCCESS)
+ limLog(pMac, LOGP, FL("could not activate Heartbeat timer\n"));
+ }
+
+ return eSIR_SUCCESS;
+} /*** end limHandleIBSScoalescing() ***/
+
+
+void limIbssHeartBeatHandle(tpAniSirGlobal pMac,tpPESession psessionEntry)
+{
+ tLimIbssPeerNode *pTempNode, *pPrevNode;
+ tLimIbssPeerNode *pTempNextNode = NULL;
+ tANI_U16 aid;
+ tpDphHashNode pStaDs;
+ tANI_U32 threshold;
+ tANI_U16 staIndex;
+ tANI_U8 ucUcastSig;
+ tANI_U8 ucBcastSig;
+
+ /** MLM BSS is started and if PE in scanmode then MLM state will be waiting for probe resp.
+ * If Heart beat timeout triggers during this corner case then we need to reactivate HeartBeat timer
+ */
+ if(psessionEntry->limMlmState != eLIM_MLM_BSS_STARTED_STATE) {
+ /******
+ * Note: Use this code once you have converted all
+ * limReactivateHeartBeatTimer() calls to
+ * limReactivateTimer() calls.
+ *
+ ******/
+ //limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER, psessionEntry);
+ limReactivateHeartBeatTimer(pMac, psessionEntry);
+ return;
+ }
+ /** If LinkMonitor is Disabled */
+ if(!pMac->sys.gSysEnableLinkMonitorMode)
+ return;
+
+ pPrevNode = pTempNode = pMac->lim.gLimIbssPeerList;
+ threshold = (pMac->lim.gLimNumIbssPeers / 4 ) + 1;
+
+ /** Monitor the HeartBeat with the Individual PEERS in the IBSS */
+ while (pTempNode != NULL)
+ {
+ pTempNextNode = pTempNode->next;
+ if(pTempNode->beaconHBCount) //There was a beacon for this peer during heart beat.
+ {
+ pTempNode->beaconHBCount = 0;
+ pTempNode->heartbeatFailure = 0;
+ }
+ else //There wasnt any beacon received during heartbeat timer.
+ {
+ pTempNode->heartbeatFailure++;
+ PELOGE(limLog(pMac, LOGE, FL("Heartbeat fail = %d thres = %d"), pTempNode->heartbeatFailure, pMac->lim.gLimNumIbssPeers);)
+ if(pTempNode->heartbeatFailure >= threshold )
+ {
+ //Remove this entry from the list.
+ pStaDs = dphLookupHashEntry(pMac, pTempNode->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
+ if (pStaDs)
+ {
+ staIndex = pStaDs->staIndex;
+ ucUcastSig = pStaDs->ucUcastSig;
+ ucBcastSig = pStaDs->ucBcastSig;
+
+ (void) limDelSta(pMac, pStaDs, false /*asynchronous*/,psessionEntry);
+ limDeleteDphHashEntry(pMac, pStaDs->staAddr, aid,psessionEntry);
+
+ //Send indication.
+ ibss_status_chg_notify( pMac, pTempNode->peerMacAddr, staIndex,
+ ucUcastSig, ucBcastSig,
+ eWNI_SME_IBSS_PEER_DEPARTED_IND,
+ psessionEntry->smeSessionId );
+ }
+ if(pTempNode == pMac->lim.gLimIbssPeerList)
+ {
+ pMac->lim.gLimIbssPeerList = pTempNode->next;
+ pPrevNode = pMac->lim.gLimIbssPeerList;
+ }
+ else
+ pPrevNode->next = pTempNode->next;
+
+ palFreeMemory(pMac->hHdd,pTempNode);
+ pMac->lim.gLimNumIbssPeers--;
+
+ pTempNode = pTempNextNode; //Since we deleted current node, prevNode remains same.
+ continue;
+ }
+ }
+
+ pPrevNode = pTempNode;
+ pTempNode = pTempNextNode;
+ }
+
+ /** General IBSS Activity Monitor, check if in IBSS Mode we are received any Beacons */
+ if(pMac->lim.gLimNumIbssPeers)
+ {
+ if(psessionEntry->LimRxedBeaconCntDuringHB < MAX_NO_BEACONS_PER_HEART_BEAT_INTERVAL)
+ pMac->lim.gLimHeartBeatBeaconStats[psessionEntry->LimRxedBeaconCntDuringHB]++;
+ else
+ pMac->lim.gLimHeartBeatBeaconStats[0]++;
+
+ limReactivateHeartBeatTimer(pMac, psessionEntry);
+
+ // Reset number of beacons received
+ limResetHBPktCount(psessionEntry);
+ return;
+ }
+ else
+ {
+
+ PELOGW(limLog(pMac, LOGW, FL("Heartbeat Failure\n"));)
+ pMac->lim.gLimHBfailureCntInLinkEstState++;
+
+ if (psessionEntry->limIbssActive == true)
+ {
+ // We don't receive Beacon frames from any
+ // other STA in IBSS. Announce IBSS inactive
+ // to Roaming algorithm
+ PELOGW(limLog(pMac, LOGW, FL("Alone in IBSS\n"));)
+ psessionEntry->limIbssActive = false;
+
+ limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_IBSS_INACTIVE,
+ NULL, 0, psessionEntry->smeSessionId);
+ }
+ }
+}
+
+
+/** -------------------------------------------------------------
+\fn limIbssDecideProtectionOnDelete
+\brief Decides all the protection related information.
+\
+\param tpAniSirGlobal pMac
+\param tSirMacAddr peerMacAddr
+\param tpUpdateBeaconParams pBeaconParams
+\return None
+ -------------------------------------------------------------*/
+void
+limIbssDecideProtectionOnDelete(tpAniSirGlobal pMac,
+ tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
+{
+ tANI_U32 phyMode;
+ tHalBitVal erpEnabled = eHAL_CLEAR;
+ tSirRFBand rfBand = SIR_BAND_UNKNOWN;
+ tANI_U32 i;
+
+ if(NULL == pStaDs)
+ return;
+
+ limGetRfBand(pMac, &rfBand, psessionEntry);
+ if(SIR_BAND_2_4_GHZ == rfBand)
+ {
+ limGetPhyMode(pMac, &phyMode, psessionEntry);
+ erpEnabled = pStaDs->erpEnabled;
+ //we are HT or 11G and 11B station is getting deleted.
+ if ( ((phyMode == WNI_CFG_PHY_MODE_11G) || pMac->lim.htCapability)
+ && (erpEnabled == eHAL_CLEAR))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("(%d) A legacy STA is disassociated. Addr is "),
+ psessionEntry->gLim11bParams.numSta);
+ limPrintMacAddr(pMac, pStaDs->staAddr, LOGE);)
+ if (psessionEntry->gLim11bParams.numSta > 0)
+ {
+ for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
+ {
+ if (pMac->lim.protStaCache[i].active)
+ {
+ if (palEqualMemory( pMac->hHdd,pMac->lim.protStaCache[i].addr,
+ pStaDs->staAddr, sizeof(tSirMacAddr)))
+ {
+ psessionEntry->gLim11bParams.numSta--;
+ pMac->lim.protStaCache[i].active = false;
+ break;
+ }
+ }
+ }
+ }
+
+ if (psessionEntry->gLim11bParams.numSta == 0)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("No more 11B STA exists. Disable protection. \n"));)
+ limIbssSetProtection(pMac, false, pBeaconParams,psessionEntry);
+ }
+ }
+ }
+}
diff --git a/CORE/MAC/src/pe/lim/limIbssPeerMgmt.h b/CORE/MAC/src/pe/lim/limIbssPeerMgmt.h
new file mode 100644
index 0000000..4b3a39f
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limIbssPeerMgmt.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limIbssPeerMgmt.h contains prototypes for
+ * the utility functions LIM uses to maintain peers in IBSS.
+ * Author: Chandra Modumudi
+ * Date: 03/12/04
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+
+#include "sirCommon.h"
+#include "limUtils.h"
+
+void limIbssInit(tpAniSirGlobal);
+void limIbssDelete(tpAniSirGlobal,tpPESession psessionEntry);
+tSirRetStatus limIbssCoalesce(tpAniSirGlobal, tpSirMacMgmtHdr, tpSchBeaconStruct, tANI_U8*,tANI_U32, tANI_U16,tpPESession);
+tSirRetStatus limIbssStaAdd(tpAniSirGlobal, void *,tpPESession);
+tSirRetStatus limIbssAddStaRsp( tpAniSirGlobal, void *,tpPESession);
+void limIbssDelBssRsp( tpAniSirGlobal, void *,tpPESession);
+void limIbssDelBssRspWhenCoalescing(tpAniSirGlobal, void *,tpPESession);
+void limIbssAddBssRspWhenCoalescing(tpAniSirGlobal pMac, void * msg, tpPESession pSessionEntry);
+void limIbssDecideProtectionOnDelete(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams,tpPESession pSessionEntry);
+void limIbssHeartBeatHandle(tpAniSirGlobal pMac,tpPESession psessionEntry);
+
diff --git a/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c b/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c
new file mode 100644
index 0000000..f9c103b
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c
@@ -0,0 +1,552 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limLinkMonitoringAlgo.cc contains the code for
+ * Link monitoring algorithm on AP and heart beat failure
+ * handling on STA.
+ * Author: Chandra Modumudi
+ * Date: 03/01/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#include "aniGlobal.h"
+#include "wniCfgAp.h"
+#include "cfgApi.h"
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halDataStruct.h"
+#include "halCommonApi.h"
+#endif
+
+#include "schApi.h"
+#include "pmmApi.h"
+#include "utilsApi.h"
+#include "limAssocUtils.h"
+#include "limTypes.h"
+#include "limUtils.h"
+#include "limPropExtsUtils.h"
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+#include "vos_diag_core_log.h"
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+#include "limSession.h"
+#include "limSerDesUtils.h"
+
+
+/**
+ * limSendKeepAliveToPeer()
+ *
+ *FUNCTION:
+ * This function is called to send Keep alive message to peer
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limSendKeepAliveToPeer(tpAniSirGlobal pMac)
+{
+
+#ifdef ANI_PRODUCT_TYPE_AP //oct 3rd review
+
+ tpDphHashNode pStaDs;
+ //fetch the sessionEntry based on the sessionId
+ tpPESession psessionEntry;
+
+ if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimKeepaliveTimer.sessionId))== NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+
+ // If keep live has been disabled, exit
+ if (pMac->sch.keepAlive == 0)
+ return;
+
+ if ( (limIsSystemInScanState(pMac) == false) &&
+ (psessionEntry->limSystemRole == eLIM_AP_ROLE))
+ {
+ tANI_U16 i;
+ tANI_U32 len = SIR_MAC_MAX_SSID_LENGTH;
+ tAniSSID ssId;
+
+ /*
+ ** send keepalive NULL data frame for each
+ ** associated STA;
+ */
+
+ for (i=2; i<pMac->lim.maxStation; i++)
+ {
+ pStaDs = dphGetHashEntry(pMac, i, &psessionEntry->dph.dphHashTable);
+
+ if (pStaDs && pStaDs->added &&
+ (pStaDs->mlmStaContext.mlmState == eLIM_MLM_LINK_ESTABLISHED_STATE))
+ {
+ // SP-Tx hangs at times when a zero-lenght packet is transmitted
+ // To avoid any interoperability issue with third party clinet
+ // instead of sending a non-zero data-null packet, AP sends a
+ // probe response as a keep alive packet.
+ if (wlan_cfgGetStr(pMac, WNI_CFG_SSID,
+ (tANI_U8 *) &ssId.ssId,
+ (tANI_U32 *) &len) != eSIR_SUCCESS)
+ {
+ /// Could not get SSID from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve SSID\n"));
+ }
+ ssId.length = (tANI_U8) len;
+
+ PELOG2(limLog(pMac, LOG2, FL("Sending keepalive Probe Rsp Msg to "));
+ limPrintMacAddr(pMac, pStaDs->staAddr, LOG2);)
+ limSendProbeRspMgmtFrame(pMac,
+ pStaDs->staAddr,
+ &ssId,
+ i,
+ DPH_KEEPALIVE_FRAME, 0);
+ }
+ }
+ }
+ #endif
+} /*** limSendKeepAliveToPeer() ***/
+
+
+/** ---------------------------------------------------------
+\fn limDeleteStaContext
+\brief This function handles the message from HAL:
+\ WDA_DELETE_STA_CONTEXT_IND. This function
+\ validates that the given station id exist, and if so,
+\ deletes the station by calling limTriggerSTAdeletion.
+\param tpAniSirGlobal pMac
+\param tpSirMsgQ limMsg
+\return none
+ -----------------------------------------------------------*/
+void
+limDeleteStaContext(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
+{
+ tpDeleteStaContext pMsg = (tpDeleteStaContext)limMsg->bodyptr;
+ tpDphHashNode pStaDs;
+ tpPESession psessionEntry ;
+ tANI_U8 sessionId;
+
+ if((psessionEntry = peFindSessionByBssid(pMac,pMsg->bssId,&sessionId))== NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));)
+ palFreeMemory(pMac->hHdd, pMsg);
+ return;
+ }
+
+ if (NULL != pMsg)
+ {
+#ifdef WLAN_SOFTAP_FEATURE
+ switch(pMsg->reasonCode)
+ {
+ case HAL_DEL_STA_REASON_CODE_KEEP_ALIVE:
+ case HAL_DEL_STA_REASON_CODE_TIM_BASED:
+ PELOGE(limLog(pMac, LOGE, FL(" Deleting station: staId = %d, reasonCode = %d\n"), pMsg->staId, pMsg->reasonCode);)
+#endif
+ pStaDs = dphGetHashEntry(pMac, pMsg->assocId, &psessionEntry->dph.dphHashTable);
+ if (! pStaDs)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Skip STA deletion (invalid STA)\n"));)
+ palFreeMemory(pMac->hHdd, pMsg);
+ return;
+ }
+
+ /* check and see if same staId. This is to avoid the scenario
+ * where we're trying to delete a staId we just added.
+ */
+ if (pStaDs->staIndex != pMsg->staId)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("staid mismatch: %d vs %d \n"), pStaDs->staIndex, pMsg->staId);)
+ palFreeMemory(pMac->hHdd, pMsg);
+ return;
+ }
+
+ if((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) ||
+ (eLIM_AP_ROLE == psessionEntry->limSystemRole))
+ {
+ PELOG1(limLog(pMac, LOG1, FL("SAP:lim Delete Station Context (staId: %d, assocId: %d) \n"),
+ pMsg->staId, pMsg->assocId);)
+ limTriggerSTAdeletion(pMac, pStaDs, psessionEntry);
+ }
+ else
+ {
+ //TearDownLink with AP
+ tLimMlmDeauthInd mlmDeauthInd;
+ PELOG1(limLog(pMac, LOG1, FL("lim Delete Station Context (staId: %d, assocId: %d) \n"),
+ pMsg->staId, pMsg->assocId);)
+
+ pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
+ pStaDs->mlmStaContext.cleanupTrigger = eLIM_LINK_MONITORING_DEAUTH;
+
+ // Issue Deauth Indication to SME.
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDeauthInd.peerMacAddr,
+ pStaDs->staAddr, sizeof(tSirMacAddr));
+ mlmDeauthInd.reasonCode = (tANI_U8) pStaDs->mlmStaContext.disassocReason;
+ mlmDeauthInd.deauthTrigger = pStaDs->mlmStaContext.cleanupTrigger;
+
+ limPostSmeMessage(pMac, LIM_MLM_DEAUTH_IND, (tANI_U32 *) &mlmDeauthInd);
+
+ limSendSmeDeauthInd(pMac, pStaDs, psessionEntry);
+ }
+#ifdef WLAN_SOFTAP_FEATURE
+ break;
+
+ case HAL_DEL_STA_REASON_CODE_UNKNOWN_A2:
+ PELOGE(limLog(pMac, LOGE, FL(" Deleting Unknown station \n"));)
+ limPrintMacAddr(pMac, pMsg->addr2, LOGE);
+
+ limSendDeauthMgmtFrame( pMac, eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON, pMsg->addr2, psessionEntry);
+ break;
+
+ default:
+ PELOGE(limLog(pMac, LOGE, FL(" Unknown reason code \n"));)
+ break;
+
+ }
+#endif
+ }
+
+ palFreeMemory(pMac->hHdd, pMsg);
+ return;
+}
+
+
+/**
+ * limTriggerSTAdeletion()
+ *
+ *FUNCTION:
+ * This function is called to trigger STA context deletion
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to global MAC structure
+ * @param pStaDs - Pointer to internal STA Datastructure
+ * @return None
+ */
+void
+limTriggerSTAdeletion(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
+{
+ tSirSmeDeauthReq *pSmeDeauthReq;
+ tANI_U8 *pBuf;
+ tANI_U8 *pLen;
+ tANI_U16 msgLength = 0;
+
+ if (! pStaDs)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Skip STA deletion (invalid STA)\n"));)
+ return;
+ }
+ /**
+ * MAC based Authentication was used. Trigger
+ * Deauthentication frame to peer since it will
+ * take care of disassociation as well.
+ */
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSmeDeauthReq, sizeof(tSirSmeDeauthReq)))
+ {
+ limLog(pMac, LOGP, FL("palAllocateMemory failed for eWNI_SME_DEAUTH_REQ \n"));
+ return;
+ }
+
+ pBuf = (tANI_U8 *) &pSmeDeauthReq->messageType;
+
+ //messageType
+#ifdef WLAN_SOFTAP_FEATURE
+ limCopyU16((tANI_U8*)pBuf, eWNI_SME_DISASSOC_REQ);
+#else
+ limCopyU16((tANI_U8*)pBuf, eWNI_SME_DEAUTH_REQ);
+#endif
+ pBuf += sizeof(tANI_U16);
+ msgLength += sizeof(tANI_U16);
+
+ //length
+ pLen = pBuf;
+ pBuf += sizeof(tANI_U16);
+ msgLength += sizeof(tANI_U16);
+
+ //sessionId
+ *pBuf = psessionEntry->peSessionId;
+ pBuf++;
+ msgLength++;
+
+ //transactionId
+ limCopyU16((tANI_U8*)pBuf, psessionEntry->transactionId);
+ pBuf += sizeof(tANI_U16);
+ msgLength += sizeof(tANI_U16);
+
+ //bssId
+ palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr) );
+ pBuf += sizeof(tSirMacAddr);
+ msgLength += sizeof(tSirMacAddr);
+
+ //peerMacAddr
+ palCopyMemory( pMac->hHdd, pBuf, pStaDs->staAddr, sizeof(tSirMacAddr) );
+ pBuf += sizeof(tSirMacAddr);
+ msgLength += sizeof(tSirMacAddr);
+
+ //reasonCode
+#ifdef WLAN_SOFTAP_FEATURE
+ limCopyU16((tANI_U8*)pBuf, (tANI_U16)eLIM_LINK_MONITORING_DISASSOC);
+#else
+ limCopyU16((tANI_U8*)pBuf, (tANI_U16)eLIM_LINK_MONITORING_DEAUTH);
+#endif
+ pBuf += sizeof(tANI_U16);
+ msgLength += sizeof(tANI_U16);
+
+ //Do not send disassoc OTA
+ //pBuf[0] = 1 means do not send the disassoc frame over the air
+ //pBuf[0] = 0 means send the disassoc frame over the air
+ pBuf[0]= 0;
+ pBuf += sizeof(tANI_U8);
+ msgLength += sizeof(tANI_U8);
+
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ //aid
+ limCopyU16((tANI_U8*)pBuf, pStaDs->assocId);
+ pBuf += sizeof(tANI_U16);
+ msgLength += sizeof(tANI_U16);
+#endif
+
+ //Fill in length
+ limCopyU16((tANI_U8*)pLen, msgLength);
+
+#ifdef WLAN_SOFTAP_FEATURE
+ limPostSmeMessage(pMac, eWNI_SME_DISASSOC_REQ, (tANI_U32 *) pSmeDeauthReq);
+#else
+ limPostSmeMessage(pMac, eWNI_SME_DEAUTH_REQ, (tANI_U32 *) pSmeDeauthReq);
+#endif
+ palFreeMemory( pMac->hHdd, pSmeDeauthReq );
+
+} /*** end limTriggerSTAdeletion() ***/
+
+
+
+/**
+ * limTearDownLinkWithAp()
+ *
+ *FUNCTION:
+ * This function is called when heartbeat (beacon reception)
+ * fails on STA
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limTearDownLinkWithAp(tpAniSirGlobal pMac, tANI_U8 sessionId, tSirMacReasonCodes reasonCode)
+{
+ tpDphHashNode pStaDs = NULL;
+
+ //tear down the following sessionEntry
+ tpPESession psessionEntry;
+
+ if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+ /**
+ * Heart beat failed for upto threshold value
+ * and AP did not respond for Probe request.
+ * Trigger link tear down.
+ */
+
+ pMac->pmm.inMissedBeaconScenario = FALSE;
+ limLog(pMac, LOGW,
+ FL("No ProbeRsp from AP after HB failure. Tearing down link\n"));
+
+ // Deactivate heartbeat timer
+ limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
+
+ // Announce loss of link to Roaming algorithm
+ // and cleanup by sending SME_DISASSOC_REQ to SME
+
+ pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
+
+
+ if (pStaDs != NULL)
+ {
+ tLimMlmDeauthInd mlmDeauthInd;
+
+ pStaDs->mlmStaContext.disassocReason = reasonCode;
+ pStaDs->mlmStaContext.cleanupTrigger = eLIM_LINK_MONITORING_DEAUTH;
+
+ /// Issue Deauth Indication to SME.
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDeauthInd.peerMacAddr,
+ pStaDs->staAddr,
+ sizeof(tSirMacAddr));
+ mlmDeauthInd.reasonCode = (tANI_U8) pStaDs->mlmStaContext.disassocReason;
+ mlmDeauthInd.deauthTrigger = pStaDs->mlmStaContext.cleanupTrigger;
+
+ limPostSmeMessage(pMac, LIM_MLM_DEAUTH_IND, (tANI_U32 *) &mlmDeauthInd);
+
+ limSendSmeDeauthInd(pMac, pStaDs, psessionEntry);
+ }
+} /*** limTearDownLinkWithAp() ***/
+
+
+
+
+/**
+ * limHandleHeartBeatFailure()
+ *
+ *FUNCTION:
+ * This function is called when heartbeat (beacon reception)
+ * fails on STA
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void limHandleHeartBeatFailure(tpAniSirGlobal pMac,tpPESession psessionEntry)
+{
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ vos_log_beacon_update_pkt_type *log_ptr = NULL;
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ /* If gLimHeartBeatTimer fires between the interval of sending WDA_ENTER_BMPS_REQUEST
+ * to the HAL and receiving WDA_ENTER_BMPS_RSP from the HAL, then LIM (PE) tries to Process the
+ * SIR_LIM_HEAR_BEAT_TIMEOUT message but The PE state is ePMM_STATE_BMPS_SLEEP so PE dont
+ * want to handle heartbeat timeout in the BMPS, because Firmware handles it in BMPS.
+ * So just return from heartbeatfailure handler
+ */
+
+ if(!limIsSystemInActiveState(pMac))
+ return;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ WLAN_VOS_DIAG_LOG_ALLOC(log_ptr, vos_log_beacon_update_pkt_type, LOG_WLAN_BEACON_UPDATE_C);
+ if(log_ptr)
+ log_ptr->bcn_rx_cnt = psessionEntry->LimRxedBeaconCntDuringHB;
+ WLAN_VOS_DIAG_LOG_REPORT(log_ptr);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ /* Ensure HB Status for the session has been reseted */
+ psessionEntry->LimHBFailureStatus = eANI_BOOLEAN_FALSE;
+ /** Re Activate Timer if the system is Waiting for ReAssoc Response*/
+ if(((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
+ (psessionEntry->limSystemRole == eLIM_STA_ROLE) ||
+ (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
+ (LIM_IS_CONNECTION_ACTIVE(psessionEntry) ||
+ (limIsReassocInProgress(pMac, psessionEntry))))
+ {
+ if(psessionEntry->LimRxedBeaconCntDuringHB < MAX_NO_BEACONS_PER_HEART_BEAT_INTERVAL)
+ pMac->lim.gLimHeartBeatBeaconStats[psessionEntry->LimRxedBeaconCntDuringHB]++;
+ else
+ pMac->lim.gLimHeartBeatBeaconStats[0]++;
+
+ /******
+ * Note: Use this code once you have converted all
+ * limReactivateHeartBeatTimer() calls to
+ * limReactivateTimer() calls.
+ *
+ ******/
+ //limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER, psessionEntry);
+ limReactivateHeartBeatTimer(pMac, psessionEntry);
+
+ // Reset number of beacons received
+ limResetHBPktCount(psessionEntry);
+ return;
+ }
+ if (((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
+ (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE))
+ {
+ if (!pMac->sys.gSysEnableLinkMonitorMode)
+ return;
+
+ /**
+ * Beacon frame not received within heartbeat timeout.
+ */
+ PELOGW(limLog(pMac, LOGW, FL("Heartbeat Failure\n"));)
+ pMac->lim.gLimHBfailureCntInLinkEstState++;
+
+ /**
+ * Check if connected on the DFS channel, if not connected on
+ * DFS channel then only send the probe request otherwise tear down the link
+ */
+ if(!limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
+ {
+ /*** Detected continuous Beacon Misses ***/
+ psessionEntry->LimHBFailureStatus= eANI_BOOLEAN_TRUE;
+ /**
+ * Send Probe Request frame to AP to see if
+ * it is still around. Wait until certain
+ * timeout for Probe Response from AP.
+ */
+ PELOGW(limLog(pMac, LOGW, FL("Heart Beat missed from AP. Sending Probe Req\n"));)
+ /* for searching AP, we don't include any additional IE */
+ limSendProbeReqMgmtFrame(pMac, &psessionEntry->ssId, psessionEntry->bssId,
+ psessionEntry->currentOperChannel,psessionEntry->selfMacAddr,
+ psessionEntry->dot11mode, 0, NULL);
+ }
+ else
+ {
+ /* Connected on DFS channel so should not send the probe request
+ * tear down the link directly */
+ limTearDownLinkWithAp(pMac, psessionEntry->peSessionId, eSIR_MAC_UNSPEC_FAILURE_REASON);
+ }
+ }
+ else
+ {
+ /**
+ * Heartbeat timer may have timed out
+ * while we're doing background scanning/learning
+ * or in states other than link-established state.
+ * Log error.
+ */
+ PELOG1(limLog(pMac, LOG1, FL("received heartbeat timeout in state %X\n"),
+ psessionEntry->limMlmState);)
+ limPrintMlmState(pMac, LOG1, psessionEntry->limMlmState);
+ pMac->lim.gLimHBfailureCntInOtherStates++;
+ limReactivateHeartBeatTimer(pMac, psessionEntry);
+ }
+} /*** limHandleHeartBeatFailure() ***/
diff --git a/CORE/MAC/src/pe/lim/limLogDump.c b/CORE/MAC/src/pe/lim/limLogDump.c
new file mode 100644
index 0000000..8271119
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limLogDump.c
@@ -0,0 +1,2386 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*============================================================================
+limLogDump.c
+
+Implements the dump commands specific to the lim module.
+
+Copyright (c) 2007 QUALCOMM Incorporated.
+All Rights Reserved.
+Qualcomm Confidential and Proprietary
+ ============================================================================*/
+
+#include "vos_types.h"
+#include "limApi.h"
+
+#if defined(ANI_LOGDUMP)
+
+
+#include "limUtils.h"
+#include "limSecurityUtils.h"
+#include "schApi.h"
+#include "limSerDesUtils.h"
+#include "limAssocUtils.h"
+#include "limSendMessages.h"
+#include "logDump.h"
+#include "limTrace.h"
+#if defined WLAN_FEATURE_VOWIFI
+#include "rrmApi.h"
+#endif
+#if defined WLAN_FEATURE_VOWIFI_11R
+#include <limFT.h>
+#endif
+#include "smeInside.h"
+
+static char *getRole( tLimSystemRole role )
+{
+ switch (role)
+ {
+ case eLIM_UNKNOWN_ROLE:
+ return "eLIM_UNKNOWN_ROLE";
+ case eLIM_AP_ROLE:
+ return "eLIM_AP_ROLE";
+ case eLIM_STA_IN_IBSS_ROLE:
+ return "eLIM_STA_IN_IBSS_ROLE";
+ case eLIM_STA_ROLE:
+ return "eLIM_STA_ROLE";
+ case eLIM_BT_AMP_STA_ROLE:
+ return "eLIM_BT_AMP_STA_ROLE";
+ case eLIM_BT_AMP_AP_ROLE:
+ return "eLIM_BT_AMP_AP_ROLE";
+ default:
+ return "UNKNOWN";
+ }
+}
+
+#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+static char *
+dumpMacAddr(tpAniSirGlobal pMac, char *p, tANI_U8 *addr)
+{
+ p += log_sprintf( pMac,p, "%2x:%2x:%2x:%2x:%2x:%2x",
+ addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
+ return p;
+}
+#endif
+
+
+char *dumpLim( tpAniSirGlobal pMac, char *p )
+{
+ #ifdef FIXME_GEN6
+ //iterate through the sessionTable and dump sta entries for each session.
+ //Keep this code under 'WLAN_DEBUG' compile flag.
+
+ tANI_U16 i, j;
+
+
+ p += log_sprintf( pMac,p, "\n ----- LIM Debug Information ----- \n");
+ p += log_sprintf( pMac,p, "LIM Role = (%d) %s\n",
+ pMac->lim.gLimSystemRole, getRole(pMac->lim.gLimSystemRole));
+ p += log_sprintf( pMac,p, "SME State = (%d) %s",
+ pMac->lim.gLimSmeState, limSmeStateStr(pMac->lim.gLimSmeState));
+ p += log_sprintf( pMac,p, "MLM State = (%d) %s",
+ pMac->lim.gLimMlmState, limMlmStateStr(pMac->lim.gLimMlmState));
+
+ p += log_sprintf( pMac,p, "CHANNEL BONDING Mode (%1d) and State (X|X|X|AU|CS|U/D|O|A) (0x%1x)\n",
+ pMac->lim.gCbMode, pMac->lim.gCbState);
+ p += log_sprintf( pMac,p, "802.11n HT Capability: %s\n",
+ (pMac->lim.htCapability == 1) ? "Enabled" : "Disabled");
+ p += log_sprintf( pMac,p, "gLimProcessDefdMsgs: %s\n",
+ (pMac->lim.gLimProcessDefdMsgs == 1) ? "Enabled" : "Disabled");
+
+ if (pMac->lim.gLimSystemRole == eLIM_STA_ROLE)
+ {
+ p += log_sprintf( pMac,p, "AID = %X\t\t\n", pMac->lim.gLimAID);
+ p += log_sprintf( pMac,p, "SSID mismatch in Beacon Count = %d\n",
+ pMac->lim.gLimBcnSSIDMismatchCnt);
+ p += log_sprintf( pMac,p, "Number of link establishments = %d\n",
+ pMac->lim.gLimNumLinkEsts);
+ }
+ else if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
+ {
+ p += log_sprintf( pMac,p, "Num of STAs associated = %d\n",
+ pMac->lim.gLimNumOfCurrentSTAs);
+
+ p += log_sprintf( pMac,p, "Num of Pre-auth contexts = %d\n",
+ pMac->lim.gLimNumPreAuthContexts);
+
+ p += log_sprintf( pMac,p, "Num of AssocReq dropped in invalid State = %d\n",
+ pMac->lim.gLimNumAssocReqDropInvldState);
+
+ p += log_sprintf( pMac,p, "Num of ReassocReq dropped in invalid State = %d\n",
+ pMac->lim.gLimNumReassocReqDropInvldState);
+
+ p += log_sprintf( pMac,p, "Num of Hash Miss Event ignored = %d\n",
+ pMac->lim.gLimNumHashMissIgnored);
+
+
+
+
+ }
+
+ p += log_sprintf( pMac,p, "Num of RxCleanup Count = %d\n",
+ pMac->lim.gLimNumRxCleanup);
+ p += log_sprintf( pMac,p, "Unexpected Beacon Count = %d\n",
+ pMac->lim.gLimUnexpBcnCnt);
+ p += log_sprintf( pMac,p, "Number of Re/Assoc rejects of 11b STAs = %d\n",
+ pMac->lim.gLim11bStaAssocRejectCount);
+ p += log_sprintf( pMac,p, "No. of HeartBeat Failures in LinkEst State = %d\n",
+ pMac->lim.gLimHBfailureCntInLinkEstState);
+ p += log_sprintf( pMac,p, "No. of Probe Failures after HB failed = %d\n",
+ pMac->lim.gLimProbeFailureAfterHBfailedCnt);
+ p += log_sprintf( pMac,p, "No. of HeartBeat Failures in Other States = %d\n",
+ pMac->lim.gLimHBfailureCntInOtherStates);
+ p += log_sprintf( pMac,p, "No. of Beacons Rxed During HB Interval = %d\n",
+ pMac->lim.gLimRxedBeaconCntDuringHB);
+ p += log_sprintf( pMac,p, "Self Operating Mode = %s\n", limDot11ModeStr(pMac, (tANI_U8)pMac->lim.gLimDot11Mode));
+
+
+
+
+
+ p += log_sprintf( pMac,p, "\n");
+
+ if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
+ i = 2;
+ else
+ i = 1;
+
+
+ for (; i< pMac->lim.maxStation; i++)
+ {
+ tpDphHashNode pSta = dphGetHashEntry(pMac, (unsigned short)i);
+ if (pSta && pSta->added)
+ {
+ p += log_sprintf( pMac,p, "\nSTA AID: %d STA ID: %d Valid: %d AuthType: %d MLM State: %s",
+ i, pSta->staIndex, pSta->valid,
+ pSta->mlmStaContext.authType,
+ limMlmStateStr(pSta->mlmStaContext.mlmState));
+
+ p += log_sprintf( pMac,p, "\tAID:%-2d OpRateMode:%s ShPrmbl:%d HT:%d GF:%d TxChWidth:%d MimoPS:%d LsigProt:%d\n",
+ pSta->assocId, limStaOpRateModeStr(pSta->supportedRates.opRateMode),
+ pSta->shortPreambleEnabled, pSta->mlmStaContext.htCapability,
+ pSta->htGreenfield, pSta->htSupportedChannelWidthSet,
+ pSta->htMIMOPSState, pSta->htLsigTXOPProtection);
+
+ p += log_sprintf( pMac,p, "\tAMPDU [MaxSz(Factor):%d, Dens: %d] AMSDU-MaxLen: %d\n",
+ pSta->htMaxRxAMpduFactor, pSta->htAMpduDensity,pSta->htMaxAmsduLength);
+ p += log_sprintf( pMac,p, "\tDSSCCkMode40Mhz: %d, SGI20: %d, SGI40: %d\n",
+ pSta->htDsssCckRate40MHzSupport, pSta->htShortGI20Mhz,
+ pSta->htShortGI40Mhz);
+
+ p += log_sprintf( pMac,p, "\t11b Rates: ");
+ for(j=0; j<SIR_NUM_11B_RATES; j++)
+ if(pSta->supportedRates.llbRates[j] > 0)
+ p += log_sprintf( pMac,p, "%d ", pSta->supportedRates.llbRates[j]);
+
+ p += log_sprintf( pMac,p, "\n\t11a Rates: ");
+ for(j=0; j<SIR_NUM_11A_RATES; j++)
+ if(pSta->supportedRates.llaRates[j] > 0)
+ p += log_sprintf( pMac,p, "%d ", pSta->supportedRates.llaRates[j]);
+
+ p += log_sprintf( pMac,p, "\n\tPolaris Rates: ");
+ for(j=0; j<SIR_NUM_POLARIS_RATES; j++)
+ if(pSta->supportedRates.aniLegacyRates[j] > 0)
+ p += log_sprintf( pMac,p, "%d ", pSta->supportedRates.aniLegacyRates[j]);
+
+ p += log_sprintf( pMac,p, "\n\tTitan and Taurus Proprietary Rate Bitmap: %08x\n",
+ pSta->supportedRates.aniEnhancedRateBitmap);
+ p += log_sprintf( pMac,p, "\tMCS Rate Set Bitmap: ");
+ for(j=0; j<SIR_MAC_MAX_SUPPORTED_MCS_SET; j++)
+ p += log_sprintf( pMac,p, "%x ", pSta->supportedRates.supportedMCSSet[j]);
+
+ }
+ }
+ p += log_sprintf( pMac,p, "\nProbe response disable = %d\n",
+ pMac->lim.gLimProbeRespDisableFlag);
+
+#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA)
+ p += log_sprintf( pMac,p, "Scan mode enable = %d\n",
+ pMac->sys.gSysEnableScanMode);
+ p += log_sprintf( pMac,p, "BackgroundScanDisable = %d\n",
+ pMac->lim.gLimBackgroundScanDisable);
+ p += log_sprintf( pMac,p, "ForceBackgroundScanDisable = %d\n",
+ pMac->lim.gLimForceBackgroundScanDisable);
+ p += log_sprintf( pMac,p, "LinkMonitor mode enable = %d\n",
+ pMac->sys.gSysEnableLinkMonitorMode);
+ p += log_sprintf( pMac,p, "Qos Capable = %d\n",
+ SIR_MAC_GET_QOS(pMac->lim.gLimCurrentBssCaps));
+ p += log_sprintf( pMac,p, "Wme Capable = %d\n",
+ LIM_BSS_CAPS_GET(WME, pMac->lim.gLimCurrentBssQosCaps));
+ p += log_sprintf( pMac,p, "Wsm Capable = %d\n",
+ LIM_BSS_CAPS_GET(WSM, pMac->lim.gLimCurrentBssQosCaps));
+ if (pMac->lim.gLimSystemRole == eLIM_STA_IN_IBSS_ROLE)
+ {
+ p += log_sprintf( pMac,p, "Number of peers in IBSS = %d\n",
+ pMac->lim.gLimNumIbssPeers);
+ if (pMac->lim.gLimNumIbssPeers)
+ {
+ tLimIbssPeerNode *pTemp;
+ pTemp = pMac->lim.gLimIbssPeerList;
+ p += log_sprintf( pMac,p, "MAC-Addr Ani Edca WmeInfo HT Caps #S,#E(Rates)\n");
+ while (pTemp != NULL)
+ {
+ p += log_sprintf( pMac,p, "%02X:%02X:%02X:%02X:%02X:%02X ",
+ pTemp->peerMacAddr[0],
+ pTemp->peerMacAddr[1],
+ pTemp->peerMacAddr[2],
+ pTemp->peerMacAddr[3],
+ pTemp->peerMacAddr[4],
+ pTemp->peerMacAddr[5]);
+ p += log_sprintf( pMac,p, " %d %d,%d %d %d %04X %d,%d\n",
+ pTemp->aniIndicator,
+ pTemp->edcaPresent, pTemp->wmeEdcaPresent,
+ pTemp->wmeInfoPresent,
+ pTemp->htCapable,
+ pTemp->capabilityInfo,
+ pTemp->supportedRates.numRates,
+ pTemp->extendedRates.numRates);
+ pTemp = pTemp->next;
+ }
+ }
+ }
+#else
+ p += log_sprintf( pMac,p, "Measurements enabled = %d\n",
+ pMac->sys.gSysEnableLearnMode);
+ p += log_sprintf( pMac,p, "Scan Mode for Learn Mode enable = %d\n",
+ pMac->lim.gLimUseScanModeForLearnMode);
+#endif
+ p += log_sprintf( pMac,p, "System Scan/Learn Mode bit = %d\n",
+ pMac->lim.gLimSystemInScanLearnMode);
+ p += log_sprintf( pMac,p, "Scan override = %d\n",
+ pMac->lim.gLimScanOverride);
+ p += log_sprintf( pMac,p, "CB State protection = %d\n",
+ pMac->lim.gLimCBStateProtection);
+ p += log_sprintf( pMac,p, "Count of Titan STA's = %d\n",
+ pMac->lim.gLimTitanStaCount);
+
+ //current BSS capability
+ p += log_sprintf( pMac,p, "**********Current BSS Capability********\n");
+ p += log_sprintf( pMac,p, "Ess = %d, ", SIR_MAC_GET_ESS(pMac->lim.gLimCurrentBssCaps));
+ p += log_sprintf( pMac,p, "Privacy = %d, ", SIR_MAC_GET_PRIVACY(pMac->lim.gLimCurrentBssCaps));
+ p += log_sprintf( pMac,p, "Short Preamble = %d, ", SIR_MAC_GET_SHORT_PREAMBLE(pMac->lim.gLimCurrentBssCaps));
+ p += log_sprintf( pMac,p, "Short Slot = %d, ", SIR_MAC_GET_SHORT_SLOT_TIME(pMac->lim.gLimCurrentBssCaps));
+ p += log_sprintf( pMac,p, "Qos = %d\n", SIR_MAC_GET_QOS(pMac->lim.gLimCurrentBssCaps));
+
+ //Protection related information
+ p += log_sprintf( pMac,p, "*****Protection related information******\n");
+ p += log_sprintf( pMac,p, "Protection %s\n", pMac->lim.gLimProtectionControl ? "Enabled" : "Disabled");
+
+ p += log_sprintf( pMac,p, "OBSS MODE = %d\n", pMac->lim.gHTObssMode);
+#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+
+ p += log_sprintf( pMac,p, "\nNumber of active OLBC detected = %d\n",
+ pMac->lim.gLimOlbcParams.numSta);
+ if (pMac->lim.gLimOlbcParams.protectionEnabled)
+ p += log_sprintf( pMac,p, "Protection due to OLBC is ON\n");
+ else
+ p += log_sprintf( pMac,p, "Protection due to OLBC is OFF\n");
+
+ p += log_sprintf( pMac,p, "Content of OLBC cache: \n");
+ for (i=0; i<LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
+ {
+ if (pMac->lim.protStaOverlapCache[i].active)
+ {
+ p = dumpMacAddr(pMac, p, pMac->lim.protStaOverlapCache[i].addr);
+ p += log_sprintf( pMac,p, "\n");
+ }
+ }
+
+ p += log_sprintf( pMac,p, "Content of Protection cache: \n");
+ for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
+ {
+ if (pMac->lim.protStaCache[i].active)
+ {
+ p = dumpMacAddr(pMac, p, pMac->lim.protStaCache[i].addr);
+ if(pMac->lim.protStaCache[i].protStaCacheType == eLIM_PROT_STA_CACHE_TYPE_HT20)
+ p += log_sprintf( pMac,p, " Type: HT20\n");
+ else if(pMac->lim.protStaCache[i].protStaCacheType == eLIM_PROT_STA_CACHE_TYPE_llB)
+ p += log_sprintf( pMac,p, " Type: 11B\n");
+ else if(pMac->lim.protStaCache[i].protStaCacheType == eLIM_PROT_STA_CACHE_TYPE_llG)
+ p += log_sprintf( pMac,p, " Type: 11G\n");
+
+ p += log_sprintf( pMac,p, "\n");
+ }
+ }
+ p += log_sprintf( pMac,p, "Count of different type sta associated\n");
+ p += log_sprintf( pMac,p, "11B = %d, Protection: %d\n", pMac->lim.gLim11bParams.numSta, pMac->lim.gLim11bParams.protectionEnabled);
+ p += log_sprintf( pMac,p, "11G = %d, Protection: %d\n", pMac->lim.gLim11gParams.numSta, pMac->lim.gLim11gParams.protectionEnabled);
+ p += log_sprintf( pMac,p, "nonGF = %d, Protection: %d\n", pMac->lim.gLimNonGfParams.numSta, pMac->lim.gLimNonGfParams.protectionEnabled);
+ p += log_sprintf( pMac,p, "!LsigTxop = %d, Protection: %d\n", pMac->lim.gLimLsigTxopParams.numSta, pMac->lim.gLimLsigTxopParams.protectionEnabled);
+ p += log_sprintf( pMac,p, "ht20 = %d Protection: %d\n", pMac->lim.gLimHt20Params.numSta, pMac->lim.gLimHt20Params.protectionEnabled);
+
+ p += log_sprintf( pMac,p, "\nNumber of STA do not support short preamble = %d\n",
+ pMac->lim.gLimNoShortParams.numNonShortPreambleSta);
+ for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
+ {
+ if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
+ {
+ p = dumpMacAddr(pMac, p, pMac->lim.gLimNoShortParams.staNoShortCache[i].addr);
+ p += log_sprintf( pMac,p, "\n");
+ }
+ }
+
+ p += log_sprintf( pMac,p, "\nNumber of STA do not support short slot time = %d\n",
+ pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
+ for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
+ {
+ if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
+ {
+ p = dumpMacAddr(pMac, p, pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr);
+ p += log_sprintf( pMac,p, "\n");
+ }
+ }
+
+
+#endif
+ p += log_sprintf( pMac, p, "HT operating Mode = %d, llbCoexist = %d, llgCoexist = %d, ht20Coexist = %d, nonGfPresent = %d, RifsMode = %d, lsigTxop = %d\n",
+ pMac->lim.gHTOperMode, pMac->lim.llbCoexist, pMac->lim.llgCoexist,
+ pMac->lim.ht20MhzCoexist, pMac->lim.gHTNonGFDevicesPresent,
+ pMac->lim.gHTRifsMode, pMac->lim.gHTLSigTXOPFullSupport);
+
+ p += log_sprintf(pMac, p, "2nd Channel offset = %d\n",
+ pMac->lim.gHTSecondaryChannelOffset);
+#endif
+ return p;
+}
+
+/*******************************************
+ * FUNCTION: triggerBeaconGen()
+ *
+ * This logdump sends SIR_SCH_BEACON_GEN_IND to SCH.
+ * SCH then proceeds to generate a beacon template
+ * and copy it to the Host/SoftMAC shared memory
+ *
+ * TODO - This routine can safely be deleted once
+ * beacon generation is working
+ ******************************************/
+char *triggerBeaconGen( tpAniSirGlobal pMac, char *p )
+{
+ tSirMsgQ mesg = { (tANI_U16) SIR_LIM_BEACON_GEN_IND, (tANI_U16) 0, (tANI_U32) 0 };
+
+ pMac->lim.gLimSmeState = eLIM_SME_NORMAL_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+ pMac->lim.gLimSystemRole = eLIM_AP_ROLE;
+
+ p += log_sprintf( pMac, p,
+ "Posted SIR_LIM_BEACON_GEN_IND with result = %s\n",
+ (eSIR_SUCCESS == limPostMsgApi( pMac, &mesg ))?
+ "Success": "Failure" );
+
+ return p;
+}
+
+
+/*******************************************
+ * FUNCTION: testLimSendProbeRsp()
+ *
+ * This logdump sends SIR_MAC_MGMT_PROBE_RSP
+ *
+ * TODO - This routine can safely be deleted once
+ * the MGMT frame transmission is working
+ ******************************************/
+char *testLimSendProbeRsp( tpAniSirGlobal pMac, char *p )
+{
+ tSirMacAddr peerMacAddr = { 0, 1, 2, 3, 4, 5 };
+ tAniSSID ssId;
+ tANI_U32 len = SIR_MAC_MAX_SSID_LENGTH;
+ tpPESession psessionEntry = &pMac->lim.gpSession[0]; //TBD-RAJESH HOW TO GET sessionEntry?????
+
+
+ if( eSIR_SUCCESS != wlan_cfgGetStr( pMac,
+ WNI_CFG_SSID,
+ (tANI_U8 *) &ssId.ssId,
+ (tANI_U32 *) &len ))
+ {
+ // Could not get SSID from CFG. Log error.
+ p += log_sprintf( pMac, p, "Unable to retrieve SSID\n" );
+ return p;
+ }
+ else
+ ssId.length = (tANI_U8) len;
+
+ p += log_sprintf( pMac, p, "Calling limSendProbeRspMgmtFrame...\n" );
+ limSendProbeRspMgmtFrame( pMac, peerMacAddr, &ssId, -1, 1, psessionEntry , 0);
+
+ return p;
+}
+
+
+static char *sendSmeScanReq(tpAniSirGlobal pMac, char *p)
+{
+ tSirMsgQ msg;
+ tSirSmeScanReq scanReq, *pScanReq;
+
+ p += log_sprintf( pMac,p, "sendSmeScanReq: Preparing eWNI_SME_SCAN_REQ message\n");
+
+ pScanReq = (tSirSmeScanReq *) &scanReq;
+
+ if (palAllocateMemory(pMac->hHdd, (void **)&pScanReq, sizeof(tSirSmeScanReq)) != eHAL_STATUS_SUCCESS)
+ {
+ p += log_sprintf( pMac,p,"sendSmeScanReq: palAllocateMemory() failed \n");
+ return p;
+ }
+
+ pScanReq->messageType = eWNI_SME_SCAN_REQ;
+ pScanReq->minChannelTime = 30;
+ pScanReq->maxChannelTime = 130;
+ pScanReq->bssType = eSIR_INFRASTRUCTURE_MODE;
+ limGetMyMacAddr(pMac, pScanReq->bssId);
+ pScanReq->numSsid = 1;
+ palCopyMemory(pMac->hHdd, (void *) &pScanReq->ssId[0].ssId, (void *)"Ivan", 4);
+ pScanReq->ssId[0].length = 4;
+ pScanReq->scanType = eSIR_ACTIVE_SCAN;
+ pScanReq->returnAfterFirstMatch = 0;
+ pScanReq->returnUniqueResults = 0;
+ pScanReq->returnFreshResults = SIR_BG_SCAN_PURGE_RESUTLS|SIR_BG_SCAN_RETURN_FRESH_RESULTS;
+ pScanReq->channelList.numChannels = 1;
+ pScanReq->channelList.channelNumber[0] = 6;
+ pScanReq->uIEFieldLen = 0;
+ pScanReq->uIEFieldOffset = sizeof(tSirSmeScanReq);
+ pScanReq->sessionId = 0;
+
+ msg.type = eWNI_SME_SCAN_REQ;
+ msg.bodyptr = pScanReq;
+ msg.bodyval = 0;
+ p += log_sprintf( pMac,p, "sendSmeScanReq: limPostMsgApi(eWNI_SME_SCAN_REQ) \n");
+ limPostMsgApi(pMac, &msg);
+
+ return p;
+}
+
+static char *sendSmeDisAssocReq(tpAniSirGlobal pMac, char *p,tANI_U32 arg1 ,tANI_U32 arg2)
+{
+
+ tpDphHashNode pStaDs;
+ tSirMsgQ msg;
+ tSirSmeDisassocReq *pDisAssocReq;
+ tpPESession psessionEntry;
+
+ //arg1 - assocId
+ //arg2 - sessionId
+ if( arg1 < 1 )
+ {
+ p += log_sprintf( pMac,p,"Invalid session OR Assoc ID \n");
+ return p;
+ }
+
+ if((psessionEntry = peFindSessionBySessionId(pMac,(tANI_U8)arg2) )== NULL)
+ {
+ p += log_sprintf( pMac,p,"Session does not exist for given session Id \n");
+ return p;
+ }
+
+ pStaDs = dphGetHashEntry(pMac, (tANI_U16)arg1, &psessionEntry->dph.dphHashTable);
+
+ if(NULL == pStaDs)
+ {
+ p += log_sprintf( pMac,p, "Could not find station with assocId = %d\n", arg1);
+ return p;
+ }
+
+ if (palAllocateMemory(pMac->hHdd, (void **)&pDisAssocReq, sizeof(tSirSmeDisassocReq)) != eHAL_STATUS_SUCCESS)
+ {
+ p += log_sprintf( pMac,p,"sendSmeDisAssocReq: palAllocateMemory() failed \n");
+ return p;
+ }
+
+ if( ( (psessionEntry->limSystemRole == eLIM_STA_ROLE) ||
+ (psessionEntry ->limSystemRole == eLIM_BT_AMP_STA_ROLE) ) &&
+ (psessionEntry->statypeForBss == STA_ENTRY_PEER))
+ {
+ sirCopyMacAddr(pDisAssocReq->bssId,psessionEntry->bssId);
+ sirCopyMacAddr(pDisAssocReq->peerMacAddr,psessionEntry->bssId);
+ }
+ if((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
+#ifdef WLAN_SOFTAP_FEATURE
+ || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
+#endif
+ )
+ {
+ sirCopyMacAddr(pDisAssocReq->peerMacAddr,pStaDs->staAddr);
+ sirCopyMacAddr(pDisAssocReq->bssId,psessionEntry->bssId);
+ }
+
+ pDisAssocReq->messageType = eWNI_SME_DISASSOC_REQ;
+
+ pDisAssocReq->length = sizeof(tSirSmeDisassocReq);
+
+ pDisAssocReq->reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
+
+ pDisAssocReq->sessionId = 0;
+
+ pDisAssocReq->transactionId = 0;
+
+ msg.type = eWNI_SME_DISASSOC_REQ;
+ msg.bodyptr = pDisAssocReq;
+ msg.bodyval = 0;
+
+ p += log_sprintf( pMac,p, "sendSmeDisAssocReq: limPostMsgApi(eWNI_SME_DISASSOC_REQ) \n");
+ limPostMsgApi(pMac, &msg);
+
+ return p;
+}
+
+
+static char *sendSmeStartBssReq(tpAniSirGlobal pMac, char *p,tANI_U32 arg1)
+{
+ tSirMsgQ msg;
+ tSirSmeStartBssReq *pStartBssReq;
+ unsigned char *pBuf;
+ tAniCBSecondaryMode cbMode;
+ tSirNwType nwType;
+
+ p += log_sprintf( pMac,p, "sendSmeStartBssReq: Preparing eWNI_SME_START_BSS_REQ message\n");
+
+ if(arg1 > 2)
+ {
+ p += log_sprintf( pMac,p,"Invalid Argument1 \n");
+ return p;
+ }
+
+ if (palAllocateMemory(pMac->hHdd, (void **)&pStartBssReq, sizeof(tSirSmeStartBssReq)) != eHAL_STATUS_SUCCESS)
+ {
+ p += log_sprintf( pMac,p,"sendSmeStartBssReq: palAllocateMemory() failed \n");
+ return p;
+ }
+
+ pStartBssReq->messageType = eWNI_SME_START_BSS_REQ;
+ pStartBssReq->length = 29; // 0x1d
+
+ if(arg1 == 0) //BTAMP STATION
+ {
+ pStartBssReq->bssType = eSIR_BTAMP_STA_MODE;
+
+ pStartBssReq->ssId.length = 5;
+ palCopyMemory(pMac->hHdd, (void *) &pStartBssReq->ssId.ssId, (void *)"BTSTA", 5);
+ }
+ else if(arg1 == 1) //BTAMP AP
+ {
+ pStartBssReq->bssType = eSIR_BTAMP_AP_MODE;
+ pStartBssReq->ssId.length = 4;
+ palCopyMemory(pMac->hHdd, (void *) &pStartBssReq->ssId.ssId, (void *)"BTAP", 4);
+ }
+ else //IBSS
+ {
+ pStartBssReq->bssType = eSIR_IBSS_MODE;
+ pStartBssReq->ssId.length = 4;
+ palCopyMemory(pMac->hHdd, (void *) &pStartBssReq->ssId.ssId, (void *)"Ibss", 4);
+ }
+
+ // Filling in channel ID 6
+ pBuf = &(pStartBssReq->ssId.ssId[pStartBssReq->ssId.length]);
+ *pBuf = 6;
+ pBuf++;
+
+ // Filling in CB mode
+ cbMode = eANI_CB_SECONDARY_NONE;
+ palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&cbMode, sizeof(tAniCBSecondaryMode) );
+ pBuf += sizeof(tAniCBSecondaryMode);
+
+ // Filling in RSN IE Length to zero
+ palZeroMemory( pMac->hHdd, pBuf, sizeof(tANI_U16) ); //tSirRSNie->length
+ pBuf += sizeof(tANI_U16);
+
+ // Filling in NW Type
+ nwType = eSIR_11G_NW_TYPE;
+ palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&nwType, sizeof(tSirNwType) );
+ pBuf += sizeof(tSirNwType);
+
+ /* ---- To be filled by LIM later ----
+ pStartBssReq->operationalRateSet
+ pStartBssReq->extendedRateSet
+ pStartBssReq->dot11mode
+ pStartBssReq->bssId
+ pStartBssReq->selfMacAddr
+ pStartBssReq->beaconInterval
+ pStartBssReq->sessionId = 0;
+ pStartBssReq->transactionId = 0;
+ * ------------------------------------ */
+
+ msg.type = eWNI_SME_START_BSS_REQ;
+ msg.bodyptr = pStartBssReq;
+ msg.bodyval = 0;
+ p += log_sprintf( pMac,p, "sendSmeStartBssReq: limPostMsgApi(eWNI_SME_START_BSS_REQ) \n");
+ limPostMsgApi(pMac, &msg);
+
+ return p;
+}
+
+static char *sendSmeStopBssReq(tpAniSirGlobal pMac, char *p, tANI_U32 sessionId)
+{
+ tSirMsgQ msg;
+ tSirSmeStopBssReq stopBssReq, *pStopBssReq;
+ tANI_U16 msgLen = 0;
+ tpPESession psessionEntry;
+
+ psessionEntry = peFindSessionBySessionId(pMac, (tANI_U8)sessionId);
+ if ( psessionEntry == NULL )
+ {
+ limLog(pMac, LOGP, FL("Session entry does not exist for given sessionID \n"));
+ return p;
+ }
+
+ p += log_sprintf( pMac,p, "sendSmeStopBssReq: Preparing eWNI_SME_STOP_BSS_REQ message\n");
+ pStopBssReq = (tSirSmeStopBssReq *) &stopBssReq;
+
+ if (palAllocateMemory(pMac->hHdd, (void **)&pStopBssReq, sizeof(tSirSmeStopBssReq)) != eHAL_STATUS_SUCCESS)
+ {
+ p += log_sprintf( pMac,p,"sendSmeStopBssReq: palAllocateMemory() failed \n");
+ return p;
+ }
+
+ pStopBssReq->messageType = eWNI_SME_STOP_BSS_REQ;
+ msgLen += sizeof(tANI_U32); // msgType + length
+
+ pStopBssReq->reasonCode = eSIR_SME_SUCCESS;
+ msgLen += sizeof(tSirResultCodes);
+
+ palCopyMemory(pMac->hHdd, (void *) &pStopBssReq->bssId, (void *)psessionEntry->bssId, 6);
+ msgLen += sizeof(tSirMacAddr);
+
+ pStopBssReq->sessionId = (tANI_U8)sessionId;
+ msgLen += sizeof(tANI_U8);
+
+ pStopBssReq->transactionId = 0;
+ msgLen += sizeof(tANI_U16);
+
+ pStopBssReq->length = msgLen;
+
+ msg.type = eWNI_SME_STOP_BSS_REQ;
+ msg.bodyptr = pStopBssReq;
+ msg.bodyval = 0;
+ p += log_sprintf( pMac,p, "sendSmeStopBssReq: limPostMsgApi(eWNI_SME_STOP_BSS_REQ) \n");
+ limPostMsgApi(pMac, &msg);
+
+ return p;
+}
+
+static char *sendSmeJoinReq(tpAniSirGlobal pMac, char *p)
+{
+ tSirMsgQ msg;
+ tSirSmeJoinReq *pJoinReq;
+ unsigned char *pBuf;
+ tANI_U16 msgLen = 307;
+
+ tANI_U8 msgDump[307] = {
+ 0x06, 0x12, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00,
+ 0xDE, 0xAD, 0xBA, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x64, 0x00, 0x21, 0x04, 0x02, 0x00, 0x00,
+ 0x00, 0x01, 0x1E, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x18,
+ 0x00, 0x00, 0x00, 0xA8, 0x85, 0x4F, 0x7A, 0x00, 0x06, 0x41,
+ 0x6E, 0x69, 0x4E, 0x65, 0x74, 0x01, 0x04, 0x82, 0x84, 0x8B,
+ 0x96, 0x03, 0x01, 0x06, 0x07, 0x06, 0x55, 0x53, 0x49, 0x01,
+ 0x0E, 0x1E, 0x2A, 0x01, 0x00, 0x32, 0x08, 0x0C, 0x12, 0x18,
+ 0x24, 0x30, 0x48, 0x60, 0x6C, 0x2D, 0x1A, 0xEE, 0x11, 0x03,
+ 0xFF, 0xFF, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x3D, 0x16, 0x06, 0x07, 0x11, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDD, 0x18, 0x00,
+ 0x50, 0xF2, 0x02, 0x01, 0x01, 0x01, 0x00, 0x03, 0xA4, 0x00,
+ 0x00, 0x27, 0xA4, 0x00, 0x00, 0x42, 0x43, 0x5E, 0x00, 0x62,
+ 0x32, 0x2F, 0x00, 0xDD, 0x14, 0x00, 0x0A, 0xF5, 0x00, 0x03,
+ 0x01, 0x03, 0x05, 0x0A, 0x02, 0x80, 0xC0, 0x12, 0x06, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xB6, 0x0D, 0xDD, 0x6E, 0x00, 0x50, 0xF2,
+ 0x04, 0x10, 0x4A, 0x00, 0x01, 0x10, 0x10, 0x44, 0x00, 0x01,
+ 0x01, 0x10, 0x3B, 0x00, 0x01, 0x03, 0x10, 0x47, 0x00, 0x10,
+ 0xDB, 0xC6, 0x77, 0x28, 0xB9, 0xF3, 0xD8, 0x58, 0x86, 0xFF,
+ 0xFC, 0x6B, 0xB6, 0xB9, 0x27, 0x79, 0x10, 0x21, 0x00, 0x08,
+ 0x51, 0x75, 0x61, 0x6C, 0x63, 0x6F, 0x6D, 0x6D, 0x10, 0x23,
+ 0x00, 0x07, 0x57, 0x46, 0x52, 0x34, 0x30, 0x33, 0x31, 0x10,
+ 0x24, 0x00, 0x06, 0x4D, 0x4E, 0x31, 0x32, 0x33, 0x34, 0x10,
+ 0x42, 0x00, 0x06, 0x53, 0x4E, 0x31, 0x32, 0x33, 0x34, 0x10,
+ 0x54, 0x00, 0x08, 0x00, 0x06, 0x00, 0x50, 0xF2, 0x04, 0x00,
+ 0x01, 0x10, 0x11, 0x00, 0x06, 0x31, 0x31, 0x6E, 0x2D, 0x41,
+ 0x50, 0x10, 0x08, 0x00, 0x02, 0x01, 0x8E
+ };
+
+ if (palAllocateMemory(pMac->hHdd, (void **)&pJoinReq, msgLen) != eHAL_STATUS_SUCCESS)
+ {
+ p += log_sprintf( pMac,p,"sendSmeJoinReq: palAllocateMemory() failed \n");
+ return p;
+ }
+
+ pBuf = (unsigned char *)pJoinReq;
+ palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)msgDump, msgLen );
+
+ msg.type = eWNI_SME_JOIN_REQ;
+ msg.bodyptr = pJoinReq;
+ msg.bodyval = 0;
+ limPostMsgApi(pMac, &msg);
+
+ return p;
+}
+
+
+static char *printSessionInfo(tpAniSirGlobal pMac, char *p)
+{
+ tpPESession psessionEntry = &pMac->lim.gpSession[0];
+ tANI_U8 i;
+
+ p += log_sprintf( pMac, p, "Dump PE Session \n");
+
+ for(i=0; i < pMac->lim.maxBssId; i++)
+ {
+ if( pMac->lim.gpSession[i].valid )
+ {
+ psessionEntry = &pMac->lim.gpSession[i];
+ p += log_sprintf( pMac,p, "*****************************************\n");
+ p += log_sprintf( pMac,p, " PE Session [%d] \n", i);
+ p += log_sprintf( pMac,p, "available: %d \n", psessionEntry->available);
+ p += log_sprintf( pMac,p, "peSessionId: %d, smeSessionId: %d, transactionId: %d \n",
+ psessionEntry->peSessionId, psessionEntry->smeSessionId, psessionEntry->smeSessionId);
+ p += log_sprintf( pMac,p, "bssId: %02X:%02X:%02X:%02X:%02X:%02X \n",
+ psessionEntry->bssId[0], psessionEntry->bssId[1], psessionEntry->bssId[2],
+ psessionEntry->bssId[3], psessionEntry->bssId[4], psessionEntry->bssId[5]);
+ p += log_sprintf( pMac,p, "selfMacAddr: %02X:%02X:%02X:%02X:%02X:%02X \n",
+ psessionEntry->selfMacAddr[0], psessionEntry->selfMacAddr[1], psessionEntry->selfMacAddr[2],
+ psessionEntry->selfMacAddr[3], psessionEntry->selfMacAddr[4], psessionEntry->selfMacAddr[5]);
+ p += log_sprintf( pMac,p, "bssIdx: %d \n", psessionEntry->bssIdx);
+ p += log_sprintf( pMac,p, "valid: %d \n", psessionEntry->valid);
+ p += log_sprintf( pMac,p, "limMlmState: (%d) %s ", psessionEntry->limMlmState, limMlmStateStr(psessionEntry->limMlmState) );
+ p += log_sprintf( pMac,p, "limPrevMlmState: (%d) %s ", psessionEntry->limPrevMlmState, limMlmStateStr(psessionEntry->limMlmState) );
+ p += log_sprintf( pMac,p, "limSmeState: (%d) %s ", psessionEntry->limSmeState, limSmeStateStr(psessionEntry->limSmeState) );
+ p += log_sprintf( pMac,p, "limPrevSmeState: (%d) %s ", psessionEntry->limPrevSmeState, limSmeStateStr(psessionEntry->limPrevSmeState) );
+ p += log_sprintf( pMac,p, "limSystemRole: (%d) %s \n", psessionEntry->limSystemRole, getRole(psessionEntry->limSystemRole) );
+ p += log_sprintf( pMac,p, "bssType: (%d) %s \n", psessionEntry->bssType, limBssTypeStr(psessionEntry->bssType));
+ p += log_sprintf( pMac,p, "operMode: %d \n", psessionEntry->operMode);
+ p += log_sprintf( pMac,p, "dot11mode: %d \n", psessionEntry->dot11mode);
+ p += log_sprintf( pMac,p, "htCapabality: %d \n", psessionEntry->htCapabality);
+ p += log_sprintf( pMac,p, "limRFBand: %d \n", psessionEntry->limRFBand);
+ p += log_sprintf( pMac,p, "limIbssActive: %d \n", psessionEntry->limIbssActive);
+ p += log_sprintf( pMac,p, "limCurrentAuthType: %d \n", psessionEntry->limCurrentAuthType);
+ p += log_sprintf( pMac,p, "limCurrentBssCaps: %d \n", psessionEntry->limCurrentBssCaps);
+ p += log_sprintf( pMac,p, "limCurrentBssQosCaps: %d \n", psessionEntry->limCurrentBssQosCaps);
+ p += log_sprintf( pMac,p, "limCurrentBssPropCap: %d \n", psessionEntry->limCurrentBssPropCap);
+ p += log_sprintf( pMac,p, "limSentCapsChangeNtf: %d \n", psessionEntry->limSentCapsChangeNtf);
+ p += log_sprintf( pMac,p, "LimAID: %d \n", psessionEntry->limAID);
+ p += log_sprintf( pMac,p, "ReassocbssId: %02X:%02X:%02X:%02X:%02X:%02X \n",
+ psessionEntry->limReAssocbssId[0], psessionEntry->limReAssocbssId[1], psessionEntry->limReAssocbssId[2],
+ psessionEntry->limReAssocbssId[3], psessionEntry->limReAssocbssId[4], psessionEntry->limReAssocbssId[5]);
+ p += log_sprintf( pMac,p, "limReassocChannelId: %d \n", psessionEntry->limReassocChannelId);
+ p += log_sprintf( pMac,p, "limReassocBssCaps: %d \n", psessionEntry->limReassocBssCaps);
+ p += log_sprintf( pMac,p, "limReassocBssQosCaps: %d \n", psessionEntry->limReassocBssQosCaps);
+ p += log_sprintf( pMac,p, "limReassocBssPropCap: %d \n", psessionEntry->limReassocBssPropCap);
+ p += log_sprintf( pMac,p, "limReassocTitanHtCaps: %d \n", psessionEntry->limReassocTitanHtCaps);
+ p += log_sprintf( pMac,p, "********************************************\n");
+ }
+ }
+ return p;
+}
+
+void
+limSetEdcaBcastACMFlag(tpAniSirGlobal pMac, tANI_U32 ac, tANI_U32 acmFlag)
+{
+ tpPESession psessionEntry = &pMac->lim.gpSession[0]; //TBD-RAJESH HOW TO GET sessionEntry?????
+ psessionEntry->gLimEdcaParamsBC[ac].aci.acm = (tANI_U8)acmFlag;
+ psessionEntry->gLimEdcaParamSetCount++;
+ schSetFixedBeaconFields(pMac,psessionEntry);
+}
+
+static char *
+limDumpEdcaParams(tpAniSirGlobal pMac, char *p)
+{
+ tANI_U8 i = 0;
+ tpPESession psessionEntry = &pMac->lim.gpSession[0]; //TBD-RAJESH HOW TO GET sessionEntry?????
+ p += log_sprintf( pMac,p, "EDCA parameter set count = %d\n", psessionEntry->gLimEdcaParamSetCount);
+ p += log_sprintf( pMac,p, "Broadcast parameters\n");
+ p += log_sprintf( pMac,p, "AC\tACI\tACM\tAIFSN\tCWMax\tCWMin\tTxopLimit\t\n");
+ for(i = 0; i < MAX_NUM_AC; i++)
+ {
+ //right now I am just interested in ACM bit. this can be extended for all other EDCA paramters.
+ p += log_sprintf( pMac,p, "%d\t%d\t%d\t%d\t%d\t%d\t%d\n", i,
+ psessionEntry->gLimEdcaParamsBC[i].aci.aci, psessionEntry->gLimEdcaParamsBC[i].aci.acm,
+ psessionEntry->gLimEdcaParamsBC[i].aci.aifsn, psessionEntry->gLimEdcaParamsBC[i].cw.max,
+ psessionEntry->gLimEdcaParamsBC[i].cw.min, psessionEntry->gLimEdcaParamsBC[i].txoplimit);
+ }
+
+ p += log_sprintf( pMac,p, "\nLocal parameters\n");
+ p += log_sprintf( pMac,p, "AC\tACI\tACM\tAIFSN\tCWMax\tCWMin\tTxopLimit\t\n");
+ for(i = 0; i < MAX_NUM_AC; i++)
+ {
+ //right now I am just interested in ACM bit. this can be extended for all other EDCA paramters.
+ p += log_sprintf( pMac,p, "%d\t%d\t%d\t%d\t%d\t%d\t%d\n", i,
+ psessionEntry->gLimEdcaParams[i].aci.aci, psessionEntry->gLimEdcaParams[i].aci.acm,
+ psessionEntry->gLimEdcaParams[i].aci.aifsn, psessionEntry->gLimEdcaParams[i].cw.max,
+ psessionEntry->gLimEdcaParams[i].cw.min, psessionEntry->gLimEdcaParams[i].txoplimit);
+ }
+
+ return p;
+}
+
+
+static char* limDumpTspecEntry(tpAniSirGlobal pMac, char *p, tANI_U32 tspecEntryNo)
+{
+ tpLimTspecInfo pTspecList;
+ if(tspecEntryNo >= LIM_NUM_TSPEC_MAX)
+ {
+ p += log_sprintf( pMac,p, "Tspec Entry no. %d is out of allowed range(0 .. %d)\n",
+ tspecEntryNo, (LIM_NUM_TSPEC_MAX - 1));
+ return p;
+ }
+ pTspecList = &pMac->lim.tspecInfo[tspecEntryNo];
+ if (pTspecList->inuse)
+ p += log_sprintf( pMac,p, "Entry %d is VALID\n", tspecEntryNo);
+ else
+ {
+ p += log_sprintf( pMac,p, "Entry %d is UNUSED\n", tspecEntryNo);
+ return p;
+ }
+ p += log_sprintf( pMac,p, "\tSta %0x:%0x:%0x:%0x:%0x:%0x, AID %d, Index %d\n",
+ pTspecList->staAddr[0], pTspecList->staAddr[1],
+ pTspecList->staAddr[2], pTspecList->staAddr[3],
+ pTspecList->staAddr[4], pTspecList->staAddr[5],
+ pTspecList->assocId, pTspecList->idx);
+ p += log_sprintf( pMac,p, "\tType %d, Length %d, ackPolicy %d, userPrio %d, accessPolicy = %d, Dir %d, tsid %d\n",
+ pTspecList->tspec.type, pTspecList->tspec.length,
+ pTspecList->tspec.tsinfo.traffic.ackPolicy, pTspecList->tspec.tsinfo.traffic.userPrio,
+ pTspecList->tspec.tsinfo.traffic.accessPolicy, pTspecList->tspec.tsinfo.traffic.direction,
+ pTspecList->tspec.tsinfo.traffic.tsid);
+ p += log_sprintf( pMac,p, "\tPsb %d, Agg %d, TrafficType %d, schedule %d; msduSz: nom %d, max %d\n",
+ pTspecList->tspec.tsinfo.traffic.psb, pTspecList->tspec.tsinfo.traffic.aggregation,
+ pTspecList->tspec.tsinfo.traffic.trafficType, pTspecList->tspec.tsinfo.schedule.schedule,
+ pTspecList->tspec.nomMsduSz, pTspecList->tspec.maxMsduSz);
+ p += log_sprintf( pMac,p, "\tSvcInt: Min %d, Max %d; dataRate: Min %d, mean %d, peak %d\n",
+ pTspecList->tspec.minSvcInterval, pTspecList->tspec.maxSvcInterval,
+ pTspecList->tspec.minDataRate, pTspecList->tspec.meanDataRate,
+ pTspecList->tspec.peakDataRate);
+ p += log_sprintf( pMac,p, "\tmaxBurstSz %d, delayBound %d, minPhyRate %d, surplusBw %d, mediumTime %d\n",
+ pTspecList->tspec.maxBurstSz, pTspecList->tspec.delayBound,
+ pTspecList->tspec.minPhyRate, pTspecList->tspec.surplusBw,
+ pTspecList->tspec.mediumTime);
+
+ return p;
+}
+
+static char* dumpTspecTableSummary(tpAniSirGlobal pMac, tpLimTspecInfo pTspecList, char *p, int ctspec)
+{
+ p += log_sprintf( pMac, p, "%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n",
+ ctspec, pTspecList->idx, pTspecList->assocId,
+ pTspecList->tspec.tsinfo.traffic.ackPolicy, pTspecList->tspec.tsinfo.traffic.userPrio,
+ pTspecList->tspec.tsinfo.traffic.psb, pTspecList->tspec.tsinfo.traffic.aggregation,
+ pTspecList->tspec.tsinfo.traffic.accessPolicy, pTspecList->tspec.tsinfo.traffic.direction,
+ pTspecList->tspec.tsinfo.traffic.tsid, pTspecList->tspec.tsinfo.traffic.trafficType);
+
+ return p;
+}
+
+
+static char* limDumpDphTableSummary(tpAniSirGlobal pMac,char *p)
+{
+ tANI_U8 i, j;
+ p += log_sprintf( pMac,p, "DPH Table dump\n");
+
+ for(j=0; j < pMac->lim.maxBssId; j++)
+ {
+ /* Find first free room in session table */
+ if(pMac->lim.gpSession[j].valid)
+ {
+ p += log_sprintf( pMac,p, "aid staId bssid encPol qosMode wme 11e wsm staaddr\n");
+ for(i = 0; i < pMac->lim.gpSession[j].dph.dphHashTable.size; i++)
+ {
+ if (pMac->lim.gpSession[j].dph.dphHashTable.pDphNodeArray[i].added)
+ {
+ p += log_sprintf( pMac,p, "%d %d %d %d %d %d %d %d %x:%x:%x:%x:%x:%x\n",
+ pMac->lim.gpSession[j].dph.dphHashTable.pDphNodeArray[i].assocId,
+ pMac->lim.gpSession[j].dph.dphHashTable.pDphNodeArray[i].staIndex,
+ pMac->lim.gpSession[j].dph.dphHashTable.pDphNodeArray[i].bssId,
+ pMac->lim.gpSession[j].dph.dphHashTable.pDphNodeArray[i].encPolicy,
+ pMac->lim.gpSession[j].dph.dphHashTable.pDphNodeArray[i].qosMode,
+ pMac->lim.gpSession[j].dph.dphHashTable.pDphNodeArray[i].wmeEnabled,
+ pMac->lim.gpSession[j].dph.dphHashTable.pDphNodeArray[i].lleEnabled,
+ pMac->lim.gpSession[j].dph.dphHashTable.pDphNodeArray[i].wsmEnabled,
+ pMac->lim.gpSession[j].dph.dphHashTable.pDphNodeArray[i].staAuthenticated,
+ pMac->lim.gpSession[j].dph.dphHashTable.pDphNodeArray[i].staAddr[0],
+ pMac->lim.gpSession[j].dph.dphHashTable.pDphNodeArray[i].staAddr[1],
+ pMac->lim.gpSession[j].dph.dphHashTable.pDphNodeArray[i].staAddr[2],
+ pMac->lim.gpSession[j].dph.dphHashTable.pDphNodeArray[i].staAddr[3],
+ pMac->lim.gpSession[j].dph.dphHashTable.pDphNodeArray[i].staAddr[4],
+ pMac->lim.gpSession[j].dph.dphHashTable.pDphNodeArray[i].staAddr[5]);
+ }
+ }
+ }
+ }
+ return p;
+}
+
+// add the specified tspec to the tspec list
+static char* limDumpTsecTable( tpAniSirGlobal pMac, char* p)
+{
+ int ctspec;
+ tpLimTspecInfo pTspecList = &pMac->lim.tspecInfo[0];
+
+ p += log_sprintf( pMac,p, "=======LIM TSPEC TABLE DUMP\n");
+ p += log_sprintf( pMac,p, "Num\tIdx\tAID\tAckPol\tUP\tPSB\tAgg\tAccessPol\tDir\tTSID\ttraffic\n");
+
+ for (ctspec = 0; ctspec < LIM_NUM_TSPEC_MAX; ctspec++, pTspecList++)
+ {
+ if (pTspecList->inuse)
+ p = dumpTspecTableSummary(pMac, pTspecList, p, ctspec);
+ }
+ return p;
+}
+
+static char *
+dump_lim_tspec_table( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+ p = limDumpTsecTable(pMac, p);
+ return p;
+}
+
+static char *
+dump_lim_tspec_entry( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg2; (void) arg3; (void) arg4;
+ p = limDumpTspecEntry(pMac, p, arg1);
+ return p;
+}
+
+static char *
+dump_lim_dph_table_summary( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg2; (void) arg3; (void) arg4;
+ p = limDumpDphTableSummary(pMac, p);
+ return p;
+}
+
+
+static char *
+dump_lim_link_monitor_stats( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ tANI_U32 ind, val;
+
+ (void) arg2; (void) arg3; (void) arg4;
+ p += log_sprintf( pMac,p, "\n ----- LIM Heart Beat Stats ----- \n");
+ p += log_sprintf( pMac,p, "No. of HeartBeat Failures in LinkEst State = %d\n",
+ pMac->lim.gLimHBfailureCntInLinkEstState);
+ p += log_sprintf( pMac,p, "No. of Probe Failures after HB failed = %d\n",
+ pMac->lim.gLimProbeFailureAfterHBfailedCnt);
+ p += log_sprintf( pMac,p, "No. of HeartBeat Failures in Other States = %d\n",
+ pMac->lim.gLimHBfailureCntInOtherStates);
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val) == eSIR_SUCCESS)
+ p += log_sprintf( pMac,p, "Cfg HeartBeat Threshold = %d\n", val);
+
+ p += log_sprintf( pMac,p, "# Beacons Rcvd in HB interval # of times\n");
+
+ for (ind = 1; ind < MAX_NO_BEACONS_PER_HEART_BEAT_INTERVAL; ind++)
+ {
+ p += log_sprintf( pMac,p, "\t\t\t\t\t\t\t\t%2d\t\t\t\t\t\t\t\t\t\t\t%8d\n", ind,
+ pMac->lim.gLimHeartBeatBeaconStats[ind]);
+ }
+ p += log_sprintf( pMac,p, "\t\t\t\t\t\t\t\t%2d>\t\t\t\t\t\t\t\t\t\t%8d\n",
+ MAX_NO_BEACONS_PER_HEART_BEAT_INTERVAL-1,
+ pMac->lim.gLimHeartBeatBeaconStats[0]);
+
+ if (arg1 != 0)
+ {
+ for (ind = 0; ind < MAX_NO_BEACONS_PER_HEART_BEAT_INTERVAL; ind++)
+ pMac->lim.gLimHeartBeatBeaconStats[ind] = 0;
+
+ pMac->lim.gLimHBfailureCntInLinkEstState = 0;
+ pMac->lim.gLimProbeFailureAfterHBfailedCnt = 0;
+ pMac->lim.gLimHBfailureCntInOtherStates = 0;
+
+ p += log_sprintf( pMac,p, "\nReset HeartBeat Statistics\n");
+ }
+ return p;
+}
+
+static char *
+dump_lim_edca_params( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+ p = limDumpEdcaParams(pMac, p);
+ return p;
+}
+
+static char *
+dump_lim_acm_set( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg3; (void) arg4;
+ limSetEdcaBcastACMFlag(pMac, arg1 /*ac(0..3)*/, arg2 /*(acmFlag = 1 to set ACM*/);
+ return p;
+}
+
+static char *
+dump_lim_bgscan_toggle( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg2; (void) arg3; (void) arg4;
+ pMac->lim.gLimForceBackgroundScanDisable = (arg1 == 0) ? 1 : 0;
+ p += log_sprintf( pMac,p, "Bgnd scan is now %s\n",
+ (pMac->lim.gLimForceBackgroundScanDisable) ? "Disabled" : "On");
+ return p;
+}
+
+static char *
+dump_lim_linkmonitor_toggle( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg2; (void) arg3; (void) arg4;
+ pMac->sys.gSysEnableLinkMonitorMode = (arg1 == 0) ? 0 : 1;
+ p += log_sprintf( pMac,p, "LinkMonitor mode enable = %s\n",
+ (pMac->sys.gSysEnableLinkMonitorMode) ? "On" : "Off");
+ return p;
+}
+
+static char *
+dump_lim_proberesp_toggle( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg2; (void) arg3; (void) arg4;
+ pMac->lim.gLimProbeRespDisableFlag = (arg1 == 0) ? 0 : 1;
+ p += log_sprintf( pMac,p, "ProbeResponse mode disable = %s\n",
+ (pMac->lim.gLimProbeRespDisableFlag) ? "On" : "Off");
+ return p;
+}
+
+static char *
+dump_lim_add_sta( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+#ifdef FIXME_GEN6
+ tpDphHashNode pStaDs;
+ tpPESession psessionEntry = &pMac->lim.gpSession[0]; //TBD-RAJESH HOW TO GET sessionEntry?????
+ tSirMacAddr staMac = {0};
+ tANI_U16 aid;
+ if(arg2 > 5)
+ goto addStaFail;
+ aid = limAssignAID(pMac);
+ pStaDs = dphGetHashEntry(pMac, aid);
+ if(NULL == pStaDs)
+ {
+ staMac[5] = (tANI_U8) arg1;
+ pStaDs = dphAddHashEntry(pMac, staMac, aid, &psessionEntry->dph.dphHashTable);
+ if(NULL == pStaDs)
+ goto addStaFail;
+
+ pStaDs->staType = STA_ENTRY_PEER;
+ switch(arg2)
+ {
+ //11b station
+ case 0:
+ {
+ pStaDs->mlmStaContext.htCapability = 0;
+ pStaDs->erpEnabled = 0;
+ p += log_sprintf( pMac,p, "11b");
+ }
+ break;
+ //11g station
+ case 1:
+ {
+ pStaDs->mlmStaContext.htCapability = 0;
+ pStaDs->erpEnabled = 1;
+ p += log_sprintf( pMac,p, "11g");
+ }
+ break;
+ //ht20 station non-GF
+ case 2:
+ {
+ pStaDs->mlmStaContext.htCapability = 1;
+ pStaDs->erpEnabled = 1;
+ pStaDs->htSupportedChannelWidthSet = 0;
+ pStaDs->htGreenfield = 0;
+ p += log_sprintf( pMac,p, "HT20 non-GF");
+ }
+ break;
+ //ht20 station GF
+ case 3:
+ {
+ pStaDs->mlmStaContext.htCapability = 1;
+ pStaDs->erpEnabled = 1;
+ pStaDs->htSupportedChannelWidthSet = 0;
+ pStaDs->htGreenfield = 1;
+ p += log_sprintf( pMac,p, "HT20 GF");
+ }
+ break;
+ //ht40 station non-GF
+ case 4:
+ {
+ pStaDs->mlmStaContext.htCapability = 1;
+ pStaDs->erpEnabled = 1;
+ pStaDs->htSupportedChannelWidthSet = 1;
+ pStaDs->htGreenfield = 0;
+ p += log_sprintf( pMac,p, "HT40 non-GF");
+ }
+ break;
+ //ht40 station GF
+ case 5:
+ {
+ pStaDs->mlmStaContext.htCapability = 1;
+ pStaDs->erpEnabled = 1;
+ pStaDs->htSupportedChannelWidthSet = 1;
+ pStaDs->htGreenfield = 1;
+ p += log_sprintf( pMac,p, "HT40 GF");
+ }
+ break;
+ default:
+ {
+ p += log_sprintf( pMac,p, "arg2 not in range [0..3]. Station not added.\n");
+ goto addStaFail;
+ }
+ break;
+ }
+
+ pStaDs->added = 1;
+ p += log_sprintf( pMac,p, " station with mac address 00:00:00:00:00:%x added.\n", (tANI_U8)arg1);
+ limAddSta(pMac, pStaDs,psessionEntry);
+ }
+ else
+ {
+addStaFail:
+ p += log_sprintf( pMac,p, "Could not add station\n");
+ p += log_sprintf( pMac,p, "arg1: 6th byte of the station MAC address\n");
+ p += log_sprintf( pMac,p, "arg2[0..5] : station type as described below\n");
+ p += log_sprintf( pMac,p, "\t 0: 11b, 1: 11g, 2: HT20 non-GF, 3: HT20 GF, 4: HT40 non-GF, 5: HT40 GF\n");
+ }
+#endif
+ return p;
+}
+
+static char *
+dump_lim_del_sta( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+
+ tpDphHashNode pStaDs;
+ tLimMlmDisassocInd mlmDisassocInd;
+ tpPESession psessionEntry;
+ tANI_U8 reasonCode = eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON;
+
+ if((psessionEntry = peFindSessionBySessionId(pMac,(tANI_U8)arg2) )== NULL)
+ {
+ p += log_sprintf( pMac,p,"Session does not exist for given session Id \n");
+ return p;
+ }
+
+ pStaDs = dphGetHashEntry(pMac, (tANI_U16)arg1, &psessionEntry->dph.dphHashTable);
+
+ if(NULL == pStaDs)
+ {
+ p += log_sprintf( pMac,p, "Could not find station with assocId = %d\n", arg1);
+ return p;
+ }
+
+ if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)
+ {
+ p += log_sprintf( pMac,p, "received Disassoc frame from peer that is in state %X \n", pStaDs->mlmStaContext.mlmState);
+ return p;
+ }
+
+ pStaDs->mlmStaContext.cleanupTrigger = eLIM_PEER_ENTITY_DISASSOC;
+ pStaDs->mlmStaContext.disassocReason = (tSirMacReasonCodes) reasonCode;
+
+ // Issue Disassoc Indication to SME.
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDisassocInd.peerMacAddr,
+ (tANI_U8 *) pStaDs->staAddr, sizeof(tSirMacAddr));
+ mlmDisassocInd.reasonCode = reasonCode;
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ mlmDisassocInd.aid = pStaDs->assocId;
+#endif
+ mlmDisassocInd.disassocTrigger = eLIM_PEER_ENTITY_DISASSOC;
+
+ mlmDisassocInd.sessionId = psessionEntry->peSessionId;
+
+ limPostSmeMessage(pMac, LIM_MLM_DISASSOC_IND, (tANI_U32 *) &mlmDisassocInd);
+ // Receive path cleanup
+ limCleanupRxPath(pMac, pStaDs,psessionEntry);
+ return p;
+}
+
+
+
+
+static char *
+set_lim_prot_cfg( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+
+/**********************************
+* Protection Enable
+*
+*LOWER byte for associated stations
+*UPPER byte for overlapping stations.
+*11g ==> protection from 11g
+*11b ==> protection from 11b
+*each byte will have the following info
+*bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
+*reserved reserved RIFS Lsig n-GF ht20 11g 11b
+**********************************
+WNI_CFG_PROTECTION_ENABLED I 4 9
+V RW NP RESTART
+LIM
+0 0xff 0xff
+V RW NP RESTART
+LIM
+0 0xffff 0xffff
+
+#ENUM FROM_llB 0
+#ENUM FROM_llG 1
+#ENUM HT_20 2
+#ENUM NON_GF 3
+#ENUM LSIG_TXOP 4
+#ENUM RIFS 5
+#ENUM OLBC_FROM_llB 8
+#ENUM OLBC_FROM_llG 9
+#ENUM OLBC_HT20 10
+#ENUM OLBC_NON_GF 11
+#ENUM OLBC_LSIG_TXOP 12
+#ENUM OLBC_RIFS 13
+******************************************/
+ if(1 == arg1)
+ dump_cfg_set(pMac, WNI_CFG_PROTECTION_ENABLED, 0xff, arg3, arg4, p);
+ else if(2 == arg1)
+ dump_cfg_set(pMac, WNI_CFG_PROTECTION_ENABLED, arg2 & 0xff, arg3, arg4, p);
+ else
+ {
+ p += log_sprintf( pMac,p, "To set protection config:\n");
+ p += log_sprintf( pMac,p, "arg1: operation type(1 -> set to Default 0xff, 2-> set to a arg2, else print help)\n");
+ }
+ return p;
+}
+
+
+static char *
+dump_lim_set_protection_control( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ dump_cfg_set(pMac, WNI_CFG_FORCE_POLICY_PROTECTION, arg1, arg2, arg3, p);
+#ifdef WLAN_SOFTAP_FEATURE
+ limSetCfgProtection(pMac, NULL);
+#else
+ limSetCfgProtection(pMac);
+#endif
+ return p;
+}
+
+
+static char *
+dump_lim_send_SM_Power_Mode( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ tSirMsgQ msg;
+ tpSirMbMsg pMBMsg;
+ tSirMacHTMIMOPowerSaveState state;
+
+ p += log_sprintf( pMac,p, "%s: Verifying the Arguments\n", __FUNCTION__);
+ if ((arg1 > 3) || (arg1 == 2))
+ {
+ p += log_sprintf( pMac,p, "Invalid Argument , enter one of the valid states\n");
+ return p;
+ }
+
+ state = (tSirMacHTMIMOPowerSaveState) arg1;
+
+ palAllocateMemory(pMac->hHdd, (void **)&pMBMsg, WNI_CFG_MB_HDR_LEN + sizeof(tSirMacHTMIMOPowerSaveState));
+ if(NULL == pMBMsg)
+ {
+ p += log_sprintf( pMac,p, "pMBMsg is NULL\n");
+ return p;
+ }
+ pMBMsg->type = eWNI_PMC_SMPS_STATE_IND;
+ pMBMsg->msgLen = (tANI_U16)(WNI_CFG_MB_HDR_LEN + sizeof(tSirMacHTMIMOPowerSaveState));
+ palCopyMemory(pMac->hHdd, pMBMsg->data, &state, sizeof(tSirMacHTMIMOPowerSaveState));
+
+ msg.type = eWNI_PMC_SMPS_STATE_IND;
+ msg.bodyptr = pMBMsg;
+ msg.bodyval = 0;
+
+ if (limPostMsgApi(pMac, &msg) != TX_SUCCESS)
+ {
+ p += log_sprintf( pMac,p, "Updating the SMPower Request has failed \n");
+ palFreeMemory(pMac->hHdd, pMBMsg);
+ }
+ else
+ {
+ p += log_sprintf( pMac,p, "Updating the SMPower Request is Done \n");
+ }
+
+ return p;
+}
+
+
+
+
+static char *
+dump_lim_addba_req( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+tSirRetStatus status;
+tpDphHashNode pSta;
+ tpPESession psessionEntry = &pMac->lim.gpSession[0]; //TBD-RAJESH HOW TO GET sessionEntry?????
+
+
+ (void) arg4;
+
+ // Get DPH Sta entry for this ASSOC ID
+ pSta = dphGetHashEntry( pMac, (tANI_U16) arg1, &psessionEntry->dph.dphHashTable);
+ if( NULL == pSta )
+ {
+ p += log_sprintf( pMac, p,
+ "\n%s: Could not find entry in DPH table for assocId = %d\n",
+ __FUNCTION__,
+ arg1 );
+ }
+ else
+ {
+ status = limPostMlmAddBAReq( pMac, pSta, (tANI_U8) arg2, (tANI_U16) arg3,psessionEntry);
+ p += log_sprintf( pMac, p,
+ "\n%s: Attempted to send an ADDBA Req to STA Index %d, for TID %d. Send Status = %s\n",
+ __FUNCTION__,
+ pSta->staIndex,
+ arg2,
+ limResultCodeStr( status ));
+ }
+
+ return p;
+}
+
+static char *
+dump_lim_delba_req( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+tSirRetStatus status;
+tpDphHashNode pSta;
+ tpPESession psessionEntry = &pMac->lim.gpSession[0]; //TBD-RAJESH HOW TO GET sessionEntry?????
+
+ // Get DPH Sta entry for this ASSOC ID
+ pSta = dphGetHashEntry( pMac, (tANI_U16) arg1, &psessionEntry->dph.dphHashTable );
+ if( NULL == pSta )
+ {
+ p += log_sprintf( pMac, p,
+ "\n%s: Could not find entry in DPH table for assocId = %d\n",
+ __FUNCTION__,
+ arg1 );
+ }
+ else
+ {
+ status = limPostMlmDelBAReq( pMac, pSta, (tANI_U8) arg2, (tANI_U8) arg3, (tANI_U16) arg4 ,psessionEntry);
+ p += log_sprintf( pMac, p,
+ "\n%s: Attempted to send a DELBA Ind to STA Index %d, "
+ "as the BA \"%s\" for TID %d, with Reason code %d. "
+ "Send Status = %s\n",
+ __FUNCTION__,
+ pSta->staIndex,
+ (arg2 == 1)? "Initiator": "Recipient",
+ arg3, // TID
+ arg4, // Reason Code
+ limResultCodeStr( status ));
+ }
+
+ return p;
+}
+
+static char *
+dump_lim_ba_timeout( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+
+/* FIXME: NO HAL IN UMAC for PRIMA */
+#if !defined( FEATURE_WLAN_INTEGRATED_SOC )
+ // Call HAL API to trigger deletion of BA due to timeout
+ (void)halMsg_PostBADeleteInd( pMac, (tANI_U16) arg1, (tANI_U8) arg2, (tANI_U8) arg3,
+ HAL_BA_ERR_TIMEOUT );
+#endif
+
+ p += log_sprintf( pMac, p,
+ "\n%s: Attempted to trigger a BA Timeout Ind to STA Index %d, for TID %d, Direction %d\n",
+ __FUNCTION__,
+ arg1, // STA index
+ arg2, // TID
+ arg3 ); // BA Direction
+
+ return p;
+}
+
+static char *
+dump_lim_list_active_ba( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+tANI_U32 i;
+tpDphHashNode pSta;
+
+//TBD-RAJESH HOW TO GET sessionEntry?????
+
+tpPESession psessionEntry = &pMac->lim.gpSession[0]; //TBD-RAJESH
+
+ (void) arg2; (void) arg3; (void) arg4;
+
+ // Get DPH Sta entry for this ASSOC ID
+ pSta = dphGetHashEntry( pMac, (tANI_U16) arg1, &psessionEntry->dph.dphHashTable);
+ if( NULL == pSta )
+ {
+ p += log_sprintf( pMac, p,
+ "\n%s: Could not find entry in DPH table for assocId = %d\n",
+ __FUNCTION__,
+ arg1 );
+ }
+ else
+ {
+ p += log_sprintf( pMac, p,
+ "\nList of Active BA sessions for STA Index %d with Assoc ID %d\n",
+ pSta->staIndex,
+ arg1 );
+
+ p += log_sprintf( pMac, p, "TID\tRxBA\tTxBA\tRxBufferSize\tTxBufferSize\tRxBATimeout\tTxBATimeout\n");
+ for( i = 0; i < STACFG_MAX_TC; i ++ )
+ p += log_sprintf( pMac, p,
+ "%d\t%d\t%d\t%d\t%d\t%d\t%d\n",
+ i, // TID
+ pSta->tcCfg[i].fUseBARx,
+ pSta->tcCfg[i].fUseBATx,
+ pSta->tcCfg[i].rxBufSize,
+ pSta->tcCfg[i].txBufSize,
+ pSta->tcCfg[i].tuRxBAWaitTimeout,
+ pSta->tcCfg[i].tuTxBAWaitTimeout );
+ }
+
+ return p;
+}
+
+
+static char *
+dump_lim_AddBA_DeclineStat( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+
+ int Tid, Enable=(arg1 & 0x1);
+ tANI_U8 val;
+
+ if (arg1 > 1) {
+ log_sprintf( pMac,p, "%s:Invalid Value is entered for Enable/Disable \n", __FUNCTION__ );
+ arg1 &= 1;
+ }
+
+ val = pMac->lim.gAddBA_Declined;
+
+ if (arg2 > 7) {
+ log_sprintf( pMac,p, "%s:Invalid Value is entered for Tid \n", __FUNCTION__ );
+ Tid = arg2 & 0x7;
+ } else
+ Tid = arg2;
+
+
+ if ( Enable)
+ val |= Enable << Tid;
+ else
+ val &= ~(0x1 << Tid);
+
+ if (cfgSetInt(pMac, (tANI_U16)WNI_CFG_ADDBA_REQ_DECLINE, (tANI_U32) val) != eSIR_SUCCESS)
+ log_sprintf( pMac,p, "%s:Config Set for ADDBA REQ Decline has failed \n", __FUNCTION__ );
+
+ log_sprintf( pMac,p, "%s:Decline value %d is being set for TID %d ,\n \tAddBA_Decline Cfg value is %d \n", __FUNCTION__ , arg1, Tid, (int) val);
+
+ return p;
+}
+static char *
+dump_lim_set_dot11_mode( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+
+ tpPESession psessionEntry =&pMac->lim.gpSession[0]; //TBD-RAJESH HOW TO GET sessionEntry?????
+ dump_cfg_set(pMac, WNI_CFG_DOT11_MODE, arg1, arg2, arg3, p);
+ if ( (limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) ||
+ (limGetSystemRole(psessionEntry) == eLIM_STA_IN_IBSS_ROLE))
+ schSetFixedBeaconFields(pMac,psessionEntry);
+ p += log_sprintf( pMac,p, "The Dot11 Mode is set to %s", limDot11ModeStr(pMac, (tANI_U8)psessionEntry->dot11mode));
+ return p;
+}
+
+
+static char* dump_lim_update_cb_Mode(tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ tANI_U32 localPwrConstraint;
+ tpPESession psessionEntry = &pMac->lim.gpSession[0]; //TBD-RAJESH HOW TO GET sessionEntry?????
+
+ if ( !pMac->lim.htCapability )
+ {
+ p += log_sprintf( pMac,p, "Error: Dot11 mode is non-HT, can not change the CB mode.\n");
+ return p;
+ }
+
+ pMac->lim.gHTSecondaryChannelOffset = arg1;
+ setupCBState(pMac, limGetAniCBState(pMac->lim.gHTSecondaryChannelOffset));
+
+ if(eSIR_SUCCESS != cfgSetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE,
+ arg1 ? WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : WNI_CFG_CHANNEL_BONDING_MODE_DISABLE))
+ p += log_sprintf(pMac,p, "cfgSetInt failed for WNI_CFG_CHANNEL_BONDING_MODE\n");
+
+ wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint);
+
+ limSendSwitchChnlParams(pMac, psessionEntry->currentOperChannel, pMac->lim.gHTSecondaryChannelOffset,
+ (tPowerdBm) localPwrConstraint, psessionEntry->peSessionId);
+ if ( (limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) ||
+ (limGetSystemRole(psessionEntry) == eLIM_STA_IN_IBSS_ROLE))
+ schSetFixedBeaconFields(pMac,psessionEntry);
+ return p;
+
+}
+
+static char* dump_lim_abort_scan(tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+ //csrScanAbortMacScan(pMac);
+ return p;
+
+}
+
+static char* dump_lim_start_stop_bg_scan(tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg2; (void) arg3; (void) arg4;
+
+ if (TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
+ {
+ limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
+ }
+
+ if(arg1 == 1)
+ {
+ if (tx_timer_activate(
+ &pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
+ {
+ pMac->lim.gLimBackgroundScanTerminate = TRUE;
+ }
+ else
+ {
+ pMac->lim.gLimBackgroundScanTerminate = FALSE;
+ pMac->lim.gLimBackgroundScanDisable = false;
+ pMac->lim.gLimForceBackgroundScanDisable = false;
+ }
+ }
+ else
+ {
+ pMac->lim.gLimBackgroundScanTerminate = TRUE;
+ pMac->lim.gLimBackgroundScanChannelId = 0;
+ pMac->lim.gLimBackgroundScanDisable = true;
+ pMac->lim.gLimForceBackgroundScanDisable = true;
+ }
+ return p;
+
+}
+
+static char*
+dump_lim_get_pe_statistics(tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ eHalStatus status = eHAL_STATUS_SUCCESS;
+ tpAniGetPEStatsReq pReq;
+ tANI_U32 statsMask;
+
+ (void) arg2; (void) arg3; (void) arg4;
+
+
+ switch(arg1)
+ {
+ case 1:
+ statsMask = PE_SUMMARY_STATS_INFO;
+ break;
+ case 2:
+ statsMask = PE_GLOBAL_CLASS_A_STATS_INFO;
+ break;
+ case 3:
+ statsMask = PE_GLOBAL_CLASS_B_STATS_INFO;
+ break;
+ case 4:
+ statsMask = PE_GLOBAL_CLASS_C_STATS_INFO;
+ break;
+ case 5:
+ statsMask = PE_PER_STA_STATS_INFO;
+ break;
+ default:
+ return p;
+ }
+
+
+ if( eHAL_STATUS_SUCCESS != (status = palAllocateMemory (pMac->hHdd, (void**) &pReq, sizeof(tAniGetPEStatsReq))))
+ {
+ p += log_sprintf( pMac,p, "Error: Unable to allocate memory.\n");
+ return p;
+ }
+
+ palZeroMemory( pMac, pReq, sizeof(*pReq));
+
+ pReq->msgType = eWNI_SME_GET_STATISTICS_REQ;
+ pReq->statsMask = statsMask;
+ pReq->staId = (tANI_U16)arg2;
+
+ pMac->lim.gLimRspReqd = eANI_BOOLEAN_TRUE;
+ limPostSmeMessage(pMac, eWNI_SME_GET_STATISTICS_REQ, (tANI_U32 *) pReq);
+
+ return p;
+
+}
+
+extern char* setLOGLevel( tpAniSirGlobal pMac, char *p, tANI_U32 module, tANI_U32 level );
+static char *
+dump_lim_set_log_level( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ p = setLOGLevel(pMac, p, arg1, arg2);
+ return p;
+}
+
+static char *
+dump_lim_update_log_level( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ vos_trace_setLevel( arg1, arg2 );
+ return p;
+}
+
+static char *
+dump_lim_scan_req_send( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+ p = sendSmeScanReq(pMac, p);
+ return p;
+}
+
+static char *
+dump_lim_send_start_bss_req( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+ p = sendSmeStartBssReq(pMac, p,arg1);
+ return p;
+}
+
+static char *
+dump_lim_send_join_req( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+ p = sendSmeJoinReq(pMac, p);
+ return p;
+}
+
+static char *
+dump_lim_send_disassoc_req( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+
+ p = sendSmeDisAssocReq(pMac, p, arg1 ,arg2);
+ return p;
+}
+
+static char *
+dump_lim_stop_bss_req( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg2; (void) arg3; (void) arg4;
+ p = sendSmeStopBssReq(pMac, p, arg1);
+ return p;
+}
+
+
+static char *
+dump_lim_session_print( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+ p = printSessionInfo(pMac, p);
+ return p;
+}
+
+static char *
+dump_lim_sme_reassoc_req( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ tANI_U32 sessionId = arg1;
+ tCsrRoamModifyProfileFields modifyProfileFields;
+ tANI_U32 roamId;
+
+ (void) arg2; (void) arg3; (void) arg4;
+
+ if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+ {
+ if(HAL_STATUS_SUCCESS(sme_AcquireGlobalLock( &pMac->sme )))
+ {
+ csrGetModifyProfileFields(pMac, sessionId, &modifyProfileFields);
+ csrReassoc( pMac, sessionId, &modifyProfileFields, &roamId, 0);
+ sme_ReleaseGlobalLock( &pMac->sme );
+ }
+ }
+ else
+ {
+ p += log_sprintf( pMac,p, "Invalid session = %d\n", sessionId);
+ }
+
+ return p;
+}
+
+static char *
+dump_lim_dot11h_stats( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ unsigned int i;
+ (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+
+ p += log_sprintf(pMac, p, "11h Enabled = %s\n", pMac->lim.gLim11hEnable? "TRUE": "FALSE");
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+ p += log_sprintf(pMac, p, "Measurement request issued by WSM = %s\n",
+ (pMac->lim.gpLimMeasReq != NULL)? "ISSUED": "NOT ISSUED");
+ p += log_sprintf(pMac, p, "Measurement request details...\n");
+ if (pMac->lim.gpLimMeasReq != NULL)
+ {
+ p += log_sprintf(pMac, p, "numChannels = %d, periodicMeasEnabled = %d, measIndPeriod = %d,"
+ "shortTermPeriod = %d, averagingPeriod = %d, shortChannelScanDuration = %d,"
+ "longChannelScanDuration = %d, SYS_TICK_DUR_MS = %d\n",
+ pMac->lim.gpLimMeasReq->channelList.numChannels, pMac->lim.gpLimMeasReq->measControl.periodicMeasEnabled,
+ pMac->lim.gpLimMeasReq->measIndPeriod, pMac->lim.gpLimMeasReq->measDuration.shortTermPeriod,
+ pMac->lim.gpLimMeasReq->measDuration.averagingPeriod,
+ pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration,
+ pMac->lim.gpLimMeasReq->measDuration.longChannelScanDuration, SYS_TICK_DUR_MS );
+
+ p += log_sprintf(pMac, p, "Measurement channels...\n");
+ for (i = 0; i < pMac->lim.gpLimMeasReq->channelList.numChannels; i++)
+ {
+ p += log_sprintf(pMac, p, "%d ", pMac->lim.gpLimMeasReq->channelList.channelNumber[i]);
+ }
+ p += log_sprintf(pMac, p, "\n");
+ p += log_sprintf(pMac, p, "Total Number of BSS learned = %d\n", pMac->lim.gpLimMeasData->numBssWds);
+ p += log_sprintf(pMac, p, "Total Number of Channels learned = %d\n", pMac->lim.gpLimMeasData->numMatrixNodes);
+ p += log_sprintf(pMac, p, "Duration of learning = %d\n", pMac->lim.gpLimMeasData->duration);
+ p += log_sprintf(pMac, p, "Is measurement Indication timer active = %s\n",
+ (pMac->lim.gLimMeasParams.isMeasIndTimerActive)?"YES": "NO");
+ p += log_sprintf(pMac, p, "Next learn channel Id = %d\n", pMac->lim.gLimMeasParams.nextLearnChannelId);
+ }
+ p += log_sprintf(pMac, p, "Measurement running = %s\n",
+ pMac->sys.gSysEnableLearnMode?"TRUE": "FALSE");
+#endif
+ p += log_sprintf(pMac, p, "Is system in learn mode = %s\n",
+ pMac->lim.gLimSystemInScanLearnMode?"YES": "NO");
+
+ p += log_sprintf(pMac, p, "Quiet Enabled = %s\n", (pMac->lim.gLimSpecMgmt.fQuietEnabled)?"YES": "NO");
+ p += log_sprintf(pMac, p, "Quiet state = %d\n", pMac->lim.gLimSpecMgmt.quietState);
+ p += log_sprintf(pMac, p, "Quiet Count = %d\n", pMac->lim.gLimSpecMgmt.quietCount);
+ p += log_sprintf(pMac, p, "Quiet Duration in ticks = %d\n", pMac->lim.gLimSpecMgmt.quietDuration);
+ p += log_sprintf(pMac, p, "Quiet Duration in TU = %d\n", pMac->lim.gLimSpecMgmt.quietDuration_TU);
+
+ p += log_sprintf(pMac, p, "Channel switch state = %d\n", pMac->lim.gLimSpecMgmt.dot11hChanSwState);
+ p += log_sprintf(pMac, p, "Channel switch mode = %s\n",
+ (pMac->lim.gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)?"SILENT": "NORMAL");
+ p += log_sprintf(pMac, p, "Channel switch primary channel = %d\n",
+ pMac->lim.gLimChannelSwitch.primaryChannel);
+ p += log_sprintf(pMac, p, "Channel switch secondary sub band = %d\n",
+ pMac->lim.gLimChannelSwitch.secondarySubBand);
+ p += log_sprintf(pMac, p, "Channel switch switch count = %d\n",
+ pMac->lim.gLimChannelSwitch.switchCount);
+ p += log_sprintf(pMac, p, "Channel switch switch timeout value = %d\n",
+ pMac->lim.gLimChannelSwitch.switchTimeoutValue);
+
+ p += log_sprintf(pMac, p, "Radar interrupt configured = %s\n",
+ pMac->lim.gLimSpecMgmt.fRadarIntrConfigured?"YES": "NO");
+ p += log_sprintf(pMac, p, "Radar detected in current operating channel = %s\n",
+ pMac->lim.gLimSpecMgmt.fRadarDetCurOperChan?"YES": "NO");
+ p += log_sprintf(pMac, p, "Radar detected channels...\n");
+ for (i = 0; i < pMac->sys.radarDetectCount; i++)
+ {
+ p += log_sprintf(pMac, p, "%d ", pMac->sys.detRadarChIds[i]);
+ }
+ p += log_sprintf(pMac, p, "\n");
+
+ return p;
+}
+
+static char *
+dump_lim_enable_measurement( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg2; (void) arg3; (void) arg4;
+
+ if (arg1)
+ {
+ pMac->sys.gSysEnableLearnMode = eANI_BOOLEAN_TRUE;
+ p += log_sprintf(pMac, p, "Measurement enabled\n");
+ }
+ else
+ {
+ pMac->sys.gSysEnableLearnMode = eANI_BOOLEAN_FALSE;
+ p += log_sprintf(pMac, p, "Measurement disabled\n");
+ }
+
+ return p;
+}
+
+static char *
+dump_lim_enable_quietIE( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg2; (void) arg3; (void) arg4;
+
+ if (arg1)
+ {
+ pMac->lim.gLimSpecMgmt.fQuietEnabled = eANI_BOOLEAN_TRUE;
+ p += log_sprintf(pMac, p, "QuietIE enabled\n");
+ }
+ else
+ {
+ pMac->lim.gLimSpecMgmt.fQuietEnabled = eANI_BOOLEAN_FALSE;
+ p += log_sprintf(pMac, p, "QuietIE disabled\n");
+ }
+
+ return p;
+}
+
+static char *
+dump_lim_disable_enable_scan( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg2; (void) arg3; (void) arg4;
+
+ if (arg1)
+ {
+ pMac->lim.fScanDisabled = 1;
+ p += log_sprintf(pMac, p, "Scan disabled\n");
+ }
+ else
+ {
+ pMac->lim.fScanDisabled = 0;
+ p += log_sprintf(pMac, p, "scan enabled\n");
+ }
+
+ return p;
+}
+
+static char *finishScan(tpAniSirGlobal pMac, char *p)
+{
+ tSirMsgQ msg;
+
+ p += log_sprintf( pMac,p, "logDump finishScan \n");
+
+ msg.type = SIR_LIM_MIN_CHANNEL_TIMEOUT;
+ msg.bodyval = 0;
+ msg.bodyptr = NULL;
+
+ limPostMsgApi(pMac, &msg);
+ return p;
+}
+
+
+static char *
+dump_lim_info( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+ p = dumpLim( pMac, p );
+ return p;
+}
+
+static char *
+dump_lim_finishscan_send( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+ p = finishScan(pMac, p);
+ return p;
+}
+
+static char *
+dump_lim_prb_rsp_send( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+ p = testLimSendProbeRsp( pMac, p );
+ return p;
+}
+
+static char *
+dump_sch_beacon_trigger( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+ p = triggerBeaconGen(pMac, p);
+ return p;
+}
+
+
+static char* dump_lim_trace_cfg(tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ MTRACE(macTraceCfg(pMac, arg1, arg2, arg3, arg4);)
+ return p;
+}
+
+static char* dump_lim_trace_dump(tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ MTRACE(macTraceDumpAll(pMac, (tANI_U8)arg1, (tANI_U8)arg2, arg3);)
+ return p;
+}
+
+static char* dump_lim_set_scan_in_powersave( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ p += log_sprintf( pMac,p, "logDump set scan in powersave to %d \n", arg1);
+ dump_cfg_set(pMac, WNI_CFG_SCAN_IN_POWERSAVE, arg1, arg2, arg3, p);
+ return p;
+}
+
+#if defined WLAN_FEATURE_VOWIFI
+static char *
+dump_lim_send_rrm_action( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ tpPESession psessionEntry;
+ tSirMacRadioMeasureReport pRRMReport[4];
+ tANI_U8 num = (tANI_U8)(arg4 > 4 ? 4 : arg4);
+ tANI_U8 i;
+
+ if((psessionEntry = peFindSessionBySessionId(pMac,(tANI_U8)arg2) )== NULL)
+ {
+ p += log_sprintf( pMac,p,"Session does not exist for given session Id \n");
+ return p;
+ }
+ switch (arg3)
+ {
+ case 0:
+ /* send two reports with incapable bit set */
+ pRRMReport[0].type = 6;
+ pRRMReport[1].type = 7;
+ limSendRadioMeasureReportActionFrame( pMac, 1, 2, &pRRMReport[0], psessionEntry->bssId, psessionEntry );
+ break;
+ case 1:
+ for ( i = 0 ; i < num ; i++ )
+ {
+ pRRMReport[i].type = 5;
+ if ( i == 3 )
+ pRRMReport[i].refused = 1;
+ else
+ pRRMReport[i].refused = 0;
+
+ pRRMReport[i].report.beaconReport.regClass = 32;
+ pRRMReport[i].report.beaconReport.channel = i;
+ pRRMReport[i].report.beaconReport.measDuration = 23;
+ pRRMReport[i].report.beaconReport.phyType = i << 4; //some value.
+ pRRMReport[i].report.beaconReport.bcnProbeRsp = 1;
+ pRRMReport[i].report.beaconReport.rsni = 10;
+ pRRMReport[i].report.beaconReport.rcpi = 40;
+
+ pRRMReport[i].report.beaconReport.bssid[0] = 0x00;
+ pRRMReport[i].report.beaconReport.bssid[1] = 0xAA;
+ pRRMReport[i].report.beaconReport.bssid[2] = 0xBB;
+ pRRMReport[i].report.beaconReport.bssid[3] = 0xCC;
+ pRRMReport[i].report.beaconReport.bssid[4] = 0x00;
+ pRRMReport[i].report.beaconReport.bssid[5] = 0x01 << i;
+
+
+ pRRMReport[i].report.beaconReport.antennaId = 10;
+ pRRMReport[i].report.beaconReport.parentTSF = 0x1234;
+
+ pRRMReport[i].report.beaconReport.numIes = i * 10;
+ {
+ tANI_U8 j;
+ for( j = 0; j < pRRMReport[i].report.beaconReport.numIes ; j++ )
+ {
+ pRRMReport[i].report.beaconReport.Ies[j] = j + i; //Junk values.
+ }
+ }
+
+ }
+ limSendRadioMeasureReportActionFrame( pMac, 1, num, &pRRMReport[0], psessionEntry->bssId, psessionEntry );
+ break;
+ case 2:
+ //send Neighbor request.
+ {
+ tSirMacNeighborReportReq neighbor;
+ neighbor.dialogToken = 2;
+ neighbor.ssid_present = (tANI_U8) arg4;
+ neighbor.ssid.length = 5;
+ palCopyMemory( pMac->hHdd, neighbor.ssid.ssId, "abcde", 5);
+
+ limSendNeighborReportRequestFrame( pMac, &neighbor, psessionEntry->bssId, psessionEntry );
+
+ }
+
+ break;
+ case 3:
+ //send Link measure report.
+ {
+ tSirMacLinkReport link;
+ link.dialogToken = 4;
+ link.txPower = 34;
+ link.rxAntenna = 2;
+ link.txAntenna = 1;
+ link.rcpi = 9;
+ link.rsni = 3;
+ limSendLinkReportActionFrame( pMac, &link, psessionEntry->bssId, psessionEntry );
+ }
+ break;
+ default:
+ break;
+ }
+ return p;
+}
+
+static char *
+dump_lim_unpack_rrm_action( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ tpPESession psessionEntry;
+ tANI_U32 status;
+
+ tANI_U8 size[] = {
+ 0x2C,
+ 0x2F,
+ 0x25,
+ 0x2C,
+ 0x1C,
+ 0x05
+ };
+
+ tANI_U8 pBody[][100] = {
+ {
+ /*Beacon Request 0*/
+ 0x05, 0x00, 0x01, 0x00, 0x00,
+ //Measurement request IE
+ 0x26, 0x25, 0x01, 0x00,
+ //Beacon request type
+ 0x05,
+ //Beacon request starts here
+ 0x0C, 0x01, 0x30, 0x00, 0x14, 0x00, 0x01,
+ //BSSID
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xff, 0xFF,
+ //SSID
+ 0x00, 0x05, 0x57, 0x69, 0x46, 0x69, 0x31,
+ //Reporting Condition
+ 0x01, 0x02, 0x00, 0x00,
+ //Reporting Detail
+ 0x02, 0x01, 0x1,
+ //Request IE
+ 0x0A, 0x05, 0x00, 0x30, 0x46, 0x36, 0xDD
+ },
+ {
+ /*Beacon Request 1*/
+ 0x05, 0x00, 0x01, 0x00, 0x00,
+ //Measurement request IE
+ 0x26, 0x28, 0x01, 0x00,
+ //Beacon request type
+ 0x05,
+ //Beacon request starts here
+ 0x0C, 0xFF, 0x30, 0x00, 0x14, 0x00, 0x01,
+ //BSSID
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xff, 0xFF,
+ //SSID
+/* 0x00, 0x08, 0x35, 0x36, 0x37, 0x38, 0x39, 0x40, 0x41, 0x42, */
+ //Reporting Condition
+ 0x01, 0x02, 0x00, 0x00,
+ //Reporting Detail
+ 0x02, 0x01, 0x1,
+ //Request IE
+ 0x0A, 0x05, 0x00, 0x30, 0x46, 0x36, 0xDD,
+ //AP channel report
+ 0x33, 0x03, 0x0C, 0x01, 0x06,
+ 0x33, 0x03, 0x0C, 0x24, 0x30,
+ },
+ {
+ /*Beacon Request 2*/
+ 0x05, 0x00, 0x01, 0x00, 0x00,
+ //Measurement request IE
+ 0x26, 0x1E, 0x01, 0x00,
+ //Beacon request type
+ 0x05,
+ //Beacon request starts here
+ 0x0C, 0x00, 0x30, 0x00, 0x14, 0x00, 0x02,
+ //BSSID
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xff, 0xFF,
+ //SSID
+ 0x00, 0x05, 0x57, 0x69, 0x46, 0x69, 0x31,
+ //0x00, 0x08, 0x41, 0x53, 0x54, 0x2D, 0x57, 0x41, 0x50, 0x49,
+ //Reporting Condition
+ 0x01, 0x02, 0x00, 0x00,
+ //Reporting Detail
+ 0x02, 0x01, 0x0
+ //Request IE
+ },
+ {
+ /*Beacon Request 3*/
+ 0x05, 0x00, 0x01, 0x00, 0x00,
+ //Measurement request IE
+ 0x26, 0x25, 0x01, 0x00,
+ //Beacon request type
+ 0x05,
+ //Beacon request starts here
+ 0x0C, 0x01, 0x30, 0x00, 0x69, 0x00, 0x00,
+ //BSSID
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xff, 0xFF,
+ //SSID
+ 0x00, 0x05, 0x57, 0x69, 0x46, 0x69, 0x31,
+ //Reporting Condition
+ 0x01, 0x02, 0x00, 0x00,
+ //Reporting Detail
+ 0x02, 0x01, 0x1,
+ //Request IE
+ 0x0A, 0x05, 0x00, 0x30, 0x46, 0x36, 0xDD
+ },
+ {
+ /*Neighbor report*/
+ 0x05, 0x05, 0x01,
+ //Measurement request IE
+ 0x34, 0x17,
+ //BSSID
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xff, 0xFF,
+ //BSSID INFOo
+ 0xED, 0x01, 0x00, 0x00,
+ //Reg class, channel, Phy type
+ 0x20, 0x01, 0x02,
+ //TSF Info
+ 0x01, 0x04, 0x02, 0x00, 0x60, 0x00,
+ //Condensed country
+ 0x02, 0x02, 0x62, 0x63
+ },
+ {
+ /* Link measurement request */
+ 0x05, 0x02, 0x00,
+ //Txpower used
+ 0x00,
+ //Max Tx Power
+ 0x00
+ }
+ };
+
+ if((psessionEntry = peFindSessionBySessionId(pMac,(tANI_U8)arg1) )== NULL)
+ {
+ p += log_sprintf( pMac,p,"Session does not exist for given session Id \n");
+ return p;
+ }
+ switch (arg2)
+ {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ {
+ tDot11fRadioMeasurementRequest frm;
+ if( (status = dot11fUnpackRadioMeasurementRequest( pMac, &pBody[arg2][0], size[arg2], &frm )) != 0 )
+ p += log_sprintf( pMac, p, "failed to unpack.....status = %x\n", status);
+ else
+ rrmProcessRadioMeasurementRequest( pMac, psessionEntry->bssId, &frm, psessionEntry );
+ }
+ break;
+ case 4:
+ {
+ tDot11fNeighborReportResponse frm;
+ pBody[arg2][2] = (tANI_U8)arg3; //Dialog Token
+ if( (status = dot11fUnpackNeighborReportResponse( pMac, &pBody[arg2][0], size[arg2], &frm )) != 0 )
+ p += log_sprintf( pMac, p, "failed to unpack.....status = %x\n", status);
+ else
+ rrmProcessNeighborReportResponse( pMac, &frm, psessionEntry );
+
+ }
+ break;
+ case 5:
+ {
+// FIXME.
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+ tDot11fLinkMeasurementRequest frm;
+ tHalBufDesc Bd;
+ pBody[arg2][3] = (tANI_U8)arg3; //TxPower used
+ pBody[arg2][4] = (tANI_U8)arg4; //Max Tx power
+
+ Bd.phyStats0 = 0;
+ Bd.phyStats1 = 0;
+ if( (status = dot11fUnpackLinkMeasurementRequest( pMac, &pBody[arg2][0], size[arg2], &frm )) != 0 )
+ p += log_sprintf( pMac, p, "failed to unpack.....status = %x\n", status);
+ else
+ rrmProcessLinkMeasurementRequest( pMac, (tANI_U8*)&Bd, &frm, psessionEntry );
+#endif
+ }
+ break;
+ case 6:
+ {
+ tPowerdBm localConstraint = (tPowerdBm) arg3;
+ tPowerdBm maxTxPower = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
+ maxTxPower = VOS_MIN( maxTxPower, maxTxPower-localConstraint );
+ if( maxTxPower != psessionEntry->maxTxPower )
+ {
+ rrmSendSetMaxTxPowerReq( pMac, maxTxPower, psessionEntry );
+ psessionEntry->maxTxPower = maxTxPower;
+ }
+ }
+ break;
+ default:
+ p += log_sprintf( pMac, p, "Invalid option" );
+ break;
+ }
+ return p;
+}
+#endif
+
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+#ifdef RSSI_HACK
+/* This dump command is needed to set the RSSI values in TL while testing handoff. Handoff code was tested
+ * using this dump command. Whatever the value gives as the first parameter will be considered as the average
+ * RSSI by TL and invokes corresponding callback registered by the clients */
+extern int dumpCmdRSSI;
+static char *
+dump_lim_set_tl_data_pkt_rssi( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ dumpCmdRSSI = arg1;
+ limLog(pMac, LOGE, FL("Setting TL data packet RSSI to %d"), dumpCmdRSSI);
+ return p;
+}
+#endif
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+/* This command is used to trigger FT Preauthentication with the AP with BSSID below */
+static char *
+dump_lim_ft_event( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+ static tANI_U8 macAddr[6] = {0x00, 0xde, 0xad, 0xaf, 0xaf, 0x04};
+ tpPESession psessionEntry;
+ tSirMsgQ msg;
+ tpSirFTPreAuthReq pftPreAuthReq;
+ tANI_U16 auth_req_len = 0;
+ tCsrRoamConnectedProfile Profile;
+
+ csrRoamCopyConnectProfile(pMac, arg2, &Profile);
+
+ if((psessionEntry = peFindSessionBySessionId(pMac,(tANI_U8)arg2) )== NULL)
+ {
+ p += log_sprintf( pMac,
+ p,"Session does not exist usage: 363 <0> sessionid channel \n");
+ return p;
+ }
+
+ switch (arg1)
+ {
+ case 0:
+ // Send Pre-auth event
+ {
+ /*----------------*/
+ p += log_sprintf( pMac,p, "Preparing Pre Auth Req message\n");
+ auth_req_len = sizeof(tSirFTPreAuthReq);
+
+ pftPreAuthReq = vos_mem_malloc(auth_req_len);
+ if (pftPreAuthReq == NULL)
+ {
+ p += log_sprintf( pMac,p,"Pre auth dump: palAllocateMemory() failed \n");
+ return p;
+ }
+ pftPreAuthReq->pbssDescription = vos_mem_malloc(sizeof(Profile.pBssDesc->length)+
+ Profile.pBssDesc->length);
+
+ pftPreAuthReq->messageType = eWNI_SME_FT_PRE_AUTH_REQ;
+ pftPreAuthReq->length = auth_req_len + sizeof(Profile.pBssDesc->length) +
+ Profile.pBssDesc->length;
+ pftPreAuthReq->preAuthchannelNum = 6;
+
+ palCopyMemory(pMac->hHdd, (void *) &pftPreAuthReq->currbssId,
+ (void *)psessionEntry->bssId, 6);
+ palCopyMemory(pMac->hHdd, (void *) &pftPreAuthReq->preAuthbssId,
+ (void *)macAddr, 6);
+ pftPreAuthReq->ft_ies_length = (tANI_U16)pMac->ft.ftSmeContext.auth_ft_ies_length;
+
+ // Also setup the mac address in sme context.
+ palCopyMemory(pMac->hHdd, pMac->ft.ftSmeContext.preAuthbssId, macAddr, 6);
+
+ vos_mem_copy(pftPreAuthReq->ft_ies, pMac->ft.ftSmeContext.auth_ft_ies,
+ pMac->ft.ftSmeContext.auth_ft_ies_length);
+
+ vos_mem_copy(Profile.pBssDesc->bssId, macAddr, 6);
+
+ p += log_sprintf( pMac,p, "\n ----- LIM Debug Information ----- \n");
+ p += log_sprintf( pMac, p, "%s: length = %d\n", __FUNCTION__,
+ (int)pMac->ft.ftSmeContext.auth_ft_ies_length);
+ p += log_sprintf( pMac, p, "%s: length = %02x\n", __FUNCTION__,
+ (int)pMac->ft.ftSmeContext.auth_ft_ies[0]);
+ p += log_sprintf( pMac, p, "%s: Auth Req %02x %02x %02x\n",
+ __FUNCTION__, pftPreAuthReq->ft_ies[0],
+ pftPreAuthReq->ft_ies[1], pftPreAuthReq->ft_ies[2]);
+
+ p += log_sprintf( pMac, p, "%s: Session %02x %02x %02x\n", __FUNCTION__,
+ psessionEntry->bssId[0],
+ psessionEntry->bssId[1], psessionEntry->bssId[2]);
+ p += log_sprintf( pMac, p, "%s: Session %02x %02x %02x %p\n", __FUNCTION__,
+ pftPreAuthReq->currbssId[0],
+ pftPreAuthReq->currbssId[1],
+ pftPreAuthReq->currbssId[2], pftPreAuthReq);
+
+ Profile.pBssDesc->channelId = (tANI_U8)arg3;
+ vos_mem_copy((void *)pftPreAuthReq->pbssDescription, (void *)Profile.pBssDesc,
+ Profile.pBssDesc->length);
+
+ msg.type = eWNI_SME_FT_PRE_AUTH_REQ;
+ msg.bodyptr = pftPreAuthReq;
+ msg.bodyval = 0;
+
+ p += log_sprintf( pMac, p, "limPostMsgApi(eWNI_SME_FT_PRE_AUTH_REQ) \n");
+ limPostMsgApi(pMac, &msg);
+ }
+ break;
+
+ default:
+ break;
+ }
+ return p;
+}
+#endif
+
+static tDumpFuncEntry limMenuDumpTable[] = {
+ {0, "PE (300-499)", NULL},
+ {300, "LIM: Dump state(s)/statistics", dump_lim_info},
+ {301, "PE.LIM: dump TSPEC Table", dump_lim_tspec_table},
+ {302, "PE.LIM: dump specified TSPEC entry (id)", dump_lim_tspec_entry},
+ {303, "PE.LIM: dump EDCA params", dump_lim_edca_params},
+ {304, "PE.LIM: dump DPH table summary", dump_lim_dph_table_summary},
+ {305, "PE.LIM: dump link monitor stats", dump_lim_link_monitor_stats},
+ {306, "PE.LIM:dump Set the BAR Decline stat(arg1= 1/0 (enable/disable) arg2 =TID", dump_lim_AddBA_DeclineStat},
+ {307, "PE: LIM: dump CSR Send ReAssocReq", dump_lim_sme_reassoc_req},
+ {308, "PE:LIM: dump all 11H related data", dump_lim_dot11h_stats},
+ {309, "PE:LIM: dump to enable Measurement on AP", dump_lim_enable_measurement},
+ {310, "PE:LIM: dump to enable QuietIE on AP", dump_lim_enable_quietIE},
+ {311, "PE:LIM: disable/enable scan 1(disable)", dump_lim_disable_enable_scan},
+ {320, "PE.LIM: send sme scan request", dump_lim_scan_req_send},
+
+
+ /*FIXME_GEN6*/
+ /* This dump command is more of generic dump cmd and hence it should
+ * be moved to logDump.c
+ */
+ {321, "PE:LIM: Set Log Level <VOS Module> <VOS Log Level>", dump_lim_update_log_level},
+ {322, "PE.LIM: Enable/Disable PE Tracing", dump_lim_trace_cfg},
+ {323, "PE.LIM: Trace Dump if enabled", dump_lim_trace_dump},
+ {331, "PE.LIM: Send finish scan to LIM", dump_lim_finishscan_send},
+ {332, "PE.LIM: force probe rsp send from LIM", dump_lim_prb_rsp_send},
+ {333, "PE.SCH: Trigger to generate a beacon", dump_sch_beacon_trigger},
+ {335, "PE.LIM: set ACM flag (0..3)", dump_lim_acm_set},
+ {336, "PE.LIM: Send an ADDBA Req to peer MAC arg1=aid,arg2=tid, arg3=ssn", dump_lim_addba_req},
+ {337, "PE.LIM: Send a DELBA Ind to peer MAC arg1=aid,arg2=recipient(0)/initiator(1),arg3=tid,arg4=reasonCode", dump_lim_delba_req},
+ {338, "PE.LIM: Trigger a BA timeout for STA index", dump_lim_ba_timeout},
+ {339, "PE.LIM: List active BA session(s) for AssocID", dump_lim_list_active_ba},
+ {340, "PE.LIM: Set background scan flag (0-disable, 1-enable)",dump_lim_bgscan_toggle},
+ {341, "PE.LIM: Set link monitoring mode", dump_lim_linkmonitor_toggle},
+ {342, "PE.LIM: AddSta <6th byte of station Mac>", dump_lim_add_sta},
+ {343, "PE.LIM: DelSta <aid>", dump_lim_del_sta},
+ {344, "PE.LIM: Set probe respond flag", dump_lim_proberesp_toggle},
+ {345, "PE.LIM: set protection config bitmap", set_lim_prot_cfg},
+ {346, "PE:LIM: Set the Dot11 Mode", dump_lim_set_dot11_mode},
+ {347, "PE:Enable or Disable Protection", dump_lim_set_protection_control},
+ {348, "PE:LIM: Send SM Power Mode Action frame", dump_lim_send_SM_Power_Mode},
+ {349, "PE: LIM: Change CB Mode", dump_lim_update_cb_Mode},
+ {350, "PE: LIM: abort scan", dump_lim_abort_scan},
+ {351, "PE: LIM: Start stop BG scan", dump_lim_start_stop_bg_scan},
+ {352, "PE: LIM: PE statistics <scanmask>", dump_lim_get_pe_statistics},
+ {353, "PE: LIM: Set MAC log level <Mac Module ID> <Log Level>", dump_lim_set_log_level},
+ {354, "PE: LIM: Set Scan in Power Save <0-disable, 1-enable>", dump_lim_set_scan_in_powersave},
+ {355, "PE.LIM: send sme start BSS request", dump_lim_send_start_bss_req},
+ {356, "PE.LIM: dump pesession info ", dump_lim_session_print},
+ {357, "PE.LIM: send DisAssocRequest", dump_lim_send_disassoc_req},
+ {358, "PE.LIM: send sme stop bss request <session ID>", dump_lim_stop_bss_req},
+ {359, "PE.LIM: send sme join request", dump_lim_send_join_req},
+#if defined WLAN_FEATURE_VOWIFI
+ {360, "PE.LIM: send an RRM action frame", dump_lim_send_rrm_action},
+ {361, "PE.LIM: unpack an RRM action frame", dump_lim_unpack_rrm_action},
+#endif
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+#ifdef RSSI_HACK
+ {362, "TL Set current RSSI", dump_lim_set_tl_data_pkt_rssi},
+#endif
+#endif
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ {363, "PE.LIM: trigger pre auth/reassoc event", dump_lim_ft_event},
+#endif
+
+};
+
+
+
+void limDumpInit(tpAniSirGlobal pMac)
+{
+ logDumpRegisterTable( pMac, &limMenuDumpTable[0],
+ sizeof(limMenuDumpTable)/sizeof(limMenuDumpTable[0]) );
+}
+
+
+#endif //#if defined(ANI_LOGDUMP)
+
diff --git a/CORE/MAC/src/pe/lim/limP2P.c b/CORE/MAC/src/pe/lim/limP2P.c
new file mode 100644
index 0000000..6f4d465
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limP2P.c
@@ -0,0 +1,901 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*===========================================================================
+ L I M _ P 2 P . C
+
+ OVERVIEW:
+
+ This software unit holds the implementation of the WLAN Protocol Engine for
+ P2P.
+
+ Copyright (c) 2011 QUALCOMM Incorporated.
+ All Rights Reserved.
+ Qualcomm Confidential and Proprietary
+===========================================================================*/
+
+/*===========================================================================
+
+ EDIT HISTORY FOR FILE
+
+
+ This section contains comments describing changes made to the module.
+ Notice that changes are listed in reverse chronological order.
+
+
+ $Header$$DateTime$$Author$
+
+
+ when who what, where, why
+---------- --- --------------------------------------------------------
+2011-05-02 djindal Corrected file indentation and changed remain on channel
+ handling for concurrency.
+===========================================================================*/
+
+
+#ifdef WLAN_FEATURE_P2P
+#include "limUtils.h"
+#include "limSessionUtils.h"
+#include "wlan_qct_wda.h"
+
+#define PROBE_RSP_IE_OFFSET 36
+#define BSSID_OFFSET 16
+#define ADDR2_OFFSET 10
+#define ACTION_OFFSET 24
+
+
+
+void limRemainOnChnlSuspendLinkHdlr(tpAniSirGlobal pMac, eHalStatus status,
+ tANI_U32 *data);
+void limRemainOnChnlSetLinkStat(tpAniSirGlobal pMac, eHalStatus status,
+ tANI_U32 *data, tpPESession psessionEntry);
+void limExitRemainOnChannel(tpAniSirGlobal pMac, eHalStatus status,
+ tANI_U32 *data, tpPESession psessionEntry);
+void limRemainOnChnRsp(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data);
+extern tSirRetStatus limSetLinkState(
+ tpAniSirGlobal pMac, tSirLinkState state,
+ tSirMacAddr bssId, tSirMacAddr selfMacAddr,
+ tpSetLinkStateCallback callback, void *callbackArg);
+
+static tSirRetStatus limCreateSessionForRemainOnChn(tpAniSirGlobal pMac, tPESession **ppP2pSession);
+
+/*------------------------------------------------------------------
+ *
+ * Below function is callback function, it is called when
+ * WDA_SET_LINK_STATE_RSP is received from WDI. callback function for
+ * P2P of limSetLinkState
+ *
+ *------------------------------------------------------------------*/
+void limSetLinkStateP2PCallback(tpAniSirGlobal pMac, void *callbackArg)
+{
+ //Send Ready on channel indication to SME
+ if(pMac->lim.gpLimRemainOnChanReq)
+ {
+ limSendSmeRsp(pMac, eWNI_SME_REMAIN_ON_CHN_RDY_IND, eHAL_STATUS_SUCCESS,
+ pMac->lim.gpLimRemainOnChanReq->sessionId, 0);
+ }
+ else
+ {
+ //This is possible in case remain on channel is aborted
+ limLog( pMac, LOGE, FL(" NULL pointer of gpLimRemainOnChanReq") );
+ }
+}
+
+/*------------------------------------------------------------------
+ *
+ * Remain on channel req handler. Initiate the INIT_SCAN, CHN_CHANGE
+ * and SET_LINK Request from SME, chnNum and duration to remain on channel.
+ *
+ *------------------------------------------------------------------*/
+
+
+int limProcessRemainOnChnlReq(tpAniSirGlobal pMac, tANI_U32 *pMsg)
+{
+ tANI_U8 i;
+ tpPESession psessionEntry;
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+ tpPESession pP2pSession;
+#endif
+
+ tSirRemainOnChnReq *MsgBuff = (tSirRemainOnChnReq *)pMsg;
+ pMac->lim.gpLimRemainOnChanReq = MsgBuff;
+
+ for (i =0; i < pMac->lim.maxBssId;i++)
+ {
+ psessionEntry = peFindSessionBySessionId(pMac,i);
+
+ if ( (psessionEntry != NULL) )
+ {
+ if (psessionEntry->currentOperChannel == MsgBuff->chnNum)
+ {
+ tANI_U32 val;
+ tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+
+ /* get the duration from the request */
+ val = SYS_MS_TO_TICKS(MsgBuff->duration);
+
+ limLog( pMac, LOGE, "Start listen duration = %d", val);
+ if (tx_timer_change(
+ &pMac->lim.limTimers.gLimRemainOnChannelTimer, val, 0)
+ != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP,
+ FL("Unable to change remain on channel Timer val\n"));
+ goto error;
+ }
+ else if(TX_SUCCESS != tx_timer_activate(
+ &pMac->lim.limTimers.gLimRemainOnChannelTimer))
+ {
+ limLog(pMac, LOGP,
+ FL("Unable to activate remain on channel Timer\n"));
+ limDeactivateAndChangeTimer(pMac, eLIM_REMAIN_CHN_TIMER);
+ goto error;
+ }
+
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+ //Session is needed to send probe rsp
+ if(eSIR_SUCCESS != limCreateSessionForRemainOnChn(pMac, &pP2pSession))
+ {
+ limLog( pMac, LOGE, "Unable to create session");
+ goto error;
+ }
+#endif
+
+ if ((limSetLinkState(pMac, eSIR_LINK_LISTEN_STATE,
+ nullBssid, pMac->lim.gSelfMacAddr,
+ limSetLinkStateP2PCallback, NULL)) != eSIR_SUCCESS)
+ {
+ limLog( pMac, LOGE, "Unable to change link state");
+ goto error;
+ }
+ return FALSE;
+ }
+ }
+ }
+
+ pMac->lim.gLimPrevMlmState = pMac->lim.gLimMlmState;
+ pMac->lim.gLimMlmState = eLIM_MLM_P2P_LISTEN_STATE;
+
+ pMac->lim.gTotalScanDuration = MsgBuff->duration;
+
+ /* 1st we need to suspend link with callback to initiate change channel */
+ limSuspendLink(pMac, eSIR_CHECK_LINK_TRAFFIC_BEFORE_SCAN,
+ limRemainOnChnlSuspendLinkHdlr, NULL);
+ return FALSE;
+
+error:
+ limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
+ /* pMsg is freed by the caller */
+ return FALSE;
+}
+
+
+tSirRetStatus limCreateSessionForRemainOnChn(tpAniSirGlobal pMac, tPESession **ppP2pSession)
+{
+ tSirRetStatus nSirStatus = eSIR_FAILURE;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId;
+ tANI_U32 val;
+
+ if(pMac->lim.gpLimRemainOnChanReq && ppP2pSession)
+ {
+ if((psessionEntry = peCreateSession(pMac,
+ pMac->lim.gpLimRemainOnChanReq->selfMacAddr, &sessionId, 1)) == NULL)
+ {
+ limLog(pMac, LOGE, FL("Session Can not be created \n"));
+ /* send remain on chn failure */
+ return nSirStatus;
+ }
+ /* Store PE sessionId in session Table */
+ psessionEntry->peSessionId = sessionId;
+
+ psessionEntry->limSystemRole = eLIM_P2P_DEVICE_ROLE;
+ CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
+ psessionEntry->rateSet.rate, val , SIR_MAC_MAX_NUMBER_OF_RATES );
+ psessionEntry->rateSet.numRates = val;
+
+ CFG_GET_STR( nSirStatus, pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
+ psessionEntry->extRateSet.rate, val,
+ WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN );
+ psessionEntry->extRateSet.numRates = val;
+
+ sirCopyMacAddr(psessionEntry->selfMacAddr,
+ pMac->lim.gpLimRemainOnChanReq->selfMacAddr);
+
+ psessionEntry->currentOperChannel = pMac->lim.gpLimRemainOnChanReq->chnNum;
+ nSirStatus = eSIR_SUCCESS;
+ *ppP2pSession = psessionEntry;
+ }
+
+ return nSirStatus;
+}
+
+
+/*------------------------------------------------------------------
+ *
+ * limSuspenLink callback, on success link suspend, trigger change chn
+ *
+ *
+ *------------------------------------------------------------------*/
+
+tSirRetStatus limRemainOnChnlChangeChnReq(tpAniSirGlobal pMac,
+ eHalStatus status, tANI_U32 *data)
+{
+ tpPESession psessionEntry;
+ tANI_U8 sessionId = 0;
+ tSirRetStatus nSirStatus = eSIR_FAILURE;
+
+ if( NULL == pMac->lim.gpLimRemainOnChanReq )
+ {
+ //RemainOnChannel may have aborted
+ PELOGE(limLog( pMac, LOGE, FL(" gpLimRemainOnChanReq is NULL") );)
+ return nSirStatus;
+ }
+
+ /* The link is not suspended */
+ if (status != eHAL_STATUS_SUCCESS)
+ {
+ PELOGE(limLog( pMac, LOGE, FL(" Suspend link Failure ") );)
+ goto error;
+ }
+
+
+ if((psessionEntry = peFindSessionByBssid(
+ pMac,pMac->lim.gpLimRemainOnChanReq->selfMacAddr, &sessionId)) != NULL)
+ {
+ goto change_channel;
+ }
+ else /* Session Entry does not exist for given BSSId */
+ {
+ /* Try to Create a new session */
+ if(eSIR_SUCCESS != limCreateSessionForRemainOnChn(pMac, &psessionEntry))
+ {
+ limLog(pMac, LOGE, FL("Session Can not be created \n"));
+ /* send remain on chn failure */
+ goto error;
+ }
+ }
+
+change_channel:
+ /* change channel to the requested by RemainOn Chn*/
+ limChangeChannelWithCallback(pMac,
+ pMac->lim.gpLimRemainOnChanReq->chnNum,
+ limRemainOnChnlSetLinkStat, NULL, psessionEntry);
+ return eSIR_SUCCESS;
+
+error:
+ limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
+ return eSIR_FAILURE;
+}
+
+void limRemainOnChnlSuspendLinkHdlr(tpAniSirGlobal pMac, eHalStatus status,
+ tANI_U32 *data)
+{
+ limRemainOnChnlChangeChnReq(pMac, status, data);
+ return;
+}
+
+/*------------------------------------------------------------------
+ *
+ * Set the LINK state to LISTEN to allow only PROBE_REQ and Action frames
+ *
+ *------------------------------------------------------------------*/
+void limRemainOnChnlSetLinkStat(tpAniSirGlobal pMac, eHalStatus status,
+ tANI_U32 *data, tpPESession psessionEntry)
+{
+ tANI_U32 val;
+ tSirRemainOnChnReq *MsgRemainonChannel = pMac->lim.gpLimRemainOnChanReq;
+ tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+ if (status != eHAL_STATUS_SUCCESS)
+ {
+ limLog( pMac, LOGE, "%s: Change channel not successful\n");
+ goto error1;
+ }
+
+ // Start timer here to come back to operating channel.
+ pMac->lim.limTimers.gLimRemainOnChannelTimer.sessionId =
+ psessionEntry->peSessionId;
+
+ /* get the duration from the request */
+ val = SYS_MS_TO_TICKS(MsgRemainonChannel->duration);
+
+ limLog( pMac, LOGE, "Start listen duration = %d", val);
+ if (tx_timer_change(&pMac->lim.limTimers.gLimRemainOnChannelTimer,
+ val, 0) != TX_SUCCESS)
+ {
+ /**
+ * Could not change Remain on channel Timer. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("Unable to change remain on channel Timer val\n"));
+ goto error;
+ }
+
+ if(TX_SUCCESS !=
+ tx_timer_activate(&pMac->lim.limTimers.gLimRemainOnChannelTimer))
+ {
+ limLog( pMac, LOGE,
+ "%s: remain on channel Timer Start Failed\n", __FUNCTION__);
+ goto error;
+ }
+
+ if ((limSetLinkState(pMac, eSIR_LINK_LISTEN_STATE,nullBssid,
+ pMac->lim.gSelfMacAddr, limSetLinkStateP2PCallback,
+ NULL)) != eSIR_SUCCESS)
+ {
+ limLog( pMac, LOGE, "Unable to change link state");
+ goto error;
+ }
+
+ return;
+error:
+ limDeactivateAndChangeTimer(pMac, eLIM_REMAIN_CHN_TIMER);
+error1:
+ limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
+ return;
+}
+
+/*------------------------------------------------------------------
+ *
+ * limchannelchange callback, on success channel change, set the
+ * link_state to LISTEN
+ *
+ *------------------------------------------------------------------*/
+
+void limProcessRemainOnChnTimeout(tpAniSirGlobal pMac)
+{
+ tpPESession psessionEntry;
+ tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+ limDeactivateAndChangeTimer(pMac, eLIM_REMAIN_CHN_TIMER);
+
+ if (NULL == pMac->lim.gpLimRemainOnChanReq)
+ {
+ limLog( pMac, LOGE, "No Remain on channel pending");
+ return;
+ }
+
+ /* get the previous valid LINK state */
+ if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid,
+ pMac->lim.gSelfMacAddr, NULL, NULL) != eSIR_SUCCESS)
+ {
+ limLog( pMac, LOGE, "Unable to change link state");
+ return;
+ }
+
+ if (pMac->lim.gLimMlmState != eLIM_MLM_P2P_LISTEN_STATE )
+ {
+ limRemainOnChnRsp(pMac,eHAL_STATUS_SUCCESS, NULL);
+ }
+ else
+ {
+ /* get the session */
+ if((psessionEntry = peFindSessionBySessionId(pMac,
+ pMac->lim.limTimers.gLimRemainOnChannelTimer.sessionId))== NULL)
+ {
+ limLog(pMac, LOGE,
+ FL("Session Does not exist for given sessionID\n"));
+ goto error;
+ }
+
+ limExitRemainOnChannel(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry);
+ return;
+error:
+ limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
+ }
+ return;
+}
+
+
+/*------------------------------------------------------------------
+ *
+ * limchannelchange callback, on success channel change, set the link_state
+ * to LISTEN
+ *
+ *------------------------------------------------------------------*/
+
+void limExitRemainOnChannel(tpAniSirGlobal pMac, eHalStatus status,
+ tANI_U32 *data, tpPESession psessionEntry)
+{
+
+ if (status != eHAL_STATUS_SUCCESS)
+ {
+ PELOGE(limLog( pMac, LOGE, "Remain on Channel Failed\n");)
+ goto error;
+ }
+ //Set the resume channel to Any valid channel (invalid).
+ //This will instruct HAL to set it to any previous valid channel.
+ peSetResumeChannel(pMac, 0, 0);
+ limResumeLink(pMac, limRemainOnChnRsp, NULL);
+ return;
+error:
+ limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
+ return;
+}
+
+/*------------------------------------------------------------------
+ *
+ * Send remain on channel respone: Success/ Failure
+ *
+ *------------------------------------------------------------------*/
+void limRemainOnChnRsp(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
+{
+ tpPESession psessionEntry;
+ tANI_U8 sessionId;
+ tSirRemainOnChnReq *MsgRemainonChannel = pMac->lim.gpLimRemainOnChanReq;
+ tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+ if ( NULL == MsgRemainonChannel )
+ {
+ PELOGE(limLog( pMac, LOGP,
+ "%s: No Pointer for Remain on Channel Req\n", __FUNCTION__);)
+ return;
+ }
+
+ //Incase of the Remain on Channel Failure Case
+ //Cleanup Everything
+ if(eHAL_STATUS_FAILURE == status)
+ {
+ //Deactivate Remain on Channel Timer
+ limDeactivateAndChangeTimer(pMac, eLIM_REMAIN_CHN_TIMER);
+
+ //Set the Link State to Idle
+ /* get the previous valid LINK state */
+ if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid,
+ pMac->lim.gSelfMacAddr, NULL, NULL) != eSIR_SUCCESS)
+ {
+ limLog( pMac, LOGE, "Unable to change link state");
+ }
+
+ pMac->lim.gLimSystemInScanLearnMode = 0;
+ pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
+ }
+
+ /* delete the session */
+ if((psessionEntry = peFindSessionByBssid(pMac,
+ MsgRemainonChannel->selfMacAddr,&sessionId)) != NULL)
+ {
+ if ( eLIM_P2P_DEVICE_ROLE == psessionEntry->limSystemRole )
+ {
+ peDeleteSession( pMac, psessionEntry);
+ }
+ }
+ /* Post the meessage to Sme */
+ limSendSmeRsp(pMac, eWNI_SME_REMAIN_ON_CHN_RSP, status,
+ MsgRemainonChannel->sessionId, 0);
+
+ palFreeMemory( pMac->hHdd, pMac->lim.gpLimRemainOnChanReq );
+ pMac->lim.gpLimRemainOnChanReq = NULL;
+
+ pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
+ return;
+}
+
+/*------------------------------------------------------------------
+ *
+ * Indicate the Mgmt Frame received to SME to HDD callback
+ * handle Probe_req/Action frame currently
+ *
+ *------------------------------------------------------------------*/
+void limSendSmeMgmtFrameInd(
+ tpAniSirGlobal pMac, tANI_U8 frameType,
+ tANI_U8 *frame, tANI_U32 frameLen, tANI_U16 sessionId,
+ tANI_U32 rxChannel)
+{
+ tSirMsgQ mmhMsg;
+ tpSirSmeMgmtFrameInd pSirSmeMgmtFrame = NULL;
+ tANI_U16 length;
+
+ length = sizeof(tSirSmeMgmtFrameInd) + frameLen;
+
+ if( eHAL_STATUS_SUCCESS !=
+ palAllocateMemory( pMac->hHdd, (void **)&pSirSmeMgmtFrame, length ))
+ {
+ limLog(pMac, LOGP,
+ FL("palAllocateMemory failed for eWNI_SME_LISTEN_RSP\n"));
+ return;
+ }
+ palZeroMemory(pMac->hHdd, (void*)pSirSmeMgmtFrame, length);
+
+ pSirSmeMgmtFrame->mesgType = eWNI_SME_MGMT_FRM_IND;
+ pSirSmeMgmtFrame->mesgLen = length;
+ pSirSmeMgmtFrame->sessionId = sessionId;
+ pSirSmeMgmtFrame->frameType = frameType;
+ pSirSmeMgmtFrame->rxChan = rxChannel;
+
+ vos_mem_zero(pSirSmeMgmtFrame->frameBuf,frameLen);
+ vos_mem_copy(pSirSmeMgmtFrame->frameBuf,frame,frameLen);
+
+ mmhMsg.type = eWNI_SME_MGMT_FRM_IND;
+ mmhMsg.bodyptr = pSirSmeMgmtFrame;
+ mmhMsg.bodyval = 0;
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+ return;
+} /*** end limSendSmeListenRsp() ***/
+
+
+eHalStatus limP2PActionCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess)
+{
+ limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF,
+ (txCompleteSuccess ? eSIR_SME_SUCCESS : eSIR_SME_SEND_ACTION_FAIL),
+ pMac->lim.actionFrameSessionId, 0);
+
+ return eHAL_STATUS_SUCCESS;
+}
+
+
+void limSetHtCaps(tpAniSirGlobal pMac,tANI_U8 *pIeStartPtr,tANI_U32 nBytes)
+{
+ v_U8_t *pIe=NULL;
+ tDot11fIEHTCaps dot11HtCap;
+
+ PopulateDot11fHTCaps(pMac,&dot11HtCap);
+ pIe = limGetIEPtr(pMac,pIeStartPtr, nBytes,
+ DOT11F_EID_HTCAPS,ONE_BYTE);
+ limLog( pMac, LOGE, FL("pIe 0x%x dot11HtCap.supportedMCSSet[0]=0x%x"),
+ (tANI_U32)pIe,dot11HtCap.supportedMCSSet[0]);
+ if(pIe)
+ {
+ tHtCaps *pHtcap = (tHtCaps *)&pIe[2]; //convert from unpacked to packed structure
+ pHtcap->advCodingCap = dot11HtCap.advCodingCap;
+ pHtcap->supportedChannelWidthSet = dot11HtCap.supportedChannelWidthSet;
+ pHtcap->mimoPowerSave = dot11HtCap.mimoPowerSave;
+ pHtcap->greenField = dot11HtCap.greenField;
+ pHtcap->shortGI20MHz = dot11HtCap.shortGI20MHz;
+ pHtcap->shortGI40MHz = dot11HtCap.shortGI40MHz;
+ pHtcap->txSTBC = dot11HtCap.txSTBC;
+ pHtcap->rxSTBC = dot11HtCap.rxSTBC;
+ pHtcap->delayedBA = dot11HtCap.delayedBA ;
+ pHtcap->maximalAMSDUsize = dot11HtCap.maximalAMSDUsize;
+ pHtcap->dsssCckMode40MHz = dot11HtCap.dsssCckMode40MHz;
+ pHtcap->psmp = dot11HtCap.psmp;
+ pHtcap->stbcControlFrame = dot11HtCap.stbcControlFrame;
+ pHtcap->lsigTXOPProtection = dot11HtCap.lsigTXOPProtection;
+ pHtcap->maxRxAMPDUFactor = dot11HtCap.maxRxAMPDUFactor;
+ pHtcap->mpduDensity = dot11HtCap.mpduDensity;
+ palCopyMemory( pMac->hHdd, (void *)pHtcap->supportedMCSSet,
+ (void *)(dot11HtCap.supportedMCSSet),
+ sizeof(pHtcap->supportedMCSSet));
+ pHtcap->pco = dot11HtCap.pco;
+ pHtcap->transitionTime = dot11HtCap.transitionTime;
+ pHtcap->mcsFeedback = dot11HtCap.mcsFeedback;
+ pHtcap->txBF = dot11HtCap.txBF;
+ pHtcap->rxStaggeredSounding = dot11HtCap.rxStaggeredSounding;
+ pHtcap->txStaggeredSounding = dot11HtCap.txStaggeredSounding;
+ pHtcap->rxZLF = dot11HtCap.rxZLF;
+ pHtcap->txZLF = dot11HtCap.txZLF;
+ pHtcap->implicitTxBF = dot11HtCap.implicitTxBF;
+ pHtcap->calibration = dot11HtCap.calibration;
+ pHtcap->explicitCSITxBF = dot11HtCap.explicitCSITxBF;
+ pHtcap->explicitUncompressedSteeringMatrix =
+ dot11HtCap.explicitUncompressedSteeringMatrix;
+ pHtcap->explicitBFCSIFeedback = dot11HtCap.explicitBFCSIFeedback;
+ pHtcap->explicitUncompressedSteeringMatrixFeedback =
+ dot11HtCap.explicitUncompressedSteeringMatrixFeedback;
+ pHtcap->explicitCompressedSteeringMatrixFeedback =
+ dot11HtCap.explicitCompressedSteeringMatrixFeedback;
+ pHtcap->csiNumBFAntennae = dot11HtCap.csiNumBFAntennae;
+ pHtcap->uncompressedSteeringMatrixBFAntennae =
+ dot11HtCap.uncompressedSteeringMatrixBFAntennae;
+ pHtcap->compressedSteeringMatrixBFAntennae =
+ dot11HtCap.compressedSteeringMatrixBFAntennae;
+ pHtcap->antennaSelection = dot11HtCap.antennaSelection;
+ pHtcap->explicitCSIFeedbackTx = dot11HtCap.explicitCSIFeedbackTx;
+ pHtcap->antennaIndicesFeedbackTx = dot11HtCap.antennaIndicesFeedbackTx;
+ pHtcap->explicitCSIFeedback = dot11HtCap.explicitCSIFeedback;
+ pHtcap->antennaIndicesFeedback = dot11HtCap.antennaIndicesFeedback;
+ pHtcap->rxAS = dot11HtCap.rxAS;
+ pHtcap->txSoundingPPDUs = dot11HtCap.txSoundingPPDUs;
+ }
+}
+
+
+void limSendP2PActionFrame(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
+{
+ tSirMbMsgP2p *pMbMsg = (tSirMbMsgP2p *)pMsg->bodyptr;
+ tANI_U32 nBytes;
+ tANI_U8 *pFrame;
+ void *pPacket;
+ eHalStatus halstatus;
+ tANI_U8 txFlag = 0;
+ tpSirMacFrameCtl pFc = (tpSirMacFrameCtl ) pMbMsg->data;
+ tANI_U8 noaLen = 0;
+ tANI_U8 noaStream[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN];
+ tANI_U8 origLen = 0;
+ tANI_U8 sessionId = 0;
+ v_U8_t *pP2PIe = NULL;
+ tpPESession psessionEntry;
+ v_U8_t *pPresenceRspNoaAttr = NULL;
+ v_U8_t *pNewP2PIe = NULL;
+ v_U16_t remainLen = 0;
+
+ nBytes = pMbMsg->msgLen - sizeof(tSirMbMsg);
+
+ limLog( pMac, LOG1, FL("sending pFc->type=%d pFc->subType=%d"),
+ pFc->type, pFc->subType);
+
+ psessionEntry = peFindSessionByBssid(pMac,
+ (tANI_U8*)pMbMsg->data + BSSID_OFFSET, &sessionId);
+
+ /* Check for session corresponding to ADDR2 As Supplicant is filling
+ ADDR2 with BSSID */
+ if( NULL == psessionEntry )
+ {
+ psessionEntry = peFindSessionByBssid(pMac,
+ (tANI_U8*)pMbMsg->data + ADDR2_OFFSET, &sessionId);
+ }
+
+ if( NULL == psessionEntry )
+ {
+ tANI_U8 isSessionActive = 0;
+ tANI_U8 i;
+
+ /* If we are not able to find psessionEntry entry, then try to find
+ active session, if found any active sessions then send the
+ action frame, If no active sessions found then drop the frame */
+ for (i =0; i < pMac->lim.maxBssId;i++)
+ {
+ psessionEntry = peFindSessionBySessionId(pMac,i);
+ if ( NULL != psessionEntry)
+ {
+ isSessionActive = 1;
+ break;
+ }
+ }
+ if( !isSessionActive )
+ {
+ limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF,
+ eHAL_STATUS_FAILURE, pMbMsg->sessionId, 0);
+ return;
+ }
+ }
+
+ if ((SIR_MAC_MGMT_FRAME == pFc->type)&&
+ ((SIR_MAC_MGMT_PROBE_RSP == pFc->subType)||
+ (SIR_MAC_MGMT_ACTION == pFc->subType)))
+ {
+ //if this is a probe RSP being sent from wpa_supplicant
+ if (SIR_MAC_MGMT_PROBE_RSP == pFc->subType)
+ {
+ //get proper offset for Probe RSP
+ pP2PIe = limGetP2pIEPtr(pMac,
+ (tANI_U8*)pMbMsg->data + PROBE_RSP_IE_OFFSET,
+ nBytes - PROBE_RSP_IE_OFFSET);
+ while ((NULL != pP2PIe) && (SIR_MAC_MAX_IE_LENGTH == pP2PIe[1]))
+ {
+ remainLen = nBytes - (pP2PIe - (tANI_U8*)pMbMsg->data);
+ if (remainLen > 2)
+ {
+ pNewP2PIe = limGetP2pIEPtr(pMac,
+ pP2PIe+SIR_MAC_MAX_IE_LENGTH + 2, remainLen);
+ }
+ if (pNewP2PIe)
+ {
+ pP2PIe = pNewP2PIe;
+ pNewP2PIe = NULL;
+ }
+ else
+ {
+ break;
+ }
+ } //end of while
+ }
+ else
+ {
+ if (SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY ==
+ *((v_U8_t *)pMbMsg->data+ACTION_OFFSET))
+ {
+ tpSirMacP2PActionFrameHdr pActionHdr =
+ (tpSirMacP2PActionFrameHdr)((v_U8_t *)pMbMsg->data +
+ ACTION_OFFSET);
+ if ( palEqualMemory( pMac->hHdd, pActionHdr->Oui,
+ SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE ) &&
+ (SIR_MAC_ACTION_P2P_SUBTYPE_PRESENCE_RSP ==
+ pActionHdr->OuiSubType))
+ { //In case of Presence RSP response
+ pP2PIe = limGetP2pIEPtr(pMac,
+ (v_U8_t *)pMbMsg->data + ACTION_OFFSET +
+ sizeof(tSirMacP2PActionFrameHdr),
+ (nBytes - ACTION_OFFSET -
+ sizeof(tSirMacP2PActionFrameHdr)));
+ if( NULL != pP2PIe )
+ {
+ //extract the presence of NoA attribute inside P2P IE
+ pPresenceRspNoaAttr =
+ limGetIEPtr(pMac,pP2PIe + SIR_P2P_IE_HEADER_LEN,
+ pP2PIe[1], SIR_P2P_NOA_ATTR,TWO_BYTE);
+ }
+ }
+ }
+ }
+
+ if (pP2PIe != NULL)
+ {
+ //get NoA attribute stream P2P IE
+ noaLen = limGetNoaAttrStream(pMac, noaStream, psessionEntry);
+ //need to append NoA attribute in P2P IE
+ if (noaLen > 0)
+ {
+ origLen = pP2PIe[1];
+ //if Presence Rsp has NoAttr
+ if (pPresenceRspNoaAttr)
+ {
+ v_U16_t noaAttrLen = pPresenceRspNoaAttr[1] |
+ (pPresenceRspNoaAttr[2]<<8);
+ /*One byte for attribute, 2bytes for length*/
+ origLen -= (noaAttrLen + 1 + 2);
+ //remove those bytes to copy
+ nBytes -= (noaAttrLen + 1 + 2);
+ //remove NoA from original Len
+ pP2PIe[1] = origLen;
+ }
+ if ((pP2PIe[1] + (tANI_U16)noaLen)> SIR_MAC_MAX_IE_LENGTH)
+ {
+ //Form the new NoA Byte array in multiple P2P IEs
+ noaLen = limGetNoaAttrStreamInMultP2pIes(pMac, noaStream,
+ noaLen,((pP2PIe[1] + (tANI_U16)noaLen)-
+ SIR_MAC_MAX_IE_LENGTH));
+ pP2PIe[1] = SIR_MAC_MAX_IE_LENGTH;
+ }
+ else
+ {
+ pP2PIe[1] += noaLen; //increment the length of P2P IE
+ }
+ nBytes += noaLen;
+ limLog( pMac, LOGE,
+ FL("noaLen=%d origLen=%d pP2PIe=0x%x"
+ " nBytes=%d nBytesToCopy=%d \n"),
+ noaLen,origLen,pP2PIe,nBytes,
+ ((pP2PIe + origLen + 2) - (v_U8_t *)pMbMsg->data));
+ }
+ }
+
+ if (SIR_MAC_MGMT_PROBE_RSP == pFc->subType)
+ {
+ limSetHtCaps( pMac,(tANI_U8*)pMbMsg->data + PROBE_RSP_IE_OFFSET,
+ nBytes);
+ }
+ }
+
+
+ // Ok-- try to allocate some memory:
+ halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ (tANI_U16)nBytes, ( void** ) &pFrame, (void**) &pPacket);
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to allocate %d bytes for a Probe"
+ " Request.\n"), nBytes );
+ return;
+ }
+
+ // Paranoia:
+ palZeroMemory( pMac->hHdd, pFrame, nBytes );
+
+ if (noaLen > 0)
+ {
+ // Add 2 bytes for length and Arribute field
+ v_U32_t nBytesToCopy = ((pP2PIe + origLen + 2 ) -
+ (v_U8_t *)pMbMsg->data);
+ palCopyMemory( pMac->hHdd, pFrame, pMbMsg->data, nBytesToCopy);
+ palCopyMemory( pMac->hHdd, (pFrame + nBytesToCopy), noaStream, noaLen);
+ palCopyMemory( pMac->hHdd, (pFrame + nBytesToCopy + noaLen),
+ pMbMsg->data + nBytesToCopy, nBytes - nBytesToCopy - noaLen);
+
+ }
+ else
+ {
+ palCopyMemory(pMac->hHdd, pFrame, pMbMsg->data, nBytes);
+ }
+
+ /* Use BD rate 2 for all P2P related frames. As these frames need to go
+ * at OFDM rates. And BD rate2 we configured at 6Mbps.
+ */
+ txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
+
+ if (SIR_MAC_MGMT_PROBE_RSP == pFc->subType)
+ {
+ halstatus = halTxFrame( pMac, pPacket, (tANI_U16)nBytes,
+ HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS,
+ 7,/*SMAC_SWBD_TX_TID_MGMT_HIGH */ limTxComplete, pFrame,
+ txFlag );
+
+ limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF,
+ halstatus, pMbMsg->sessionId, 0);
+ }
+ else
+ {
+ halstatus = halTxFrameWithTxComplete( pMac, pPacket, (tANI_U16)nBytes,
+ HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS,
+ 7,/*SMAC_SWBD_TX_TID_MGMT_HIGH */ limTxComplete, pFrame,
+ limP2PActionCnf, txFlag );
+
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGE, FL("could not send action frame!\n" ));
+ limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF, halstatus,
+ pMbMsg->sessionId, 0);
+ }
+ else
+ {
+ pMac->lim.actionFrameSessionId = pMbMsg->sessionId;
+ }
+ }
+
+ return;
+}
+
+
+void limAbortRemainOnChan(tpAniSirGlobal pMac)
+{
+ if(VOS_TRUE == tx_timer_running(
+ &pMac->lim.limTimers.gLimRemainOnChannelTimer))
+ {
+ //TODO check for state and take appropriate actions
+ limDeactivateAndChangeTimer(pMac, eLIM_REMAIN_CHN_TIMER);
+ limProcessRemainOnChnTimeout(pMac);
+ }
+ return;
+}
+
+/* Power Save Related Functions */
+tSirRetStatus __limProcessSmeNoAUpdate(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tpP2pPsConfig pNoA;
+ tpP2pPsParams pMsgNoA;
+ tSirMsgQ msg;
+
+ pNoA = (tpP2pPsConfig) pMsgBuf;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory(
+ pMac->hHdd, (void **) &pMsgNoA, sizeof( tP2pPsConfig )))
+ {
+ limLog( pMac, LOGE,
+ FL( "Unable to allocate memory during NoA Update\n" ));
+ return eSIR_MEM_ALLOC_FAILED;
+ }
+
+ palZeroMemory( pMac->hHdd, (tANI_U8 *)pMsgNoA, sizeof(tP2pPsConfig));
+ pMsgNoA->opp_ps = pNoA->opp_ps;
+ pMsgNoA->ctWindow = pNoA->ctWindow;
+ pMsgNoA->duration = pNoA->duration;
+ pMsgNoA->interval = pNoA->interval;
+ pMsgNoA->count = pNoA->count;
+ pMsgNoA->single_noa_duration = pNoA->single_noa_duration;
+ pMsgNoA->psSelection = pNoA->psSelection;
+
+ msg.type = SIR_HAL_SET_P2P_GO_NOA_REQ;
+ msg.reserved = 0;
+ msg.bodyptr = pMsgNoA;
+ msg.bodyval = 0;
+
+ if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
+ {
+ limLog(pMac, LOGE, FL("halPostMsgApi failed\n"));
+ return eSIR_FAILURE;
+ }
+
+ return eSIR_SUCCESS;
+} /*** end __limProcessSmeGoNegReq() ***/
+
+#endif
+
diff --git a/CORE/MAC/src/pe/lim/limProcessActionFrame.c b/CORE/MAC/src/pe/lim/limProcessActionFrame.c
new file mode 100644
index 0000000..4c89a87
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limProcessActionFrame.c
@@ -0,0 +1,2091 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limProcessActionFrame.cc contains the code
+ * for processing Action Frame.
+ * Author: Michael Lui
+ * Date: 05/23/03
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+#include "palTypes.h"
+#include "wniApi.h"
+#include "sirApi.h"
+#include "aniGlobal.h"
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halDataStruct.h"
+#endif
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+#include "wniCfgAp.h"
+#else
+#include "wniCfgSta.h"
+#endif
+#include "schApi.h"
+#include "utilsApi.h"
+#include "limTypes.h"
+#include "limUtils.h"
+#include "limAssocUtils.h"
+#include "limSecurityUtils.h"
+#include "limSerDesUtils.h"
+#include "limSendSmeRspMessages.h"
+#include "parserApi.h"
+#include "limAdmitControl.h"
+#include "wmmApsd.h"
+#include "limSendMessages.h"
+#if defined WLAN_FEATURE_VOWIFI
+#include "rrmApi.h"
+#endif
+
+#if defined FEATURE_WLAN_CCX
+#include "ccxApi.h"
+#endif
+#include "wlan_qct_wda.h"
+
+
+#define BA_DEFAULT_TX_BUFFER_SIZE 64
+
+typedef enum
+{
+ LIM_ADDBA_RSP = 0,
+ LIM_ADDBA_REQ = 1
+}tLimAddBaValidationReqType;
+
+/* Note: The test passes if the STAUT stops sending any frames, and no further
+ frames are transmitted on this channel by the station when the AP has sent
+ the last 6 beacons, with the channel switch information elements as seen
+ with the sniffer.*/
+#define SIR_CHANSW_TX_STOP_MAX_COUNT 6
+/**-----------------------------------------------------------------
+\fn limStopTxAndSwitchChannel
+\brief Stops the transmission if channel switch mode is silent and
+ starts the channel switch timer.
+
+\param pMac
+\return NONE
+-----------------------------------------------------------------*/
+void limStopTxAndSwitchChannel(tpAniSirGlobal pMac, tANI_U8 sessionId)
+{
+ tANI_U8 isFullPowerRequested = 0;
+
+ PELOG1(limLog(pMac, LOG1, FL("Channel switch Mode == %d\n"),
+ pMac->lim.gLimChannelSwitch.switchMode);)
+
+ if (pMac->lim.gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT ||
+ pMac->lim.gLimChannelSwitch.switchCount <= SIR_CHANSW_TX_STOP_MAX_COUNT)
+ {
+ /* Freeze the transmission */
+ limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
+
+ /*Request for Full power only if the device is in powersave*/
+ if(!limIsSystemInActiveState(pMac))
+ {
+ /* Request Full Power */
+ limSendSmePreChannelSwitchInd(pMac);
+ isFullPowerRequested = 1;
+ }
+ }
+ else
+ {
+ /* Resume the transmission */
+ limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
+ }
+
+ /* change the channel immediatly only if the channel switch count is 0 and the
+ * device is not in powersave
+ * If the device is in powersave channel switch should happen only after the
+ * device comes out of the powersave */
+ if (pMac->lim.gLimChannelSwitch.switchCount == 0)
+ {
+ if(limIsSystemInActiveState(pMac))
+ {
+ limProcessChannelSwitchTimeout(pMac);
+ }
+ else if(!isFullPowerRequested)
+ {
+ /* If the Full power is already not requested
+ * Request Full Power so the channel switch happens
+ * after device comes to full power */
+ limSendSmePreChannelSwitchInd(pMac);
+ }
+ return;
+ }
+
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_CHANNEL_SWITCH_TIMER));
+
+ pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId = sessionId;
+
+ if (tx_timer_activate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("tx_timer_activate failed\n"));
+ }
+ return;
+}
+
+/**------------------------------------------------------------
+\fn limStartChannelSwitch
+\brief Switches the channel if switch count == 0, otherwise
+ starts the timer for channel switch and stops BG scan
+ and heartbeat timer tempororily.
+
+\param pMac
+\param psessionEntry
+\return NONE
+------------------------------------------------------------*/
+tSirRetStatus limStartChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
+{
+ PELOG1(limLog(pMac, LOG1, FL("Starting the channel switch\n"));)
+ /* Deactivate and change reconfigure the timeout value */
+ limDeactivateAndChangeTimer(pMac, eLIM_CHANNEL_SWITCH_TIMER);
+
+ /* Follow the channel switch, forget about the previous quiet. */
+ //If quiet is running, chance is there to resume tx on its timeout.
+ //so stop timer for a safer side.
+ if (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
+ {
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_QUIET_TIMER));
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("tx_timer_deactivate failed\n"));
+ return eSIR_FAILURE;
+ }
+ }
+ else if (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
+ {
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_QUIET_BSS_TIMER));
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("tx_timer_deactivate failed\n"));
+ return eSIR_FAILURE;
+ }
+ }
+ pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+
+ /* Prepare for 11h channel switch */
+ limPrepareFor11hChannelSwitch(pMac, psessionEntry);
+
+ /** Dont add any more statements here as we posted finish scan request
+ * to HAL, wait till we get the response
+ */
+ return eSIR_SUCCESS;
+}
+
+
+/**
+ * __limProcessChannelSwitchActionFrame
+ *
+ *FUNCTION:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param *pRxPacketInfo - A pointer to packet info structure
+ * @return None
+ */
+
+static void
+
+__limProcessChannelSwitchActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
+{
+
+ tpSirMacMgmtHdr pHdr;
+ tANI_U8 *pBody;
+ tDot11fChannelSwitch *pChannelSwitchFrame;
+ tANI_U16 beaconPeriod;
+ tANI_U32 val;
+ tANI_U32 frameLen;
+ tANI_U32 nStatus;
+ eHalStatus status;
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+ pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
+ frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
+
+ PELOG3(limLog(pMac, LOG3, FL("Received Channel switch action frame\n"));)
+ if (!psessionEntry->lim11hEnable)
+ return;
+
+ status = palAllocateMemory( pMac->hHdd, (void **)&pChannelSwitchFrame, sizeof(*pChannelSwitchFrame));
+ if (eHAL_STATUS_SUCCESS != status)
+ {
+ limLog(pMac, LOGE,
+ FL("palAllocateMemory failed, status = %d \n"), status);
+ return;
+ }
+
+ /* Unpack channel switch frame */
+ nStatus = dot11fUnpackChannelSwitch(pMac, pBody, frameLen, pChannelSwitchFrame);
+
+ if( DOT11F_FAILED( nStatus ))
+ {
+ limLog( pMac, LOGE,
+ FL( "Failed to unpack and parse an 11h-CHANSW Request (0x%08x, %d bytes):\n"),
+ nStatus,
+ frameLen);
+ palFreeMemory(pMac->hHdd, pChannelSwitchFrame);
+ return;
+ }
+ else if(DOT11F_WARNED( nStatus ))
+ {
+ limLog( pMac, LOGW,
+ FL( "There were warnings while unpacking an 11h-CHANSW Request (0x%08x, %d bytes):\n"),
+ nStatus,
+ frameLen);
+ }
+
+ if (palEqualMemory( pMac->hHdd,(tANI_U8 *) &psessionEntry->bssId,
+ (tANI_U8 *) &pHdr->sa,
+ sizeof(tSirMacAddr)))
+ {
+ #if 0
+ if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &val) != eSIR_SUCCESS)
+ {
+ palFreeMemory(pMac->hHdd, pChannelSwitchFrame);
+ limLog(pMac, LOGP, FL("could not retrieve Beacon interval\n"));
+ return;
+ }
+ #endif// TO SUPPORT BT-AMP
+
+ /* copy the beacon interval from psessionEntry*/
+ val = psessionEntry->beaconParams.beaconInterval;
+
+ beaconPeriod = (tANI_U16) val;
+
+ pMac->lim.gLimChannelSwitch.primaryChannel = pChannelSwitchFrame->ChanSwitchAnn.newChannel;
+ pMac->lim.gLimChannelSwitch.switchCount = pChannelSwitchFrame->ChanSwitchAnn.switchCount;
+ pMac->lim.gLimChannelSwitch.switchTimeoutValue = SYS_MS_TO_TICKS(beaconPeriod) *
+ pMac->lim.gLimChannelSwitch.switchCount;
+ pMac->lim.gLimChannelSwitch.switchMode = pChannelSwitchFrame->ChanSwitchAnn.switchMode;
+
+ PELOG3(limLog(pMac, LOG3, FL("Rcv Chnl Swtch Frame: Timeout in %d ticks\n"),
+ pMac->lim.gLimChannelSwitch.switchTimeoutValue);)
+
+ /* Only primary channel switch element is present */
+ pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
+ pMac->lim.gLimChannelSwitch.secondarySubBand = eANI_CB_SECONDARY_NONE;
+
+ if(GET_CB_ADMIN_STATE(pMac->lim.gCbState))
+ {
+ switch(pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset)
+ {
+ case eHT_SECONDARY_CHANNEL_OFFSET_UP:
+ pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
+ pMac->lim.gLimChannelSwitch.secondarySubBand = eANI_CB_SECONDARY_UP;
+ break;
+
+ case eHT_SECONDARY_CHANNEL_OFFSET_DOWN:
+ pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
+ pMac->lim.gLimChannelSwitch.secondarySubBand = eANI_CB_SECONDARY_DOWN;
+ break;
+
+ case eHT_SECONDARY_CHANNEL_OFFSET_NONE:
+ default:
+ /* Nothing to be done here */
+ break;
+ }
+ }
+
+ }
+ else
+ {
+ PELOG1(limLog(pMac, LOG1, FL("LIM: Received action frame not from our BSS, dropping..."));)
+ }
+
+ if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Could not start channel switch\n"));)
+ }
+
+ palFreeMemory(pMac->hHdd, pChannelSwitchFrame);
+ return;
+} /*** end limProcessChannelSwitchActionFrame() ***/
+
+
+static void
+__limProcessAddTsReq(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
+{
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+
+ tSirAddtsReqInfo addts;
+ tSirRetStatus retval;
+ tpSirMacMgmtHdr pHdr;
+ tSirMacScheduleIE schedule;
+ tpDphHashNode pSta;
+ tANI_U16 status;
+ tANI_U16 aid;
+ tANI_U32 frameLen;
+ tANI_U8 *pBody;
+ tANI_U8 tspecIdx = 0; //index in the sch tspec table.
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+ pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
+ frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
+
+
+ if ((psessionEntry->limSystemRole != eLIM_AP_ROLE)||(psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("AddTs request at non-AP: ignoring\n"));)
+ return;
+ }
+
+ pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
+ if (pSta == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTs\n"));)
+ return;
+ }
+
+ PELOGW(limLog(pMac, LOGW, "AddTs Request from STA %d\n", aid);)
+ retval = sirConvertAddtsReq2Struct(pMac, pBody, frameLen, &addts);
+ if (retval != eSIR_SUCCESS)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("AddTs parsing failed (error %d)\n"), retval);)
+ return;
+ }
+
+ status = eSIR_MAC_SUCCESS_STATUS;
+
+
+ if (addts.wmeTspecPresent)
+ {
+ if ((! psessionEntry->limWmeEnabled) || (! pSta->wmeEnabled))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Ignoring addts request: wme not enabled/capable\n"));)
+ status = eSIR_MAC_WME_REFUSED_STATUS;
+ }
+ else
+ {
+ PELOG2(limLog(pMac, LOG2, FL("WME Addts received\n"));)
+ }
+ }
+ else if (addts.wsmTspecPresent)
+ {
+ if ((! psessionEntry->limWsmEnabled) || (! pSta->wsmEnabled))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Ignoring addts request: wsm not enabled/capable\n"));)
+ status = eSIR_MAC_REQ_DECLINED_STATUS;
+ }
+ else
+ {
+ PELOG2(limLog(pMac, LOG2, FL("WSM Addts received\n"));)
+ }
+ }
+ else if ((! psessionEntry->limQosEnabled) || (! pSta->lleEnabled))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Ignoring addts request: qos not enabled/capable\n"));)
+ status = eSIR_MAC_REQ_DECLINED_STATUS;
+ }
+ else
+ {
+ PELOG2(limLog(pMac, LOG2, FL("11e QoS Addts received\n"));)
+ }
+
+ // for edca, if no Admit Control, ignore the request
+ if ((status == eSIR_MAC_SUCCESS_STATUS) &&
+ (addts.tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
+ (! psessionEntry->gLimEdcaParamsBC[upToAc(addts.tspec.tsinfo.traffic.userPrio)].aci.acm))
+ {
+ limLog(pMac, LOGW, FL("AddTs with UP %d has no ACM - ignoring request\n"),
+ addts.tspec.tsinfo.traffic.userPrio);
+ status = (addts.wmeTspecPresent) ?
+ eSIR_MAC_WME_REFUSED_STATUS : eSIR_MAC_UNSPEC_FAILURE_STATUS;
+ }
+
+ if (status != eSIR_MAC_SUCCESS_STATUS)
+ {
+ limSendAddtsRspActionFrame(pMac, pHdr->sa, status, &addts, NULL,psessionEntry);
+ return;
+ }
+
+ // try to admit the STA and send the appropriate response
+ retval = limAdmitControlAddTS(pMac, &pSta->staAddr[0], &addts, NULL, pSta->assocId, true, &schedule, &tspecIdx, psessionEntry);
+ if (retval != eSIR_SUCCESS)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Unable to admit TS\n"));)
+ status = (addts.wmeTspecPresent) ?
+ eSIR_MAC_WME_REFUSED_STATUS : eSIR_MAC_UNSPEC_FAILURE_STATUS;
+ }
+ else if (addts.tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA)
+ {
+ if(eSIR_SUCCESS != limSendHalMsgAddTs(pMac, pSta->staIndex, tspecIdx, addts.tspec, psessionEntry->peSessionId))
+ {
+ limLog(pMac, LOGW, FL("AddTs with UP %d failed in limSendHalMsgAddTs - ignoring request\n"),
+ addts.tspec.tsinfo.traffic.userPrio);
+ status = (addts.wmeTspecPresent) ?
+ eSIR_MAC_WME_REFUSED_STATUS : eSIR_MAC_UNSPEC_FAILURE_STATUS;
+
+ limAdmitControlDeleteTS(pMac, pSta->assocId, &addts.tspec.tsinfo, NULL, &tspecIdx);
+ }
+ if (status != eSIR_MAC_SUCCESS_STATUS)
+ {
+ limSendAddtsRspActionFrame(pMac, pHdr->sa, status, &addts, NULL,psessionEntry);
+ return;
+ }
+ }
+#if 0 //only EDCA is supported now.
+ else if (addts.numTclas > 1)
+ {
+ limLog(pMac, LOGE, FL("Sta %d: Too many Tclas (%d), only 1 supported\n"),
+ aid, addts.numTclas);
+ status = (addts.wmeTspecPresent) ?
+ eSIR_MAC_WME_REFUSED_STATUS : eSIR_MAC_UNSPEC_FAILURE_STATUS;
+ }
+ else if (addts.numTclas == 1)
+ {
+ limLog(pMac, LOGW, "AddTs Request from STA %d: tsid %d, UP %d, OK!\n", aid,
+ addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio);
+ status = eSIR_MAC_SUCCESS_STATUS;
+ }
+#endif
+
+ limLog(pMac, LOGW, "AddTs Request from STA %d: Sending AddTs Response with status %d\n",
+ aid, status);
+
+ limSendAddtsRspActionFrame(pMac, pHdr->sa, status, &addts, &schedule,psessionEntry);
+#endif
+}
+
+
+static void
+__limProcessAddTsRsp(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
+{
+ tSirAddtsRspInfo addts;
+ tSirRetStatus retval;
+ tpSirMacMgmtHdr pHdr;
+ tpDphHashNode pSta;
+ tANI_U16 aid;
+ tANI_U32 frameLen;
+ tANI_U8 *pBody;
+ tpLimTspecInfo tspecInfo;
+ tANI_U8 ac;
+ tpDphHashNode pStaDs = NULL;
+ tANI_U8 rspReqd = 1;
+ tANI_U32 cfgLen;
+ tSirMacAddr peerMacAddr;
+
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+ pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
+ frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
+
+
+ PELOGW(limLog(pMac, LOGW, "Recv AddTs Response\n");)
+ if ((psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("AddTsRsp recvd at AP: ignoring\n"));)
+ return;
+ }
+
+ pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
+ if (pSta == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp\n"));)
+ return;
+ }
+
+ retval = sirConvertAddtsRsp2Struct(pMac, pBody, frameLen, &addts);
+ if (retval != eSIR_SUCCESS)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("AddTsRsp parsing failed (error %d)\n"), retval);)
+ return;
+ }
+
+ // don't have to check for qos/wme capabilities since we wouldn't have this
+ // flag set otherwise
+ if (! pMac->lim.gLimAddtsSent)
+ {
+ // we never sent an addts request!
+ PELOGW(limLog(pMac, LOGW, "Recvd AddTsRsp but no request was ever sent - ignoring\n");)
+ return;
+ }
+
+ if (pMac->lim.gLimAddtsReq.req.dialogToken != addts.dialogToken)
+ {
+ limLog(pMac, LOGW, "AddTsRsp: token mismatch (got %d, exp %d) - ignoring\n",
+ addts.dialogToken, pMac->lim.gLimAddtsReq.req.dialogToken);
+ return;
+ }
+
+ /*
+ * for successful addts reponse, try to add the classifier.
+ * if this fails for any reason, we should send a delts request to the ap
+ * for now, its ok not to send a delts since we are going to add support for
+ * multiple tclas soon and until then we won't send any addts requests with
+ * multiple tclas elements anyway.
+ * In case of addClassifier failure, we just let the addts timer run out
+ */
+ if (((addts.tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
+ (addts.tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH)) &&
+ (addts.status == eSIR_MAC_SUCCESS_STATUS))
+ {
+ // add the classifier - this should always succeed
+ if (addts.numTclas > 1) // currently no support for multiple tclas elements
+ {
+ limLog(pMac, LOGE, FL("Sta %d: Too many Tclas (%d), only 1 supported\n"),
+ aid, addts.numTclas);
+ return;
+ }
+ else if (addts.numTclas == 1)
+ {
+ limLog(pMac, LOGW, "AddTs Response from STA %d: tsid %d, UP %d, OK!\n", aid,
+ addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio);
+ }
+ }
+ limLog(pMac, LOGW, "Recv AddTsRsp: tsid %d, UP %d, status %d \n",
+ addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio,
+ addts.status);
+
+ // deactivate the response timer
+ limDeactivateAndChangeTimer(pMac, eLIM_ADDTS_RSP_TIMER);
+
+ if (addts.status != eSIR_MAC_SUCCESS_STATUS)
+ {
+ limLog(pMac, LOGW, "Recv AddTsRsp: tsid %d, UP %d, status %d \n",
+ addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio,
+ addts.status);
+ limSendSmeAddtsRsp(pMac, true, addts.status, psessionEntry, addts.tspec,
+ psessionEntry->smeSessionId, psessionEntry->transactionId);
+
+ // clear the addts flag
+ pMac->lim.gLimAddtsSent = false;
+
+ return;
+ }
+#ifdef FEATURE_WLAN_CCX
+ if (addts.tsmPresent)
+ {
+ limLog(pMac, LOGW, "TSM IE Present\n");
+ psessionEntry->ccxContext.tsm.tid = addts.tspec.tsinfo.traffic.userPrio;
+ vos_mem_copy(&psessionEntry->ccxContext.tsm.tsmInfo,
+ &addts.tsmIE,sizeof(tSirMacCCXTSMIE));
+ limActivateTSMStatsTimer(pMac, psessionEntry);
+ }
+#endif
+ /* Since AddTS response was successful, check for the PSB flag
+ * and directional flag inside the TS Info field.
+ * An AC is trigger enabled AC if the PSB subfield is set to 1
+ * in the uplink direction.
+ * An AC is delivery enabled AC if the PSB subfield is set to 1
+ * in the downlink direction.
+ * An AC is trigger and delivery enabled AC if the PSB subfield
+ * is set to 1 in the bi-direction field.
+ */
+ if (addts.tspec.tsinfo.traffic.psb == 1)
+ limSetTspecUapsdMask(pMac, &addts.tspec.tsinfo, SET_UAPSD_MASK);
+ else
+ limSetTspecUapsdMask(pMac, &addts.tspec.tsinfo, CLEAR_UAPSD_MASK);
+
+
+ /* ADDTS success, so AC is now admitted. We shall now use the default
+ * EDCA parameters as advertised by AP and send the updated EDCA params
+ * to HAL.
+ */
+ ac = upToAc(addts.tspec.tsinfo.traffic.userPrio);
+ if(addts.tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
+ {
+ pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
+ }
+ else if(addts.tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
+ {
+ pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
+ }
+ else if(addts.tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
+ {
+ pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
+ pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
+ }
+
+ limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
+
+ pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
+ if (pStaDs != NULL)
+ {
+ if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
+ limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
+ else
+ limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
+ }
+ else
+ limLog(pMac, LOGE, FL("Self entry missing in Hash Table \n"));
+
+
+ sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
+
+ //if schedule is not present then add TSPEC with svcInterval as 0.
+ if(!addts.schedulePresent)
+ addts.schedule.svcInterval = 0;
+ if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, &addts.tspec, addts.schedule.svcInterval, &tspecInfo))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed \n"));)
+ limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd, &addts.tspec.tsinfo, &addts.tspec,
+ psessionEntry);
+ pMac->lim.gLimAddtsSent = false;
+ return; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
+ }
+ if((addts.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA) ||
+ ((upToAc(addts.tspec.tsinfo.traffic.userPrio) < MAX_NUM_AC) &&
+ (psessionEntry->gLimEdcaParams[upToAc(addts.tspec.tsinfo.traffic.userPrio)].aci.acm)))
+ {
+ retval = limSendHalMsgAddTs(pMac, pSta->staIndex, tspecInfo->idx, addts.tspec, psessionEntry->peSessionId);
+ if(eSIR_SUCCESS != retval)
+ {
+ limAdmitControlDeleteTS(pMac, pSta->assocId, &addts.tspec.tsinfo, NULL, &tspecInfo->idx);
+
+ // Send DELTS action frame to AP
+ cfgLen = sizeof(tSirMacAddr);
+ limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd, &addts.tspec.tsinfo, &addts.tspec,
+ psessionEntry);
+ limSendSmeAddtsRsp(pMac, true, retval, psessionEntry, addts.tspec,
+ psessionEntry->smeSessionId, psessionEntry->transactionId);
+ pMac->lim.gLimAddtsSent = false;
+ return;
+ }
+ PELOGW(limLog(pMac, LOGW, FL("AddTsRsp received successfully(UP %d, TSID %d)\n"),
+ addts.tspec.tsinfo.traffic.userPrio, addts.tspec.tsinfo.traffic.tsid);)
+ }
+ else
+ {
+ PELOGW(limLog(pMac, LOGW, FL("AddTsRsp received successfully(UP %d, TSID %d)\n"),
+ addts.tspec.tsinfo.traffic.userPrio, addts.tspec.tsinfo.traffic.tsid);)
+ PELOGW(limLog(pMac, LOGW, FL("no ACM: Bypass sending WDA_ADD_TS_REQ to HAL \n"));)
+ // Use the smesessionId and smetransactionId from the PE session context
+ limSendSmeAddtsRsp(pMac, true, eSIR_SME_SUCCESS, psessionEntry, addts.tspec,
+ psessionEntry->smeSessionId, psessionEntry->transactionId);
+ }
+
+ // clear the addts flag
+ pMac->lim.gLimAddtsSent = false;
+ return;
+}
+
+
+static void
+__limProcessDelTsReq(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
+{
+ tSirRetStatus retval;
+ tSirDeltsReqInfo delts;
+ tpSirMacMgmtHdr pHdr;
+ tpDphHashNode pSta;
+ tANI_U32 frameLen;
+ tANI_U16 aid;
+ tANI_U8 *pBody;
+ tANI_U8 tsStatus;
+ tSirMacTSInfo *tsinfo;
+ tANI_U8 tspecIdx;
+ tANI_U8 ac;
+ tpDphHashNode pStaDs = NULL;
+
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+ pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
+ frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
+
+ pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
+ if (pSta == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring DelTs\n"));)
+ return;
+ }
+
+ // parse the delts request
+ retval = sirConvertDeltsReq2Struct(pMac, pBody, frameLen, &delts);
+ if (retval != eSIR_SUCCESS)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("DelTs parsing failed (error %d)\n"), retval);)
+ return;
+ }
+
+ if (delts.wmeTspecPresent)
+ {
+ if ((!psessionEntry->limWmeEnabled) || (! pSta->wmeEnabled))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Ignoring delts request: wme not enabled/capable\n"));)
+ return;
+ }
+ PELOG2(limLog(pMac, LOG2, FL("WME Delts received\n"));)
+ }
+ else if ((psessionEntry->limQosEnabled) && pSta->lleEnabled)
+ {
+ PELOG2(limLog(pMac, LOG2, FL("11e QoS Delts received\n"));)
+ }
+ else if ((psessionEntry->limWsmEnabled) && pSta->wsmEnabled)
+ {
+ PELOG2(limLog(pMac, LOG2, FL("WSM Delts received\n"));)
+ }
+ else
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Ignoring delts request: qos not enabled/capable\n"));)
+ return;
+ }
+
+ tsinfo = delts.wmeTspecPresent ? &delts.tspec.tsinfo : &delts.tsinfo;
+
+ // if no Admit Control, ignore the request
+ if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA))
+ {
+
+#if(defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+ if ((psessionEntry->limSystemRole == eLIM_AP_ROLE &&
+ (! psessionEntry->gLimEdcaParamsBC[upToAc(tsinfo->traffic.userPrio)].aci.acm)) ||
+ (psessionEntry->limSystemRole != eLIM_AP_ROLE &&
+ (! psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)))
+#else
+ if ((upToAc(tsinfo->traffic.userPrio) >= MAX_NUM_AC) || (! psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm))
+#endif
+ {
+ limLog(pMac, LOGW, FL("DelTs with UP %d has no AC - ignoring request\n"),
+ tsinfo->traffic.userPrio);
+ return;
+ }
+ }
+
+ // try to delete the TS
+ if (eSIR_SUCCESS != limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Unable to Delete TS\n"));)
+ return;
+ }
+
+ else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
+ (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
+ {
+ //Edca only for now.
+ }
+ else
+ {
+ //send message to HAL to delete TS
+ if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac, pSta->staIndex, tspecIdx, delts))
+ {
+ limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request\n"),
+ tsinfo->traffic.userPrio);
+ return;
+ }
+ }
+
+ /* We successfully deleted the TSPEC. Update the dynamic UAPSD Mask.
+ * The AC for this TSPEC is no longer trigger enabled if this Tspec
+ * was set-up in uplink direction only.
+ * The AC for this TSPEC is no longer delivery enabled if this Tspec
+ * was set-up in downlink direction only.
+ * The AC for this TSPEC is no longer triiger enabled and delivery
+ * enabled if this Tspec was a bidirectional TSPEC.
+ */
+ limSetTspecUapsdMask(pMac, tsinfo, CLEAR_UAPSD_MASK);
+
+
+ /* We're deleting the TSPEC.
+ * The AC for this TSPEC is no longer admitted in uplink/downlink direction
+ * if this TSPEC was set-up in uplink/downlink direction only.
+ * The AC for this TSPEC is no longer admitted in both uplink and downlink
+ * directions if this TSPEC was a bi-directional TSPEC.
+ * If ACM is set for this AC and this AC is admitted only in downlink
+ * direction, PE needs to downgrade the EDCA parameter
+ * (for the AC for which TS is being deleted) to the
+ * next best AC for which ACM is not enabled, and send the
+ * updated values to HAL.
+ */
+ ac = upToAc(tsinfo->traffic.userPrio);
+
+ if(tsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
+ {
+ pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
+ }
+ else if(tsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
+ {
+ pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
+ }
+ else if(tsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
+ {
+ pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
+ pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
+ }
+
+ limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
+
+ pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
+ if (pStaDs != NULL)
+ {
+ if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
+ limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
+ else
+ limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
+ }
+ else
+ limLog(pMac, LOGE, FL("Self entry missing in Hash Table \n"));
+
+ PELOG1(limLog(pMac, LOG1, FL("DeleteTS succeeded\n"));)
+ if((psessionEntry->limSystemRole != eLIM_AP_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE))
+ limSendSmeDeltsInd(pMac, &delts, aid,psessionEntry);
+
+#ifdef FEATURE_WLAN_CCX
+ limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
+#endif
+
+}
+
+
+#ifdef ANI_SUPPORT_11H
+/**
+ * limProcessBasicMeasReq
+ *
+ *FUNCTION:
+ * This function is called by limProcessMeasurementRequestFrame()
+ * when it received a Basic measurement Request action frame.
+ * Station/BP receiving this should perform basic measurements
+ * and then send Basic Measurement Report. AP should not perform
+ * any measurements, and send report indicating refusal.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pMeasReqFrame - A pointer to Basic Meas. Req structure
+ * @return None
+ */
+static void
+__limProcessBasicMeasReq(tpAniSirGlobal pMac,
+ tpSirMacMeasReqActionFrame pMeasReqFrame,
+ tSirMacAddr peerMacAddr)
+{
+ // TBD - Station shall perform basic measurements
+
+ if (limSendMeasReportFrame(pMac,
+ pMeasReqFrame,
+ peerMacAddr) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("fail to send Basic Meas report \n"));)
+ return;
+ }
+}
+
+
+/**
+ * limProcessCcaMeasReq
+ *
+ *FUNCTION:
+ * This function is called by limProcessMeasurementRequestFrame()
+ * when it received a CCA measurement Request action frame.
+ * Station/BP receiving this should perform CCA measurements
+ * and then send CCA Measurement Report. AP should not perform
+ * any measurements, and send report indicating refusal.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pMeasReqFrame - A pointer to CCA Meas. Req structure
+ * @return None
+ */
+static void
+__limProcessCcaMeasReq(tpAniSirGlobal pMac,
+ tpSirMacMeasReqActionFrame pMeasReqFrame,
+ tSirMacAddr peerMacAddr)
+{
+ // TBD - Station shall perform cca measurements
+
+ if (limSendMeasReportFrame(pMac,
+ pMeasReqFrame,
+ peerMacAddr) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("fail to send CCA Meas report \n"));)
+ return;
+ }
+}
+
+
+/**
+ * __limProcessRpiMeasReq
+ *
+ *FUNCTION:
+ * This function is called by limProcessMeasurementRequestFrame()
+ * when it received a RPI measurement Request action frame.
+ * Station/BP/AP receiving this shall not perform any measurements,
+ * and send report indicating refusal.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pMeasReqFrame - A pointer to RPI Meas. Req structure
+ * @return None
+ */
+static void
+__limProcessRpiMeasReq(tpAniSirGlobal pMac,
+ tpSirMacMeasReqActionFrame pMeasReqFrame,
+ tSirMacAddr peerMacAddr)
+{
+ if (limSendMeasReportFrame(pMac,
+ pMeasReqFrame,
+ peerMacAddr) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("fail to send RPI Meas report \n"));)
+ return;
+ }
+}
+
+
+/**
+ * __limProcessMeasurementRequestFrame
+ *
+ *FUNCTION:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param *pRxPacketInfo - A pointer to packet info structure
+ * @return None
+ */
+
+static void
+__limProcessMeasurementRequestFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo)
+{
+ tpSirMacMgmtHdr pHdr;
+ tANI_U8 *pBody;
+ tpSirMacMeasReqActionFrame pMeasReqFrame;
+ tANI_U32 frameLen;
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+ pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
+ frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
+
+ if ( eHAL_STATUS_SUCCESS !=
+ palAllocateMemory( pMac->hHdd, (void **)&pMeasReqFrame, sizeof( tSirMacMeasReqActionFrame ) ) )
+ {
+ limLog(pMac, LOGE,
+ FL("limProcessMeasurementRequestFrame: palAllocateMemory failed \n"));
+ return;
+ }
+
+ if (sirConvertMeasReqFrame2Struct(pMac, pBody, pMeasReqFrame, frameLen) !=
+ eSIR_SUCCESS)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Rcv invalid Measurement Request Action Frame \n"));)
+ return;
+ }
+
+
+ switch(pMeasReqFrame->measReqIE.measType)
+ {
+ case SIR_MAC_BASIC_MEASUREMENT_TYPE:
+ __limProcessBasicMeasReq(pMac, pMeasReqFrame, pHdr->sa);
+ break;
+
+ case SIR_MAC_CCA_MEASUREMENT_TYPE:
+ __limProcessCcaMeasReq(pMac, pMeasReqFrame, pHdr->sa);
+ break;
+
+ case SIR_MAC_RPI_MEASUREMENT_TYPE:
+ __limProcessRpiMeasReq(pMac, pMeasReqFrame, pHdr->sa);
+ break;
+
+ default:
+ PELOG1(limLog(pMac, LOG1, FL("Unknown Measurement Type %d \n"),
+ pMeasReqFrame->measReqIE.measType);)
+ break;
+ }
+
+} /*** end limProcessMeasurementRequestFrame ***/
+
+
+/**
+ * limProcessTpcRequestFrame
+ *
+ *FUNCTION:
+ * This function is called upon receiving Tpc Request frame.
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param *pRxPacketInfo - A pointer to packet info structure
+ * @return None
+ */
+
+static void
+__limProcessTpcRequestFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo)
+{
+ tpSirMacMgmtHdr pHdr;
+ tANI_U8 *pBody;
+ tpSirMacTpcReqActionFrame pTpcReqFrame;
+ tANI_U32 frameLen;
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+ pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
+ frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
+
+ PELOG1(limLog(pMac, LOG1, FL("****LIM: Processing TPC Request from peer ****"));)
+
+ if ( eHAL_STATUS_SUCCESS !=
+ palAllocateMemory( pMac->hHdd, (void **)&pTpcReqFrame, sizeof( tSirMacTpcReqActionFrame ) ) )
+ {
+ PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory failed \n"));)
+ return;
+ }
+
+ if (sirConvertTpcReqFrame2Struct(pMac, pBody, pTpcReqFrame, frameLen) !=
+ eSIR_SUCCESS)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Rcv invalid TPC Req Action Frame \n"));)
+ return;
+ }
+
+ if (limSendTpcReportFrame(pMac,
+ pTpcReqFrame,
+ pHdr->sa) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("fail to send TPC Report Frame. \n"));)
+ return;
+ }
+}
+#endif
+
+
+/**
+ * \brief Validate an ADDBA Req from peer with respect
+ * to our own BA configuration
+ *
+ * \sa __limValidateAddBAParameterSet
+ *
+ * \param pMac The global tpAniSirGlobal object
+ *
+ * \param baParameterSet The ADDBA Parameter Set.
+ *
+ * \param pDelBAFlag this parameter is NULL except for call from processAddBAReq
+ * delBAFlag is set when entry already exists.
+ *
+ * \param reqType ADDBA Req v/s ADDBA Rsp
+ * 1 - ADDBA Req
+ * 0 - ADDBA Rsp
+ *
+ * \return eSIR_SUCCESS if setup completes successfully
+ * eSIR_FAILURE is some problem is encountered
+ */
+
+static tSirMacStatusCodes
+__limValidateAddBAParameterSet( tpAniSirGlobal pMac,
+ tpDphHashNode pSta,
+ tDot11fFfAddBAParameterSet baParameterSet,
+ tANI_U8 dialogueToken,
+ tLimAddBaValidationReqType reqType ,
+ tANI_U8* pDelBAFlag /*this parameter is NULL except for call from processAddBAReq*/)
+{
+ if(baParameterSet.tid >= STACFG_MAX_TC)
+ {
+ return eSIR_MAC_WME_INVALID_PARAMS_STATUS;
+ }
+
+ //check if there is already a BA session setup with this STA/TID while processing AddBaReq
+ if((true == pSta->tcCfg[baParameterSet.tid].fUseBARx) &&
+ (LIM_ADDBA_REQ == reqType))
+ {
+ //There is already BA session setup for STA/TID.
+ limLog( pMac, LOGW,
+ FL( "AddBAReq rcvd when there is already a session for this StaId = %d, tid = %d\n " ),
+ pSta->staIndex, baParameterSet.tid);
+ limPrintMacAddr( pMac, pSta->staAddr, LOGW );
+
+ if(pDelBAFlag)
+ *pDelBAFlag = true;
+ }
+ return eSIR_MAC_SUCCESS_STATUS;
+}
+
+/**
+ * \brief Validate a DELBA Ind from peer with respect
+ * to our own BA configuration
+ *
+ * \sa __limValidateDelBAParameterSet
+ *
+ * \param pMac The global tpAniSirGlobal object
+ *
+ * \param baParameterSet The DELBA Parameter Set.
+ *
+ * \param pSta Runtime, STA-related configuration cached
+ * in the HashNode object
+ *
+ * \return eSIR_SUCCESS if setup completes successfully
+ * eSIR_FAILURE is some problem is encountered
+ */
+static tSirMacStatusCodes
+__limValidateDelBAParameterSet( tpAniSirGlobal pMac,
+ tDot11fFfDelBAParameterSet baParameterSet,
+ tpDphHashNode pSta )
+{
+tSirMacStatusCodes statusCode = eSIR_MAC_STA_BLK_ACK_NOT_SUPPORTED_STATUS;
+
+ // Validate if a BA is active for the requested TID
+ if( pSta->tcCfg[baParameterSet.tid].fUseBATx ||
+ pSta->tcCfg[baParameterSet.tid].fUseBARx )
+ {
+ statusCode = eSIR_MAC_SUCCESS_STATUS;
+
+ limLog( pMac, LOGW,
+ FL("Valid DELBA Ind received. Time to send WDA_DELBA_IND to HAL...\n"));
+ }
+ else
+ limLog( pMac, LOGW,
+ FL("Received an INVALID DELBA Ind for TID %d...\n"),
+ baParameterSet.tid );
+
+ return statusCode;
+}
+
+/**
+ * \brief Process an ADDBA REQ
+ *
+ * \sa limProcessAddBAReq
+ *
+ * \param pMac The global tpAniSirGlobal object
+ *
+ * \param pRxPacketInfo Handle to the Rx packet info from HDD
+ *
+ * \return none
+ *
+ */
+static void
+__limProcessAddBAReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
+{
+ tDot11fAddBAReq frmAddBAReq;
+ tpSirMacMgmtHdr pHdr;
+ tpDphHashNode pSta;
+ tSirMacStatusCodes status = eSIR_MAC_SUCCESS_STATUS;
+ tANI_U16 aid;
+ tANI_U32 frameLen, nStatus;
+ tANI_U8 *pBody;
+ tANI_U8 delBAFlag =0;
+
+ pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
+ pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
+ frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
+
+ // Unpack the received frame
+ nStatus = dot11fUnpackAddBAReq( pMac, pBody, frameLen, &frmAddBAReq );
+ if( DOT11F_FAILED( nStatus ))
+ {
+ limLog( pMac, LOGE,
+ FL("Failed to unpack and parse an ADDBA Request (0x%08x, %d bytes):\n"),
+ nStatus,
+ frameLen );
+
+ PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
+
+ // Without an unpacked request we cannot respond, so silently ignore the request
+ return;
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW,
+ FL( "There were warnings while unpacking an ADDBA Request (0x%08x, %d bytes):\n"),
+ nStatus,
+ frameLen );
+
+ PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
+ }
+
+ pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
+ if( pSta == NULL )
+ {
+ limLog( pMac, LOGE,
+ FL( "STA context not found - ignoring ADDBA from \n" ));
+ limPrintMacAddr( pMac, pHdr->sa, LOGW );
+
+ // FIXME - Should we do this?
+ status = eSIR_MAC_INABLITY_TO_CONFIRM_ASSOC_STATUS;
+ goto returnAfterError;
+ }
+
+ limLog( pMac, LOGW,
+ FL( "ADDBA Req from STA with AID %d, tid = %d\n" ),
+ aid, frmAddBAReq.AddBAParameterSet.tid);
+
+#ifdef WLAN_SOFTAP_VSTA_FEATURE
+ // we can only do BA on "hard" STAs
+ if (!(IS_HWSTA_IDX(pSta->staIndex)))
+ {
+ status = eSIR_MAC_REQ_DECLINED_STATUS;
+ goto returnAfterError;
+ }
+#endif //WLAN_SOFTAP_VSTA_FEATURE
+
+
+ // Now, validate the ADDBA Req
+ if( eSIR_MAC_SUCCESS_STATUS !=
+ (status = __limValidateAddBAParameterSet( pMac, pSta,
+ frmAddBAReq.AddBAParameterSet,
+ 0, //dialogue token is don't care in request validation.
+ LIM_ADDBA_REQ, &delBAFlag)))
+ goto returnAfterError;
+
+ //BA already set, so we need to delete it before adding new one.
+ if(delBAFlag)
+ {
+ if( eSIR_SUCCESS != limPostMsgDelBAInd( pMac,
+ pSta,
+ (tANI_U8)frmAddBAReq.AddBAParameterSet.tid,
+ eBA_RECIPIENT,psessionEntry))
+ {
+ status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+ goto returnAfterError;
+ }
+ }
+
+ // Check if the ADD BA Declined configuration is Disabled
+ if ((pMac->lim.gAddBA_Declined & ( 1 << frmAddBAReq.AddBAParameterSet.tid ) )) {
+ limLog( pMac, LOGE, FL( "Declined the ADDBA Req for the TID %d \n" ),
+ frmAddBAReq.AddBAParameterSet.tid);
+ status = eSIR_MAC_REQ_DECLINED_STATUS;
+ goto returnAfterError;
+ }
+
+ //
+ // Post WDA_ADDBA_REQ to HAL.
+ // If HAL/HDD decide to allow this ADDBA Req session,
+ // then this BA session is termed active
+ //
+
+ // Change the Block Ack state of this STA to wait for
+ // ADDBA Rsp from HAL
+ LIM_SET_STA_BA_STATE(pSta, frmAddBAReq.AddBAParameterSet.tid, eLIM_BA_STATE_WT_ADD_RSP);
+
+ if( eSIR_SUCCESS != limPostMsgAddBAReq( pMac,
+ pSta,
+ (tANI_U8) frmAddBAReq.DialogToken.token,
+ (tANI_U8) frmAddBAReq.AddBAParameterSet.tid,
+ (tANI_U8) frmAddBAReq.AddBAParameterSet.policy,
+ frmAddBAReq.AddBAParameterSet.bufferSize,
+ frmAddBAReq.BATimeout.timeout,
+ (tANI_U16) frmAddBAReq.BAStartingSequenceControl.ssn,
+ eBA_RECIPIENT,psessionEntry))
+ status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+ else
+ return;
+
+returnAfterError:
+
+ //
+ // Package LIM_MLM_ADDBA_RSP to MLME, with proper
+ // status code. MLME will then send an ADDBA RSP
+ // over the air to the peer MAC entity
+ //
+ if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
+ pHdr->sa,
+ status,
+ frmAddBAReq.DialogToken.token,
+ (tANI_U8) frmAddBAReq.AddBAParameterSet.tid,
+ (tANI_U8) frmAddBAReq.AddBAParameterSet.policy,
+ frmAddBAReq.AddBAParameterSet.bufferSize,
+ frmAddBAReq.BATimeout.timeout,psessionEntry))
+ {
+ limLog( pMac, LOGW,
+ FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
+ limPrintMacAddr( pMac, pHdr->sa, LOGW );
+ }
+
+}
+
+/**
+ * \brief Process an ADDBA RSP
+ *
+ * \sa limProcessAddBARsp
+ *
+ * \param pMac The global tpAniSirGlobal object
+ *
+ * \param pRxPacketInfo Handle to the packet info structure from HDD
+ *
+ * \return none
+ *
+ */
+static void
+__limProcessAddBARsp( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
+{
+tDot11fAddBARsp frmAddBARsp;
+tpSirMacMgmtHdr pHdr;
+tpDphHashNode pSta;
+tSirMacReasonCodes reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
+tANI_U16 aid;
+tANI_U32 frameLen, nStatus;
+tANI_U8 *pBody;
+
+ pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
+ pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
+ frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
+
+ pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
+ if( pSta == NULL )
+ {
+ limLog( pMac, LOGE,
+ FL( "STA context not found - ignoring ADDBA from \n" ));
+ limPrintMacAddr( pMac, pHdr->sa, LOGW );
+ return;
+ }
+
+#ifdef WLAN_SOFTAP_VSTA_FEATURE
+ // We can only do BA on "hard" STAs. We should not have issued an ADDBA
+ // Request, so we should never be processing a ADDBA Response
+ if (!(IS_HWSTA_IDX(pSta->staIndex)))
+ {
+ return;
+ }
+#endif //WLAN_SOFTAP_VSTA_FEATURE
+
+ // Unpack the received frame
+ nStatus = dot11fUnpackAddBARsp( pMac, pBody, frameLen, &frmAddBARsp );
+ if( DOT11F_FAILED( nStatus ))
+ {
+ limLog( pMac, LOGE,
+ FL( "Failed to unpack and parse an ADDBA Response (0x%08x, %d bytes):\n"),
+ nStatus,
+ frameLen );
+
+ PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
+ goto returnAfterError;
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW,
+ FL( "There were warnings while unpacking an ADDBA Response (0x%08x, %d bytes):\n"),
+ nStatus,
+ frameLen );
+
+ PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
+ }
+
+ limLog( pMac, LOGW,
+ FL( "ADDBA Rsp from STA with AID %d, tid = %d, status = %d\n" ),
+ aid, frmAddBARsp.AddBAParameterSet.tid, frmAddBARsp.Status.status);
+
+ //if there is no matchin dialougue token then ignore the response.
+
+ if(eSIR_SUCCESS != limSearchAndDeleteDialogueToken(pMac, frmAddBARsp.DialogToken.token,
+ pSta->assocId, frmAddBARsp.AddBAParameterSet.tid))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("dialogueToken in received addBARsp did not match with outstanding requests\n"));)
+ return;
+ }
+
+ // Check first if the peer accepted the ADDBA Req
+ if( eSIR_MAC_SUCCESS_STATUS == frmAddBARsp.Status.status )
+ {
+ //if peer responded with buffer size 0 then we should pick the default.
+ if(0 == frmAddBARsp.AddBAParameterSet.bufferSize)
+ frmAddBARsp.AddBAParameterSet.bufferSize = BA_DEFAULT_TX_BUFFER_SIZE;
+
+ // Now, validate the ADDBA Rsp
+ if( eSIR_MAC_SUCCESS_STATUS !=
+ __limValidateAddBAParameterSet( pMac, pSta,
+ frmAddBARsp.AddBAParameterSet,
+ (tANI_U8)frmAddBARsp.DialogToken.token,
+ LIM_ADDBA_RSP, NULL))
+ goto returnAfterError;
+ }
+ else
+ goto returnAfterError;
+
+ // Change STA state to wait for ADDBA Rsp from HAL
+ LIM_SET_STA_BA_STATE(pSta, frmAddBARsp.AddBAParameterSet.tid, eLIM_BA_STATE_WT_ADD_RSP);
+
+ //
+ // Post WDA_ADDBA_REQ to HAL.
+ // If HAL/HDD decide to allow this ADDBA Rsp session,
+ // then this BA session is termed active
+ //
+
+ if( eSIR_SUCCESS != limPostMsgAddBAReq( pMac,
+ pSta,
+ (tANI_U8) frmAddBARsp.DialogToken.token,
+ (tANI_U8) frmAddBARsp.AddBAParameterSet.tid,
+ (tANI_U8) frmAddBARsp.AddBAParameterSet.policy,
+ frmAddBARsp.AddBAParameterSet.bufferSize,
+ frmAddBARsp.BATimeout.timeout,
+ 0,
+ eBA_INITIATOR,psessionEntry))
+ reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
+ else
+ return;
+
+returnAfterError:
+
+ // TODO: Do we need to signal an error status to SME,
+ // if status != eSIR_MAC_SUCCESS_STATUS
+
+ // Restore STA "BA" State
+ LIM_SET_STA_BA_STATE(pSta, frmAddBARsp.AddBAParameterSet.tid, eLIM_BA_STATE_IDLE);
+ //
+ // Need to send a DELBA IND to peer, who
+ // would have setup a BA session with this STA
+ //
+ if( eSIR_MAC_SUCCESS_STATUS == frmAddBARsp.Status.status )
+ {
+ //
+ // Package LIM_MLM_DELBA_REQ to MLME, with proper
+ // status code. MLME will then send a DELBA IND
+ // over the air to the peer MAC entity
+ //
+ if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
+ pSta,
+ eBA_INITIATOR,
+ (tANI_U8) frmAddBARsp.AddBAParameterSet.tid,
+ reasonCode, psessionEntry))
+ {
+ limLog( pMac, LOGW,
+ FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
+ limPrintMacAddr( pMac, pHdr->sa, LOGW );
+ }
+ }
+}
+
+/**
+ * \brief Process a DELBA Indication
+ *
+ * \sa limProcessDelBAInd
+ *
+ * \param pMac The global tpAniSirGlobal object
+ *
+ * \param pRxPacketInfo Handle to the Rx packet info from HDD
+ *
+ * \return none
+ *
+ */
+static void
+__limProcessDelBAReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
+{
+tDot11fDelBAInd frmDelBAInd;
+tpSirMacMgmtHdr pHdr;
+tpDphHashNode pSta;
+tANI_U16 aid;
+tANI_U32 frameLen, nStatus;
+tANI_U8 *pBody;
+
+ pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
+ pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
+ frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
+
+ pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
+ if( pSta == NULL )
+ {
+ limLog( pMac, LOGE, FL( "STA context not found - ignoring DELBA from \n"));
+ limPrintMacAddr( pMac, pHdr->sa, LOGW );
+ return;
+ }
+
+ limLog( pMac, LOG1, FL( "DELBA Ind from STA with AID %d\n" ), aid );
+
+ // Unpack the received frame
+ nStatus = dot11fUnpackDelBAInd( pMac, pBody, frameLen, &frmDelBAInd );
+ if( DOT11F_FAILED( nStatus ))
+ {
+ limLog( pMac, LOGE,
+ FL( "Failed to unpack and parse a DELBA Indication (0x%08x, %d bytes):\n"),
+ nStatus,
+ frameLen );
+
+ PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
+ return;
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW,
+ FL( "There were warnings while unpacking a DELBA Indication (0x%08x, %d bytes):\n"),
+ nStatus,
+ frameLen );
+
+ PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
+ }
+
+ limLog( pMac, LOGW,
+ FL( "Received DELBA for TID %d, Reason code %d\n" ),
+ frmDelBAInd.DelBAParameterSet.tid,
+ frmDelBAInd.Reason.code );
+
+ // Now, validate the DELBA Ind
+ if( eSIR_MAC_SUCCESS_STATUS != __limValidateDelBAParameterSet( pMac,
+ frmDelBAInd.DelBAParameterSet,
+ pSta ))
+ return;
+
+ //
+ // Post WDA_DELBA_IND to HAL and delete the
+ // existing BA session
+ //
+ // NOTE - IEEE 802.11-REVma-D8.0, Section 7.3.1.16
+ // is kind of confusing...
+ //
+ if( eSIR_SUCCESS != limPostMsgDelBAInd( pMac,
+ pSta,
+ (tANI_U8) frmDelBAInd.DelBAParameterSet.tid,
+ (eBA_RECIPIENT == frmDelBAInd.DelBAParameterSet.initiator)?
+ eBA_INITIATOR: eBA_RECIPIENT,psessionEntry))
+ limLog( pMac, LOGE, FL( "Posting WDA_DELBA_IND to HAL failed \n"));
+
+ return;
+
+}
+
+static void
+__limProcessSMPowerSaveUpdate(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry)
+{
+
+#if 0
+ tpSirMacMgmtHdr pHdr;
+ tDot11fSMPowerSave frmSMPower;
+ tSirMacHTMIMOPowerSaveState state;
+ tpDphHashNode pSta;
+ tANI_U16 aid;
+ tANI_U32 frameLen, nStatus;
+ tANI_U8 *pBody;
+
+ pHdr = SIR_MAC_BD_TO_MPDUHEADER( pBd );
+ pBody = SIR_MAC_BD_TO_MPDUDATA( pBd );
+ frameLen = SIR_MAC_BD_TO_PAYLOAD_LEN( pBd );
+
+ pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
+ if( pSta == NULL ) {
+ limLog( pMac, LOGE,FL( "STA context not found - ignoring UpdateSM PSave Mode from \n" ));
+ limPrintMacAddr( pMac, pHdr->sa, LOGW );
+ return;
+ }
+
+ /**Unpack the received frame */
+ nStatus = dot11fUnpackSMPowerSave( pMac, pBody, frameLen, &frmSMPower);
+
+ if( DOT11F_FAILED( nStatus )) {
+ limLog( pMac, LOGE, FL( "Failed to unpack and parse a Update SM Power (0x%08x, %d bytes):\n"),
+ nStatus, frameLen );
+ PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
+ return;
+ }else if ( DOT11F_WARNED( nStatus ) ) {
+ limLog(pMac, LOGW, FL( "There were warnings while unpacking a SMPower Save update (0x%08x, %d bytes):\n"),
+ nStatus, frameLen );
+ PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
+ }
+
+ limLog(pMac, LOGW, FL("Received SM Power save Mode update Frame with PS_Enable:%d"
+ "PS Mode: %d"), frmSMPower.SMPowerModeSet.PowerSave_En,
+ frmSMPower.SMPowerModeSet.Mode);
+
+ /** Update in the DPH Table about the Update in the SM Power Save mode*/
+ if (frmSMPower.SMPowerModeSet.PowerSave_En && frmSMPower.SMPowerModeSet.Mode)
+ state = eSIR_HT_MIMO_PS_DYNAMIC;
+ else if ((frmSMPower.SMPowerModeSet.PowerSave_En) && (frmSMPower.SMPowerModeSet.Mode ==0))
+ state = eSIR_HT_MIMO_PS_STATIC;
+ else if ((frmSMPower.SMPowerModeSet.PowerSave_En == 0) && (frmSMPower.SMPowerModeSet.Mode == 0))
+ state = eSIR_HT_MIMO_PS_NO_LIMIT;
+ else {
+ PELOGW(limLog(pMac, LOGW, FL("Received SM Power save Mode update Frame with invalid mode"));)
+ return;
+ }
+
+ if (state == pSta->htMIMOPSState) {
+ PELOGE(limLog(pMac, LOGE, FL("The PEER is already set in the same mode"));)
+ return;
+ }
+
+ /** Update in the HAL Station Table for the Update of the Protection Mode */
+ pSta->htMIMOPSState = state;
+ limPostSMStateUpdate(pMac,pSta->staIndex, pSta->htMIMOPSState);
+
+#endif
+
+}
+
+#if defined WLAN_FEATURE_VOWIFI
+
+static void
+__limProcessRadioMeasureRequest( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
+{
+ tpSirMacMgmtHdr pHdr;
+ tDot11fRadioMeasurementRequest frm;
+ tANI_U32 frameLen, nStatus;
+ tANI_U8 *pBody;
+
+ pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
+ pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
+ frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
+
+ if( psessionEntry == NULL )
+ {
+ return;
+ }
+
+ /**Unpack the received frame */
+ nStatus = dot11fUnpackRadioMeasurementRequest( pMac, pBody, frameLen, &frm );
+
+ if( DOT11F_FAILED( nStatus )) {
+ limLog( pMac, LOGE, FL( "Failed to unpack and parse a Radio Measure request (0x%08x, %d bytes):\n"),
+ nStatus, frameLen );
+ PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
+ return;
+ }else if ( DOT11F_WARNED( nStatus ) ) {
+ limLog(pMac, LOGW, FL( "There were warnings while unpacking a Radio Measure request (0x%08x, %d bytes):\n"),
+ nStatus, frameLen );
+ PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
+ }
+
+ // Call rrm function to handle the request.
+
+ rrmProcessRadioMeasurementRequest( pMac, pHdr->sa, &frm, psessionEntry );
+}
+
+static void
+__limProcessLinkMeasurementReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
+{
+ tpSirMacMgmtHdr pHdr;
+ tDot11fLinkMeasurementRequest frm;
+ tANI_U32 frameLen, nStatus;
+ tANI_U8 *pBody;
+
+ pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
+ pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
+ frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
+
+ if( psessionEntry == NULL )
+ {
+ return;
+ }
+
+ /**Unpack the received frame */
+ nStatus = dot11fUnpackLinkMeasurementRequest( pMac, pBody, frameLen, &frm );
+
+ if( DOT11F_FAILED( nStatus )) {
+ limLog( pMac, LOGE, FL( "Failed to unpack and parse a Link Measure request (0x%08x, %d bytes):\n"),
+ nStatus, frameLen );
+ PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
+ return;
+ }else if ( DOT11F_WARNED( nStatus ) ) {
+ limLog(pMac, LOGW, FL( "There were warnings while unpacking a Link Measure request (0x%08x, %d bytes):\n"),
+ nStatus, frameLen );
+ PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
+ }
+
+ // Call rrm function to handle the request.
+
+ rrmProcessLinkMeasurementRequest( pMac, pRxPacketInfo, &frm, psessionEntry );
+
+}
+
+static void
+__limProcessNeighborReport( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
+{
+ tpSirMacMgmtHdr pHdr;
+ tDot11fNeighborReportResponse frm;
+ tANI_U32 frameLen, nStatus;
+ tANI_U8 *pBody;
+
+ pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
+ pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
+ frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
+
+ if( psessionEntry == NULL )
+ {
+ return;
+ }
+
+ /**Unpack the received frame */
+ nStatus = dot11fUnpackNeighborReportResponse( pMac, pBody, frameLen, &frm );
+
+ if( DOT11F_FAILED( nStatus )) {
+ limLog( pMac, LOGE, FL( "Failed to unpack and parse a Neighbor report response (0x%08x, %d bytes):\n"),
+ nStatus, frameLen );
+ PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
+ return;
+ }else if ( DOT11F_WARNED( nStatus ) ) {
+ limLog(pMac, LOGW, FL( "There were warnings while unpacking a Neighbor report response (0x%08x, %d bytes):\n"),
+ nStatus, frameLen );
+ PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
+ }
+
+ //Call rrm function to handle the request.
+ rrmProcessNeighborReportResponse( pMac, &frm, psessionEntry );
+
+}
+
+#endif
+
+#ifdef WLAN_FEATURE_11W
+/**
+ * limProcessActionFrame
+ *
+ *FUNCTION:
+ * This function is called by limProcessActionFrame() upon
+ * SA query request Action frame reception.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param *pBd - A pointer to Buffer descriptor + associated PDUs
+ * @return None
+ */
+static void __limProcessSAQueryRequestActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
+{
+ tpSirMacMgmtHdr pHdr;
+ tANI_U8 *pBody;
+ tANI_U16 transId = 0;
+
+ /* Prima --- Below Macro not available in prima
+ pHdr = SIR_MAC_BD_TO_MPDUHEADER(pBd);
+ pBody = SIR_MAC_BD_TO_MPDUDATA(pBd); */
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+ pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
+
+ /*Extract 11w trsansId from SA query request action frame
+ In SA query response action frame we will send same transId
+ In SA query request action frame:
+ Category : 1 byte
+ Action : 1 byte
+ Transaction ID : 2 bbytes */
+
+ transId = pBody[2];
+ transId = transId << 8;
+ transId |= pBody[3];
+
+ //Send 11w SA query response action frame
+ if (limSendSaQueryResponseFrame(pMac,
+ transId,
+ pHdr->sa,psessionEntry) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("fail to send SA query response action frame. \n"));)
+ return;
+ }
+}
+
+#endif
+
+/**
+ * limProcessActionFrame
+ *
+ *FUNCTION:
+ * This function is called by limProcessMessageQueue() upon
+ * Action frame reception.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param *pRxPacketInfo - A pointer to packet info structure
+ * @return None
+ */
+
+void
+limProcessActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
+{
+ tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
+ tpSirMacActionFrameHdr pActionHdr = (tpSirMacActionFrameHdr) pBody;
+
+
+ switch (pActionHdr->category)
+ {
+ case SIR_MAC_ACTION_QOS_MGMT:
+ if (psessionEntry->limQosEnabled)
+ {
+ switch (pActionHdr->actionID)
+ {
+ case SIR_MAC_QOS_ADD_TS_REQ:
+ __limProcessAddTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
+ break;
+
+ case SIR_MAC_QOS_ADD_TS_RSP:
+ __limProcessAddTsRsp(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
+ break;
+
+ case SIR_MAC_QOS_DEL_TS_REQ:
+ __limProcessDelTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
+ break;
+
+ default:
+ PELOGE(limLog(pMac, LOGE, FL("Qos action %d not handled\n"), pActionHdr->actionID);)
+ break;
+ }
+ break ;
+ }
+
+ break;
+
+ case SIR_MAC_ACTION_SPECTRUM_MGMT:
+ switch (pActionHdr->actionID)
+ {
+#ifdef ANI_SUPPORT_11H
+ case SIR_MAC_ACTION_MEASURE_REQUEST_ID:
+ if(psessionEntry->lim11hEnable)
+ {
+ __limProcessMeasurementRequestFrame(pMac, pRxPacketInfo);
+ }
+ break;
+
+ case SIR_MAC_ACTION_TPC_REQUEST_ID:
+ if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) ||
+ (pessionEntry->limSystemRole == eLIM_AP_ROLE))
+ {
+ if(psessionEntry->lim11hEnable)
+ {
+ __limProcessTpcRequestFrame(pMac, pRxPacketInfo);
+ }
+ }
+ break;
+
+#endif
+ case SIR_MAC_ACTION_CHANNEL_SWITCH_ID:
+ if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
+ {
+ __limProcessChannelSwitchActionFrame(pMac, pRxPacketInfo,psessionEntry);
+ }
+ break;
+ default:
+ PELOGE(limLog(pMac, LOGE, FL("Spectrum mgmt action id %d not handled\n"), pActionHdr->actionID);)
+ break;
+ }
+ break;
+
+ case SIR_MAC_ACTION_WME:
+ if (! psessionEntry->limWmeEnabled)
+ {
+ limLog(pMac, LOGW, FL("WME mode disabled - dropping action frame %d\n"),
+ pActionHdr->actionID);
+ break;
+ }
+ switch(pActionHdr->actionID)
+ {
+ case SIR_MAC_QOS_ADD_TS_REQ:
+ __limProcessAddTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
+ break;
+
+ case SIR_MAC_QOS_ADD_TS_RSP:
+ __limProcessAddTsRsp(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
+ break;
+
+ case SIR_MAC_QOS_DEL_TS_REQ:
+ __limProcessDelTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
+ break;
+
+ default:
+ PELOGE(limLog(pMac, LOGE, FL("WME action %d not handled\n"), pActionHdr->actionID);)
+ break;
+ }
+ break;
+
+ case SIR_MAC_ACTION_BLKACK:
+ // Determine the "type" of BA Action Frame
+ switch(pActionHdr->actionID)
+ {
+ case SIR_MAC_BLKACK_ADD_REQ:
+ __limProcessAddBAReq( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
+ break;
+
+ case SIR_MAC_BLKACK_ADD_RSP:
+ __limProcessAddBARsp( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
+ break;
+
+ case SIR_MAC_BLKACK_DEL:
+ __limProcessDelBAReq( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
+ break;
+
+ default:
+ break;
+ }
+
+ break;
+ case SIR_MAC_ACTION_HT:
+ /** Type of HT Action to be performed*/
+ switch(pActionHdr->actionID) {
+ case SIR_MAC_SM_POWER_SAVE:
+ __limProcessSMPowerSaveUpdate(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
+ break;
+ default:
+ PELOGE(limLog(pMac, LOGE, FL("Action ID %d not handled in HT Action category\n"), pActionHdr->actionID);)
+ break;
+ }
+ break;
+
+#if defined WLAN_FEATURE_VOWIFI
+ case SIR_MAC_ACTION_RRM:
+ if( pMac->rrm.rrmPEContext.rrmEnable )
+ {
+ switch(pActionHdr->actionID) {
+ case SIR_MAC_RRM_RADIO_MEASURE_REQ:
+ __limProcessRadioMeasureRequest( pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry );
+ break;
+ case SIR_MAC_RRM_LINK_MEASUREMENT_REQ:
+ __limProcessLinkMeasurementReq( pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry );
+ break;
+ case SIR_MAC_RRM_NEIGHBOR_RPT:
+ __limProcessNeighborReport( pMac, (tANI_U8*) pRxPacketInfo, psessionEntry );
+ break;
+ default:
+ PELOGE( limLog( pMac, LOGE, FL("Action ID %d not handled in RRM\n"), pActionHdr->actionID);)
+ break;
+
+ }
+ }
+ else
+ {
+ // Else we will just ignore the RRM messages.
+ PELOGE( limLog( pMac, LOGE, FL("RRM Action frame ignored as RRM is disabled in cfg\n"));)
+ }
+ break;
+#endif
+#if defined WLAN_FEATURE_P2P
+ case SIR_MAC_ACTION_PUBLIC_USAGE:
+ switch(pActionHdr->actionID) {
+ case SIR_MAC_ACTION_VENDOR_SPECIFIC:
+ {
+ tpSirMacVendorSpecificPublicActionFrameHdr pPubAction = (tpSirMacVendorSpecificPublicActionFrameHdr) pActionHdr;
+ tpSirMacMgmtHdr pHdr;
+ tANI_U32 frameLen;
+ tANI_U8 P2POui[] = { 0x50, 0x6F, 0x9A, 0x09 };
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+ frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
+
+ //Check if it is a P2P public action frame.
+ if( palEqualMemory( pMac->hHdd, pPubAction->Oui, P2POui, 4 ) )
+ {
+ /* Forward to the SME to HDD to wpa_supplicant */
+ // type is ACTION
+ limSendSmeMgmtFrameInd(pMac, pHdr->fc.subType,
+ (tANI_U8*)pHdr, frameLen + sizeof(tSirMacMgmtHdr), 0,
+ WDA_GET_RX_CH( pRxPacketInfo ));
+ }
+ else
+ {
+ limLog( pMac, LOGE, FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x\n"),
+ pPubAction->Oui[0], pPubAction->Oui[1], pPubAction->Oui[2], pPubAction->Oui[3] );
+ }
+ }
+ break;
+
+ default:
+ PELOGE(limLog(pMac, LOGE, FL("Unhandled public action frame -- %x \n"), pActionHdr->actionID);)
+ break;
+ }
+ break;
+#endif
+
+#ifdef WLAN_FEATURE_11W
+ case SIR_MAC_ACTION_SA_QUERY:
+ {
+ /**11w SA query request action frame received**/
+ __limProcessSAQueryRequestActionFrame(pMac,(tANI_U8*) pRxPacketInfo, psessionEntry );
+ break;
+ }
+#endif
+
+ default:
+ PELOGE(limLog(pMac, LOGE, FL("Action category %d not handled\n"), pActionHdr->category);)
+ break;
+ }
+}
+
+#if defined WLAN_FEATURE_P2P
+/**
+ * limProcessActionFrameNoSession
+ *
+ *FUNCTION:
+ * This function is called by limProcessMessageQueue() upon
+ * Action frame reception and no session.
+ * Currently only public action frames can be received from
+ * a non-associated station.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param *pBd - A pointer to Buffer descriptor + associated PDUs
+ * @return None
+ */
+
+void
+limProcessActionFrameNoSession(tpAniSirGlobal pMac, tANI_U8 *pBd)
+{
+ tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pBd);
+ tpSirMacVendorSpecificPublicActionFrameHdr pActionHdr = (tpSirMacVendorSpecificPublicActionFrameHdr) pBody;
+
+ limLog( pMac, LOGE, "Received a Action frame -- no session");
+
+ switch ( pActionHdr->category )
+ {
+ case SIR_MAC_ACTION_PUBLIC_USAGE:
+ switch(pActionHdr->actionID) {
+ case SIR_MAC_ACTION_VENDOR_SPECIFIC:
+ {
+ tpSirMacMgmtHdr pHdr;
+ tANI_U32 frameLen;
+ tANI_U8 P2POui[] = { 0x50, 0x6F, 0x9A, 0x09 };
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pBd);
+ frameLen = WDA_GET_RX_PAYLOAD_LEN(pBd);
+
+ //Check if it is a P2P public action frame.
+ if( palEqualMemory( pMac->hHdd, pActionHdr->Oui, P2POui, 4 ) )
+ {
+ /* Forward to the SME to HDD to wpa_supplicant */
+ // type is ACTION
+ limSendSmeMgmtFrameInd(pMac, pHdr->fc.subType,
+ (tANI_U8*)pHdr, frameLen + sizeof(tSirMacMgmtHdr), 0,
+ WDA_GET_RX_CH( pBd ));
+ }
+ else
+ {
+ limLog( pMac, LOGE, FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x\n"),
+ pActionHdr->Oui[0], pActionHdr->Oui[1], pActionHdr->Oui[2], pActionHdr->Oui[3] );
+ }
+ }
+ break;
+ default:
+ PELOGE(limLog(pMac, LOGE, FL("Unhandled public action frame -- %x \n"), pActionHdr->actionID);)
+ break;
+ }
+ break;
+ default:
+ PELOGE(limLog(pMac, LOGE, FL("Unhandled action frame without session -- %x \n"), pActionHdr->category);)
+ break;
+
+ }
+}
+#endif
diff --git a/CORE/MAC/src/pe/lim/limProcessAssocReqFrame.c b/CORE/MAC/src/pe/lim/limProcessAssocReqFrame.c
new file mode 100644
index 0000000..6ee945d
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limProcessAssocReqFrame.c
@@ -0,0 +1,1648 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limProcessAssocReqFrame.cc contains the code
+ * for processing Re/Association Request Frame.
+ * Author: Chandra Modumudi
+ * Date: 03/18/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ * 05/26/10 js WPA handling in (Re)Assoc frames
+ *
+ */
+#include "palTypes.h"
+#include "aniGlobal.h"
+#include "wniCfgAp.h"
+#include "sirApi.h"
+#include "cfgApi.h"
+
+#include "schApi.h"
+#include "pmmApi.h"
+#include "utilsApi.h"
+#include "limTypes.h"
+#include "limUtils.h"
+#include "limAssocUtils.h"
+#include "limSecurityUtils.h"
+#include "limSerDesUtils.h"
+#include "limStaHashApi.h"
+#include "limAdmitControl.h"
+#include "palApi.h"
+
+
+#include "vos_types.h"
+/**
+ * limConvertSupportedChannels
+ *
+ *FUNCTION:
+ * This function is called by limProcessAssocReqFrame() to
+ * parse the channel support IE in the Assoc/Reassoc Request
+ * frame, and send relevant information in the SME_ASSOC_IND
+ *
+ *NOTE:
+ *
+ * @param pMac - A pointer to Global MAC structure
+ * @param pMlmAssocInd - A pointer to SME ASSOC/REASSOC IND
+ * @param assocReq - A pointer to ASSOC/REASSOC Request frame
+ *
+ * @return None
+ */
+static void
+limConvertSupportedChannels(tpAniSirGlobal pMac,
+ tpLimMlmAssocInd pMlmAssocInd,
+ tSirAssocReq *assocReq)
+{
+
+ tANI_U16 i, j, index=0;
+ tANI_U8 firstChannelNumber;
+ tANI_U8 numberOfChannel;
+ tANI_U8 nextChannelNumber;
+
+ if(assocReq->supportedChannels.length >= SIR_MAX_SUPPORTED_CHANNEL_LIST)
+ {
+ limLog(pMac, LOG1, FL("Number of supported channels:%d is more than MAX\n"),
+ assocReq->supportedChannels.length);
+ pMlmAssocInd->supportedChannels.numChnl = 0;
+ return;
+ }
+
+ for(i=0; i < (assocReq->supportedChannels.length); i++)
+ {
+ // Get First Channel Number
+ firstChannelNumber = assocReq->supportedChannels.supportedChannels[i];
+ pMlmAssocInd->supportedChannels.channelList[index] = firstChannelNumber;
+ i++;
+ index++;
+ if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST)
+ {
+ pMlmAssocInd->supportedChannels.numChnl = 0;
+ return;
+ }
+ // Get Number of Channels in a Subband
+ numberOfChannel = assocReq->supportedChannels.supportedChannels[i];
+ PELOG2(limLog(pMac, LOG2, FL("Rcv AssocReq: chnl=%d, numOfChnl=%d \n"),
+ firstChannelNumber, numberOfChannel);)
+
+ if (numberOfChannel > 1)
+ {
+ nextChannelNumber = firstChannelNumber;
+ if(SIR_BAND_5_GHZ == limGetRFBand(firstChannelNumber))
+ {
+ for (j=1; j < numberOfChannel; j++)
+ {
+ nextChannelNumber += SIR_11A_FREQUENCY_OFFSET;
+ pMlmAssocInd->supportedChannels.channelList[index] = nextChannelNumber;
+ index++;
+ if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST)
+ {
+ pMlmAssocInd->supportedChannels.numChnl = 0;
+ return;
+ }
+ }
+ }
+ else if(SIR_BAND_2_4_GHZ == limGetRFBand(firstChannelNumber))
+ {
+ for (j=1; j < numberOfChannel; j++)
+ {
+ nextChannelNumber += SIR_11B_FREQUENCY_OFFSET;
+ pMlmAssocInd->supportedChannels.channelList[index] = nextChannelNumber;
+ index++;
+ if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST)
+ {
+ pMlmAssocInd->supportedChannels.numChnl = 0;
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ pMlmAssocInd->supportedChannels.numChnl = (tANI_U8) index;
+ PELOG2(limLog(pMac, LOG2,
+ FL("Send AssocInd to WSM: spectrum ON, minPwr %d, maxPwr %d, numChnl %d\n"),
+ pMlmAssocInd->powerCap.minTxPower,
+ pMlmAssocInd->powerCap.maxTxPower,
+ pMlmAssocInd->supportedChannels.numChnl);)
+}
+
+
+/**---------------------------------------------------------------
+\fn limProcessAssocReqFrame
+\brief This function is called by limProcessMessageQueue()
+\ upon Re/Association Request frame reception in
+\ BTAMP AP or Soft AP role.
+\
+\param pMac
+\param *pRxPacketInfo - A pointer to Buffer descriptor + associated PDUs
+\param subType - Indicates whether it is Association Request(=0)
+\ or Reassociation Request(=1) frame
+\return None
+------------------------------------------------------------------*/
+void
+limProcessAssocReqFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,
+ tANI_U8 subType, tpPESession psessionEntry)
+{
+ tANI_U8 updateContext;
+ tANI_U8 *pBody;
+ tANI_U16 aid, temp;
+ tANI_U32 val;
+ tANI_S32 framelen;
+ tSirRetStatus status;
+ tpSirMacMgmtHdr pHdr;
+ struct tLimPreAuthNode *pStaPreAuthContext;
+ tAniAuthType authType;
+ tSirMacCapabilityInfo localCapabilities;
+ tpDphHashNode pStaDs = NULL;
+ tpSirAssocReq pAssocReq;
+#ifdef WLAN_SOFTAP_FEATURE
+ tLimMlmStates mlmPrevState;
+ tDot11fIERSN Dot11fIERSN;
+ tDot11fIEWPA Dot11fIEWPA;
+#endif
+ tANI_U32 phyMode;
+ tHalBitVal qosMode;
+ tHalBitVal wsmMode, wmeMode;
+ tANI_U8 *wpsIe = NULL;
+ tSirMacRateSet basicRates;
+ tANI_U8 i = 0, j = 0;
+
+ limGetPhyMode(pMac, &phyMode, psessionEntry);
+
+ limGetQosMode(psessionEntry, &qosMode);
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+ framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
+
+ if (psessionEntry->limSystemRole == eLIM_STA_ROLE || psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE )
+ {
+ limLog(pMac, LOGE, FL("received unexpected ASSOC REQ subType=%d for role=%d, radioId=%d from \n"),
+ subType, psessionEntry->limSystemRole, pMac->sys.gSirRadioId);
+ limPrintMacAddr(pMac, pHdr->sa, LOGE);
+ sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3,
+ WDA_GET_RX_MPDU_DATA(pRxPacketInfo), framelen);
+ return;
+ }
+
+ // Get pointer to Re/Association Request frame body
+ pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
+
+ if (limIsGroupAddr(pHdr->sa))
+ {
+ // Received Re/Assoc Req frame from a BC/MC address
+ // Log error and ignore it
+ if (subType == LIM_ASSOC)
+ limLog(pMac, LOG1, FL("received Assoc frame from a BC/MC address\n"));
+ else
+ limLog(pMac, LOG1, FL("received ReAssoc frame from a BC/MC address\n"));
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);
+ return;
+ }
+ limLog(pMac, LOG2, FL("Received AssocReq Frame: "));
+ sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, (tANI_U8 *) pBody, framelen);
+
+#ifdef WLAN_SOFTAP_FEATURE
+ // If TKIP counter measures active send Assoc Rsp frame to station with eSIR_MAC_MIC_FAILURE_REASON
+ if ((psessionEntry->bTkipCntrMeasActive) && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
+ {
+ limSendAssocRspMgmtFrame(pMac,
+ eSIR_MAC_MIC_FAILURE_REASON,
+ 1,
+ pHdr->sa,
+ subType, 0, psessionEntry);
+ return;
+ }
+#endif
+
+ // Allocate memory for the Assoc Request frame
+ if ( palAllocateMemory(pMac->hHdd, (void **)&pAssocReq, sizeof(*pAssocReq)) != eHAL_STATUS_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("PAL Allocate Memory failed in AssocReq\n"));
+ return;
+ }
+ palZeroMemory( pMac->hHdd, (void *)pAssocReq , sizeof(*pAssocReq));
+
+ // Parse Assoc Request frame
+ if (subType == LIM_ASSOC)
+ status = sirConvertAssocReqFrame2Struct(pMac, pBody, framelen, pAssocReq);
+ else
+ status = sirConvertReassocReqFrame2Struct(pMac, pBody, framelen, pAssocReq);
+
+ if (status != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGW, FL("Parse error AssocRequest, length=%d from \n"),framelen);
+ limPrintMacAddr(pMac, pHdr->sa, LOGW);
+ limSendAssocRspMgmtFrame(pMac, eSIR_MAC_UNSPEC_FAILURE_STATUS, 1, pHdr->sa, subType, 0, psessionEntry);
+ goto error;
+ }
+
+ if ( palAllocateMemory(pMac->hHdd, (void **)&pAssocReq->assocReqFrame, framelen) != eHAL_STATUS_SUCCESS)
+ {
+ limLog(pMac, LOGE, FL("Unable to allocate memory for the assoc req, length=%d from \n"),framelen);
+ goto error;
+ }
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pAssocReq->assocReqFrame,
+ (tANI_U8 *) pBody, framelen);
+ pAssocReq->assocReqFrameLength = framelen;
+
+ if (cfgGetCapabilityInfo(pMac, &temp,psessionEntry) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("could not retrieve Capabilities\n"));
+ goto error;
+ }
+#if defined(ANI_PRODUCT_TYPE_AP) && defined(ANI_LITTLE_BYTE_ENDIAN)
+ *(tANI_U16*)&localCapabilities=(tANI_U16)(temp);
+#else
+ limCopyU16((tANI_U8 *) &localCapabilities, temp);
+#endif
+
+ if (limCompareCapabilities(pMac,
+ pAssocReq,
+ &localCapabilities,psessionEntry) == false)
+ {
+ /**
+ * Capabilities of requesting STA does not match with
+ * local capabilities. Respond with 'unsupported capabilities'
+ * status code.
+ */
+ limSendAssocRspMgmtFrame(
+ pMac,
+ eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
+ 1,
+ pHdr->sa,
+ subType, 0,psessionEntry);
+
+ limLog(pMac, LOG1, FL("local caps 0x%x received 0x%x\n"), localCapabilities, pAssocReq->capabilityInfo);
+
+ // Log error
+ if (subType == LIM_ASSOC)
+ limLog(pMac, LOG1,
+ FL("received Assoc req with unsupported capabilities from\n"));
+ else
+ limLog(pMac, LOG1,
+ FL("received ReAssoc req with unsupported capabilities from\n"));
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);
+ goto error;
+ }
+
+ updateContext = false;
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ // Check if multiple SSID feature is not enabled
+ if (psessionEntry->pLimStartBssReq->ssId.length)
+ {
+ if (limCmpSSid(pMac, &pAssocReq->ssId, psessionEntry) == false)
+ {
+ /*Temp hack for UPF35 - skip SSID check in order to be able to interop
+ with Marvel - they send their own SSID instead of ours*/
+ if ( 0 != vos_get_skip_ssid_check())
+ {
+ limLog(pMac, LOG1, FL("Received unmatched SSID but cfg to suppress - continuing\n"));
+ }
+ else
+ {
+ /**
+ * Received Re/Association Request with either
+ * Broadcast SSID OR with SSID that does not
+ * match with local one.
+ * Respond with unspecified status code.
+ */
+ limSendAssocRspMgmtFrame(pMac,
+ eSIR_MAC_UNSPEC_FAILURE_STATUS,
+ 1,
+ pHdr->sa,
+ subType, 0,psessionEntry);
+
+ // Log error
+ if (subType == LIM_ASSOC)
+ limLog(pMac, LOGW, FL("received Assoc req with unmatched SSID from \n"));
+ else
+ limLog(pMac, LOGW, FL("received ReAssoc req with unmatched SSID from \n"));
+ limPrintMacAddr(pMac, pHdr->sa, LOGW);
+ goto error;
+ }
+ }
+ }
+ else
+ limLog(pMac, LOG1, FL("Suppressed SSID, App is going to check SSID\n"));
+#else
+ if (limCmpSSid(pMac, &pAssocReq->ssId, psessionEntry) == false)
+ {
+ /**
+ * Received Re/Association Request with either
+ * Broadcast SSID OR with SSID that does not
+ * match with local one.
+ * Respond with unspecified status code.
+ */
+ limSendAssocRspMgmtFrame(pMac,
+ eSIR_MAC_UNSPEC_FAILURE_STATUS,
+ 1,
+ pHdr->sa,
+ subType, 0,psessionEntry);
+
+ // Log error
+ if (subType == LIM_ASSOC)
+ limLog(pMac, LOGW,
+ FL("received Assoc req with unmatched SSID from \n"));
+ else
+ limLog(pMac, LOGW,
+ FL("received ReAssoc req with unmatched SSID from \n"));
+ limPrintMacAddr(pMac, pHdr->sa, LOGW);
+ goto error;
+ }
+#endif
+
+ /***************************************************************
+ ** Verify if the requested rates are available in supported rate
+ ** set or Extended rate set. Some APs are adding basic rates in
+ ** Extended rateset IE
+ ***************************************************************/
+ basicRates.numRates = 0;
+
+ for(i = 0; i < pAssocReq->supportedRates.numRates; i++)
+ {
+ basicRates.rate[i] = pAssocReq->supportedRates.rate[i];
+ basicRates.numRates++;
+ }
+
+ for(j = 0; (j < pAssocReq->extendedRates.numRates) && (i < SIR_MAC_RATESET_EID_MAX); i++,j++)
+ {
+ basicRates.rate[i] = pAssocReq->extendedRates.rate[j];
+ basicRates.numRates++;
+ }
+ if (limCheckRxBasicRates(pMac, basicRates, psessionEntry) == false)
+ {
+ /**
+ * Requesting STA does not support ALL BSS basic
+ * rates. Respond with 'basic rates not supported'
+ * status code.
+ */
+ limSendAssocRspMgmtFrame(
+ pMac,
+ eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS,
+ 1,
+ pHdr->sa,
+ subType, 0,psessionEntry);
+
+ // Log error
+ if (subType == LIM_ASSOC)
+ limLog(pMac, LOGW,
+ FL("received Assoc req with unsupported rates from \n"));
+ else
+ limLog(pMac, LOGW,
+ FL("received ReAssoc req with unsupported rates from\n"));
+ limPrintMacAddr(pMac, pHdr->sa, LOGW);
+ goto error;
+ }
+
+#ifdef WLAN_SOFTAP_FEATURE
+
+ if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
+ (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11G_ONLY) &&
+ ((!pAssocReq->extendedRatesPresent ) || (pAssocReq->HTCaps.present)))
+ {
+ limSendAssocRspMgmtFrame( pMac, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
+ 1, pHdr->sa, subType, 0, psessionEntry );
+ limLog(pMac, LOGE, FL("SOFTAP was in 11G only mode, rejecting legacy STA's\n"));
+ goto error;
+
+ }//end if phyMode == 11G_only
+
+ if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
+ (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11N_ONLY) &&
+ (!pAssocReq->HTCaps.present))
+ {
+ limSendAssocRspMgmtFrame( pMac, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
+ 1, pHdr->sa, subType, 0, psessionEntry );
+ limLog(pMac, LOGE, FL("SOFTAP was in 11N only mode, rejecting legacy STA's\n"));
+ goto error;
+ }//end if PhyMode == 11N_only
+
+#endif
+
+ /* Spectrum Management (11h) specific checks */
+ if (localCapabilities.spectrumMgt)
+ {
+ tSirRetStatus status = eSIR_SUCCESS;
+
+ /* If station is 11h capable, then it SHOULD send all mandatory
+ * IEs in assoc request frame. Let us verify that
+ */
+ if (pAssocReq->capabilityInfo.spectrumMgt)
+ {
+ if (!((pAssocReq->powerCapabilityPresent) && (pAssocReq->supportedChannelsPresent)))
+ {
+ /* One or more required information elements are missing, log the peers error */
+ if (!pAssocReq->powerCapabilityPresent)
+ {
+ if(subType == LIM_ASSOC)
+ limLog(pMac, LOG1, FL("LIM Info: Missing Power capability IE in assoc request\n"));
+ else
+ limLog(pMac, LOG1, FL("LIM Info: Missing Power capability IE in Reassoc request\n"));
+ }
+ if (!pAssocReq->supportedChannelsPresent)
+ {
+ if(subType == LIM_ASSOC)
+ limLog(pMac, LOG1, FL("LIM Info: Missing Supported channel IE in assoc request\n"));
+ else
+ limLog(pMac, LOG1, FL("LIM Info: Missing Supported channel IE in Reassoc request\n"));
+ }
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);
+ }
+ else
+ {
+ /* Assoc request has mandatory fields */
+ status = limIsDot11hPowerCapabilitiesInRange(pMac, pAssocReq, psessionEntry);
+ if (eSIR_SUCCESS != status)
+ {
+ if (subType == LIM_ASSOC)
+ limLog(pMac, LOGW, FL("LIM Info: Association MinTxPower(STA) > MaxTxPower(AP)\n"));
+ else
+ limLog(pMac, LOGW, FL("LIM Info: Reassociation MinTxPower(STA) > MaxTxPower(AP)\n"));
+ limPrintMacAddr(pMac, pHdr->sa, LOGW);
+ }
+ status = limIsDot11hSupportedChannelsValid(pMac, pAssocReq);
+ if (eSIR_SUCCESS != status)
+ {
+ if (subType == LIM_ASSOC)
+ limLog(pMac, LOGW, FL("LIM Info: Association wrong supported channels (STA)\n"));
+ else
+ limLog(pMac, LOGW, FL("LIM Info: Reassociation wrong supported channels (STA)\n"));
+ limPrintMacAddr(pMac, pHdr->sa, LOGW);
+ }
+ /* IEs are valid, use them if needed */
+ }
+ } //if(assoc.capabilityInfo.spectrumMgt)
+ else
+ {
+ /* As per the capabiities, the spectrum management is not enabled on the station
+ * The AP may allow the associations to happen even if spectrum management is not
+ * allowed, if the transmit power of station is below the regulatory maximum
+ */
+
+ /* TODO: presently, this is not handled. In the current implemetation, the AP would
+ * allow the station to associate even if it doesn't support spectrum management.
+ */
+ }
+ }// end of spectrum management related processing
+
+ if ( (pAssocReq->HTCaps.present) && (limCheckMCSSet(pMac, pAssocReq->HTCaps.supportedMCSSet) == false))
+ {
+ /**
+ * Requesting STA does not support ALL BSS MCS basic Rate set rates.
+ * Spec does not define any status code for this scenario.
+ */
+ limSendAssocRspMgmtFrame(
+ pMac,
+ eSIR_MAC_OUTSIDE_SCOPE_OF_SPEC_STATUS,
+ 1,
+ pHdr->sa,
+ subType, 0,psessionEntry);
+
+ // Log error
+ if (subType == LIM_ASSOC)
+ limLog(pMac, LOGW,
+ FL("received Assoc req with unsupported MCS Rate Set from \n"));
+ else
+ limLog(pMac, LOGW,
+ FL("received ReAssoc req with unsupported MCS Rate Set from\n"));
+ limPrintMacAddr(pMac, pHdr->sa, LOGW);
+ goto error;
+ }
+
+ //if (pMac->dph.gDphPhyMode == WNI_CFG_PHY_MODE_11G)
+ if (phyMode == WNI_CFG_PHY_MODE_11G)
+ {
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_11G_ONLY_POLICY, &val) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("could not retrieve 11g-only flag\n"));
+ goto error;
+ }
+
+ if (!pAssocReq->extendedRatesPresent && val)
+ {
+ /**
+ * Received Re/Association Request from
+ * 11b STA when 11g only policy option
+ * is set.
+ * Reject with unspecified status code.
+ */
+ limSendAssocRspMgmtFrame(
+ pMac,
+ eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS,
+ 1,
+ pHdr->sa,
+ subType, 0,psessionEntry);
+
+ limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from 11b STA: "));
+ limPrintMacAddr(pMac, pHdr->sa, LOGW);
+
+#ifdef WLAN_DEBUG
+ pMac->lim.gLim11bStaAssocRejectCount++;
+#endif
+ goto error;
+ }
+ }
+
+#ifdef WMM_APSD
+ // Save the QOS info element in assoc request..
+ limGetWmeMode(pMac, &wmeMode);
+ if (wmeMode == eHAL_SET)
+ {
+ tpQosInfoSta qInfo;
+
+ qInfo = (tpQosInfoSta) (pAssocReq->qosCapability.qosInfo);
+
+ if ((pMac->lim.gWmmApsd.apsdEnable == 0) && (qInfo->ac_be || qInfo->ac_bk || qInfo->ac_vo || qInfo->ac_vi))
+ {
+
+ /**
+ * Received Re/Association Request from
+ * 11b STA when 11g only policy option
+ * is set.
+ * Reject with unspecified status code.
+ */
+ limSendAssocRspMgmtFrame(
+ pMac,
+ eSIR_MAC_WME_REFUSED_STATUS,
+ 1,
+ pHdr->sa,
+ subType, 0,psessionEntry);
+
+ limLog(pMac, LOGW,
+ FL("Rejecting Re/Assoc req from STA: "));
+ limPrintMacAddr(pMac, pHdr->sa, LOGW);
+ limLog(pMac, LOGE, FL("APSD not enabled, qosInfo - 0x%x\n"), *qInfo);
+ goto error;
+ }
+ }
+#endif
+
+ // Check for 802.11n HT caps compatibility; are HT Capabilities
+ // turned on in lim?
+ if ( psessionEntry->htCapabality )
+ {
+ // There are; are they turned on in the STA?
+ if ( pAssocReq->HTCaps.present )
+ {
+ // The station *does* support 802.11n HT capability...
+
+ limLog( pMac, LOG1, FL( "AdvCodingCap:%d ChaWidthSet:%d "
+ "PowerSave:%d greenField:%d "
+ "shortGI20:%d shortGI40:%d\n"
+ "txSTBC:%d rxSTBC:%d delayBA:%d"
+ "maxAMSDUsize:%d DSSS/CCK:%d "
+ "PSMP:%d stbcCntl:%d lsigTXProt:%d\n"),
+ pAssocReq->HTCaps.advCodingCap,
+ pAssocReq->HTCaps.supportedChannelWidthSet,
+ pAssocReq->HTCaps.mimoPowerSave,
+ pAssocReq->HTCaps.greenField,
+ pAssocReq->HTCaps.shortGI20MHz,
+ pAssocReq->HTCaps.shortGI40MHz,
+ pAssocReq->HTCaps.txSTBC,
+ pAssocReq->HTCaps.rxSTBC,
+ pAssocReq->HTCaps.delayedBA,
+ pAssocReq->HTCaps.maximalAMSDUsize,
+ pAssocReq->HTCaps.dsssCckMode40MHz,
+ pAssocReq->HTCaps.psmp,
+ pAssocReq->HTCaps.stbcControlFrame,
+ pAssocReq->HTCaps.lsigTXOPProtection );
+
+ // Make sure the STA's caps are compatible with our own:
+ //11.15.2 Support of DSSS/CCK in 40 MHz
+ //the AP shall refuse association requests from an HT STA that has the DSSS/CCK
+ //Mode in 40 MHz subfield set to 1;
+
+ //FIXME_BTAMP_AP : Need to be enabled
+ /*
+ if ( !pMac->lim.gHTDsssCckRate40MHzSupport && pAssocReq->HTCaps.dsssCckMode40MHz )
+ {
+ statusCode = eSIR_MAC_DSSS_CCK_RATE_NOT_SUPPORT_STATUS;
+ limLog( pMac, LOGW, FL( "AP DSSS/CCK is disabled; "
+ "STA rejected.\n" ) );
+ // Reject association
+ limSendAssocRspMgmtFrame( pMac, statusCode, 1, pHdr->sa, subType, 0,psessionEntry);
+ goto error;
+ }
+ */
+ }
+ } // End if on HT caps turned on in lim.
+
+#ifdef WLAN_SOFTAP_FEATURE
+ /* Clear the buffers so that frame parser knows that there isn't a previously decoded IE in these buffers */
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&Dot11fIERSN, sizeof( Dot11fIERSN ) );
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&Dot11fIEWPA, sizeof( Dot11fIEWPA ) );
+
+ /* if additional IE is present, check if it has WscIE */
+ if( pAssocReq->addIEPresent && pAssocReq->addIE.length )
+ wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
+ /* when wpsIe is present, RSN/WPA IE is ignored */
+ if( wpsIe == NULL )
+ {
+ /** check whether as RSN IE is present */
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE
+ && psessionEntry->pLimStartBssReq->privacy
+ && psessionEntry->pLimStartBssReq->rsnIE.length)
+ {
+ limLog(pMac, LOGE,
+ FL("AP supports RSN enabled authentication\n"));
+
+ if(pAssocReq->rsnPresent)
+ {
+ if(pAssocReq->rsn.length)
+ {
+ // Unpack the RSN IE
+ dot11fUnpackIeRSN(pMac,
+ &pAssocReq->rsn.info[0],
+ pAssocReq->rsn.length,
+ &Dot11fIERSN);
+
+ /* Check RSN version is supported or not */
+ if(SIR_MAC_OUI_VERSION_1 == Dot11fIERSN.version)
+ {
+ /* check the groupwise and pairwise cipher suites */
+ if(eSIR_SUCCESS != (status = limCheckRxRSNIeMatch(pMac, Dot11fIERSN, psessionEntry, pAssocReq->HTCaps.present) ) )
+ {
+ /* some IE is not properly sent */
+ /* received Association req frame with RSN IE but length is 0 */
+ limSendAssocRspMgmtFrame(
+ pMac,
+ status,
+ 1,
+ pHdr->sa,
+ subType, 0,psessionEntry);
+
+ limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA: "));
+ limPrintMacAddr(pMac, pHdr->sa, LOGW);
+ goto error;
+
+ }
+ }
+ else
+ {
+ /* received Association req frame with RSN IE version wrong */
+ limSendAssocRspMgmtFrame(
+ pMac,
+ eSIR_MAC_UNSUPPORTED_RSN_IE_VERSION_STATUS,
+ 1,
+ pHdr->sa,
+ subType, 0,psessionEntry);
+
+ limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA: "));
+ limPrintMacAddr(pMac, pHdr->sa, LOGW);
+ goto error;
+
+ }
+ }
+ else
+ {
+ /* received Association req frame with RSN IE but length is 0 */
+ limSendAssocRspMgmtFrame(
+ pMac,
+ eSIR_MAC_INVALID_INFORMATION_ELEMENT_STATUS,
+ 1,
+ pHdr->sa,
+ subType, 0,psessionEntry);
+
+ limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA: "));
+ limPrintMacAddr(pMac, pHdr->sa, LOGW);
+ goto error;
+
+ }
+ } /* end - if(pAssocReq->rsnPresent) */
+ if((!pAssocReq->rsnPresent) && pAssocReq->wpaPresent)
+ {
+ // Unpack the WPA IE
+ if(pAssocReq->wpa.length)
+ {
+ dot11fUnpackIeWPA(pMac,
+ &pAssocReq->wpa.info[4], //OUI is not taken care
+ pAssocReq->wpa.length,
+ &Dot11fIEWPA);
+ /* check the groupwise and pairwise cipher suites */
+ if(eSIR_SUCCESS != (status = limCheckRxWPAIeMatch(pMac, Dot11fIEWPA, psessionEntry, pAssocReq->HTCaps.present)))
+ {
+ /* received Association req frame with WPA IE but mismatch */
+ limSendAssocRspMgmtFrame(
+ pMac,
+ status,
+ 1,
+ pHdr->sa,
+ subType, 0,psessionEntry);
+
+ limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA: "));
+ limPrintMacAddr(pMac, pHdr->sa, LOGW);
+ goto error;
+
+ }
+ }
+ else
+ {
+ /* received Association req frame with invalid WPA IE */
+ limSendAssocRspMgmtFrame(
+ pMac,
+ eSIR_MAC_INVALID_INFORMATION_ELEMENT_STATUS,
+ 1,
+ pHdr->sa,
+ subType, 0,psessionEntry);
+
+ limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA: "));
+ limPrintMacAddr(pMac, pHdr->sa, LOGW);
+ goto error;
+ }/* end - if(pAssocReq->wpa.length) */
+ } /* end - if(pAssocReq->wpaPresent) */
+ } /* end of if(psessionEntry->pLimStartBssReq->privacy
+ && psessionEntry->pLimStartBssReq->rsnIE->length) */
+
+ } /* end of if( ! pAssocReq->wscInfo.present ) */
+#endif //WLAN_SOFTAP_FEATURE
+
+ /**
+ * Extract 'associated' context for STA, if any.
+ * This is maintained by DPH and created by LIM.
+ */
+ pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
+
+ /// Extract pre-auth context for the STA, if any.
+ pStaPreAuthContext = limSearchPreAuthList(pMac, pHdr->sa);
+
+ if (pStaDs == NULL)
+ {
+ /// Requesting STA is not currently associated
+ if (pMac->lim.gLimNumOfCurrentSTAs == pMac->lim.maxStation)
+ {
+ /**
+ * Maximum number of STAs that AP can handle reached.
+ * Send Association response to peer MAC entity
+ */
+ limRejectAssociation(pMac, pHdr->sa,
+ subType, false,
+ (tAniAuthType) 0, 0,
+ false,
+ (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
+
+ goto error;
+ }
+
+ /// Check if STA is pre-authenticated.
+ if ((pStaPreAuthContext == NULL) ||
+ (pStaPreAuthContext &&
+ (pStaPreAuthContext->mlmState !=
+ eLIM_MLM_AUTHENTICATED_STATE)))
+ {
+ /**
+ * STA is not pre-authenticated yet requesting
+ * Re/Association before Authentication.
+ * OR STA is in the process of getting authenticated
+ * and sent Re/Association request.
+ * Send Deauthentication frame with 'prior
+ * authentication required' reason code.
+ */
+ limSendDeauthMgmtFrame(
+ pMac,
+ eSIR_MAC_STA_NOT_PRE_AUTHENTICATED_REASON, //=9
+ pHdr->sa,psessionEntry);
+
+ // Log error
+ if (subType == LIM_ASSOC)
+ limLog(pMac, LOG1,
+ FL("received Assoc req from STA that does not have pre-auth context, MAC addr is: \n"));
+ else
+ limLog(pMac, LOG1,
+ FL("received ReAssoc req from STA that does not have pre-auth context, MAC addr is: \n"));
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);
+ goto error;
+ }
+
+ /// Delete 'pre-auth' context of STA
+ authType = pStaPreAuthContext->authType;
+ limDeletePreAuthNode(pMac, pHdr->sa);
+
+ // All is well. Assign AID (after else part)
+
+ } // if (pStaDs == NULL)
+ else
+ {
+ // STA context does exist for this STA
+
+ if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)
+ {
+ /**
+ * Requesting STA is in some 'transient' state?
+ * Ignore the Re/Assoc Req frame by incrementing
+ * debug counter & logging error.
+ */
+ if (subType == LIM_ASSOC)
+ {
+
+#ifdef WLAN_DEBUG
+ pMac->lim.gLimNumAssocReqDropInvldState++;
+#endif
+ limLog(pMac, LOG1, FL("received Assoc req in state %X from "), pStaDs->mlmStaContext.mlmState);
+ }
+ else
+ {
+#ifdef WLAN_DEBUG
+ pMac->lim.gLimNumReassocReqDropInvldState++;
+#endif
+ limLog(pMac, LOG1, FL("received ReAssoc req in state %X from "), pStaDs->mlmStaContext.mlmState);
+ }
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);
+ limPrintMlmState(pMac, LOG1, (tLimMlmStates) pStaDs->mlmStaContext.mlmState);
+ goto error;
+ } // if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)
+
+ /**
+ * STA sent Re/Association Request frame while already in
+ * 'associated' state. Update STA capabilities and
+ * send Association response frame with same AID
+ */
+
+ pStaDs->mlmStaContext.capabilityInfo = pAssocReq->capabilityInfo;
+
+ if (pStaPreAuthContext &&
+ (pStaPreAuthContext->mlmState ==
+ eLIM_MLM_AUTHENTICATED_STATE))
+ {
+ /// STA has triggered pre-auth again
+ authType = pStaPreAuthContext->authType;
+ limDeletePreAuthNode(pMac, pHdr->sa);
+ }
+ else
+ authType = pStaDs->mlmStaContext.authType;
+
+ updateContext = true;
+
+ if (dphInitStaState(pMac, pHdr->sa, aid, true, &psessionEntry->dph.dphHashTable) == NULL)
+ {
+ limLog(pMac, LOGE, FL("could not Init STAid=%d\n"), aid);
+ goto error;
+ }
+
+
+ goto sendIndToSme;
+ } // end if (lookup for STA in perStaDs fails)
+
+
+
+ // check if sta is allowed per QoS AC rules
+ //if (pMac->dph.gDphQosEnabled || pMac->dph.gDphWmeEnabled)
+ limGetWmeMode(psessionEntry, &wmeMode);
+ if ((qosMode == eHAL_SET) || (wmeMode == eHAL_SET))
+ {
+ // for a qsta, check if the requested Traffic spec
+ // is admissible
+ // for a non-qsta check if the sta can be admitted
+ if (pAssocReq->addtsPresent)
+ {
+ tANI_U8 tspecIdx = 0; //index in the sch tspec table.
+ if (limAdmitControlAddTS(pMac, pHdr->sa, &(pAssocReq->addtsReq),
+ &(pAssocReq->qosCapability), 0, false, NULL, &tspecIdx, psessionEntry) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGW, FL("AdmitControl: TSPEC rejected\n"));
+ limSendAssocRspMgmtFrame(
+ pMac,
+ eSIR_MAC_QAP_NO_BANDWIDTH_REASON,
+ 1,
+ pHdr->sa,
+ subType, 0,psessionEntry);
+#ifdef WLAN_DEBUG
+ pMac->lim.gLimNumAssocReqDropACRejectTS++;
+#endif
+ goto error;
+ }
+ }
+ else if (limAdmitControlAddSta(pMac, pHdr->sa, false)
+ != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGW, FL("AdmitControl: Sta rejected\n"));
+ limSendAssocRspMgmtFrame(
+ pMac,
+ eSIR_MAC_QAP_NO_BANDWIDTH_REASON,
+ 1,
+ pHdr->sa,
+ subType, 0,psessionEntry);
+#ifdef WLAN_DEBUG
+ pMac->lim.gLimNumAssocReqDropACRejectSta++;
+#endif
+ goto error;
+ }
+
+ // else all ok
+ limLog(pMac, LOG1, FL("AdmitControl: Sta OK!\n"));
+ }
+
+ /**
+ * STA is Associated !
+ */
+ if (subType == LIM_ASSOC)
+ limLog(pMac, LOG1, FL("received Assoc req successful from "));
+ else
+ limLog(pMac, LOG1, FL("received ReAssoc req successful from "));
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);
+
+ /**
+ * Assign unused/least recently used AID from perStaDs.
+ * This will 12-bit STAid used by MAC HW.
+ * NOTE: limAssignAID() assigns AID values ranging between 1 - 255
+ */
+
+ aid = limAssignAID(pMac);
+
+ if (!aid)
+ {
+ // Could not assign AID
+ // Reject association
+ limRejectAssociation(pMac, pHdr->sa,
+ subType, true, authType,
+ aid, false,
+ (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
+
+ goto error;
+ }
+
+ /**
+ * Add an entry to hash table maintained by DPH module
+ */
+
+ pStaDs = dphAddHashEntry(pMac, pHdr->sa, aid, &psessionEntry->dph.dphHashTable);
+
+ if (pStaDs == NULL)
+ {
+ // Could not add hash table entry at DPH
+ limLog(pMac, LOGE,
+ FL("could not add hash entry at DPH for aid=%d, MacAddr:\n"),
+ aid);
+ limPrintMacAddr(pMac, pHdr->sa, LOGE);
+
+ // Release AID
+ limReleaseAID(pMac, aid);
+
+ limRejectAssociation(pMac, pHdr->sa,
+ subType, true, authType, aid, false,
+ (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
+
+ goto error;
+ }
+
+
+sendIndToSme:
+
+ psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq;
+
+ pStaDs->mlmStaContext.htCapability = pAssocReq->HTCaps.present;
+ pStaDs->qos.addtsPresent = (pAssocReq->addtsPresent==0) ? false : true;
+ pStaDs->qos.addts = pAssocReq->addtsReq;
+ pStaDs->qos.capability = pAssocReq->qosCapability;
+ pStaDs->versionPresent = 0;
+ /* short slot and short preamble should be updated before doing limaddsta */
+ pStaDs->shortPreambleEnabled = (tANI_U8)pAssocReq->capabilityInfo.shortPreamble;
+ pStaDs->shortSlotTimeEnabled = (tANI_U8)pAssocReq->capabilityInfo.shortSlotTime;
+
+ if (pAssocReq->propIEinfo.versionPresent) //update STA version info
+ {
+ pStaDs->versionPresent = 1;
+ pStaDs->version = pAssocReq->propIEinfo.version;
+ }
+ pStaDs->propCapability = 0;
+ if (pAssocReq->propIEinfo.capabilityPresent)
+ {
+ if (sirGetCfgPropCaps(pMac, &pStaDs->propCapability))
+ pStaDs->propCapability &= pAssocReq->propIEinfo.capability;
+ }
+
+ pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE;
+ pStaDs->valid = 0;
+ pStaDs->mlmStaContext.authType = authType;
+ pStaDs->staType = STA_ENTRY_PEER;
+
+ //TODO: If listen interval is more than certain limit, reject the association.
+ //Need to check customer requirements and then implement.
+ pStaDs->mlmStaContext.listenInterval = pAssocReq->listenInterval;
+ pStaDs->mlmStaContext.capabilityInfo = pAssocReq->capabilityInfo;
+
+ /* The following count will be used to knock-off the station if it doesn't
+ * come back to receive the buffered data. The AP will wait for numTimSent number
+ * of beacons after sending TIM information for the station, before assuming that
+ * the station is no more associated and disassociates it
+ */
+
+ /** timWaitCount is used by PMM for monitoring the STA's in PS for LINK*/
+ pStaDs->timWaitCount = (tANI_U8)GET_TIM_WAIT_COUNT(pAssocReq->listenInterval);
+
+ /** Initialise the Current successful MPDU's tranfered to this STA count as 0 */
+ pStaDs->curTxMpduCnt = 0;
+
+ if(IS_DOT11_MODE_HT(psessionEntry->dot11mode) &&
+ (pAssocReq->HTCaps.present))
+ {
+ pStaDs->htGreenfield = (tANI_U8)pAssocReq->HTCaps.greenField;
+ pStaDs->htAMpduDensity = pAssocReq->HTCaps.mpduDensity;
+ pStaDs->htDsssCckRate40MHzSupport = (tANI_U8)pAssocReq->HTCaps.dsssCckMode40MHz;
+ pStaDs->htLsigTXOPProtection = (tANI_U8)pAssocReq->HTCaps.lsigTXOPProtection;
+ pStaDs->htMaxAmsduLength = (tANI_U8)pAssocReq->HTCaps.maximalAMSDUsize;
+ pStaDs->htMaxRxAMpduFactor = pAssocReq->HTCaps.maxRxAMPDUFactor;
+ pStaDs->htMIMOPSState = pAssocReq->HTCaps.mimoPowerSave;
+ pStaDs->htShortGI20Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI20MHz;
+ pStaDs->htShortGI40Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI40MHz;
+ pStaDs->htSupportedChannelWidthSet = (tANI_U8)pAssocReq->HTCaps.supportedChannelWidthSet;
+ pStaDs->baPolicyFlag = 0xFF;
+ }
+
+
+
+ if (limPopulateMatchingRateSet(pMac,
+ pStaDs,
+ &(pAssocReq->supportedRates),
+ &(pAssocReq->extendedRates),
+ pAssocReq->HTCaps.supportedMCSSet,
+ &(pAssocReq->propIEinfo.propRates), psessionEntry) != eSIR_SUCCESS)
+ {
+ // Could not update hash table entry at DPH with rateset
+ limLog(pMac, LOGE,
+ FL("could not update hash entry at DPH for aid=%d, MacAddr:\n"),
+ aid);
+ limPrintMacAddr(pMac, pHdr->sa, LOGE);
+
+ // Release AID
+ limReleaseAID(pMac, aid);
+
+
+ limRejectAssociation(pMac, pHdr->sa,
+ subType, true, authType, aid, true,
+ (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
+
+ /*return it from here rather than goto error statement.This is done as the memory is getting free twice*/
+ return;
+ //goto error;
+ }
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pStaDs->mlmStaContext.propRateSet,
+ (tANI_U8 *) &(pAssocReq->propIEinfo.propRates),
+ pAssocReq->propIEinfo.propRates.numPropRates + 1);
+
+ /// Add STA context at MAC HW (BMU, RHP & TFP)
+
+ pStaDs->qosMode = eANI_BOOLEAN_FALSE;
+ pStaDs->lleEnabled = eANI_BOOLEAN_FALSE;
+ if (pAssocReq->capabilityInfo.qos && (qosMode == eHAL_SET))
+ {
+ pStaDs->lleEnabled = eANI_BOOLEAN_TRUE;
+ pStaDs->qosMode = eANI_BOOLEAN_TRUE;
+ }
+
+ pStaDs->wmeEnabled = eANI_BOOLEAN_FALSE;
+ pStaDs->wsmEnabled = eANI_BOOLEAN_FALSE;
+ limGetWmeMode(psessionEntry, &wmeMode);
+ //if ((! pStaDs->lleEnabled) && assoc.wmeInfoPresent && pMac->dph.gDphWmeEnabled)
+ if ((! pStaDs->lleEnabled) && pAssocReq->wmeInfoPresent && (wmeMode == eHAL_SET))
+ {
+ pStaDs->wmeEnabled = eANI_BOOLEAN_TRUE;
+ pStaDs->qosMode = eANI_BOOLEAN_TRUE;
+ limGetWsmMode(psessionEntry, &wsmMode);
+ /* WMM_APSD - WMM_SA related processing should be separate; WMM_SA and WMM_APSD
+ can coexist */
+#ifdef WLAN_SOFTAP_FEATURE
+ if( pAssocReq->WMMInfoStation.present)
+ {
+ /* check whether AP supports or not */
+ if ((psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ && (psessionEntry->apUapsdEnable == 0) && (pAssocReq->WMMInfoStation.acbe_uapsd
+ || pAssocReq->WMMInfoStation.acbk_uapsd
+ || pAssocReq->WMMInfoStation.acvo_uapsd
+ || pAssocReq->WMMInfoStation.acvi_uapsd))
+ {
+
+ /**
+ * Received Re/Association Request from
+ * STA when UPASD is not supported.
+ */
+ limLog( pMac, LOGE, FL( "AP do not support UPASD REASSOC Failed\n" ));
+ limRejectAssociation(pMac, pHdr->sa,
+ subType, true, authType, aid, true,
+ (tSirResultCodes) eSIR_MAC_WME_REFUSED_STATUS, psessionEntry);
+
+
+ /*return it from here rather than goto error statement.This is done as the memory is getting free twice in this uapsd scenario*/
+ return;
+ //goto error;
+ }
+ else
+ {
+ /* update UAPSD and send it to LIM to add STA */
+ pStaDs->qos.capability.qosInfo.acbe_uapsd = pAssocReq->WMMInfoStation.acbe_uapsd;
+ pStaDs->qos.capability.qosInfo.acbk_uapsd = pAssocReq->WMMInfoStation.acbk_uapsd;
+ pStaDs->qos.capability.qosInfo.acvo_uapsd = pAssocReq->WMMInfoStation.acvo_uapsd;
+ pStaDs->qos.capability.qosInfo.acvi_uapsd = pAssocReq->WMMInfoStation.acvi_uapsd;
+ pStaDs->qos.capability.qosInfo.maxSpLen = pAssocReq->WMMInfoStation.max_sp_length;
+ }
+ }
+#endif
+ //if (assoc.wsmCapablePresent && pMac->dph.gDphWsmEnabled)
+ if (pAssocReq->wsmCapablePresent && (wsmMode == eHAL_SET))
+ pStaDs->wsmEnabled = eANI_BOOLEAN_TRUE;
+
+ }
+
+ // Re/Assoc Response frame to requesting STA
+ pStaDs->mlmStaContext.subType = subType;
+
+ if (pAssocReq->propIEinfo.aniIndicator)
+ pStaDs->aniPeer = 1;
+
+ // BTAMP: Storing the parsed assoc request in the psessionEntry array
+ psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq;
+
+ /* BTAMP: If STA context already exist (ie. updateContext = 1)
+ * for this STA, then we should delete the old one, and add
+ * the new STA. This is taken care of in the limDelSta() routine.
+ *
+ * Prior to BTAMP, we were setting this flag so that when
+ * PE receives SME_ASSOC_CNF, and if this flag is set, then
+ * PE shall delete the old station and then add. But now in
+ * BTAMP, we're directly adding station before waiting for
+ * SME_ASSOC_CNF, so we can do this now.
+ */
+ if (!updateContext)
+ {
+ pStaDs->mlmStaContext.updateContext = 0;
+
+ // BTAMP: Add STA context at HW - issue WDA_ADD_STA_REQ to HAL
+ if (limAddSta(pMac, pStaDs,psessionEntry) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGE, FL("could not Add STA with assocId=%d\n"), pStaDs->assocId);
+ limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType,
+ true, pStaDs->mlmStaContext.authType, pStaDs->assocId, true,
+ (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
+
+ /*return it from here rather than goto error statement.This is done as the memory is getting free twice*/
+ return;
+ //goto error;
+ }
+ }
+ else
+ {
+ pStaDs->mlmStaContext.updateContext = 1;
+
+#ifdef WLAN_SOFTAP_FEATURE
+ mlmPrevState = pStaDs->mlmStaContext.mlmState;
+
+ /* As per the HAL/FW needs the reassoc req need not be calling limDelSta */
+ if(subType != LIM_REASSOC)
+ {
+ //we need to set the mlmState here in order differentiate in limDelSta.
+ pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE;
+ if(limDelSta(pMac, pStaDs, true, psessionEntry) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGE, FL("could not DEL STA with assocId=%d staId %d\n"), pStaDs->assocId, pStaDs->staIndex);
+ limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType, true, pStaDs->mlmStaContext.authType,
+ pStaDs->assocId, true,(tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
+
+ //Restoring the state back.
+ pStaDs->mlmStaContext.mlmState = mlmPrevState;
+ goto error;
+ }
+ }
+ else
+ {
+ /* mlmState is changed in limAddSta context */
+ /* use the same AID, already allocated */
+ if (limAddSta(pMac, pStaDs,psessionEntry) != eSIR_SUCCESS)
+ {
+ limLog( pMac, LOGE, FL( "AP do not support UPASD REASSOC Failed\n" ));
+ limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType, true, pStaDs->mlmStaContext.authType,
+ pStaDs->assocId, true,(tSirResultCodes) eSIR_MAC_WME_REFUSED_STATUS, psessionEntry);
+
+ //Restoring the state back.
+ pStaDs->mlmStaContext.mlmState = mlmPrevState;
+ goto error;
+ }
+
+ }
+#endif
+
+ }
+
+ return;
+
+error:
+ if (pAssocReq != NULL)
+ {
+ if ( pAssocReq->assocReqFrame )
+ {
+ palFreeMemory(pMac->hHdd, pAssocReq->assocReqFrame);
+ pAssocReq->assocReqFrame = NULL;
+ }
+
+ if (palFreeMemory(pMac->hHdd, pAssocReq) != eHAL_STATUS_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("PalFree Memory failed \n"));
+ return;
+ }
+ }
+
+ if(pStaDs!= NULL)
+ psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
+ return;
+
+} /*** end limProcessAssocReqFrame() ***/
+
+
+
+/**---------------------------------------------------------------
+\fn limSendMlmAssocInd
+\brief This function sends either LIM_MLM_ASSOC_IND
+\ or LIM_MLM_REASSOC_IND to SME.
+\
+\param pMac
+\param *pStaDs - Station DPH hash entry
+\param psessionEntry - PE session entry
+\return None
+
+ * ?????? How do I get
+ * - subtype =====> psessionEntry->parsedAssocReq.reassocRequest
+ * - aid =====> pStaDs->assocId
+ * - pHdr->sa =====> pStaDs->staAddr
+ * - authType
+ * - pHdr->seqControl =====> no longer needed
+ * - pStaDs
+------------------------------------------------------------------*/
+void limSendMlmAssocInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
+{
+ tpLimMlmAssocInd pMlmAssocInd = NULL;
+ tpLimMlmReassocInd pMlmReassocInd;
+ tpSirAssocReq pAssocReq;
+ tANI_U16 temp;
+ tANI_U32 phyMode;
+ tANI_U8 subType;
+#ifdef WLAN_SOFTAP_FEATURE
+ tANI_U8 *wpsIe = NULL;
+#endif
+ tANI_U32 tmp;
+// tANI_U16 statusCode;
+ tANI_U16 i, j=0;
+
+ // Get a copy of the already parsed Assoc Request
+ pAssocReq = (tpSirAssocReq) psessionEntry->parsedAssocReq[pStaDs->assocId];
+
+ // Get the phyMode
+ limGetPhyMode(pMac, &phyMode, psessionEntry);
+
+ // Extract pre-auth context for the peer BTAMP-STA, if any.
+
+ // Determiine if its Assoc or ReAssoc Request
+ if (pAssocReq->reassocRequest == 1)
+ subType = LIM_REASSOC;
+ else
+ subType = LIM_ASSOC;
+#ifdef WLAN_SOFTAP_FEATURE
+ if (subType == LIM_ASSOC || subType == LIM_REASSOC)
+#else
+ if (subType == LIM_ASSOC )
+#endif
+ {
+ temp = sizeof(tLimMlmAssocInd);
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+ temp += pAssocReq->propIEinfo.numBss * sizeof(tSirNeighborBssInfo);
+#endif
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmAssocInd, temp))
+ {
+ limReleaseAID(pMac, pStaDs->assocId);
+ limLog(pMac, LOGP, FL("palAllocateMemory failed for pMlmAssocInd\n"));
+ return;
+ }
+ palZeroMemory( pMac->hHdd, pMlmAssocInd, temp);
+
+ palCopyMemory( pMac->hHdd,(tANI_U8 *)pMlmAssocInd->peerMacAddr,(tANI_U8 *)pStaDs->staAddr,sizeof(tSirMacAddr));
+
+ pMlmAssocInd->aid = pStaDs->assocId;
+ palCopyMemory( pMac->hHdd, (tANI_U8 *)&pMlmAssocInd->ssId,(tANI_U8 *)&(pAssocReq->ssId), pAssocReq->ssId.length + 1);
+ pMlmAssocInd->sessionId = psessionEntry->peSessionId;
+ pMlmAssocInd->authType = pStaDs->mlmStaContext.authType;
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+ // Note for BTAMP: no need to fill in pMlmAssocInd->seqNum
+ pMlmAssocInd->wniIndicator = (tAniBool) pAssocReq->propIEinfo.aniIndicator;
+ pMlmAssocInd->bpIndicator = (tAniBool) pAssocReq->propIEinfo.bpIndicator;
+ pMlmAssocInd->bpType = (tSirBpIndicatorType) pAssocReq->propIEinfo.bpType;
+ if (pAssocReq->extendedRatesPresent)
+ {
+ pMlmAssocInd->nwType = eSIR_11G_NW_TYPE;
+ limSetStaHashErpMode(pMac, pStaDs->assocId, eHAL_SET);
+ }
+ else
+ {
+ if (phyMode == WNI_CFG_PHY_MODE_11A)
+ pMlmAssocInd->nwType = eSIR_11A_NW_TYPE;
+ else
+ {
+ pMlmAssocInd->nwType = eSIR_11B_NW_TYPE;
+ limSetStaHashErpMode(pMac, pStaDs->assocId, eHAL_CLEAR);
+ }
+ }
+ pMlmAssocInd->assocType = (tSirAssocType)pAssocReq->propIEinfo.assocType;
+ pMlmAssocInd->load.numStas = pMac->lim.gLimNumOfCurrentSTAs;
+ pMlmAssocInd->load.channelUtilization =(pMac->lim.gpLimMeasData) ? pMac->lim.gpLimMeasData->avgChannelUtilization : 0;
+ pMlmAssocInd->numBss = (tANI_U32) pAssocReq->propIEinfo.numBss;
+ if (pAssocReq->propIEinfo.numBss)
+ {
+ palCopyMemory( pMac->hHdd,(tANI_U8 *) pMlmAssocInd->neighborList,(tANI_U8 *)pAssocReq->propIEinfo.pBssList,
+ (sizeof(tSirNeighborBssInfo) * pAssocReq->propIEinfo.numBss));
+ }
+#endif
+ pMlmAssocInd->capabilityInfo = pAssocReq->capabilityInfo;
+
+ // Fill in RSN IE information
+ pMlmAssocInd->rsnIE.length = 0;
+#ifdef WLAN_SOFTAP_FEATURE
+ // if WPS IE is present, ignore RSN IE
+ if (pAssocReq->addIEPresent && pAssocReq->addIE.length ) {
+ wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
+ }
+ if (pAssocReq->rsnPresent && (NULL == wpsIe))
+#else
+ if (pAssocReq->rsnPresent)
+#endif
+ {
+ limLog(pMac, LOG2, FL("Assoc Req RSN IE len = %d\n"), pAssocReq->rsn.length);
+ pMlmAssocInd->rsnIE.length = 2 + pAssocReq->rsn.length;
+ pMlmAssocInd->rsnIE.rsnIEdata[0] = SIR_MAC_RSN_EID;
+ pMlmAssocInd->rsnIE.rsnIEdata[1] = pAssocReq->rsn.length;
+ palCopyMemory( pMac->hHdd,
+ &pMlmAssocInd->rsnIE.rsnIEdata[2],
+ pAssocReq->rsn.info,
+ pAssocReq->rsn.length);
+ }
+
+ //FIXME: we need to have the cb information seprated between HT and Titan later.
+ if(pAssocReq->HTCaps.present)
+ limGetHtCbAdminState(pMac, pAssocReq->HTCaps, &pMlmAssocInd->titanHtCaps);
+
+ // Fill in 802.11h related info
+ if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent)
+ {
+ pMlmAssocInd->spectrumMgtIndicator = eSIR_TRUE;
+ pMlmAssocInd->powerCap.minTxPower = pAssocReq->powerCapability.minTxPower;
+ pMlmAssocInd->powerCap.maxTxPower = pAssocReq->powerCapability.maxTxPower;
+ limConvertSupportedChannels(pMac, pMlmAssocInd, pAssocReq);
+ }
+ else
+ pMlmAssocInd->spectrumMgtIndicator = eSIR_FALSE;
+
+
+#ifdef WLAN_SOFTAP_FEATURE
+ /* This check is to avoid extra Sec IEs present incase of WPS */
+ if (pAssocReq->wpaPresent && (NULL == wpsIe))
+#else
+ if ((pAssocReq->wpaPresent) && (pMlmAssocInd->rsnIE.length < SIR_MAC_MAX_IE_LENGTH))
+#endif
+ {
+ if((pMlmAssocInd->rsnIE.length + pAssocReq->wpa.length) >= SIR_MAC_MAX_IE_LENGTH)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("rsnIEdata index out of bounds %d\n"), pMlmAssocInd->rsnIE.length);)
+ return;
+ }
+ pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length] = SIR_MAC_WPA_EID;
+ pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length + 1] = pAssocReq->wpa.length;
+ palCopyMemory( pMac->hHdd,
+ &pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length + 2],
+ pAssocReq->wpa.info,
+ pAssocReq->wpa.length);
+ pMlmAssocInd->rsnIE.length += 2 + pAssocReq->wpa.length;
+ }
+
+
+ pMlmAssocInd->addIE.length = 0;
+ if (pAssocReq->addIEPresent)
+ {
+ palCopyMemory( pMac->hHdd,
+ &pMlmAssocInd->addIE.addIEdata,
+ pAssocReq->addIE.addIEdata,
+ pAssocReq->addIE.length);
+
+ pMlmAssocInd->addIE.length = pAssocReq->addIE.length;
+ }
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if(pAssocReq->wmeInfoPresent)
+ {
+
+ if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WME_ENABLED, &tmp) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("wlan_cfgGetInt failed for id %d\n"), WNI_CFG_WME_ENABLED );
+
+ /* check whether AP is enabled with WMM */
+ if(tmp)
+ {
+ pMlmAssocInd->WmmStaInfoPresent = 1;
+ }
+ else
+ {
+ pMlmAssocInd->WmmStaInfoPresent= 0;
+ }
+ /* Note: we are not rejecting association here because IOT will fail */
+
+ }
+#endif
+
+ // Required for indicating the frames to upper layer
+ pMlmAssocInd->assocReqLength = pAssocReq->assocReqFrameLength;
+ pMlmAssocInd->assocReqPtr = pAssocReq->assocReqFrame;
+
+ pMlmAssocInd->beaconPtr = psessionEntry->beacon;
+ pMlmAssocInd->beaconLength = psessionEntry->bcnLen;
+
+ limPostSmeMessage(pMac, LIM_MLM_ASSOC_IND, (tANI_U32 *) pMlmAssocInd);
+ palFreeMemory( pMac->hHdd, pMlmAssocInd);
+ }
+ else
+ {
+ // If its of Reassociation Request, then post LIM_MLM_REASSOC_IND
+ temp = sizeof(tLimMlmReassocInd);
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ temp += pAssocReq->propIEinfo.numBss * sizeof(tSirNeighborBssInfo);
+#endif
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmReassocInd, temp))
+ {
+ limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pMlmReassocInd\n"));
+ limReleaseAID(pMac, pStaDs->assocId);
+ return;
+ }
+ palZeroMemory( pMac->hHdd, pMlmReassocInd, temp);
+
+ palCopyMemory( pMac->hHdd,(tANI_U8 *) pMlmReassocInd->peerMacAddr, (tANI_U8 *)pStaDs->staAddr, sizeof(tSirMacAddr));
+ palCopyMemory( pMac->hHdd,(tANI_U8 *) pMlmReassocInd->currentApAddr, (tANI_U8 *)&(pAssocReq->currentApAddr), sizeof(tSirMacAddr));
+ pMlmReassocInd->aid = pStaDs->assocId;
+ pMlmReassocInd->authType = pStaDs->mlmStaContext.authType;
+ palCopyMemory( pMac->hHdd,(tANI_U8 *)&pMlmReassocInd->ssId, (tANI_U8 *)&(pAssocReq->ssId), pAssocReq->ssId.length + 1);
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+ // Note for BTAMP: no need to fill in pMlmAssocInd->seqNum
+ pMlmReassocInd->wniIndicator = (tAniBool) pAssocReq->propIEinfo.aniIndicator;
+ pMlmReassocInd->bpIndicator = (tAniBool) pAssocReq->propIEinfo.bpIndicator;
+ pMlmReassocInd->bpType = (tSirBpIndicatorType) pAssocReq->propIEinfo.bpType;
+ if (pAssocReq->extendedRatesPresent)
+ {
+ pMlmReassocInd->nwType = eSIR_11G_NW_TYPE;
+ limSetStaHashErpMode(pMac, pStaDs->assocId, eHAL_SET);
+ }
+ else
+ {
+ if (phyMode == WNI_CFG_PHY_MODE_11A)
+ pMlmReassocInd->nwType = eSIR_11A_NW_TYPE;
+ else
+ {
+ pMlmReassocInd->nwType = eSIR_11B_NW_TYPE;
+ limSetStaHashErpMode(pMac, pStaDs->assocId, eHAL_CLEAR);
+ }
+ }
+
+ pMlmReassocInd->reassocType = (tSirAssocType)pAssocReq->propIEinfo.assocType;
+ pMlmReassocInd->load.numStas = pMac->lim.gLimNumOfCurrentSTAs;
+ pMlmReassocInd->load.channelUtilization = (pMac->lim.gpLimMeasData) ?
+ pMac->lim.gpLimMeasData->avgChannelUtilization : 0;
+ pMlmReassocInd->numBss = (tANI_U32) pAssocReq->propIEinfo.numBss;
+ if (pAssocReq->propIEinfo.numBss)
+ {
+ palCopyMemory( pMac->hHdd,
+ (tANI_U8 *) pMlmReassocInd->neighborList,
+ (tANI_U8 *) pAssocReq->propIEinfo.pBssList,
+ (sizeof(tSirNeighborBssInfo) * pAssocReq->propIEinfo.numBss));
+ }
+#endif
+ if (pAssocReq->propIEinfo.aniIndicator)
+ pStaDs->aniPeer = 1;
+
+ pMlmReassocInd->capabilityInfo = pAssocReq->capabilityInfo;
+ pMlmReassocInd->rsnIE.length = 0;
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if (pAssocReq->addIEPresent && pAssocReq->addIE.length )
+ wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
+
+ if (pAssocReq->rsnPresent && (NULL == wpsIe))
+#else
+ if (pAssocReq->rsnPresent)
+#endif
+ {
+ limLog(pMac, LOG2, FL("Assoc Req: RSN IE length = %d\n"), pAssocReq->rsn.length);
+ pMlmReassocInd->rsnIE.length = 2 + pAssocReq->rsn.length;
+ pMlmReassocInd->rsnIE.rsnIEdata[0] = SIR_MAC_RSN_EID;
+ pMlmReassocInd->rsnIE.rsnIEdata[1] = pAssocReq->rsn.length;
+ palCopyMemory( pMac->hHdd, &pMlmReassocInd->rsnIE.rsnIEdata[2], pAssocReq->rsn.info, pAssocReq->rsn.length);
+ }
+
+ if(pAssocReq->HTCaps.present)
+ limGetHtCbAdminState(pMac, pAssocReq->HTCaps, &pMlmReassocInd->titanHtCaps );
+
+ // 802.11h support
+ if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent)
+ {
+ pMlmReassocInd->spectrumMgtIndicator = eSIR_TRUE;
+ pMlmReassocInd->powerCap.minTxPower = pAssocReq->powerCapability.minTxPower;
+ pMlmReassocInd->powerCap.maxTxPower = pAssocReq->powerCapability.maxTxPower;
+ pMlmReassocInd->supportedChannels.numChnl = (tANI_U8)(pAssocReq->supportedChannels.length / 2);
+
+ limLog(pMac, LOG1,
+ FL("Sending Reassoc Ind: spectrum ON, minPwr %d, maxPwr %d, numChnl %d\n"),
+ pMlmReassocInd->powerCap.minTxPower,
+ pMlmReassocInd->powerCap.maxTxPower,
+ pMlmReassocInd->supportedChannels.numChnl);
+
+ for(i=0; i < pMlmReassocInd->supportedChannels.numChnl; i++)
+ {
+ pMlmReassocInd->supportedChannels.channelList[i] = pAssocReq->supportedChannels.supportedChannels[j];
+ limLog(pMac, LOG1, FL("Sending ReassocInd: chn[%d] = %d \n"),
+ i, pMlmReassocInd->supportedChannels.channelList[i]);
+ j+=2;
+ }
+ }
+ else
+ pMlmReassocInd->spectrumMgtIndicator = eSIR_FALSE;
+
+
+#ifdef WLAN_SOFTAP_FEATURE
+ /* This check is to avoid extra Sec IEs present incase of WPS */
+ if (pAssocReq->wpaPresent && (NULL == wpsIe))
+#else
+ if (pAssocReq->wpaPresent)
+#endif
+ {
+ limLog(pMac, LOG2, FL("Received WPA IE length in Assoc Req is %d\n"), pAssocReq->wpa.length);
+ pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length] = SIR_MAC_WPA_EID;
+ pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length + 1] = pAssocReq->wpa.length;
+ palCopyMemory( pMac->hHdd,
+ &pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length + 2],
+ pAssocReq->wpa.info,
+ pAssocReq->wpa.length);
+ pMlmReassocInd->rsnIE.length += 2 + pAssocReq->wpa.length;
+ }
+
+ pMlmReassocInd->addIE.length = 0;
+ if (pAssocReq->addIEPresent)
+ {
+ palCopyMemory( pMac->hHdd,
+ &pMlmReassocInd->addIE.addIEdata,
+ pAssocReq->addIE.addIEdata,
+ pAssocReq->addIE.length);
+
+ pMlmReassocInd->addIE.length = pAssocReq->addIE.length;
+ }
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if(pAssocReq->wmeInfoPresent)
+ {
+
+ if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WME_ENABLED, &tmp) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("wlan_cfgGetInt failed for id %d\n"), WNI_CFG_WME_ENABLED );
+
+ /* check whether AP is enabled with WMM */
+ if(tmp)
+ {
+ pMlmReassocInd->WmmStaInfoPresent = 1;
+ }
+ else
+ {
+ pMlmReassocInd->WmmStaInfoPresent = 0;
+ }
+ /* Note: we are not rejecting Re-association here because IOT will fail */
+
+ }
+#endif
+
+ // Required for indicating the frames to upper layer
+ pMlmReassocInd->assocReqLength = pAssocReq->assocReqFrameLength;
+ pMlmReassocInd->assocReqPtr = pAssocReq->assocReqFrame;
+
+ pMlmReassocInd->beaconPtr = psessionEntry->beacon;
+ pMlmReassocInd->beaconLength = psessionEntry->bcnLen;
+
+ limPostSmeMessage(pMac, LIM_MLM_REASSOC_IND, (tANI_U32 *) pMlmReassocInd);
+ palFreeMemory( pMac->hHdd, pMlmReassocInd);
+ }
+
+ return;
+
+} /*** end limSendMlmAssocInd() ***/
diff --git a/CORE/MAC/src/pe/lim/limProcessAssocRspFrame.c b/CORE/MAC/src/pe/lim/limProcessAssocRspFrame.c
new file mode 100644
index 0000000..954ff1e
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limProcessAssocRspFrame.c
@@ -0,0 +1,786 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limProcessAssocRspFrame.cc contains the code
+ * for processing Re/Association Response Frame.
+ * Author: Chandra Modumudi
+ * Date: 03/18/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#include "wniApi.h"
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+#include "wniCfgAp.h"
+#else
+#include "wniCfgSta.h"
+#endif
+#include "aniGlobal.h"
+#include "cfgApi.h"
+
+#include "utilsApi.h"
+#include "pmmApi.h"
+#include "limTypes.h"
+#include "limUtils.h"
+#include "limAssocUtils.h"
+#include "limSecurityUtils.h"
+#include "limSerDesUtils.h"
+#include "limStaHashApi.h"
+#include "limSendMessages.h"
+
+#ifdef FEATURE_WLAN_CCX
+#include "ccxApi.h"
+#endif
+
+extern tSirRetStatus schBeaconEdcaProcess(tpAniSirGlobal pMac, tSirMacEdcaParamSetIE *edca, tpPESession psessionEntry);
+
+
+/**
+ * @function : limUpdateAssocStaDatas
+ *
+ * @brief : This function is called to Update the Station Descriptor (dph) Details from
+ * Association / ReAssociation Response Frame
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pStaDs - Station Descriptor in DPH
+ * @param pAssocRsp - Pointer to Association Response Structure
+ *
+ * @return None
+ */
+void limUpdateAssocStaDatas(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpSirAssocRsp pAssocRsp,tpPESession psessionEntry)
+{
+ tANI_U32 prop;
+ tANI_U32 phyMode;
+ tANI_U32 val;
+ //tpSirBoardCapabilities pBoardCaps;
+ tANI_BOOLEAN qosMode;
+ tANI_U16 rxHighestRate = 0;
+
+ limGetPhyMode(pMac, &phyMode, psessionEntry);
+
+ pStaDs->staType= STA_ENTRY_SELF;
+
+ limGetQosMode(psessionEntry, &qosMode);
+ // set the ani peer bit, if self mode is one of the proprietary modes
+ if(IS_DOT11_MODE_PROPRIETARY(psessionEntry->dot11mode))
+ {
+ wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, &prop);
+
+ if (prop)
+ {
+ pStaDs->aniPeer = eHAL_SET;
+ pStaDs->propCapability = pAssocRsp->propIEinfo.capability;
+ }
+ }
+
+ //pMac->lim.gLimMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
+ pStaDs->mlmStaContext.authType = psessionEntry->limCurrentAuthType;
+
+ // Add capabilities information, rates and AID
+ pStaDs->mlmStaContext.capabilityInfo = pAssocRsp->capabilityInfo;
+ pStaDs->shortPreambleEnabled= (tANI_U8)pAssocRsp->capabilityInfo.shortPreamble;
+
+ //Update HT Capabilites only when the self mode supports HT
+ if(IS_DOT11_MODE_HT(psessionEntry->dot11mode)) {
+ pStaDs->mlmStaContext.htCapability = pAssocRsp->HTCaps.present;
+
+ if ( pAssocRsp->HTCaps.present ) {
+ pStaDs->htGreenfield = ( tANI_U8 ) pAssocRsp->HTCaps.greenField;
+ pStaDs->htSupportedChannelWidthSet = ( tANI_U8 ) (pAssocRsp->HTCaps.supportedChannelWidthSet ?
+ pAssocRsp->HTInfo.recommendedTxWidthSet :
+ pAssocRsp->HTCaps.supportedChannelWidthSet );
+ pStaDs->htLsigTXOPProtection = ( tANI_U8 ) pAssocRsp->HTCaps.lsigTXOPProtection;
+ pStaDs->htMIMOPSState = (tSirMacHTMIMOPowerSaveState)pAssocRsp->HTCaps.mimoPowerSave;
+ pStaDs->htMaxAmsduLength = ( tANI_U8 ) pAssocRsp->HTCaps.maximalAMSDUsize;
+ pStaDs->htAMpduDensity = pAssocRsp->HTCaps.mpduDensity;
+ pStaDs->htDsssCckRate40MHzSupport = (tANI_U8)pAssocRsp->HTCaps.dsssCckMode40MHz;
+ pStaDs->htShortGI20Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI20MHz;
+ pStaDs->htShortGI40Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI40MHz;
+ pStaDs->htMaxRxAMpduFactor = pAssocRsp->HTCaps.maxRxAMPDUFactor;
+ limFillRxHighestSupportedRate(pMac, &rxHighestRate, pAssocRsp->HTCaps.supportedMCSSet);
+ pStaDs->supportedRates.rxHighestDataRate = rxHighestRate;
+
+ //FIXME_AMPDU
+ // In the future, may need to check for "assoc.HTCaps.delayedBA"
+ // For now, it is IMMEDIATE BA only on ALL TID's
+ pStaDs->baPolicyFlag = 0xFF;
+ }
+ }
+
+ if (limPopulateOwnRateSet(pMac, &pStaDs->supportedRates, pAssocRsp->HTCaps.supportedMCSSet, false,psessionEntry) != eSIR_SUCCESS) {
+ limLog(pMac, LOGP, FL("could not get rateset and extended rate set\n"));
+ return;
+ }
+
+ //If one of the rates is 11g rates, set the ERP mode.
+ if ((phyMode == WNI_CFG_PHY_MODE_11G) && sirIsArate(pStaDs->supportedRates.llaRates[0] & 0x7f))
+ pStaDs->erpEnabled = eHAL_SET;
+
+
+ val = WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET_LEN;
+ if (wlan_cfgGetStr(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET,
+ (tANI_U8 *) &pStaDs->mlmStaContext.propRateSet.propRate,
+ &val) != eSIR_SUCCESS) {
+ /// Could not get prop rateset from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve prop rateset\n"));
+ return;
+ }
+ pStaDs->mlmStaContext.propRateSet.numPropRates = (tANI_U8) val;
+
+ pStaDs->qosMode = 0;
+ pStaDs->lleEnabled = 0;
+
+ // update TSID to UP mapping
+ //if (pMac->lim.gLimQosEnabled)
+ if (qosMode) {
+ if (pAssocRsp->edcaPresent) {
+ tSirRetStatus status;
+ status = schBeaconEdcaProcess(pMac,&pAssocRsp->edca, psessionEntry);
+ PELOG2(limLog(pMac, LOG2, "Edca set update based on AssocRsp: status %d\n",
+ status);)
+ if (status != eSIR_SUCCESS) {
+ PELOGE(limLog(pMac, LOGE, FL("Edca error in AssocResp \n"));)
+ } else { // update default tidmap based on ACM
+ pStaDs->qosMode = 1;
+ pStaDs->lleEnabled = 1;
+ }
+ }
+ }
+
+ pStaDs->wmeEnabled = 0;
+ pStaDs->wsmEnabled = 0;
+ if (psessionEntry->limWmeEnabled && pAssocRsp->wmeEdcaPresent)
+ {
+ tSirRetStatus status;
+ status = schBeaconEdcaProcess(pMac,&pAssocRsp->edca, psessionEntry);
+ PELOGW(limLog(pMac, LOGW, "WME Edca set update based on AssocRsp: status %d\n", status);)
+
+ if (status != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("WME Edca error in AssocResp - ignoring\n"));)
+ else { // update default tidmap based on HashACM
+ pStaDs->qosMode = 1;
+ pStaDs->wmeEnabled = 1;
+ }
+ }
+ else {
+ /* We received assoc rsp from a legacy AP. So fill in the default
+ * local EDCA params. This is needed (refer to bug #14989) as we'll
+ * be passing the gLimEdcaParams to HAL in limProcessStaMlmAddBssRsp().
+ */
+ schSetDefaultEdcaParams(pMac, psessionEntry);
+ }
+
+
+}
+
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+/**
+ * @function : limUpdateReAssocGlobals
+ *
+ * @brief : This function is called to Update the Globals (LIM) during ReAssoc.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pAssocRsp - Pointer to Association Response Structure
+ *
+ * @return None
+ */
+
+void limUpdateReAssocGlobals(tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp,tpPESession psessionEntry)
+{
+ /**
+ * Update the status for PMM module
+ */
+ pmmResetPmmState(pMac);
+
+ // Update the current Bss Information
+ palCopyMemory( pMac->hHdd, psessionEntry->bssId,
+ psessionEntry->limReAssocbssId, sizeof(tSirMacAddr));
+ psessionEntry->currentOperChannel = psessionEntry->limReassocChannelId;
+ psessionEntry->limCurrentBssCaps = psessionEntry->limReassocBssCaps;
+ psessionEntry->limCurrentBssQosCaps = psessionEntry->limReassocBssQosCaps;
+ psessionEntry->limCurrentBssPropCap = psessionEntry->limReassocBssPropCap;
+ psessionEntry->limCurrentTitanHtCaps = psessionEntry->limReassocTitanHtCaps;
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &psessionEntry->ssId,
+ (tANI_U8 *) &psessionEntry->limReassocSSID,
+ psessionEntry->limReassocSSID.length+1);
+
+ // Store assigned AID for TIM processing
+ psessionEntry->limAID = pAssocRsp->aid & 0x3FFF;
+ /** Set the State Back to ReAssoc Rsp*/
+ psessionEntry->limMlmState = eLIM_MLM_WT_REASSOC_RSP_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+
+}
+#endif
+
+/**
+ * @function : limProcessAssocRspFrame
+ *
+ * @brief : This function is called by limProcessMessageQueue() upon
+ * Re/Association Response frame reception.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param *pRxPacketInfo - A pointer to Rx packet info structure
+ * @param subType - Indicates whether it is Association Response (=0) or
+ * Reassociation Response (=1) frame
+ *
+ * @return None
+ */
+
+void
+limProcessAssocRspFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U8 subType,tpPESession psessionEntry)
+{
+ tANI_U8 *pBody;
+ tANI_U16 caps;
+ tANI_U32 frameLen;
+ tSirMacAddr currentBssId;
+ tpSirMacMgmtHdr pHdr;
+ tSirMacCapabilityInfo localCapabilities;
+ tpDphHashNode pStaDs;
+ tpSirAssocRsp pAssocRsp;
+ tLimMlmAssocCnf mlmAssocCnf;
+
+ #ifdef ANI_PRODUCT_TYPE_CLIENT
+ tSchBeaconStruct beaconStruct;
+#endif
+
+ //Initialize status code to success.
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+
+ mlmAssocCnf.resultCode = eSIR_SME_SUCCESS;
+ /* Update PE session Id*/
+ mlmAssocCnf.sessionId = psessionEntry->peSessionId;
+
+
+ if (psessionEntry->limSystemRole == eLIM_AP_ROLE || psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE )
+ {
+ // Should not have received Re/Association Response
+ // frame on AP. Log error
+ limLog(pMac, LOGE,
+ FL("received Re/Assoc response frame on role %d \n"),
+ psessionEntry->limSystemRole);
+
+ return;
+ }
+
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+ frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
+
+ if (((subType == LIM_ASSOC) &&
+ (psessionEntry->limMlmState != eLIM_MLM_WT_ASSOC_RSP_STATE)) ||
+ ((subType == LIM_REASSOC) &&
+ ((psessionEntry->limMlmState != eLIM_MLM_WT_REASSOC_RSP_STATE)
+#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+ && (psessionEntry->limMlmState != eLIM_MLM_WT_FT_REASSOC_RSP_STATE)
+#endif
+ )))
+ {
+ /// Received unexpected Re/Association Response frame
+
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOG1(limLog(pMac, LOG1, FL("mlm state is set to %d session=%d\n"),
+ psessionEntry->limMlmState, psessionEntry->peSessionId);)
+#endif
+ // Log error
+ if (!pHdr->fc.retry)
+ {
+ limLog(pMac, LOGE,
+ FL("received Re/Assoc rsp frame in unexpected state\n"));
+ limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
+ }
+
+ return;
+ }
+#if 0
+ if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) !=
+ eSIR_SUCCESS)
+ {
+ /// Could not get BSSID from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
+ return;
+ }
+#endif //TO SUPPORT BT-AMP
+ sirCopyMacAddr(currentBssId,psessionEntry->bssId);
+
+ if (subType == LIM_ASSOC)
+ {
+ if (!palEqualMemory( pMac->hHdd,pHdr->sa, currentBssId, sizeof(tSirMacAddr)) )
+ {
+ /**
+ * Received Association Response frame from an entity
+ * other than one to which request was initiated.
+ * Ignore this and wait until Association Failure Timeout.
+ */
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received AssocRsp frame from unexpected peer "));
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ return;
+ }
+ }
+ else
+ {
+ if ( !palEqualMemory( pMac->hHdd,pHdr->sa, psessionEntry->limReAssocbssId, sizeof(tSirMacAddr)) )
+ {
+ /**
+ * Received Reassociation Response frame from an entity
+ * other than one to which request was initiated.
+ * Ignore this and wait until Reassociation Failure Timeout.
+ */
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received ReassocRsp frame from unexpected peer "));)
+ PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ return;
+ }
+ }
+
+ if ( palAllocateMemory(pMac->hHdd, (void **)&pAssocRsp, sizeof(*pAssocRsp)) != eHAL_STATUS_SUCCESS) {
+ limLog(pMac, LOGP, FL("Pal Allocate Memory failed in AssocRsp\n"));
+ return;
+ }
+
+ // Get pointer to Re/Association Response frame body
+ pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
+
+ // parse Re/Association Response frame.
+ if (sirConvertAssocRespFrame2Struct(
+ pMac, pBody, frameLen, pAssocRsp) == eSIR_FAILURE)
+ {
+ if (palFreeMemory(pMac->hHdd, pAssocRsp) != eHAL_STATUS_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("PalFree Memory failed \n"));
+ return;
+ }
+ PELOGE(limLog(pMac, LOGE, FL("Parse error Assoc resp subtype %d, length=%d\n"), frameLen,subType);)
+ return;
+ }
+
+ if(!pAssocRsp->suppRatesPresent)
+ {
+ PELOGE(limLog(pMac, LOGW, FL("assoc response does not have supported rate set"));)
+ palCopyMemory(pMac->hHdd, &pAssocRsp->supportedRates,
+ &psessionEntry->rateSet, sizeof(tSirMacRateSet));
+ }
+
+ mlmAssocCnf.protStatusCode = pAssocRsp->statusCode;
+
+ if( psessionEntry->assocRsp != NULL )
+ {
+ palFreeMemory(pMac->hHdd, psessionEntry->assocRsp);
+ psessionEntry->assocRsp = NULL;
+ }
+ if( (palAllocateMemory(pMac->hHdd, (void**)&psessionEntry->assocRsp, frameLen)) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc response, len = %d"), frameLen);)
+ }
+ else
+ {
+ //Store the Assoc response. This is sent to csr/hdd in join cnf response.
+ palCopyMemory(pMac->hHdd, psessionEntry->assocRsp, pBody, frameLen);
+ psessionEntry->assocRspLen = frameLen;
+ }
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ if (psessionEntry->ricData != NULL)
+ {
+ palFreeMemory(pMac->hHdd, psessionEntry->ricData);
+ psessionEntry->ricData = NULL;
+ }
+ if(pAssocRsp->ricPresent)
+ {
+ psessionEntry->RICDataLen = pAssocRsp->num_RICData * sizeof(tDot11fIERICDataDesc);
+ if( (palAllocateMemory(pMac->hHdd, (void**)&psessionEntry->ricData, psessionEntry->RICDataLen)) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc response"));)
+ psessionEntry->RICDataLen = 0;
+ }
+ else
+ {
+ palCopyMemory(pMac->hHdd, psessionEntry->ricData, &pAssocRsp->RICData[0], psessionEntry->RICDataLen);
+ }
+ }
+ else
+ {
+ psessionEntry->RICDataLen = 0;
+ psessionEntry->ricData = NULL;
+ }
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+ if (psessionEntry->tspecIes != NULL)
+ {
+ palFreeMemory(pMac->hHdd, psessionEntry->tspecIes);
+ psessionEntry->tspecIes = NULL;
+ }
+ if(pAssocRsp->tspecPresent)
+ {
+ psessionEntry->tspecLen = pAssocRsp->num_tspecs * sizeof(tDot11fIEWMMTSPEC);
+ if( (palAllocateMemory(pMac->hHdd, (void**)&psessionEntry->tspecIes, psessionEntry->tspecLen)) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc response"));)
+ psessionEntry->tspecLen = 0;
+ }
+ else
+ {
+ palCopyMemory(pMac->hHdd, psessionEntry->tspecIes, &pAssocRsp->TSPECInfo[0], psessionEntry->tspecLen);
+ }
+ PELOG1(limLog(pMac, LOG1, FL(" Tspec EID present in assoc rsp "));)
+ }
+ else
+ {
+ psessionEntry->tspecLen = 0;
+ psessionEntry->tspecIes = NULL;
+ PELOG1(limLog(pMac, LOG1, FL(" Tspec EID *NOT* present in assoc rsp "));)
+ }
+#endif
+
+ if (pAssocRsp->capabilityInfo.ibss)
+ {
+ /**
+ * Received Re/Association Response from peer
+ * with IBSS capability set.
+ * Ignore the frame and wait until Re/assoc
+ * failure timeout.
+ */
+
+ // Log error
+ limLog(pMac, LOGE,
+ FL("received Re/AssocRsp frame with IBSS capability\n"));
+ palFreeMemory(pMac->hHdd, pAssocRsp);
+ return;
+ }
+
+ if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get Capabilities value
+ * from CFG. Log error.
+ */
+ palFreeMemory(pMac->hHdd, pAssocRsp);
+ limLog(pMac, LOGP, FL("could not retrieve Capabilities value\n"));
+ return;
+ }
+ limCopyU16((tANI_U8 *) &localCapabilities, caps);
+
+ if (subType == LIM_ASSOC) // Stop Association failure timer
+ limDeactivateAndChangeTimer(pMac, eLIM_ASSOC_FAIL_TIMER);
+ else // Stop Reassociation failure timer
+ limDeactivateAndChangeTimer(pMac, eLIM_REASSOC_FAIL_TIMER);
+
+ if (pAssocRsp->statusCode != eSIR_MAC_SUCCESS_STATUS)
+ {
+ // Re/Association response was received
+ // either with failure code.
+ // Log error.
+ PELOGE(limLog(pMac, LOGE, FL("received Re/AssocRsp frame failure code %d\n"), pAssocRsp->statusCode);)
+ // Need to update 'association failure' error counter
+ // along with STATUS CODE
+
+ // Return Assoc confirm to SME with received failure code
+
+ if (pAssocRsp->propIEinfo.loadBalanceInfoPresent)
+ {
+ mlmAssocCnf.resultCode = eSIR_SME_TRANSFER_STA;
+ palCopyMemory( pMac->hHdd, pMac->lim.gLimAlternateRadio.bssId,
+ pAssocRsp->propIEinfo.alternateRadio.bssId, sizeof(tSirMacAddr));
+ pMac->lim.gLimAlternateRadio.channelId =
+ pAssocRsp->propIEinfo.alternateRadio.channelId;
+ }else
+ mlmAssocCnf.resultCode = eSIR_SME_ASSOC_REFUSED;
+
+ // Delete Pre-auth context for the associated BSS
+ if (limSearchPreAuthList(pMac, pHdr->sa))
+ limDeletePreAuthNode(pMac, pHdr->sa);
+
+ goto assocReject;
+ }
+ else if ((pAssocRsp->aid & 0x3FFF) > 2007)
+ {
+ // Re/Association response was received
+ // with invalid AID value
+ // Log error
+ PELOGW(limLog(pMac, LOGW, FL("received Re/AssocRsp frame with invalid aid %X \n"), pAssocRsp->aid);)
+ mlmAssocCnf.resultCode = eSIR_SME_INVALID_ASSOC_RSP_RXED;
+ mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+
+ // Send advisory Disassociation frame to AP
+ limSendDisassocMgmtFrame(pMac, eSIR_MAC_UNSPEC_FAILURE_REASON, pHdr->sa,psessionEntry);
+
+ goto assocReject;
+ }
+ // Association Response received with success code
+
+ if (subType == LIM_REASSOC)
+ {
+ // Log success
+ PELOG1(limLog(pMac, LOG1, FL("Successfully Reassociated with BSS\n"));)
+#ifdef FEATURE_WLAN_CCX
+ {
+ tANI_U8 cnt = 0;
+ if (pAssocRsp->tsmPresent)
+ {
+ limLog(pMac, LOGW, "TSM IE Present in Reassoc Rsp\n");
+ // Start the TSM timer only if the TSPEC Ie is present in the reassoc rsp
+ if (pAssocRsp->tspecPresent) {
+ // Find the TSPEC IE with VO user priority
+ for (cnt=0; cnt<pAssocRsp->num_tspecs; cnt++) {
+ if ( upToAc(pAssocRsp->TSPECInfo[cnt].user_priority) == EDCA_AC_VO) {
+ psessionEntry->ccxContext.tsm.tid = pAssocRsp->TSPECInfo[cnt].user_priority;
+ vos_mem_copy(&psessionEntry->ccxContext.tsm.tsmInfo,
+ &pAssocRsp->tsmIE, sizeof(tSirMacCCXTSMIE));
+ limActivateTSMStatsTimer(pMac, psessionEntry);
+ if(psessionEntry->ccxContext.tsm.tsmInfo.state) {
+ psessionEntry->ccxContext.tsm.tsmMetrics.RoamingCount++;
+ }
+ break;
+ }
+ }
+ } else {
+ limLog(pMac, LOGE, "TSM present but TSPEC IE not present in Reassoc Rsp\n");
+ }
+ }
+ }
+#endif
+ if (psessionEntry->pLimMlmJoinReq)
+ {
+ palFreeMemory( pMac->hHdd, psessionEntry->pLimMlmJoinReq);
+ psessionEntry->pLimMlmJoinReq = NULL;
+ }
+
+ psessionEntry->limAssocResponseData = (void *) pAssocRsp; /** Store the ReAssocRsp Frame in DphTable to be used
+ during processing DelSta nd DelBss to send AddBss again*/
+ pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
+
+ if(!pStaDs)
+ {
+ PELOGE(limLog(pMac, LOG1, FL("could not get hash entry at DPH for \n"));)
+ limPrintMacAddr(pMac, pHdr->sa, LOGE);
+ mlmAssocCnf.resultCode = eSIR_SME_INVALID_ASSOC_RSP_RXED;
+ mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+
+ // Send advisory Disassociation frame to AP
+ limSendDisassocMgmtFrame(pMac, eSIR_MAC_UNSPEC_FAILURE_REASON, pHdr->sa,psessionEntry);
+
+ goto assocReject;
+ }
+
+#if defined(WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+ if (psessionEntry->limMlmState == eLIM_MLM_WT_FT_REASSOC_RSP_STATE)
+ {
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog(pMac, LOGE, FL("Sending self sta\n"));)
+#endif
+ pmmResetPmmState(pMac);
+
+ limUpdateAssocStaDatas(pMac, pStaDs, pAssocRsp,psessionEntry);
+
+ // Store assigned AID for TIM processing
+ psessionEntry->limAID = pAssocRsp->aid & 0x3FFF;
+
+ limAddFTStaSelf(pMac, (pAssocRsp->aid & 0x3FFF), psessionEntry);
+
+ return;
+ }
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+ /* If we're re-associating to the same BSS, we don't want to invoke delete
+ * STA, delete BSS, as that would remove the already established TSPEC.
+ * Just go ahead and re-add the BSS, STA with new capability information.
+ * However, if we're re-associating to a different BSS, then follow thru
+ * with del STA, del BSS, add BSS, add STA.
+ */
+ if (sirCompareMacAddr( psessionEntry->bssId, psessionEntry->limReAssocbssId))
+ limHandleAddBssInReAssocContext(pMac, pStaDs, psessionEntry);
+ else
+ {
+ // reset the uapsd mask settings since we're re-associating to new AP
+ pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
+ pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
+
+ if (limCleanupRxPath(pMac, pStaDs,psessionEntry) != eSIR_SUCCESS)
+ goto assocReject;
+ }
+ return;
+ }
+
+ // Log success
+ PELOG1(limLog(pMac, LOG1, FL("Successfully Associated with BSS\n"));)
+#ifdef FEATURE_WLAN_CCX
+ if(psessionEntry->ccxContext.tsm.tsmInfo.state)
+ {
+ psessionEntry->ccxContext.tsm.tsmMetrics.RoamingCount = 0;
+ }
+#endif
+ /**
+ * Update the status for PMM module
+ */
+ pmmResetPmmState(pMac);
+
+ // Store assigned AID for TIM processing
+ psessionEntry->limAID = pAssocRsp->aid & 0x3FFF;
+
+
+ //STA entry was created during pre-assoc state.
+ if ((pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
+ {
+ // Could not add hash table entry
+ PELOGE(limLog(pMac, LOGE, FL("could not get hash entry at DPH for \n"));)
+ limPrintMacAddr(pMac, pHdr->sa, LOGE);
+
+ mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ mlmAssocCnf.protStatusCode = eSIR_SME_SUCCESS;
+
+
+ limPostSmeMessage(pMac, LIM_MLM_ASSOC_CNF,
+ (tANI_U32 *) &mlmAssocCnf);
+ palFreeMemory(pMac->hHdd, pAssocRsp);
+ return;
+ }
+
+ // Delete Pre-auth context for the associated BSS
+ if (limSearchPreAuthList(pMac, pHdr->sa))
+ limDeletePreAuthNode(pMac, pHdr->sa);
+
+ limUpdateAssocStaDatas(pMac, pStaDs, pAssocRsp,psessionEntry);
+#ifdef ANI_PRODUCT_TYPE_CLIENT
+ // Extract the AP capabilities from the beacon that was received earlier
+ // TODO - Watch out for an error response!
+ limExtractApCapabilities( pMac,
+ (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
+ limGetIElenFromBssDescription( &psessionEntry->pLimJoinReq->bssDescription ),
+ &beaconStruct );
+
+ if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
+ limDecideStaProtectionOnAssoc(pMac, &beaconStruct, psessionEntry);
+
+ if(beaconStruct.erpPresent) {
+ if (beaconStruct.erpIEInfo.barkerPreambleMode)
+ psessionEntry->beaconParams.fShortPreamble = false;
+ else
+ psessionEntry->beaconParams.fShortPreamble = true;
+ }
+
+
+ //Update the BSS Entry, this entry was added during preassoc.
+ if( eSIR_SUCCESS == limStaSendAddBss( pMac, pAssocRsp, &beaconStruct,
+ &psessionEntry->pLimJoinReq->bssDescription, true, psessionEntry))
+ {
+ palFreeMemory(pMac->hHdd, pAssocRsp);
+ return;
+ }
+ else
+ {
+ mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+ }
+
+#elif defined(ANI_AP_CLIENT_SDK)
+ if( eSIR_SUCCESS == limStaSendAddBss( pMac, *pAssocRsp,
+ &psessionEntry->pLimJoinReq->neighborBssList.bssList[0], true))
+ {
+ palFreeMemory(pMac->hHdd, pAssocRsp);
+ return;
+ }
+ else
+ {
+ mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+ }
+#else
+ palFreeMemory(pMac->hHdd, pAssocRsp);
+ return;
+#endif
+
+
+assocReject:
+ if ((subType == LIM_ASSOC)
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ || ((subType == LIM_REASSOC) && (psessionEntry->limMlmState == eLIM_MLM_WT_FT_REASSOC_RSP_STATE))
+#endif
+ ) {
+ PELOGE(limLog(pMac, LOGE, FL("Assoc Rejected by the peer. Reason: %d\n"), mlmAssocCnf.resultCode);)
+ pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+ if (psessionEntry->pLimMlmJoinReq)
+ {
+ palFreeMemory( pMac->hHdd, psessionEntry->pLimMlmJoinReq);
+ psessionEntry->pLimMlmJoinReq = NULL;
+ }
+ if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
+ psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState\n"));)
+ if (subType == LIM_ASSOC)
+ {
+ limPostSmeMessage(pMac, LIM_MLM_ASSOC_CNF, (tANI_U32 *) &mlmAssocCnf);
+ }
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ else
+ {
+ mlmAssocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
+ limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmAssocCnf);
+ }
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+ } else {
+ limRestorePreReassocState( pMac,
+ eSIR_SME_REASSOC_REFUSED, mlmAssocCnf.protStatusCode,psessionEntry);
+ }
+
+ /* CR: vos packet memory is leaked when assoc rsp timeouted/failed. */
+ /* notify TL that association is failed so that TL can flush the cached frame */
+ WLANTL_AssocFailed (psessionEntry->staId);
+
+
+ palFreeMemory(pMac->hHdd, pAssocRsp);
+ return;
+} /*** end limProcessAssocRspFrame() ***/
+
diff --git a/CORE/MAC/src/pe/lim/limProcessAuthFrame.c b/CORE/MAC/src/pe/lim/limProcessAuthFrame.c
new file mode 100644
index 0000000..08fd818
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limProcessAuthFrame.c
@@ -0,0 +1,1742 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limProcessAuthFrame.cc contains the code
+ * for processing received Authentication Frame.
+ * Author: Chandra Modumudi
+ * Date: 03/11/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ * 05/12/2010 js To support Shared key authentication at AP side
+ *
+ */
+
+#include "wniApi.h"
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halDataStruct.h"
+#endif
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+#include "wniCfgAp.h"
+#else
+#include "wniCfgSta.h"
+#endif
+#include "aniGlobal.h"
+#include "cfgApi.h"
+
+#include "utilsApi.h"
+#include "limUtils.h"
+#include "limAssocUtils.h"
+#include "limSecurityUtils.h"
+#include "limSerDesUtils.h"
+#ifdef WLAN_FEATURE_VOWIFI_11R
+#include "limFT.h"
+#endif
+#include "vos_utils.h"
+
+
+/**
+ * isAuthValid
+ *
+ *FUNCTION:
+ * This function is called by limProcessAuthFrame() upon Authentication
+ * frame reception.
+ *
+ *LOGIC:
+ * This function is used to test validity of auth frame:
+ * - AUTH1 and AUTH3 must be received in AP mode
+ * - AUTH2 and AUTH4 must be received in STA mode
+ * - AUTH3 and AUTH4 must have challenge text IE, that is,'type' field has been set to
+ * SIR_MAC_CHALLENGE_TEXT_EID by parser
+ * -
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param *auth - Pointer to extracted auth frame body
+ *
+ * @return 0 or 1 (Valid)
+ */
+
+
+static inline unsigned int isAuthValid(tpAniSirGlobal pMac, tpSirMacAuthFrameBody auth,tpPESession sessionEntry) {
+ unsigned int valid;
+ valid=1;
+
+ if ( ((auth->authTransactionSeqNumber==SIR_MAC_AUTH_FRAME_1)||
+ (auth->authTransactionSeqNumber==SIR_MAC_AUTH_FRAME_3)) &&
+ ((sessionEntry->limSystemRole == eLIM_STA_ROLE)||(sessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)))
+ valid=0;
+
+ if ( ((auth->authTransactionSeqNumber==SIR_MAC_AUTH_FRAME_2)||(auth->authTransactionSeqNumber==SIR_MAC_AUTH_FRAME_4))&&
+ ((sessionEntry->limSystemRole == eLIM_AP_ROLE)||(sessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)))
+ valid=0;
+
+ if ( ((auth->authTransactionSeqNumber==SIR_MAC_AUTH_FRAME_3)||(auth->authTransactionSeqNumber==SIR_MAC_AUTH_FRAME_4))&&
+ (auth->type!=SIR_MAC_CHALLENGE_TEXT_EID)&&(auth->authAlgoNumber != eSIR_SHARED_KEY))
+ valid=0;
+
+ return valid;
+}
+
+
+/**
+ * limProcessAuthFrame
+ *
+ *FUNCTION:
+ * This function is called by limProcessMessageQueue() upon Authentication
+ * frame reception.
+ *
+ *LOGIC:
+ * This function processes received Authentication frame and responds
+ * with either next Authentication frame in sequence to peer MAC entity
+ * or LIM_MLM_AUTH_IND on AP or LIM_MLM_AUTH_CNF on STA.
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ * 1. Authentication failures are reported to SME with same status code
+ * received from the peer MAC entity.
+ * 2. Authentication frame2/4 received with alogirthm number other than
+ * one requested in frame1/3 are logged with an error and auth confirm
+ * will be sent to SME only after auth failure timeout.
+ * 3. Inconsistency in the spec:
+ * On receiving Auth frame2, specs says that if WEP key mapping key
+ * or default key is NULL, Auth frame3 with a status code 15 (challenge
+ * failure to be returned to peer entity. However, section 7.2.3.10,
+ * table 14 says that status code field is 'reserved' for frame3 !
+ * In the current implementation, Auth frame3 is returned with status
+ * code 15 overriding section 7.2.3.10.
+ * 4. If number pre-authentications reach configrable max limit,
+ * Authentication frame with 'unspecified failure' status code is
+ * returned to requesting entity.
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param *pRxPacketInfo - A pointer to Rx packet info structure
+ * @return None
+ */
+
+void
+limProcessAuthFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tpPESession psessionEntry)
+{
+ tANI_U8 *pBody, keyId, cfgPrivacyOptImp,
+ defaultKey[SIR_MAC_KEY_LENGTH],
+ encrAuthFrame[LIM_ENCR_AUTH_BODY_LEN],
+ plainBody[256];
+ tANI_U16 frameLen;
+ //tANI_U32 authRspTimeout, maxNumPreAuth, val;
+ tANI_U32 maxNumPreAuth, val;
+ tSirMacAuthFrameBody *pRxAuthFrameBody, rxAuthFrame, authFrame;
+ tpSirMacMgmtHdr pHdr;
+ tCfgWepKeyEntry *pKeyMapEntry = NULL;
+ struct tLimPreAuthNode *pAuthNode;
+ tLimMlmAuthInd mlmAuthInd;
+ tANI_U8 decryptResult;
+ tANI_U8 *pChallenge;
+ tANI_U32 key_length=8;
+ tANI_U8 challengeTextArray[SIR_MAC_AUTH_CHALLENGE_LENGTH];
+#ifdef WLAN_SOFTAP_FEATURE
+ tpDphHashNode pStaDs = NULL;
+ tANI_U16 assocId = 0;
+#endif
+ /* Added For BT -AMP support */
+ // Get pointer to Authentication frame header and body
+
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+ frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
+
+
+ if (!frameLen)
+ {
+ // Log error
+ limLog(pMac, LOGE,
+ FL("received Authentication frame with no body from "));
+ limPrintMacAddr(pMac, pHdr->sa, LOGE);
+
+ return;
+ }
+
+ if (limIsGroupAddr(pHdr->sa))
+ {
+ // Received Auth frame from a BC/MC address
+ // Log error and ignore it
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Auth frame from a BC/MC address - "));)
+ PELOG1( limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ return;
+ }
+
+ pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
+
+ PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, (tANI_U8*)pBd, ((tpHalBufDesc) pBd)->mpduDataOffset + frameLen);)
+
+
+
+ /// Determine if WEP bit is set in the FC or received MAC header
+ if (pHdr->fc.wep)
+ {
+ /**
+ * WEP bit is set in FC of MAC header.
+ */
+
+#ifdef WLAN_SOFTAP_FEATURE
+ // If TKIP counter measures enabled issue Deauth frame to station
+ if ((psessionEntry->bTkipCntrMeasActive) && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
+ {
+ PELOGE( limLog(pMac, LOGE,
+ FL("Tkip counter measures Enabled, sending Deauth frame to")); )
+ limPrintMacAddr(pMac, pHdr->sa, LOGE);
+
+ limSendDeauthMgmtFrame( pMac, eSIR_MAC_MIC_FAILURE_REASON,
+ pHdr->sa, psessionEntry );
+ return;
+ }
+#endif
+
+ // Extract key ID from IV (most 2 bits of 4th byte of IV)
+
+ keyId = (*(pBody + 3)) >> 6;
+
+ /**
+ * On STA in infrastructure BSS, Authentication frames received
+ * with WEP bit set in the FC must be rejected with challenge
+ * failure status code (wierd thing in the spec - this should have
+ * been rejected with unspecified failure or unexpected assertion
+ * of wep bit (this status code does not exist though) or
+ * Out-of-sequence-Authentication-Frame status code.
+ */
+
+ if (psessionEntry->limSystemRole == eLIM_STA_ROLE || psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
+ {
+ authFrame.authAlgoNumber = eSIR_SHARED_KEY;
+ authFrame.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_4;
+ authFrame.authStatusCode = eSIR_MAC_CHALLENGE_FAILURE_STATUS;
+
+ limSendAuthMgmtFrame(pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Authentication frame with wep bit set on role=%d from "),
+ psessionEntry->limSystemRole );
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ return;
+ }
+
+ if (frameLen < LIM_ENCR_AUTH_BODY_LEN)
+ {
+ // Log error
+ limLog(pMac, LOGE,
+ FL("Not enough size [%d] to decrypt received Auth frame"),
+ frameLen);
+ limPrintMacAddr(pMac, pHdr->sa, LOGE);
+
+ return;
+ }
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ {
+ val = psessionEntry->privacy;
+ }
+ else
+#endif
+ // Accept Authentication frame only if Privacy is implemented
+ if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED,
+ &val) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get Privacy option
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP, FL("could not retrieve Privacy option\n"));
+ }
+
+ cfgPrivacyOptImp = (tANI_U8)val;
+ if (cfgPrivacyOptImp)
+ {
+ /**
+ * Privacy option is implemented.
+ * Check if the received frame is Authentication
+ * frame3 and there is a context for requesting STA.
+ * If not, reject with unspecified failure status code
+ */
+ pAuthNode = limSearchPreAuthList(pMac, pHdr->sa);
+
+ if (pAuthNode == NULL)
+ {
+ /**
+ * No 'pre-auth' context exists for this STA that sent
+ * an Authentication frame with FC bit set.
+ * Send Auth frame4 with 'out of sequence' status code.
+ */
+ authFrame.authAlgoNumber = eSIR_SHARED_KEY;
+ authFrame.authTransactionSeqNumber =
+ SIR_MAC_AUTH_FRAME_4;
+ authFrame.authStatusCode =
+ eSIR_MAC_AUTH_FRAME_OUT_OF_SEQ_STATUS;
+
+ limSendAuthMgmtFrame(pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Authentication frame from peer that has no preauth context with WEP bit set. Addr "));)
+ PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ return;
+ }
+ else
+ {
+ /// Change the auth-response timeout
+ limDeactivateAndChangePerStaIdTimer(pMac,
+ eLIM_AUTH_RSP_TIMER,
+ pAuthNode->authNodeIdx);
+
+ /// 'Pre-auth' status exists for STA
+ if ((pAuthNode->mlmState !=
+ eLIM_MLM_WT_AUTH_FRAME3_STATE) &&
+ (pAuthNode->mlmState !=
+ eLIM_MLM_AUTH_RSP_TIMEOUT_STATE))
+ {
+ /**
+ * Should not have received Authentication frame
+ * with WEP bit set in FC in other states.
+ * Reject by sending Authenticaton frame with
+ * out of sequence Auth frame status code.
+ */
+
+ authFrame.authAlgoNumber = eSIR_SHARED_KEY;
+ authFrame.authTransactionSeqNumber =
+ SIR_MAC_AUTH_FRAME_4;
+ authFrame.authStatusCode =
+ eSIR_MAC_AUTH_FRAME_OUT_OF_SEQ_STATUS;
+
+ limSendAuthMgmtFrame(pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Authentication frame from peer that is in state %d. Addr "),
+ pAuthNode->mlmState);)
+ PELOG1( limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ return;
+ }
+ }
+
+ /**
+ * Check if there exists a key mappping key
+ * for the STA that sent Authentication frame
+ */
+ pKeyMapEntry = limLookUpKeyMappings(pHdr->sa);
+
+ if (pKeyMapEntry)
+ {
+ if (!pKeyMapEntry->wepOn)
+ {
+ /**
+ * Key Mapping entry has null key.
+ * Send Authentication frame
+ * with challenge failure status code
+ */
+ authFrame.authAlgoNumber = eSIR_SHARED_KEY;
+ authFrame.authTransactionSeqNumber =
+ SIR_MAC_AUTH_FRAME_4;
+ authFrame.authStatusCode =
+ eSIR_MAC_CHALLENGE_FAILURE_STATUS;
+
+ limSendAuthMgmtFrame(pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Auth frame3 from peer that has NULL key map entry, Addr "));)
+ PELOG1( limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ return;
+ } // if (!pKeyMapEntry->wepOn)
+ else
+ {
+ decryptResult = limDecryptAuthFrame(pMac, pKeyMapEntry->key,
+ pBody,
+ plainBody,
+ key_length,
+ (tANI_U16) (frameLen-SIR_MAC_WEP_IV_LENGTH));
+ if (decryptResult == LIM_DECRYPT_ICV_FAIL)
+ {
+ /// ICV failure
+ PELOGW(limLog(pMac, LOGW, FL("=====> decryptResult == LIM_DECRYPT_ICV_FAIL ...\n"));)
+ limDeletePreAuthNode(pMac,
+ pHdr->sa);
+ authFrame.authAlgoNumber = eSIR_SHARED_KEY;
+ authFrame.authTransactionSeqNumber =
+ SIR_MAC_AUTH_FRAME_4;
+ authFrame.authStatusCode =
+ eSIR_MAC_CHALLENGE_FAILURE_STATUS;
+
+ limSendAuthMgmtFrame(
+ pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Authentication frame from peer that failed decryption, Addr "));)
+ PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ return;
+ }
+
+ if ((sirConvertAuthFrame2Struct(pMac, plainBody, frameLen-8, &rxAuthFrame)!=eSIR_SUCCESS)||(!isAuthValid(pMac, &rxAuthFrame,psessionEntry)))
+ return;
+
+
+ } // end if (pKeyMapEntry->key == NULL)
+ } // if keyMappings has entry
+ else
+ {
+
+ val = SIR_MAC_KEY_LENGTH;
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ {
+ tpSirKeys pKey;
+ pKey = &psessionEntry->WEPKeyMaterial[keyId].key[0];
+ palCopyMemory( pMac->hHdd, defaultKey, pKey->key, pKey->keyLength);
+ val = pKey->keyLength;
+ }
+ else
+#endif
+ if (wlan_cfgGetStr(pMac, (tANI_U16) (WNI_CFG_WEP_DEFAULT_KEY_1 + keyId),
+ defaultKey, &val) != eSIR_SUCCESS)
+ {
+ /// Could not get Default key from CFG.
+ //Log error.
+ limLog(pMac, LOGP,
+ FL("could not retrieve Default key\n"));
+
+ /**
+ * Send Authentication frame
+ * with challenge failure status code
+ */
+
+ authFrame.authAlgoNumber = eSIR_SHARED_KEY;
+ authFrame.authTransactionSeqNumber =
+ SIR_MAC_AUTH_FRAME_4;
+ authFrame.authStatusCode =
+ eSIR_MAC_CHALLENGE_FAILURE_STATUS;
+
+ limSendAuthMgmtFrame(pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+
+ return;
+ }
+
+ key_length=val;
+
+ decryptResult = limDecryptAuthFrame(pMac, defaultKey,
+ pBody,
+ plainBody,
+ key_length,
+ (tANI_U16) (frameLen-SIR_MAC_WEP_IV_LENGTH));
+ if (decryptResult == LIM_DECRYPT_ICV_FAIL)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("=====> decryptResult == LIM_DECRYPT_ICV_FAIL ...\n"));)
+ /// ICV failure
+ limDeletePreAuthNode(pMac,
+ pHdr->sa);
+ authFrame.authAlgoNumber = eSIR_SHARED_KEY;
+ authFrame.authTransactionSeqNumber =
+ SIR_MAC_AUTH_FRAME_4;
+ authFrame.authStatusCode =
+ eSIR_MAC_CHALLENGE_FAILURE_STATUS;
+
+ limSendAuthMgmtFrame(
+ pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Authentication frame from peer that failed decryption, Addr "));)
+ PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ return;
+ }
+ if ((sirConvertAuthFrame2Struct(pMac, plainBody, frameLen-8, &rxAuthFrame)!=eSIR_SUCCESS)||(!isAuthValid(pMac, &rxAuthFrame,psessionEntry)))
+ return;
+
+ } // End of check for Key Mapping/Default key presence
+ }
+ else
+ {
+ /**
+ * Privacy option is not implemented.
+ * So reject Authentication frame received with
+ * WEP bit set by sending Authentication frame
+ * with 'challenge failure' status code. This is
+ * another strange thing in the spec. Status code
+ * should have been 'unsupported algorithm' status code.
+ */
+
+ authFrame.authAlgoNumber = eSIR_SHARED_KEY;
+ authFrame.authTransactionSeqNumber =
+ SIR_MAC_AUTH_FRAME_4;
+ authFrame.authStatusCode =
+ eSIR_MAC_CHALLENGE_FAILURE_STATUS;
+
+ limSendAuthMgmtFrame(pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Authentication frame3 from peer that while privacy option is turned OFF, Addr "));)
+ PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ return;
+ } // else if (wlan_cfgGetInt(CFG_PRIVACY_OPTION_IMPLEMENTED))
+ } // if (fc.wep)
+ else
+ {
+
+
+ if ((sirConvertAuthFrame2Struct(pMac, pBody, frameLen, &rxAuthFrame)!=eSIR_SUCCESS)||(!isAuthValid(pMac, &rxAuthFrame,psessionEntry)))
+ return;
+ }
+
+
+ pRxAuthFrameBody = &rxAuthFrame;
+
+ PELOG2(limLog(pMac, LOG2,
+ FL("Received Auth frame with type=%d seqnum=%d, status=%d (%d)\n"),
+ (tANI_U32) pRxAuthFrameBody->authAlgoNumber,
+ (tANI_U32) pRxAuthFrameBody->authTransactionSeqNumber,
+ (tANI_U32) pRxAuthFrameBody->authStatusCode,(tANI_U32)pMac->lim.gLimNumPreAuthContexts);)
+
+ switch (pRxAuthFrameBody->authTransactionSeqNumber)
+ {
+ case SIR_MAC_AUTH_FRAME_1:
+ // AuthFrame 1
+
+ /// Check if there exists pre-auth context for this STA
+ pAuthNode = limSearchPreAuthList(pMac, pHdr->sa);
+ if (pAuthNode)
+ {
+ /// Pre-auth context exists for the STA
+ if (pHdr->fc.retry == 0)
+ {
+ /**
+ * STA is initiating brand-new Authentication
+ * sequence after local Auth Response timeout.
+ * Or STA retrying to transmit First Auth frame due to packet drop OTA
+ * Delete Pre-auth node and fall through.
+ */
+ if(pAuthNode->fTimerStarted)
+ {
+ limDeactivateAndChangePerStaIdTimer(pMac,
+ eLIM_AUTH_RSP_TIMER,
+ pAuthNode->authNodeIdx);
+ }
+ PELOGE(limLog(pMac, LOGE, FL("STA is initiating brand-new Authentication ...\n"));)
+ limDeletePreAuthNode(pMac,
+ pHdr->sa);
+#ifdef WLAN_SOFTAP_FEATURE
+ /**
+ * SAP Mode:Disassociate the station and
+ * delete its entry if we have its entry
+ * already and received "auth" from the
+ * same station.
+ */
+
+ for (assocId = 0; assocId < psessionEntry->dph.dphHashTable.size; assocId++)// Softap dphHashTable.size = 8
+ {
+ pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
+
+ if (NULL == pStaDs)
+ continue;
+
+ if (pStaDs->valid)
+ {
+ if (palEqualMemory( pMac->hHdd,(tANI_U8 *) &pStaDs->staAddr,
+ (tANI_U8 *) &(pHdr->sa), (tANI_U8) (sizeof(tSirMacAddr))) )
+ break;
+ }
+ }
+
+ if (NULL != pStaDs)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("lim Delete Station Context (staId: %d, assocId: %d) \n"),pStaDs->staIndex, assocId);)
+ limSendDeauthMgmtFrame(pMac,
+ eSIR_MAC_UNSPEC_FAILURE_REASON, (tANI_U8 *) pAuthNode->peerMacAddr,psessionEntry);
+ limTriggerSTAdeletion(pMac, pStaDs, psessionEntry);
+ return;
+ }
+#endif
+ }
+ else
+ {
+ /*
+ * This can happen when first authentication frame is received
+ * but ACK lost at STA side, in this case 2nd auth frame is already
+ * in transmission queue
+ * */
+ PELOGE(limLog(pMac, LOGE, FL("STA is initiating Authentication after ACK lost...\n"));)
+ return;
+ }
+ }
+ if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_NUM_PRE_AUTH,
+ (tANI_U32 *) &maxNumPreAuth) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get MaxNumPreAuth
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve MaxNumPreAuth\n"));
+ }
+#ifdef ANI_AP_SDK_OPT
+ if(maxNumPreAuth > SIR_SDK_OPT_MAX_NUM_PRE_AUTH)
+ maxNumPreAuth = SIR_SDK_OPT_MAX_NUM_PRE_AUTH;
+#endif // ANI_AP_SDK_OPT
+ if (pMac->lim.gLimNumPreAuthContexts == maxNumPreAuth)
+ {
+ /**
+ * Maximum number of pre-auth contexts
+ * reached. Send Authentication frame
+ * with unspecified failure
+ */
+ authFrame.authAlgoNumber =
+ pRxAuthFrameBody->authAlgoNumber;
+ authFrame.authTransactionSeqNumber =
+ pRxAuthFrameBody->authTransactionSeqNumber + 1;
+ authFrame.authStatusCode =
+ eSIR_MAC_UNSPEC_FAILURE_STATUS;
+
+ limSendAuthMgmtFrame(pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+
+ return;
+ }
+ /// No Pre-auth context exists for the STA.
+#ifdef WLAN_SOFTAP_FEATURE
+ if (limIsAuthAlgoSupported(
+ pMac,
+ (tAniAuthType)
+ pRxAuthFrameBody->authAlgoNumber, psessionEntry))
+#else
+ if (limIsAuthAlgoSupported(
+ pMac,
+ (tAniAuthType)
+ pRxAuthFrameBody->authAlgoNumber))
+
+#endif
+ {
+ switch (pRxAuthFrameBody->authAlgoNumber)
+ {
+ case eSIR_OPEN_SYSTEM:
+ PELOG1(limLog(pMac, LOG1, FL("=======> eSIR_OPEN_SYSTEM ...\n"));)
+ /// Create entry for this STA in pre-auth list
+ pAuthNode = limAcquireFreePreAuthNode(pMac, &pMac->lim.gLimPreAuthTimerTable);
+ if (pAuthNode == NULL)
+ {
+ // Log error
+ limLog(pMac, LOGW,
+ FL("Max pre-auth nodes reached "));
+ limPrintMacAddr(pMac, pHdr->sa, LOGW);
+
+ return;
+ }
+
+ PELOG1(limLog(pMac, LOG1, FL("Alloc new data: %x peer \n"), pAuthNode);
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ palCopyMemory( pMac->hHdd,
+ (tANI_U8 *) pAuthNode->peerMacAddr,
+ pHdr->sa,
+ sizeof(tSirMacAddr));
+
+ pAuthNode->mlmState =
+ eLIM_MLM_AUTHENTICATED_STATE;
+ pAuthNode->authType = (tAniAuthType)
+ pRxAuthFrameBody->authAlgoNumber;
+ pAuthNode->fSeen = 0;
+ pAuthNode->fTimerStarted = 0;
+ limAddPreAuthNode(pMac, pAuthNode);
+
+ /**
+ * Send Authenticaton frame with Success
+ * status code.
+ */
+
+ authFrame.authAlgoNumber =
+ pRxAuthFrameBody->authAlgoNumber;
+ authFrame.authTransactionSeqNumber =
+ pRxAuthFrameBody->authTransactionSeqNumber + 1;
+ authFrame.authStatusCode = eSIR_MAC_SUCCESS_STATUS;
+ limSendAuthMgmtFrame(
+ pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+
+ /// Send Auth indication to SME
+
+ palCopyMemory( pMac->hHdd,
+ (tANI_U8 *) mlmAuthInd.peerMacAddr,
+ (tANI_U8 *) pHdr->sa,
+ sizeof(tSirMacAddr));
+ mlmAuthInd.authType = (tAniAuthType)
+ pRxAuthFrameBody->authAlgoNumber;
+ mlmAuthInd.sessionId = psessionEntry->smeSessionId;
+
+ limPostSmeMessage(pMac,
+ LIM_MLM_AUTH_IND,
+ (tANI_U32 *) &mlmAuthInd);
+ break;
+
+ case eSIR_SHARED_KEY:
+ PELOG1(limLog(pMac, LOG1, FL("=======> eSIR_SHARED_KEY ...\n"));)
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ {
+ val = psessionEntry->privacy;
+ }
+ else
+#endif
+ if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED,
+ &val) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get Privacy option
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve Privacy option\n"));
+ }
+ cfgPrivacyOptImp = (tANI_U8)val;
+ if (!cfgPrivacyOptImp)
+ {
+ /**
+ * Authenticator does not have WEP
+ * implemented.
+ * Reject by sending Authentication frame
+ * with Auth algorithm not supported status
+ * code.
+ */
+
+ authFrame.authAlgoNumber =
+ pRxAuthFrameBody->authAlgoNumber;
+ authFrame.authTransactionSeqNumber =
+ pRxAuthFrameBody->authTransactionSeqNumber + 1;
+ authFrame.authStatusCode =
+ eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS;
+
+ limSendAuthMgmtFrame(
+ pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Auth frame for unsupported auth algorithm %d from "),
+ pRxAuthFrameBody->authAlgoNumber);)
+ PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ return;
+ }
+ else
+ {
+ // Create entry for this STA
+ //in pre-auth list
+ pAuthNode = limAcquireFreePreAuthNode(pMac, &pMac->lim.gLimPreAuthTimerTable);
+ if (pAuthNode == NULL)
+ {
+ // Log error
+ limLog(pMac, LOGW,
+ FL("Max pre-auth nodes reached "));
+ limPrintMacAddr(pMac, pHdr->sa, LOGW);
+
+ return;
+ }
+
+ palCopyMemory( pMac->hHdd,
+ (tANI_U8 *) pAuthNode->peerMacAddr,
+ pHdr->sa,
+ sizeof(tSirMacAddr));
+
+ pAuthNode->mlmState =
+ eLIM_MLM_WT_AUTH_FRAME3_STATE;
+ pAuthNode->authType =
+ (tAniAuthType)
+ pRxAuthFrameBody->authAlgoNumber;
+ pAuthNode->fSeen = 0;
+ pAuthNode->fTimerStarted = 0;
+ limAddPreAuthNode(pMac, pAuthNode);
+
+ PELOG1(limLog(pMac, LOG1, FL("Alloc new data: %x id %d peer \n"),
+ pAuthNode, pAuthNode->authNodeIdx);)
+ PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ /// Create and activate Auth Response timer
+ if (tx_timer_change_context(&pAuthNode->timer, pAuthNode->authNodeIdx) != TX_SUCCESS)
+ {
+ /// Could not start Auth response timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("Unable to chg context auth response timer for peer "));
+ limPrintMacAddr(pMac, pHdr->sa, LOGP);
+
+ /**
+ * Send Authenticaton frame with
+ * unspecified failure status code.
+ */
+
+ authFrame.authAlgoNumber =
+ pRxAuthFrameBody->authAlgoNumber;
+ authFrame.authTransactionSeqNumber =
+ pRxAuthFrameBody->authTransactionSeqNumber + 1;
+ authFrame.authStatusCode =
+ eSIR_MAC_UNSPEC_FAILURE_STATUS;
+
+ limSendAuthMgmtFrame(pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+
+ limDeletePreAuthNode(pMac, pHdr->sa);
+ return;
+ }
+
+ limActivateAuthRspTimer(pMac, pAuthNode);
+
+ pAuthNode->fTimerStarted = 1;
+
+ // get random bytes and use as
+ // challenge text
+ // TODO
+ //if( !VOS_IS_STATUS_SUCCESS( vos_rand_get_bytes( 0, (tANI_U8 *)challengeTextArray, SIR_MAC_AUTH_CHALLENGE_LENGTH ) ) )
+ {
+ limLog(pMac, LOGE,FL("Challenge text preparation failed in limProcessAuthFrame"));
+ }
+
+ pChallenge = pAuthNode->challengeText;
+
+ palCopyMemory( pMac->hHdd,
+ pChallenge,
+ (tANI_U8 *) challengeTextArray,
+ sizeof(challengeTextArray));
+
+ /**
+ * Sending Authenticaton frame with challenge.
+ */
+
+ authFrame.authAlgoNumber =
+ pRxAuthFrameBody->authAlgoNumber;
+ authFrame.authTransactionSeqNumber =
+ pRxAuthFrameBody->authTransactionSeqNumber + 1;
+ authFrame.authStatusCode =
+ eSIR_MAC_SUCCESS_STATUS;
+ authFrame.type = SIR_MAC_CHALLENGE_TEXT_EID;
+ authFrame.length = SIR_MAC_AUTH_CHALLENGE_LENGTH;
+ palCopyMemory( pMac->hHdd,
+ authFrame.challengeText,
+ pAuthNode->challengeText,
+ SIR_MAC_AUTH_CHALLENGE_LENGTH);
+
+ limSendAuthMgmtFrame(
+ pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+ } // if (wlan_cfgGetInt(CFG_PRIVACY_OPTION_IMPLEMENTED))
+
+ break;
+
+ default:
+ /**
+ * Responding party does not support the
+ * authentication algorithm requested by
+ * sending party.
+ * Reject by sending Authentication frame
+ * with auth algorithm not supported status code
+ */
+
+ authFrame.authAlgoNumber =
+ pRxAuthFrameBody->authAlgoNumber;
+ authFrame.authTransactionSeqNumber =
+ pRxAuthFrameBody->authTransactionSeqNumber + 1;
+ authFrame.authStatusCode =
+ eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS;
+
+ limSendAuthMgmtFrame(
+ pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+
+ // Log error
+ PELOG1( limLog(pMac, LOG1,
+ FL("received Auth frame for unsupported auth algorithm %d from "),
+ pRxAuthFrameBody->authAlgoNumber);)
+ PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ return;
+ } // end switch(pRxAuthFrameBody->authAlgoNumber)
+ } // if (limIsAuthAlgoSupported(pRxAuthFrameBody->authAlgoNumber))
+ else
+ {
+ /**
+ * Responding party does not support the
+ * authentication algorithm requested by sending party.
+ * Reject Authentication with StatusCode=13.
+ */
+ authFrame.authAlgoNumber =
+ pRxAuthFrameBody->authAlgoNumber;
+ authFrame.authTransactionSeqNumber =
+ pRxAuthFrameBody->authTransactionSeqNumber + 1;
+ authFrame.authStatusCode =
+ eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS;
+
+ limSendAuthMgmtFrame(pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Authentication frame for unsupported auth algorithm %d from "),
+ pRxAuthFrameBody->authAlgoNumber);)
+ PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+ return;
+ } //end if (limIsAuthAlgoSupported(pRxAuthFrameBody->authAlgoNumber))
+ break;
+
+ case SIR_MAC_AUTH_FRAME_2:
+ // AuthFrame 2
+
+ if (psessionEntry->limMlmState != eLIM_MLM_WT_AUTH_FRAME2_STATE)
+ {
+ /**
+ * Received Authentication frame2 in an unexpected state.
+ * Log error and ignore the frame.
+ */
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Auth frame2 from peer in state %d, addr "),
+ psessionEntry->limMlmState);)
+ PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ return;
+ }
+
+ if ( !palEqualMemory( pMac->hHdd,(tANI_U8 *) pHdr->sa,
+ (tANI_U8 *) &pMac->lim.gpLimMlmAuthReq->peerMacAddr,
+ sizeof(tSirMacAddr)) )
+ {
+ /**
+ * Received Authentication frame from an entity
+ * other than one request was initiated.
+ * Wait until Authentication Failure Timeout.
+ */
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Auth frame2 from unexpected peer "));)
+ PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ break;
+ }
+
+ if (pRxAuthFrameBody->authStatusCode ==
+ eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS)
+ {
+ /**
+ * Interoperability workaround: Linksys WAP4400N is returning
+ * wrong authType in OpenAuth response in case of
+ * SharedKey AP configuration. Pretend we don't see that,
+ * so upper layer can fallback to SharedKey authType,
+ * and successfully connect to the AP.
+ */
+ if (pRxAuthFrameBody->authAlgoNumber !=
+ pMac->lim.gpLimMlmAuthReq->authType)
+ {
+ pRxAuthFrameBody->authAlgoNumber =
+ pMac->lim.gpLimMlmAuthReq->authType;
+ }
+ }
+
+ if (pRxAuthFrameBody->authAlgoNumber !=
+ pMac->lim.gpLimMlmAuthReq->authType)
+ {
+ /**
+ * Received Authentication frame with an auth
+ * algorithm other than one requested.
+ * Wait until Authentication Failure Timeout.
+ */
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Auth frame2 for unexpected auth algo number %d from "),
+ pRxAuthFrameBody->authAlgoNumber);)
+ PELOG1( limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ break;
+ }
+
+ if (pRxAuthFrameBody->authStatusCode ==
+ eSIR_MAC_SUCCESS_STATUS)
+ {
+ if (pRxAuthFrameBody->authAlgoNumber ==
+ eSIR_OPEN_SYSTEM)
+ {
+ psessionEntry->limCurrentAuthType = eSIR_OPEN_SYSTEM;
+
+ pAuthNode = limAcquireFreePreAuthNode(pMac, &pMac->lim.gLimPreAuthTimerTable);
+
+ if (pAuthNode == NULL)
+ {
+ // Log error
+ limLog(pMac, LOGW,
+ FL("Max pre-auth nodes reached "));
+ limPrintMacAddr(pMac, pHdr->sa, LOGW);
+
+ return;
+ }
+
+ PELOG1(limLog(pMac, LOG1, FL("Alloc new data: %x peer \n"), pAuthNode);)
+ PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ palCopyMemory( pMac->hHdd,
+ (tANI_U8 *) pAuthNode->peerMacAddr,
+ pMac->lim.gpLimMlmAuthReq->peerMacAddr,
+ sizeof(tSirMacAddr));
+ pAuthNode->fTimerStarted = 0;
+ pAuthNode->authType = pMac->lim.gpLimMlmAuthReq->authType;
+ limAddPreAuthNode(pMac, pAuthNode);
+
+ limRestoreFromAuthState(pMac, eSIR_SME_SUCCESS,
+ pRxAuthFrameBody->authStatusCode,psessionEntry);
+ } // if (pRxAuthFrameBody->authAlgoNumber == eSIR_OPEN_SYSTEM)
+ else
+ {
+ // Shared key authentication
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ {
+ val = psessionEntry->privacy;
+ }
+ else
+#endif
+ if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED,
+ &val) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get Privacy option
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve Privacy option\n"));
+ }
+ cfgPrivacyOptImp = (tANI_U8)val;
+ if (!cfgPrivacyOptImp)
+ {
+ /**
+ * Requesting STA does not have WEP implemented.
+ * Reject with unsupported authentication algorithm
+ * Status code and wait until auth failure timeout
+ */
+
+ // Log error
+ PELOG1( limLog(pMac, LOG1,
+ FL("received Auth frame from peer for unsupported auth algo %d, Addr "),
+ pRxAuthFrameBody->authAlgoNumber);)
+ PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ authFrame.authAlgoNumber =
+ pRxAuthFrameBody->authAlgoNumber;
+ authFrame.authTransactionSeqNumber =
+ pRxAuthFrameBody->authTransactionSeqNumber + 1;
+ authFrame.authStatusCode =
+ eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS;
+
+ limSendAuthMgmtFrame(pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+ return;
+ }
+ else
+ {
+
+ if (pRxAuthFrameBody->type !=
+ SIR_MAC_CHALLENGE_TEXT_EID)
+ {
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Auth frame with invalid challenge text IE\n"));)
+
+ return;
+ }
+
+ /**
+ * Check if there exists a key mappping key
+ * for the STA that sent Authentication frame
+ */
+ pKeyMapEntry = limLookUpKeyMappings(
+ pHdr->sa);
+
+ if (pKeyMapEntry)
+ {
+ if (pKeyMapEntry->key == NULL)
+ {
+ /**
+ * Key Mapping entry has null key.
+ * Send Auth frame with
+ * challenge failure status code
+ */
+ authFrame.authAlgoNumber =
+ pRxAuthFrameBody->authAlgoNumber;
+ authFrame.authTransactionSeqNumber =
+ pRxAuthFrameBody->authTransactionSeqNumber + 1;
+ authFrame.authStatusCode =
+ eSIR_MAC_CHALLENGE_FAILURE_STATUS;
+
+ limSendAuthMgmtFrame(pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Auth frame from peer when key mapping key is NULL, addr "));)
+ PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ limRestoreFromAuthState(pMac, eSIR_SME_NO_KEY_MAPPING_KEY_FOR_PEER,
+ eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry);
+
+ return;
+ } // if (pKeyMapEntry->key == NULL)
+ else
+ {
+ ((tpSirMacAuthFrameBody) plainBody)->authAlgoNumber =
+ sirSwapU16ifNeeded(pRxAuthFrameBody->authAlgoNumber);
+ ((tpSirMacAuthFrameBody) plainBody)->authTransactionSeqNumber =
+ sirSwapU16ifNeeded((tANI_U16) (pRxAuthFrameBody->authTransactionSeqNumber + 1));
+ ((tpSirMacAuthFrameBody) plainBody)->authStatusCode = eSIR_MAC_SUCCESS_STATUS;
+ ((tpSirMacAuthFrameBody) plainBody)->type = SIR_MAC_CHALLENGE_TEXT_EID;
+ ((tpSirMacAuthFrameBody) plainBody)->length = SIR_MAC_AUTH_CHALLENGE_LENGTH;
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) ((tpSirMacAuthFrameBody) plainBody)->challengeText,
+ pRxAuthFrameBody->challengeText,
+ SIR_MAC_AUTH_CHALLENGE_LENGTH);
+
+ limEncryptAuthFrame(pMac, 0,
+ pKeyMapEntry->key,
+ plainBody,
+ encrAuthFrame,key_length);
+
+ psessionEntry->limMlmState = eLIM_MLM_WT_AUTH_FRAME4_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+ limSendAuthMgmtFrame(pMac,
+ (tpSirMacAuthFrameBody) encrAuthFrame,
+ pHdr->sa,
+ LIM_WEP_IN_FC,psessionEntry);
+
+ break;
+ } // end if (pKeyMapEntry->key == NULL)
+ } // if (pKeyMapEntry)
+ else
+ {
+ if (wlan_cfgGetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID,
+ &val) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get Default keyId
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve Default keyId\n"));
+ }
+ keyId = (tANI_U8)val;
+
+ val = SIR_MAC_KEY_LENGTH;
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ {
+ tpSirKeys pKey;
+ pKey = &psessionEntry->WEPKeyMaterial[keyId].key[0];
+ palCopyMemory( pMac->hHdd, defaultKey, pKey->key, pKey->keyLength);
+ }
+ else
+#endif
+ if (wlan_cfgGetStr(pMac, (tANI_U16) (WNI_CFG_WEP_DEFAULT_KEY_1 + keyId),
+ defaultKey,
+ &val)
+ != eSIR_SUCCESS)
+ {
+ /// Could not get Default key from CFG.
+ //Log error.
+ limLog(pMac, LOGP,
+ FL("could not retrieve Default key\n"));
+
+ authFrame.authAlgoNumber =
+ pRxAuthFrameBody->authAlgoNumber;
+ authFrame.authTransactionSeqNumber =
+ pRxAuthFrameBody->authTransactionSeqNumber + 1;
+ authFrame.authStatusCode =
+ eSIR_MAC_CHALLENGE_FAILURE_STATUS;
+
+ limSendAuthMgmtFrame(
+ pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+
+ limRestoreFromAuthState(pMac, eSIR_SME_INVALID_WEP_DEFAULT_KEY,
+ eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry);
+
+ break;
+ }
+ key_length=val;
+ ((tpSirMacAuthFrameBody) plainBody)->authAlgoNumber =
+ sirSwapU16ifNeeded(pRxAuthFrameBody->authAlgoNumber);
+ ((tpSirMacAuthFrameBody) plainBody)->authTransactionSeqNumber =
+ sirSwapU16ifNeeded((tANI_U16) (pRxAuthFrameBody->authTransactionSeqNumber + 1));
+ ((tpSirMacAuthFrameBody) plainBody)->authStatusCode = eSIR_MAC_SUCCESS_STATUS;
+ ((tpSirMacAuthFrameBody) plainBody)->type = SIR_MAC_CHALLENGE_TEXT_EID;
+ ((tpSirMacAuthFrameBody) plainBody)->length = SIR_MAC_AUTH_CHALLENGE_LENGTH;
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) ((tpSirMacAuthFrameBody) plainBody)->challengeText,
+ pRxAuthFrameBody->challengeText,
+ SIR_MAC_AUTH_CHALLENGE_LENGTH);
+
+ limEncryptAuthFrame(pMac, keyId,
+ defaultKey,
+ plainBody,
+ encrAuthFrame,key_length);
+
+ psessionEntry->limMlmState =
+ eLIM_MLM_WT_AUTH_FRAME4_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+ limSendAuthMgmtFrame(pMac,
+ (tpSirMacAuthFrameBody) encrAuthFrame,
+ pHdr->sa,
+ LIM_WEP_IN_FC,psessionEntry);
+
+ break;
+ } // end if (pKeyMapEntry)
+ } // end if (!wlan_cfgGetInt(CFG_PRIVACY_OPTION_IMPLEMENTED))
+ } // end if (pRxAuthFrameBody->authAlgoNumber == eSIR_OPEN_SYSTEM)
+ } // if (pRxAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS)
+ else
+ {
+ /**
+ * Authentication failure.
+ * Return Auth confirm with received failure code to SME
+ */
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Auth frame from peer with failure code %d addr "),
+ pRxAuthFrameBody->authStatusCode);)
+ PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ limRestoreFromAuthState(pMac, eSIR_SME_AUTH_REFUSED,
+ pRxAuthFrameBody->authStatusCode,psessionEntry);
+ } // end if (pRxAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS)
+
+ break;
+
+ case SIR_MAC_AUTH_FRAME_3:
+ // AuthFrame 3
+
+ if (pRxAuthFrameBody->authAlgoNumber != eSIR_SHARED_KEY)
+ {
+ /**
+ * Received Authentication frame3 with algorithm other than
+ * Shared Key authentication type. Reject with Auth frame4
+ * with 'out of sequence' status code.
+ */
+ authFrame.authAlgoNumber = eSIR_SHARED_KEY;
+ authFrame.authTransactionSeqNumber =
+ SIR_MAC_AUTH_FRAME_4;
+ authFrame.authStatusCode =
+ eSIR_MAC_AUTH_FRAME_OUT_OF_SEQ_STATUS;
+
+ limSendAuthMgmtFrame(pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Auth frame3 from peer with auth algo number %d Addr "),
+ pRxAuthFrameBody->authAlgoNumber);)
+ PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ return;
+ }
+
+ if (psessionEntry->limSystemRole == eLIM_AP_ROLE || psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE ||
+ psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
+ {
+ /**
+ * Check if wep bit was set in FC. If not set,
+ * reject with Authentication frame4 with
+ * 'challenge failure' status code.
+ */
+ if (!pHdr->fc.wep)
+ {
+ /// WEP bit is not set in FC of Auth Frame3
+ authFrame.authAlgoNumber = eSIR_SHARED_KEY;
+ authFrame.authTransactionSeqNumber =
+ SIR_MAC_AUTH_FRAME_4;
+ authFrame.authStatusCode =
+ eSIR_MAC_CHALLENGE_FAILURE_STATUS;
+
+ limSendAuthMgmtFrame(pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Auth frame3 from peer with no WEP bit set, addr "));)
+ PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ return;
+ }
+
+ pAuthNode = limSearchPreAuthList(pMac,
+ pHdr->sa);
+ if (pAuthNode == NULL)
+ {
+ /**
+ * No 'pre-auth' context exists for
+ * this STA that sent an Authentication
+ * frame3.
+ * Send Auth frame4 with 'out of sequence'
+ * status code.
+ */
+ authFrame.authAlgoNumber = eSIR_SHARED_KEY;
+ authFrame.authTransactionSeqNumber =
+ SIR_MAC_AUTH_FRAME_4;
+ authFrame.authStatusCode =
+ eSIR_MAC_AUTH_FRAME_OUT_OF_SEQ_STATUS;
+
+ limSendAuthMgmtFrame(pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received AuthFrame3 from peer that has no preauth context. Addr "));)
+ PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ return;
+ }
+
+ if (pAuthNode->mlmState == eLIM_MLM_AUTH_RSP_TIMEOUT_STATE)
+ {
+ /**
+ * Received Auth Frame3 after Auth Response timeout.
+ * Reject by sending Auth Frame4 with
+ * Auth respone timeout Status Code.
+ */
+ authFrame.authAlgoNumber = eSIR_SHARED_KEY;
+ authFrame.authTransactionSeqNumber =
+ SIR_MAC_AUTH_FRAME_4;
+ authFrame.authStatusCode =
+ eSIR_MAC_AUTH_RSP_TIMEOUT_STATUS;
+
+ limSendAuthMgmtFrame(
+ pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+
+ // Log error
+ limLog(pMac, LOGW,
+ FL("auth response timer timedout for peer "));
+ limPrintMacAddr(pMac, pHdr->sa, LOGW);
+
+ /// Delete pre-auth context of STA
+ limDeletePreAuthNode(pMac,
+ pHdr->sa);
+
+ return;
+ } // end switch (pAuthNode->mlmState)
+
+ if (pRxAuthFrameBody->authStatusCode != eSIR_MAC_SUCCESS_STATUS)
+ {
+ /**
+ * Received Authenetication Frame 3 with status code
+ * other than success. Wait until Auth response timeout
+ * to delete STA context.
+ */
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Auth frame3 from peer with status code %d, addr "),
+ pRxAuthFrameBody->authStatusCode);)
+ PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ return;
+ }
+
+ /**
+ * Check if received challenge text is same as one sent in
+ * Authentication frame3
+ */
+
+ if (palEqualMemory( pMac->hHdd,pRxAuthFrameBody->challengeText,
+ pAuthNode->challengeText,
+ SIR_MAC_AUTH_CHALLENGE_LENGTH))
+ {
+ /// Challenge match. STA is autheticated !
+
+ /// Delete Authentication response timer if running
+ limDeactivateAndChangePerStaIdTimer(pMac,
+ eLIM_AUTH_RSP_TIMER,
+ pAuthNode->authNodeIdx);
+
+ pAuthNode->fTimerStarted = 0;
+ pAuthNode->mlmState = eLIM_MLM_AUTHENTICATED_STATE;
+
+ /**
+ * Send Authentication Frame4 with 'success' Status Code.
+ */
+ authFrame.authAlgoNumber = eSIR_SHARED_KEY;
+ authFrame.authTransactionSeqNumber =
+ SIR_MAC_AUTH_FRAME_4;
+ authFrame.authStatusCode = eSIR_MAC_SUCCESS_STATUS;
+
+ limSendAuthMgmtFrame(pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+
+ /// Send Auth indication to SME
+ palCopyMemory( pMac->hHdd,
+ (tANI_U8 *) mlmAuthInd.peerMacAddr,
+ (tANI_U8 *) pHdr->sa,
+ sizeof(tSirMacAddr));
+ mlmAuthInd.authType = (tAniAuthType)
+ pRxAuthFrameBody->authAlgoNumber;
+ mlmAuthInd.sessionId = psessionEntry->smeSessionId;
+
+ limPostSmeMessage(pMac,
+ LIM_MLM_AUTH_IND,
+ (tANI_U32 *) &mlmAuthInd);
+
+ break;
+ }
+ else
+ {
+ /**
+ * Challenge Failure.
+ * Send Authentication frame4 with 'challenge failure'
+ * status code and wait until Auth response timeout to
+ * delete STA context.
+ */
+
+ authFrame.authAlgoNumber =
+ pRxAuthFrameBody->authAlgoNumber;
+ authFrame.authTransactionSeqNumber =
+ SIR_MAC_AUTH_FRAME_4;
+ authFrame.authStatusCode =
+ eSIR_MAC_CHALLENGE_FAILURE_STATUS;
+
+ limSendAuthMgmtFrame(pMac, &authFrame,
+ pHdr->sa,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+
+ // Log error
+ PELOG1( limLog(pMac, LOG1,
+ FL("Challenge failure for peer "));)
+ PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+ return;
+ }
+ } // if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE || ...
+
+ break;
+
+ case SIR_MAC_AUTH_FRAME_4:
+ // AuthFrame 4
+ if (psessionEntry->limMlmState != eLIM_MLM_WT_AUTH_FRAME4_STATE)
+ {
+ /**
+ * Received Authentication frame4 in an unexpected state.
+ * Log error and ignore the frame.
+ */
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received unexpected Auth frame4 from peer in state %d, addr "),
+ psessionEntry->limMlmState);)
+ PELOG1( limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ return;
+ }
+
+ if (pRxAuthFrameBody->authAlgoNumber != eSIR_SHARED_KEY)
+ {
+ /**
+ * Received Authentication frame4 with algorithm other than
+ * Shared Key authentication type.
+ * Wait until Auth failure timeout to report authentication
+ * failure to SME.
+ */
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Auth frame4 from peer with invalid auth algo %d, addr "),
+ pRxAuthFrameBody->authAlgoNumber);)
+ PELOG1(limPrintMacAddr(pMac, pHdr->sa,
+ LOG1);)
+
+ return;
+ }
+
+ if ( !palEqualMemory( pMac->hHdd,(tANI_U8 *) pHdr->sa,
+ (tANI_U8 *) &pMac->lim.gpLimMlmAuthReq->peerMacAddr,
+ sizeof(tSirMacAddr)) )
+ {
+ /**
+ * Received Authentication frame from an entity
+ * other than one to which request was initiated.
+ * Wait until Authentication Failure Timeout.
+ */
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Auth frame4 from unexpected peer "));
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ break;
+ }
+
+ if (pRxAuthFrameBody->authAlgoNumber !=
+ pMac->lim.gpLimMlmAuthReq->authType)
+ {
+ /**
+ * Received Authentication frame with an auth algorithm
+ * other than one requested.
+ * Wait until Authentication Failure Timeout.
+ */
+
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Authentication frame from peer with invalid auth seq number %d, addr "),
+ pRxAuthFrameBody->authTransactionSeqNumber);
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ break;
+ }
+
+ if (pRxAuthFrameBody->authStatusCode ==
+ eSIR_MAC_SUCCESS_STATUS)
+ {
+ /**
+ * Authentication Success !
+ * Inform SME of same.
+ */
+ psessionEntry->limCurrentAuthType = eSIR_SHARED_KEY;
+
+ pAuthNode = limAcquireFreePreAuthNode(pMac, &pMac->lim.gLimPreAuthTimerTable);
+ if (pAuthNode == NULL)
+ {
+ // Log error
+ limLog(pMac, LOGW,
+ FL("Max pre-auth nodes reached "));
+ limPrintMacAddr(pMac, pHdr->sa, LOGW);
+
+ return;
+ }
+ PELOG1(limLog(pMac, LOG1, FL("Alloc new data: %x peer \n"), pAuthNode);
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ palCopyMemory( pMac->hHdd,
+ (tANI_U8 *) pAuthNode->peerMacAddr,
+ pMac->lim.gpLimMlmAuthReq->peerMacAddr,
+ sizeof(tSirMacAddr));
+ pAuthNode->fTimerStarted = 0;
+ pAuthNode->authType = pMac->lim.gpLimMlmAuthReq->authType;
+ limAddPreAuthNode(pMac, pAuthNode);
+
+ limRestoreFromAuthState(pMac, eSIR_SME_SUCCESS,
+ pRxAuthFrameBody->authStatusCode,psessionEntry);
+
+ } // if (pRxAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS)
+ else
+ {
+ /**
+ * Authentication failure.
+ * Return Auth confirm with received failure code to SME
+ */
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1, FL("Authentication failure from peer "));
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ limRestoreFromAuthState(pMac, eSIR_SME_AUTH_REFUSED,
+ pRxAuthFrameBody->authStatusCode,psessionEntry);
+ } // end if (pRxAuthFrameBody->Status == 0)
+
+ break;
+
+ default:
+ /// Invalid Authentication Frame received. Ignore it.
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Auth frame from peer with invalid auth seq number %d, addr "),
+ pRxAuthFrameBody->authTransactionSeqNumber);
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ break;
+ } // end switch (pRxAuthFrameBody->authTransactionSeqNumber)
+} /*** end limProcessAuthFrame() ***/
+
+
+
+
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+
+/*----------------------------------------------------------------------
+ *
+ * Pass the received Auth frame. This is possibly the pre-auth from the
+ * neighbor AP, in the same mobility domain.
+ * This will be used in case of 11r FT.
+ *
+ * !!!! This is going to be renoved for the next checkin. We will be creating
+ * the session before sending out the Auth. Thus when auth response
+ * is received we will have a session in progress. !!!!!
+ *----------------------------------------------------------------------
+ */
+int limProcessAuthFrameNoSession(tpAniSirGlobal pMac, tANI_U8 *pBd, void *body)
+{
+ tpSirMacMgmtHdr pHdr;
+ tpPESession psessionEntry = NULL;
+ tANI_U8 *pBody;
+ tANI_U16 frameLen;
+ tSirMacAuthFrameBody rxAuthFrame;
+ tSirMacAuthFrameBody *pRxAuthFrameBody = NULL;
+ int ret_status = eSIR_FAILURE;
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pBd);
+ pBody = WDA_GET_RX_MPDU_DATA(pBd);
+ frameLen = WDA_GET_RX_PAYLOAD_LEN(pBd);
+
+ // Check for the operating channel and see what needs to be done next.
+ psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry;
+ if (psessionEntry == NULL)
+ {
+ limLog(pMac, LOGW, FL("Error: Unable to find session id while in pre-auth phase for FT"));
+ return eSIR_FAILURE;
+ }
+
+ if (pMac->ft.ftPEContext.pFTPreAuthReq == NULL)
+ {
+ // No FT in progress.
+ return eSIR_FAILURE;
+ }
+
+ if (frameLen == 0)
+ {
+ return eSIR_FAILURE;
+ }
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+ limPrintMacAddr(pMac, pHdr->bssId, LOGE);
+ limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOGE);
+#endif
+
+ // Check that its the same bssId we have for preAuth
+ if (!palEqualMemory( pMac->hHdd, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId,
+ pHdr->bssId, sizeof( tSirMacAddr )))
+ {
+ // In this case SME if indeed has triggered a
+ // pre auth it will time out.
+ return eSIR_FAILURE;
+ }
+
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+ limLog(pMac, LOGE, FL("Pre-Auth response received from neighbor"));
+ limLog(pMac, LOGE, FL("Pre-Auth done state"));
+#endif
+ // Stopping timer now, that we have our unicast from the AP
+ // of our choice.
+ limDeactivateAndChangeTimer(pMac, eLIM_FT_PREAUTH_RSP_TIMER);
+
+
+ // Save off the auth resp.
+ if ((sirConvertAuthFrame2Struct(pMac, pBody, frameLen, &rxAuthFrame) != eSIR_SUCCESS))
+ {
+ limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
+ return eSIR_FAILURE;
+ }
+ pRxAuthFrameBody = &rxAuthFrame;
+
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog(pMac, LOGE,
+ FL("Received Auth frame with type=%d seqnum=%d, status=%d (%d)\n"),
+ (tANI_U32) pRxAuthFrameBody->authAlgoNumber,
+ (tANI_U32) pRxAuthFrameBody->authTransactionSeqNumber,
+ (tANI_U32) pRxAuthFrameBody->authStatusCode,(tANI_U32)pMac->lim.gLimNumPreAuthContexts);)
+#endif
+
+ switch (pRxAuthFrameBody->authTransactionSeqNumber)
+ {
+ case SIR_MAC_AUTH_FRAME_2:
+ if (pRxAuthFrameBody->authStatusCode != eSIR_MAC_SUCCESS_STATUS)
+ {
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog( pMac, LOGE, "Auth status code received is %d\n",
+ (tANI_U32) pRxAuthFrameBody->authStatusCode);)
+#endif
+ }
+ else
+ {
+ ret_status = eSIR_SUCCESS;
+ }
+ break;
+
+ default:
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog( pMac, LOGE, "Seq. no incorrect expected 2 received %d\n",
+ (tANI_U32) pRxAuthFrameBody->authTransactionSeqNumber);)
+#endif
+ break;
+ }
+
+ // Send the Auth response to SME
+ limHandleFTPreAuthRsp(pMac, ret_status, pBody, frameLen, psessionEntry);
+
+ return ret_status;
+}
+
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
diff --git a/CORE/MAC/src/pe/lim/limProcessBeaconFrame.c b/CORE/MAC/src/pe/lim/limProcessBeaconFrame.c
new file mode 100644
index 0000000..0fdd30d
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limProcessBeaconFrame.c
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limProcessBeaconFrame.cc contains the code
+ * for processing Received Beacon Frame.
+ * Author: Chandra Modumudi
+ * Date: 03/01/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+#include "wniCfgAp.h"
+#else
+#include "wniCfgSta.h"
+#endif
+#include "aniGlobal.h"
+#include "cfgApi.h"
+#include "schApi.h"
+#include "wniCfgAp.h"
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halCommonApi.h"
+#endif
+#include "utilsApi.h"
+#include "limTypes.h"
+#include "limUtils.h"
+#include "limAssocUtils.h"
+#include "limPropExtsUtils.h"
+#include "limSerDesUtils.h"
+
+/**
+ * limProcessBeaconFrame
+ *
+ *FUNCTION:
+ * This function is called by limProcessMessageQueue() upon Beacon
+ * frame reception.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ * 1. Beacons received in 'normal' state in IBSS are handled by
+ * Beacon Processing module.
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param *pRxPacketInfo - A pointer to RX packet info structure
+ * @return None
+ */
+
+void
+limProcessBeaconFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
+{
+ tpSirMacMgmtHdr pHdr;
+ tSchBeaconStruct beacon;
+
+ pMac->lim.gLimNumBeaconsRcvd++;
+
+ /* here is it required to increment session specific heartBeat beacon counter */
+
+
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+
+
+ PELOG2(limLog(pMac, LOG2, FL("Received Beacon frame with length=%d from "),
+ WDA_GET_RX_MPDU_LEN(pRxPacketInfo));
+ limPrintMacAddr(pMac, pHdr->sa, LOG2);)
+
+ if (limDeactivateMinChannelTimerDuringScan(pMac) != eSIR_SUCCESS)
+ return;
+
+ /**
+ * Expect Beacon only when
+ * 1. STA is in Scan mode waiting for Beacon/Probe response or
+ * 2. STA is waiting for Beacon/Probe Respose Frame
+ * to announce join success.
+ * 3. STA/AP is in Learn mode
+ */
+ if ((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) ||
+ (pMac->lim.gLimMlmState == eLIM_MLM_PASSIVE_SCAN_STATE) ||
+ (pMac->lim.gLimMlmState == eLIM_MLM_LEARN_STATE) ||
+ (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE))
+ {
+ // Parse received Beacon
+ if (sirConvertBeaconFrame2Struct(pMac, (tANI_U8 *) pRxPacketInfo,
+ &beacon) != eSIR_SUCCESS)
+ {
+ // Received wrongly formatted/invalid Beacon.
+ // Ignore it and move on.
+ limLog(pMac, LOGW,
+ FL("Received invalid Beacon in state %X\n"),
+ psessionEntry->limMlmState);
+ limPrintMlmState(pMac, LOGW, psessionEntry->limMlmState);
+ return;
+ }
+
+
+ MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, 0, beacon.timeStamp[0]);)
+ MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, 0, beacon.timeStamp[1]);)
+
+
+ if ((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) ||
+ (pMac->lim.gLimMlmState == eLIM_MLM_PASSIVE_SCAN_STATE))
+ {
+#ifdef WLAN_FEATURE_P2P
+ //If we are scanning for P2P, only accept probe rsp
+ if((pMac->lim.gLimHalScanState != eLIM_HAL_SCANNING_STATE) || (NULL == pMac->lim.gpLimMlmScanReq)
+ || !pMac->lim.gpLimMlmScanReq->p2pSearch )
+#endif
+ {
+ limCheckAndAddBssDescription(pMac, &beacon, pRxPacketInfo,
+ ((pMac->lim.gLimHalScanState == eLIM_HAL_SCANNING_STATE) ? eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE),
+ eANI_BOOLEAN_FALSE);
+ }
+ }
+ else if (pMac->lim.gLimMlmState == eLIM_MLM_LEARN_STATE)
+ {
+#if (WNI_POLARIS_FW_PRODUCT == AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ // STA/AP is in learn mode
+ /* Not sure whether the below 2 lines are needed for the station. TODO If yes, this should be
+ * uncommented. Also when we tested enabling this, there is a crash as soon as the station
+ * comes up which needs to be fixed*/
+ //if (pMac->lim.gLimSystemRole == eLIM_STA_ROLE)
+ // limCheckAndAddBssDescription(pMac, &beacon, pRxPacketInfo, eANI_BOOLEAN_TRUE);
+ limCollectMeasurementData(pMac, pRxPacketInfo, &beacon);
+ PELOG3(limLog(pMac, LOG3, FL("Parsed WDS info in Beacon frames: wdsLength=%d\n"),
+ beacon.propIEinfo.wdsLength);)
+#endif
+ }
+ else
+ {
+ if( psessionEntry->beacon != NULL )
+ {
+ palFreeMemory(pMac->hHdd, psessionEntry->beacon);
+ psessionEntry->beacon = NULL;
+ }
+ psessionEntry->bcnLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
+ if( (palAllocateMemory(pMac->hHdd, (void**)&psessionEntry->beacon, psessionEntry->bcnLen)) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store beacon"));)
+ }
+ else
+ {
+ //Store the Beacon/ProbeRsp. This is sent to csr/hdd in join cnf response.
+ palCopyMemory(pMac->hHdd, psessionEntry->beacon, WDA_GET_RX_MPDU_DATA(pRxPacketInfo), psessionEntry->bcnLen);
+
+ }
+
+ // STA in WT_JOIN_BEACON_STATE (IBSS)
+ limCheckAndAnnounceJoinSuccess(pMac, &beacon, pHdr,psessionEntry);
+ } // if (pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE)
+ } // if ((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) || ...
+ else
+ {
+ // Ignore Beacon frame in all other states
+ if (psessionEntry->limMlmState == eLIM_MLM_JOINED_STATE ||
+ psessionEntry->limMlmState == eLIM_MLM_BSS_STARTED_STATE ||
+ psessionEntry->limMlmState == eLIM_MLM_WT_AUTH_FRAME2_STATE ||
+ psessionEntry->limMlmState == eLIM_MLM_WT_AUTH_FRAME3_STATE ||
+ psessionEntry->limMlmState == eLIM_MLM_WT_AUTH_FRAME4_STATE ||
+ psessionEntry->limMlmState == eLIM_MLM_AUTH_RSP_TIMEOUT_STATE ||
+ psessionEntry->limMlmState == eLIM_MLM_AUTHENTICATED_STATE ||
+ psessionEntry->limMlmState == eLIM_MLM_WT_ASSOC_RSP_STATE ||
+ psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE ||
+ psessionEntry->limMlmState == eLIM_MLM_ASSOCIATED_STATE ||
+ psessionEntry->limMlmState == eLIM_MLM_REASSOCIATED_STATE ||
+ psessionEntry->limMlmState == eLIM_MLM_WT_ASSOC_CNF_STATE ||
+ limIsReassocInProgress(pMac,psessionEntry)) {
+ // nothing unexpected about beacon in these states
+ pMac->lim.gLimNumBeaconsIgnored++;
+ }
+ else
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Received Beacon in unexpected state %d\n"),
+ psessionEntry->limMlmState);
+ limPrintMlmState(pMac, LOG1, psessionEntry->limMlmState);)
+#ifdef WLAN_DEBUG
+ pMac->lim.gLimUnexpBcnCnt++;
+#endif
+ }
+ }
+
+ return;
+} /*** end limProcessBeaconFrame() ***/
+
+
+/**---------------------------------------------------------------
+\fn limProcessBeaconFrameNoSession
+\brief This function is called by limProcessMessageQueue()
+\ upon Beacon reception.
+\
+\param pMac
+\param *pRxPacketInfo - A pointer to Rx packet info structure
+\return None
+------------------------------------------------------------------*/
+void
+limProcessBeaconFrameNoSession(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo)
+{
+ tpSirMacMgmtHdr pHdr;
+ tSchBeaconStruct beacon;
+
+ pMac->lim.gLimNumBeaconsRcvd++;
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+
+ limLog(pMac, LOG2, FL("Received Beacon frame with length=%d from "),
+ WDA_GET_RX_MPDU_LEN(pRxPacketInfo));
+ limPrintMacAddr(pMac, pHdr->sa, LOG2);
+
+ if (limDeactivateMinChannelTimerDuringScan(pMac) != eSIR_SUCCESS)
+ return;
+
+ /**
+ * No session has been established. Expect Beacon only when
+ * 1. STA is in Scan mode waiting for Beacon/Probe response or
+ * 2. STA/AP is in Learn mode
+ */
+ if ((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) ||
+ (pMac->lim.gLimMlmState == eLIM_MLM_PASSIVE_SCAN_STATE) ||
+ (pMac->lim.gLimMlmState == eLIM_MLM_LEARN_STATE))
+ {
+ if (sirConvertBeaconFrame2Struct(pMac, (tANI_U8 *) pRxPacketInfo, &beacon) != eSIR_SUCCESS)
+ {
+ // Received wrongly formatted/invalid Beacon. Ignore and move on.
+ limLog(pMac, LOGW, FL("Received invalid Beacon in global MLM state %X\n"), pMac->lim.gLimMlmState);
+ limPrintMlmState(pMac, LOGW, pMac->lim.gLimMlmState);
+ return;
+ }
+
+ if ( (pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) ||
+ (pMac->lim.gLimMlmState == eLIM_MLM_PASSIVE_SCAN_STATE) )
+ {
+#ifdef WLAN_FEATURE_P2P
+ //If we are scanning for P2P, only accept probe rsp
+ if((pMac->lim.gLimHalScanState != eLIM_HAL_SCANNING_STATE) || (NULL == pMac->lim.gpLimMlmScanReq)
+ || !pMac->lim.gpLimMlmScanReq->p2pSearch )
+#endif
+ {
+ limCheckAndAddBssDescription(pMac, &beacon, pRxPacketInfo, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_FALSE);
+ }
+ }
+ else if (pMac->lim.gLimMlmState == eLIM_MLM_LEARN_STATE)
+ {
+#if (WNI_POLARIS_FW_PRODUCT == AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ // STA/AP is in learn mode
+ /* Not sure whether the below 2 lines are needed for the station. TODO If yes, this should be
+ * uncommented. Also when we tested enabling this, there is a crash as soon as the station
+ * comes up which needs to be fixed*/
+ //if (pMac->lim.gLimSystemRole == eLIM_STA_ROLE)
+ // limCheckAndAddBssDescription(pMac, &beacon, pRxPacketInfo, eANI_BOOLEAN_TRUE);
+ limCollectMeasurementData(pMac, pRxPacketInfo, &beacon);
+ limLog(pMac, LOG3, FL("Parsed WDS info in Beacon frames: wdsLength=%d\n"),
+ beacon.propIEinfo.wdsLength);
+#endif
+ } // end of eLIM_MLM_LEARN_STATE)
+ } // end of (eLIM_MLM_WT_PROBE_RESP_STATE) || (eLIM_MLM_PASSIVE_SCAN_STATE)
+ else
+ {
+ limLog(pMac, LOG1, FL("Rcvd Beacon in unexpected MLM state %d\n"), pMac->lim.gLimMlmState);
+ limPrintMlmState(pMac, LOG1, pMac->lim.gLimMlmState);
+#ifdef WLAN_DEBUG
+ pMac->lim.gLimUnexpBcnCnt++;
+#endif
+ }
+
+ return;
+} /*** end limProcessBeaconFrameNoSession() ***/
+
diff --git a/CORE/MAC/src/pe/lim/limProcessCfgUpdates.c b/CORE/MAC/src/pe/lim/limProcessCfgUpdates.c
new file mode 100644
index 0000000..726da44
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limProcessCfgUpdates.c
@@ -0,0 +1,979 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limProcessCfgUpdates.cc contains the utility functions
+ * to handle various CFG parameter update events
+ * Author: Chandra Modumudi
+ * Date: 01/20/03
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+
+#include "aniGlobal.h"
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+#include "wniCfgAp.h"
+#else
+#include "wniCfgSta.h"
+#endif
+#include "sirMacProtDef.h"
+#include "cfgApi.h"
+#include "limTypes.h"
+#include "limUtils.h"
+#include "limPropExtsUtils.h"
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halCommonApi.h"
+#endif
+#include "schApi.h"
+#include "pmmApi.h"
+#if defined WLAN_FEATURE_VOWIFI
+#include "rrmApi.h"
+#endif
+
+static void limUpdateConfig(tpAniSirGlobal pMac,tpPESession psessionEntry);
+
+#if 0
+/**
+ * limGetCfgIdOfDefaultKeyid()
+ *
+ *FUNCTION:
+ * This function is called to get CFG ID of default key id
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param dkid - Value of default key id
+ * @return dkCfgId - CFG ID of key corresponding to default key Id
+ */
+
+static tANI_U32
+limGetCfgIdOfDefaultKeyid(tANI_U32 dkid)
+{
+ if (dkid == WNI_CFG_WEP_DEFAULT_KEYID_0)
+ return WNI_CFG_WEP_DEFAULT_KEY_1;
+ else if (dkid == WNI_CFG_WEP_DEFAULT_KEYID_1)
+ return WNI_CFG_WEP_DEFAULT_KEY_2;
+ else if (dkid == WNI_CFG_WEP_DEFAULT_KEYID_2)
+ return WNI_CFG_WEP_DEFAULT_KEY_3;
+ else // dkid == WNI_CFG_WEP_DEFAULT_KEYID_3
+ return WNI_CFG_WEP_DEFAULT_KEY_4;
+} /*** end limGetCfgIdOfDefaultKeyid() ***/
+#endif
+
+
+/**
+ * limSetDefaultKeyIdAndKeys()
+ *
+ *FUNCTION:
+ * This function is called while applying configuration
+ * during JOIN/REASSOC/START_BSS.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+static void
+limSetDefaultKeyIdAndKeys(tpAniSirGlobal pMac)
+{
+#ifdef FIXME_GEN6
+ tANI_U32 val;
+ tANI_U32 dkCfgId;
+
+ PELOG1(limLog(pMac, LOG1, FL("Setting default keys at SP\n"));)
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID,
+ &val) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP,
+ FL("Unable to retrieve defaultKeyId from CFG\n"));
+ }
+ dkCfgId = limGetCfgIdOfDefaultKeyid(val);
+#endif
+
+} /*** end limSetDefaultKeyIdAndKeys() ***/
+
+
+/**
+ * handleCBCFGChange()
+ *
+ *FUNCTION:
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * If this API is invoked with
+ * cfgId == ANI_IGNORE_CFG_ID
+ * Then,
+ * this routine will traverse thru' ALL the
+ * related CFG's that are statically setup
+ * Else,
+ * only update this "1" CFG identified by cfgId
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param cfgId - ID of CFG parameter that got updated
+ * @return None
+ */
+void handleCBCFGChange( tpAniSirGlobal pMac, tANI_U32 cfgId )
+{
+tANI_U32 cfg, val, i = 0;
+tANI_U32 defaultCfgList[] = {
+ WNI_CFG_CHANNEL_BONDING_MODE,
+ ANI_IGNORE_CFG_ID };
+
+ do
+ {
+ //
+ // Determine if we have to use our own default CFG list
+ // OR should we use the argument passed to us
+ //
+ if( ANI_IGNORE_CFG_ID == cfgId )
+ cfg = defaultCfgList[i]; // "n" iterations reqd
+ else
+ cfg = cfgId; // Just "1" iteration reqd
+
+ switch( cfg )
+ {
+ case WNI_CFG_CHANNEL_BONDING_MODE:
+ if( eSIR_SUCCESS != wlan_cfgGetInt( pMac,
+ WNI_CFG_CHANNEL_BONDING_MODE,
+ &val ))
+ {
+ limLog( pMac, LOGW,
+ FL("Unable to retrieve CHANNEL BONDING Mode from CFG. Defaulting to DISABLE\n"));
+ pMac->lim.gCbMode = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
+ }
+ else
+ pMac->lim.gCbMode = (tANI_U8) val;
+
+ // Now, set the CHANNEL BONDING state apropriately
+ switch( pMac->lim.gCbMode )
+ {
+ // Always OFF
+ case WNI_CFG_CHANNEL_BONDING_MODE_DISABLE:
+ SET_CB_STATE_DISABLE( pMac->lim.gCbState );
+ break;
+
+ // Always ON
+ case WNI_CFG_CHANNEL_BONDING_MODE_ENABLE:
+ SET_CB_STATE_ENABLE( pMac->lim.gCbState );
+ break;
+
+ default:
+ SET_CB_STATE_ENABLE( pMac->lim.gCbState );
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ // DEBUG LOG the TITAN CFG's
+ limLog( pMac, LOG1,
+ FL("The TITAN related global CFG's are: "
+ "cbMode - %1d cbState - %1d\n"),
+ pMac->lim.gCbMode, pMac->lim.gCbState);
+
+ // If only "1" CFG needs an update, then return
+ if( ANI_IGNORE_CFG_ID == cfgId )
+ i++;
+ else
+ break;
+
+ } while( ANI_IGNORE_CFG_ID != defaultCfgList[i] ); // End-Of-List?
+}
+
+/** -------------------------------------------------------------
+\fn limSetCfgProtection
+\brief sets lim global cfg cache from the config.
+\param tpAniSirGlobal pMac
+\return None
+ -------------------------------------------------------------*/
+#ifdef WLAN_SOFTAP_FEATURE
+void limSetCfgProtection(tpAniSirGlobal pMac, tpPESession pesessionEntry)
+#else
+void limSetCfgProtection(tpAniSirGlobal pMac)
+#endif
+{
+ tANI_U32 val = 0;
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if(( pesessionEntry != NULL ) && (pesessionEntry->limSystemRole == eLIM_AP_ROLE )){
+ if (pesessionEntry->gLimProtectionControl == WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE )
+ palZeroMemory( pMac->hHdd, (void *)&pesessionEntry->cfgProtection , sizeof(tCfgProtection));
+ else{
+ limLog(pMac, LOG1, FL(" frm11a = %d, from11b = %d, frm11g = %d, "
+ "ht20 = %d, nongf = %d, lsigTxop = %d, "
+ "rifs = %d, obss = %d\n"),
+ pesessionEntry->cfgProtection.fromlla,
+ pesessionEntry->cfgProtection.fromllb,
+ pesessionEntry->cfgProtection.fromllg,
+ pesessionEntry->cfgProtection.ht20,
+ pesessionEntry->cfgProtection.nonGf,
+ pesessionEntry->cfgProtection.lsigTxop,
+ pesessionEntry->cfgProtection.rifs,
+ pesessionEntry->cfgProtection.obss);
+ }
+ }
+ else{
+#endif
+ if (wlan_cfgGetInt(pMac, WNI_CFG_FORCE_POLICY_PROTECTION, &val) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("reading WNI_CFG_FORCE_POLICY_PROTECTION cfg failed\n"));
+ return;
+ }
+ else
+ pMac->lim.gLimProtectionControl = (tANI_U8)val;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_PROTECTION_ENABLED, &val) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("reading protection cfg failed\n"));
+ return;
+ }
+
+ if(pMac->lim.gLimProtectionControl == WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
+ palZeroMemory( pMac->hHdd, (void *)&pMac->lim.cfgProtection , sizeof(tCfgProtection));
+ else
+ {
+#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+ {
+ pMac->lim.cfgProtection.overlapFromlla = (val >> WNI_CFG_PROTECTION_ENABLED_OLBC_FROM_llA) & 1;
+ pMac->lim.cfgProtection.overlapFromllb = (val >> WNI_CFG_PROTECTION_ENABLED_OLBC_FROM_llB) & 1;
+ pMac->lim.cfgProtection.overlapFromllg = (val >> WNI_CFG_PROTECTION_ENABLED_OLBC_FROM_llG) & 1;
+ pMac->lim.cfgProtection.overlapHt20 = (val >> WNI_CFG_PROTECTION_ENABLED_OLBC_HT20) & 1;
+ pMac->lim.cfgProtection.overlapNonGf = (val >> WNI_CFG_PROTECTION_ENABLED_OLBC_NON_GF) & 1;
+ pMac->lim.cfgProtection.overlapLsigTxop = (val >> WNI_CFG_PROTECTION_ENABLED_OLBC_LSIG_TXOP) & 1;
+ pMac->lim.cfgProtection.overlapRifs = (val >> WNI_CFG_PROTECTION_ENABLED_OLBC_RIFS) & 1;
+ pMac->lim.cfgProtection.overlapOBSS = (val>> WNI_CFG_PROTECTION_ENABLED_OLBC_OBSS )&1;
+
+ }
+ #endif
+ pMac->lim.cfgProtection.fromlla = (val >> WNI_CFG_PROTECTION_ENABLED_FROM_llA) & 1;
+ pMac->lim.cfgProtection.fromllb = (val >> WNI_CFG_PROTECTION_ENABLED_FROM_llB) & 1;
+ pMac->lim.cfgProtection.fromllg = (val >> WNI_CFG_PROTECTION_ENABLED_FROM_llG) & 1;
+ pMac->lim.cfgProtection.ht20 = (val >> WNI_CFG_PROTECTION_ENABLED_HT_20) & 1;
+ pMac->lim.cfgProtection.nonGf = (val >> WNI_CFG_PROTECTION_ENABLED_NON_GF) & 1;
+ pMac->lim.cfgProtection.lsigTxop = (val >> WNI_CFG_PROTECTION_ENABLED_LSIG_TXOP) & 1;
+ pMac->lim.cfgProtection.rifs = (val >> WNI_CFG_PROTECTION_ENABLED_RIFS) & 1;
+ pMac->lim.cfgProtection.obss= (val >> WNI_CFG_PROTECTION_ENABLED_OBSS) & 1;
+
+ }
+#ifdef WLAN_SOFTAP_FEATURE
+}
+#endif
+}
+
+
+
+/**
+ * limUpdateTriggerStaBkScanFlag
+ *
+ * FUNCTION:
+ * This function updates the lim global gLimTriggerBackgroundScanDuringQuietBss
+ * based on cfg configuration. Usually triggered after a cfgSetInt call.
+ *
+ * PARAMS:
+ * pMac - Pointer to Global MAC structure
+ *
+ */
+static tSirRetStatus limUpdateTriggerStaBkScanFlag(tpAniSirGlobal pMac)
+{
+ tANI_U32 val;
+ tANI_U8 flag;
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val) != eSIR_SUCCESS)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN from cfg\n"));)
+ return eSIR_FAILURE;
+ }
+
+ flag = (val) ? 1 : 0;
+ if(flag != pMac->lim.gLimTriggerBackgroundScanDuringQuietBss)
+ {
+ /* Update global flag */
+ pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = flag;
+ /*Update beacon prop IE also if we're an AP */
+
+ //call a wrapper and if the session role is other than the sta call this function schsetfixedbeacon fields function
+ limUpdateBeacon(pMac);
+
+ }
+
+ return eSIR_FAILURE;
+}
+
+
+/**
+ * limHandleCFGparamUpdate()
+ *
+ *FUNCTION:
+ * This function is called by limProcessMessages() to
+ * whenever SIR_CFG_PARAM_UPDATE_IND message is posted
+ * to LIM (due to a set operation on a CFG parameter).
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param cfgId - ID of CFG parameter that got updated
+ * @return None
+ */
+
+void
+limHandleCFGparamUpdate(tpAniSirGlobal pMac, tANI_U32 cfgId)
+{
+ tANI_U32 val1, val2;
+ tANI_U16 val16;
+ tANI_U8 val8;
+ tSirMacHTCapabilityInfo *pHTCapabilityInfo;
+ tSirMacHTParametersInfo *pAmpduParamInfo;
+ tSirMacHTInfoField1 *pHTInfoField1;
+
+ PELOG3(limLog(pMac, LOG3, FL("Handling CFG parameter id %X update\n"), cfgId);)
+ switch (cfgId)
+ {
+ case WNI_CFG_WEP_DEFAULT_KEYID:
+
+ // !!LAC - when the default KeyID is changed, force all of the
+ // keys and the keyID to be reprogrammed. this allows the
+ // keys to change after the initial setting of the keys when the CFG was
+ // applied at association time through CFG changes of the keys.
+ limSetDefaultKeyIdAndKeys( pMac );
+
+ break;
+
+ case WNI_CFG_EXCLUDE_UNENCRYPTED:
+ if (wlan_cfgGetInt(pMac, WNI_CFG_EXCLUDE_UNENCRYPTED,
+ &val1) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP,
+ FL("Unable to retrieve excludeUnencr from CFG\n"));
+ }
+#if 0
+ halSetSpExclUndecrypted(pMac, (tHalBitVal) val);
+#else
+ limLog(pMac, LOGE,
+ FL("Unsupported CFG: WNI_CFG_EXCLUDE_UNENCRYPTED\n"));
+#endif
+
+ break;
+
+ case WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT:
+ if (pMac->lim.gLimMlmState != eLIM_MLM_WT_ASSOC_RSP_STATE)
+ {
+ // 'Change' timer for future activations
+ limDeactivateAndChangeTimer(pMac,
+ eLIM_ASSOC_FAIL_TIMER);
+ }
+
+ break;
+
+#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA) || defined(ANI_AP_CLIENT_SDK)
+ case WNI_CFG_BACKGROUND_SCAN_PERIOD:
+
+
+ limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD, &val1) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("could not retrieve Background scan period value\n"));
+ break;
+ }
+ if (val1 == 0)
+ break;
+
+
+
+ if ( (pMac->lim.gLimSystemRole == eLIM_STA_ROLE) ||
+ ( (pMac->lim.gLimSystemRole == eLIM_STA_IN_IBSS_ROLE) &&
+ (pMac->lim.gLimSmeState == eLIM_SME_NORMAL_STATE)))
+ {
+ // Reactivate Background scan timer
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_BACKGROUND_SCAN_TIMER));
+ if (tx_timer_activate(
+ &pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
+ {
+ /// Could not activate background scan timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("could not activate background scan timer\n"));
+ pMac->lim.gLimBackgroundScanStarted = FALSE;
+ pMac->lim.gLimBackgroundScanTerminate = TRUE;
+ }
+ else
+ {
+ pMac->lim.gLimBackgroundScanStarted = TRUE;
+ pMac->lim.gLimBackgroundScanTerminate = FALSE;
+ }
+
+ PELOG3(limLog(pMac, LOG3,
+ FL("Updated Background scan period\n"));)
+ }
+
+ break;
+#endif
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ case WNI_CFG_PREAUTH_CLNUP_TIMEOUT:
+ if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
+ {
+ limDeactivateAndChangeTimer(pMac,
+ eLIM_PRE_AUTH_CLEANUP_TIMER);
+
+#ifdef GEN6_TODO
+ /* revisit this piece of code to assign the appropriate sessionId below
+ * priority - MEDIUM
+ */
+ pMac->lim.limTimers.gLimPreAuthClnupTimer.sessionId = sessionId;
+#endif
+ // Reactivate pre-auth cleanup timer
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PRE_AUTH_CLEANUP_TIMER));
+ if (tx_timer_activate(&pMac->lim.limTimers.gLimPreAuthClnupTimer)
+ != TX_SUCCESS)
+ {
+ /// Could not activate pre-auth cleanup timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("could not activate preauth cleanup timer\n"));
+ }
+ PELOG3(limLog(pMac, LOG3,
+ FL("Updated pre-auth cleanup timeout\n"));)
+ }
+
+ break;
+
+#endif
+
+ case WNI_CFG_BG_SCAN_CHANNEL_LIST:
+#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA) || defined(ANI_AP_CLIENT_SDK)
+ PELOG1(limLog(pMac, LOG1,
+ FL("VALID_CHANNEL_LIST has changed, reset next bg scan channel\n"));)
+ pMac->lim.gLimBackgroundScanChannelId = 0;
+#endif
+
+ break;
+
+ case WNI_CFG_CHANNEL_BONDING_MODE:
+ handleCBCFGChange( pMac, cfgId );
+ //for Secondary channel, change setupCBMode function OR the caller of that function during Join (STA) or Start BSS(AP/IBSS)
+ //Now update the HT Capability CFG based on Channel Bonding CFG
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG\n"));)
+ break;
+ }
+ if (wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, &val2) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve Channel Bonding CFG\n"));)
+ break;
+ }
+ val16 = ( tANI_U16 ) val1;
+ pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
+
+ //channel bonding mode could be set to anything from 0 to 4(Titan had these modes)
+ //But for Taurus we have only two modes: enable(>0) or disable(=0)
+ pHTCapabilityInfo->supportedChannelWidthSet = val2 ? WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
+ if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &val1) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT INFO Field1 CFG\n"));)
+ break;
+ }
+ val8 = ( tANI_U8 ) val1;
+ pHTInfoField1 = ( tSirMacHTInfoField1* ) &val8;
+ pHTInfoField1->recommendedTxWidthSet = (tANI_U8)pHTCapabilityInfo->supportedChannelWidthSet;
+ pMac->lim.gHTRecommendedTxWidthSet = pHTInfoField1->recommendedTxWidthSet;
+ if(cfgSetInt(pMac, WNI_CFG_HT_INFO_FIELD1, *(tANI_U8*)pHTInfoField1) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("could not update HT Info Field\n"));)
+
+ break;
+
+
+ case WNI_CFG_TRIG_STA_BK_SCAN:
+ if(limUpdateTriggerStaBkScanFlag(pMac) != eSIR_SUCCESS)
+ {
+ PELOG2(limLog(pMac, LOG2,
+ FL("Updating lim trigger sta bk scan global flag failed!\n"));)
+ }
+ break;
+
+ case WNI_CFG_PROTECTION_ENABLED:
+#ifdef WLAN_SOFTAP_FEATURE
+ limSetCfgProtection(pMac, NULL);
+#else
+ limSetCfgProtection(pMac);
+#endif
+ break;
+ case WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG:
+ {
+ tSirMsgQ msg = {0};
+ tANI_U32 status;
+
+ msg.type = SIR_LIM_UPDATE_BEACON;
+
+ status = limPostMsgApi(pMac, &msg);
+
+ if (status != TX_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("Failed limPostMsgApi\n"), status);)
+ break;
+ }
+ case WNI_CFG_GREENFIELD_CAPABILITY:
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap Info CFG\n"));)
+ break;
+ }
+ if (wlan_cfgGetInt(pMac, WNI_CFG_GREENFIELD_CAPABILITY, &val2) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve GreenField CFG\n"));)
+ break;
+ }
+ val16 = ( tANI_U16 ) val1;
+ pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
+ pHTCapabilityInfo->greenField = (tANI_U16)val2;
+ if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
+ break;
+
+ case WNI_CFG_HT_RX_STBC:
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve WNI_CFG_HT_CAP_INFO \n"));)
+ break;
+ }
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HT_RX_STBC, &val2) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve WNI_CFG_HT_RX_STBC\n"));)
+ break;
+ }
+ val16 = ( tANI_U16 ) val1;
+ pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
+ pHTCapabilityInfo->rxSTBC = (tANI_U16)val2;
+ if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
+ break;
+
+ case WNI_CFG_MAX_AMSDU_LENGTH:
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap Info CFG\n"));)
+ break;
+ }
+ if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_AMSDU_LENGTH, &val2) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max AMSDU Length CFG\n"));)
+ break;
+ }
+ val16 = ( tANI_U16 ) val1;
+ pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
+ pHTCapabilityInfo->maximalAMSDUsize = (tANI_U16)val2;
+ if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
+ break;
+
+ case WNI_CFG_SHORT_GI_20MHZ:
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG\n"));)
+ break;
+ }
+ if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_20MHZ, &val2) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz CFG\n"));)
+ break;
+ }
+ val16 = ( tANI_U16 ) val1;
+ pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
+ pHTCapabilityInfo->shortGI20MHz = (tANI_U16)val2;
+ if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
+ break;
+ case WNI_CFG_SHORT_GI_40MHZ:
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG\n"));)
+ break;
+ }
+ if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_40MHZ, &val2) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz CFG\n"));)
+ break;
+ }
+ val16 = ( tANI_U16 ) val1;
+ pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
+ pHTCapabilityInfo->shortGI40MHz = (tANI_U16)val2;
+ if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
+ break;
+ case WNI_CFG_MPDU_DENSITY:
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &val1) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT AMPDU Param CFG\n"));)
+ break;
+ }
+ if (wlan_cfgGetInt(pMac, WNI_CFG_MPDU_DENSITY, &val2) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve MPDU Density CFG\n"));)
+ break;
+ }
+ val16 = ( tANI_U16 ) val1;
+ pAmpduParamInfo = ( tSirMacHTParametersInfo* ) &val16;
+ pAmpduParamInfo->mpduDensity = (tANI_U8)val2;
+ if(cfgSetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, *(tANI_U8*)pAmpduParamInfo) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("could not update HT AMPDU Param CFG\n"));)
+
+ break;
+ case WNI_CFG_MAX_RX_AMPDU_FACTOR:
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &val1) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT AMPDU Param CFG\n"));)
+ break;
+ }
+ if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_RX_AMPDU_FACTOR, &val2) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve AMPDU Factor CFG\n"));)
+ break;
+ }
+ val16 = ( tANI_U16 ) val1;
+ pAmpduParamInfo = ( tSirMacHTParametersInfo* ) &val16;
+ pAmpduParamInfo->maxRxAMPDUFactor = (tANI_U8)val2;
+ if(cfgSetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, *(tANI_U8*)pAmpduParamInfo) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("could not update HT AMPDU Param CFG\n"));)
+ break;
+
+ case WNI_CFG_HEART_BEAT_THRESHOLD:
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve WNI_CFG_HEART_BEAT_THRESHOLD CFG\n"));)
+ break;
+ }
+ if(!val1)
+ {
+ limDeactivateAndChangeTimer(pMac, eLIM_HEART_BEAT_TIMER);
+ pMac->sys.gSysEnableLinkMonitorMode = 0;
+ PELOGE(limLog(pMac, LOGE, "Deactivating heartbeat link monitoring\n");)
+ }
+ else
+ {
+ pMac->sys.gSysEnableLinkMonitorMode = 1;
+ //limReactivateTimer( pMac, eLIM_HEART_BEAT_TIMER );
+ //limReactivateHeartBeatTimer(pMac, psessionEntry);
+ PELOGE(limLog(pMac, LOGE, "Reactivating heartbeat link monitoring\n");)
+ }
+ case WNI_CFG_MAX_PS_POLL:
+ case WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE:
+ case WNI_CFG_MIN_RSSI_THRESHOLD:
+ case WNI_CFG_NTH_BEACON_FILTER:
+ case WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE:
+ {
+ tpSirPowerSaveCfg pPowerSaveConfig;
+
+ /* Allocate and fill in power save configuration. */
+ if (palAllocateMemory(pMac->hHdd, (void **)&pPowerSaveConfig,
+ sizeof(tSirPowerSaveCfg)) != eHAL_STATUS_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("LIM: Cannot allocate memory for power save configuration\n"));)
+ break;
+ }
+
+ /* This context should be valid if power-save configuration message has been already dispathed
+ * during initialization process. Re-using the present configuration mask
+ */
+ palCopyMemory(pMac->hHdd, pPowerSaveConfig, (tANI_U8 *)&pMac->pmm.gPmmCfg, sizeof(tSirPowerSaveCfg));
+
+ if ( (pmmSendPowerSaveCfg(pMac, pPowerSaveConfig)) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("LIM: pmmSendPowerSaveCfg() failed \n"));)
+ }
+ }
+ break;
+
+
+ case WNI_CFG_DOT11_MODE:
+ if (wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &val1) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve Dot11 Mode CFG\n"));)
+ break;
+ }
+ /* TODO */
+ //psessionEntry->dot11mode = val1; //// un comment this line ...FORBUILD -TEMPFIX.. HOW TO GET sessionEntry?????
+ break;
+ case WNI_CFG_ADDBA_REQ_DECLINE:
+ if(wlan_cfgGetInt(pMac, WNI_CFG_ADDBA_REQ_DECLINE, &val1) != eSIR_SUCCESS) {
+ limLog( pMac, LOGE, FL( "Unable to get ADDBA_REQ_DECLINE cfg\n" ));
+ break;
+ }
+ pMac->lim.gAddBA_Declined = (tANI_U8)val1;
+ break;
+
+ case WNI_CFG_SCAN_IN_POWERSAVE:
+ if(wlan_cfgGetInt(pMac, WNI_CFG_SCAN_IN_POWERSAVE, &val1) != eSIR_SUCCESS) {
+ limLog( pMac, LOGE, FL( "Unable to get WNI_CFG_SCAN_IN_POWERSAVE \n" ));
+ break;
+ }
+ pMac->lim.gScanInPowersave = (tANI_U8)val1;
+ break;
+
+
+ case WNI_CFG_ASSOC_STA_LIMIT:
+ if(wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_STA_LIMIT, &val1) != eSIR_SUCCESS) {
+ limLog( pMac, LOGE, FL( "Unable to get WNI_CFG_ASSOC_STA_LIMIT" ));
+ break;
+ }
+ pMac->lim.gLimAssocStaLimit = (tANI_U16)val1;
+ break;
+
+ default:
+ break;
+ }
+} /*** end limHandleCFGparamUpdate() ***/
+
+
+
+/**
+ * limApplyConfiguration()
+ *
+ *FUNCTION:
+ * This function is called to apply the configured parameters
+ * before joining or reassociating with a BSS or starting a BSS.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limApplyConfiguration(tpAniSirGlobal pMac,tpPESession psessionEntry)
+{
+ tANI_U32 val=0, phyMode;
+
+ PELOG2(limLog(pMac, LOG2, FL("Applying config\n"));)
+
+#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+ limCleanupMeasResources(pMac);
+#endif
+ limInitWdsInfoParams(pMac);
+
+ psessionEntry->limSentCapsChangeNtf = false;
+
+ limGetPhyMode(pMac, &phyMode, psessionEntry);
+
+ // Set default keyId and keys
+ limSetDefaultKeyIdAndKeys(pMac);
+
+ limUpdateConfig(pMac,psessionEntry);
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, &val)
+ != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("cfg get WNI_CFG_SHORT_SLOT_TIME failed\n"));
+ return;
+ }
+ if (phyMode == WNI_CFG_PHY_MODE_11G)
+ {
+
+ if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
+ (psessionEntry->pePersona == VOS_P2P_GO_MODE))
+ {
+ val = 1;
+ }
+
+ // Program Polaris based on AP capability
+
+ if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
+ // Joining BSS.
+ val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
+ else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
+ // Reassociating with AP.
+ val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
+
+
+ if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, val) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("could not update short slot time at CFG\n"));
+ return;
+ }
+ }
+ else
+ {
+ // Reset short slot time at CFG
+ if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, 0) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("could not update short slot time at CFG\n"));
+ return;
+ }
+ }
+ //apply protection related config.
+
+#ifdef WLAN_SOFTAP_FEATURE
+ limSetCfgProtection(pMac, psessionEntry);
+#else
+ limSetCfgProtection(pMac);
+#endif
+
+
+ /* Added for BT - AMP Support */
+ if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
+ (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)||
+ (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)||
+ (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) )
+ {
+ /* This check is required to ensure the beacon generation is not done
+ as a part of join request for a BT-AMP station */
+
+ if(psessionEntry->statypeForBss == STA_ENTRY_SELF)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Initializing BT-AMP beacon generation\n"));)
+ schSetBeaconInterval(pMac,psessionEntry);
+ schSetFixedBeaconFields(pMac,psessionEntry);
+ }
+ }
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_SCAN_IN_POWERSAVE, &val) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("could not retrieve WNI_CFG_SCAN_IN_POWERSAVE\n"));
+ return;
+ }
+ pMac->lim.gScanInPowersave = (tANI_U8) val;
+
+} /*** end limApplyConfiguration() ***/
+
+
+/**
+ * limUpdateConfig
+ *
+ * FUNCTION:
+ * Update the local state from CFG database
+ * (This used to be dphUpdateConfig)
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param None
+ * @return None
+ */
+
+static void
+limUpdateConfig(tpAniSirGlobal pMac,tpPESession psessionEntry)
+{
+ tANI_U32 val;
+
+ #if 0
+ if (wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, pMac->lim.gLimMyMacAddr, &len) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("cfg get sta id failed\n"));
+ #endif //To SUPPORT BT-AMP
+ sirCopyMacAddr(pMac->lim.gLimMyMacAddr,psessionEntry->selfMacAddr);
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("cfg get short preamble failed\n"));
+ psessionEntry->beaconParams.fShortPreamble = (val) ? 1 : 0;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_WME_ENABLED, &val) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("cfg get wme enabled failed\n"));
+ psessionEntry->limWmeEnabled = (val) ? 1 : 0;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_WSM_ENABLED, &val) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("cfg get wsm enabled failed\n"));
+ psessionEntry->limWsmEnabled = (val) ? 1 : 0;
+
+ if ((! psessionEntry->limWmeEnabled) && (psessionEntry->limWsmEnabled))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Can't enable WSM without WME\n"));)
+ psessionEntry->limWsmEnabled = 0;
+ }
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_QOS_ENABLED, &val) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("cfg get qos enabled failed\n"));
+ psessionEntry->limQosEnabled = (val) ? 1 : 0;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HCF_ENABLED, &val) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("cfg get hcf enabled failed\n"));
+ psessionEntry->limHcfEnabled = (val) ? 1 : 0;
+
+ // Update the ADD BA Declined configuration
+ if(wlan_cfgGetInt(pMac, WNI_CFG_ADDBA_REQ_DECLINE, &val) != eSIR_SUCCESS)
+ limLog( pMac, LOGP, FL( "Unable to get ADDBA_REQ_DECLINE cfg\n" ));
+ pMac->lim.gAddBA_Declined = (val) ? 0xff : 0x0;
+
+ // AP: WSM should enable HCF as well, for STA enable WSM only after
+ // association response is received
+ if (psessionEntry->limWsmEnabled && psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ psessionEntry->limHcfEnabled = 1;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_11D_ENABLED, &val) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("cfg get 11d enabled failed\n"));
+ psessionEntry->lim11dEnabled = (val) ? 1 : 0;
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_STA_LIMIT, &val) != eSIR_SUCCESS) {
+ limLog( pMac, LOGP, FL( "cfg get assoc sta limit failed" ));
+ }
+ pMac->lim.gLimAssocStaLimit = (tANI_U16)val;
+
+#if defined WLAN_FEATURE_VOWIFI
+ rrmUpdateConfig( pMac, psessionEntry );
+#endif
+ PELOG1(limLog(pMac, LOG1, FL("Updated Lim shadow state based on CFG\n"));)
+
+
+}
+
+
diff --git a/CORE/MAC/src/pe/lim/limProcessDeauthFrame.c b/CORE/MAC/src/pe/lim/limProcessDeauthFrame.c
new file mode 100644
index 0000000..1147e90
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limProcessDeauthFrame.c
@@ -0,0 +1,451 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limProcessDeauthFrame.cc contains the code
+ * for processing Deauthentication Frame.
+ * Author: Chandra Modumudi
+ * Date: 03/24/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+#include "palTypes.h"
+#include "aniGlobal.h"
+
+#include "utilsApi.h"
+#include "limTypes.h"
+#include "limUtils.h"
+#include "limAssocUtils.h"
+#include "limSecurityUtils.h"
+#include "limSerDesUtils.h"
+#include "schApi.h"
+#include "limSendMessages.h"
+
+
+
+/**
+ * limProcessDeauthFrame
+ *
+ *FUNCTION:
+ * This function is called by limProcessMessageQueue() upon
+ * Deauthentication frame reception.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param *pRxPacketInfo - A pointer to Buffer descriptor + associated PDUs
+ * @return None
+ */
+
+void
+limProcessDeauthFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tpPESession psessionEntry)
+{
+ tANI_U8 *pBody;
+ tANI_U16 aid, reasonCode;
+ tpSirMacMgmtHdr pHdr;
+ tLimMlmAssocCnf mlmAssocCnf;
+ tLimMlmDeauthInd mlmDeauthInd;
+ tpDphHashNode pStaDs;
+
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+
+ pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
+
+
+ if ((eLIM_STA_ROLE == psessionEntry->limSystemRole) && (eLIM_SME_WT_DEAUTH_STATE == psessionEntry->limSmeState))
+ {
+ PELOGE(limLog(pMac, LOGE,
+ FL("received Deauth frame in DEAUTH_WT_STATE(already processing previously received DEAUTH frame).. Dropping this..\n "));)
+ return;
+ }
+
+ if (limIsGroupAddr(pHdr->sa))
+ {
+ // Received Deauth frame from a BC/MC address
+ // Log error and ignore it
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Deauth frame from a BC/MC address\n"));)
+
+ return;
+ }
+
+ if (limIsGroupAddr(pHdr->da) && !limIsAddrBC(pHdr->da))
+ {
+ // Received Deauth frame for a MC address
+ // Log error and ignore it
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Deauth frame for a MC address\n"));)
+
+ return;
+ }
+ // Get reasonCode from Deauthentication frame body
+ reasonCode = sirReadU16(pBody);
+
+ PELOGE(limLog(pMac, LOGE,
+ FL("received Deauth frame (mlm state = %s) with reason code %d from "),
+ limMlmStateStr(pMac->lim.gLimMlmState), reasonCode);
+ limPrintMacAddr(pMac, pHdr->sa, LOGE);)
+
+ if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE )||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
+ {
+ switch (reasonCode)
+ {
+ case eSIR_MAC_UNSPEC_FAILURE_REASON:
+ case eSIR_MAC_DEAUTH_LEAVING_BSS_REASON:
+ // Valid reasonCode in received Deauthentication frame
+ break;
+
+ default:
+ // Invalid reasonCode in received Deauthentication frame
+ // Log error and ignore the frame
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Deauth frame with invalid reasonCode %d from \n"),
+ reasonCode);
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ break;
+ }
+ }
+ else if (psessionEntry->limSystemRole == eLIM_STA_ROLE ||psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
+ {
+ switch (reasonCode)
+ {
+ case eSIR_MAC_UNSPEC_FAILURE_REASON:
+ case eSIR_MAC_PREV_AUTH_NOT_VALID_REASON:
+ case eSIR_MAC_DEAUTH_LEAVING_BSS_REASON:
+ case eSIR_MAC_CLASS2_FRAME_FROM_NON_AUTH_STA_REASON:
+ case eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON:
+ case eSIR_MAC_STA_NOT_PRE_AUTHENTICATED_REASON:
+ // Valid reasonCode in received Deauth frame
+ break;
+
+ default:
+ // Invalid reasonCode in received Deauth frame
+ // Log error and ignore the frame
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Deauth frame with invalid reasonCode %d from \n"),
+ reasonCode);
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ break;
+ }
+ }
+ else
+ {
+ // Received Deauth frame in either IBSS
+ // or un-known role. Log error and ignore it
+ limLog(pMac, LOGE,
+ FL("received Deauth frame with reasonCode %d in role %d from \n"),
+ reasonCode, psessionEntry->limSystemRole);
+ limPrintMacAddr(pMac, pHdr->sa, LOGE);
+
+ return;
+ }
+
+ /** If we are in the middle of ReAssoc, a few things could happen:
+ * - STA is reassociating to current AP, and receives deauth from:
+ * a) current AP
+ * b) other AP
+ * - STA is reassociating to a new AP, and receives deauth from:
+ * c) current AP
+ * d) reassoc AP
+ * e) other AP
+ *
+ * The logic is:
+ * 1) If rcv deauth from an AP other than the one we're trying to
+ * reassociate with, then drop the deauth frame (case b, c, e)
+ * 2) If rcv deauth from the "new" reassoc AP (case d), then restore
+ * context with previous AP and send SME_REASSOC_RSP failure.
+ * 3) If rcv deauth from the reassoc AP, which is also the same
+ * AP we're currently associated with (case a), then proceed
+ * with normal deauth processing.
+ */
+ if (limIsReassocInProgress(pMac,psessionEntry)) {
+ if (!IS_REASSOC_BSSID(pMac,pHdr->sa,psessionEntry)) {
+ PELOGE(limLog(pMac, LOGE, FL("Rcv Deauth from unknown/different AP while ReAssoc. Ignore \n"));)
+ return;
+ }
+
+ /** Received deauth from the new AP to which we tried to ReAssociate.
+ * Drop ReAssoc and Restore the Previous context( current connected AP).
+ */
+ if (!IS_CURRENT_BSSID(pMac, pHdr->sa,psessionEntry)) {
+ PELOGE(limLog(pMac, LOGW, FL("received DeAuth from the New AP to which ReAssoc is sent \n"));)
+ limRestorePreReassocState(pMac,
+ eSIR_SME_REASSOC_REFUSED, reasonCode,psessionEntry);
+ return;
+ }
+ }
+
+
+ /* If received DeAuth from AP other than the one we're trying to join with
+ * nor associated with, then ignore deauth and delete Pre-auth entry.
+ */
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole != eLIM_AP_ROLE ){
+#endif
+ if (!IS_CURRENT_BSSID(pMac, pHdr->sa,psessionEntry))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("received DeAuth from an AP other than we're trying to join. Ignore. \n"));)
+ if (limSearchPreAuthList(pMac, pHdr->sa))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Preauth entry exist. Deleting... \n"));)
+ limDeletePreAuthNode(pMac, pHdr->sa);
+ }
+ return;
+ }
+#ifdef WLAN_SOFTAP_FEATURE
+ }
+#endif
+
+ // Check for pre-assoc states
+ switch (psessionEntry->limSystemRole)
+ {
+ case eLIM_STA_ROLE:
+ case eLIM_BT_AMP_STA_ROLE:
+ switch (psessionEntry->limMlmState)
+ {
+ case eLIM_MLM_WT_AUTH_FRAME2_STATE:
+ /**
+ * AP sent Deauth frame while waiting
+ * for Auth frame2. Report Auth failure
+ * to SME.
+ */
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Deauth frame with failure code %d from "),
+ reasonCode);
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ limRestoreFromAuthState(pMac, eSIR_SME_DEAUTH_WHILE_JOIN,
+ reasonCode,psessionEntry);
+
+ return;
+
+ case eLIM_MLM_AUTHENTICATED_STATE:
+ /// Issue Deauth Indication to SME.
+ palCopyMemory( pMac->hHdd,
+ (tANI_U8 *) &mlmDeauthInd.peerMacAddr,
+ pHdr->sa,
+ sizeof(tSirMacAddr));
+ mlmDeauthInd.reasonCode = reasonCode;
+
+ psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+
+ limPostSmeMessage(pMac,
+ LIM_MLM_DEAUTH_IND,
+ (tANI_U32 *) &mlmDeauthInd);
+ return;
+
+ case eLIM_MLM_WT_ASSOC_RSP_STATE:
+ /**
+ * AP may have 'aged-out' our Pre-auth
+ * context. Delete local pre-auth context
+ * if any and issue ASSOC_CNF to SME.
+ */
+ if (limSearchPreAuthList(pMac, pHdr->sa))
+ limDeletePreAuthNode(pMac, pHdr->sa);
+
+ if (psessionEntry->pLimMlmJoinReq)
+ {
+ palFreeMemory( pMac->hHdd, psessionEntry->pLimMlmJoinReq);
+ psessionEntry->pLimMlmJoinReq = NULL;
+ }
+
+ mlmAssocCnf.resultCode = eSIR_SME_DEAUTH_WHILE_JOIN;
+ mlmAssocCnf.protStatusCode = reasonCode;
+
+ /* PE session Id*/
+ mlmAssocCnf.sessionId = psessionEntry->peSessionId;
+
+ psessionEntry->limMlmState =
+ psessionEntry->limPrevMlmState;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, psessionEntry->limMlmState));
+
+ // Deactive Association response timeout
+ limDeactivateAndChangeTimer(
+ pMac,
+ eLIM_ASSOC_FAIL_TIMER);
+
+ limPostSmeMessage(
+ pMac,
+ LIM_MLM_ASSOC_CNF,
+ (tANI_U32 *) &mlmAssocCnf);
+
+ return;
+
+ case eLIM_MLM_IDLE_STATE:
+ case eLIM_MLM_LINK_ESTABLISHED_STATE:
+ /**
+ * This could be Deauthentication frame from
+ * a BSS with which pre-authentication was
+ * performed. Delete Pre-auth entry if found.
+ */
+ if (limSearchPreAuthList(pMac, pHdr->sa))
+ limDeletePreAuthNode(pMac, pHdr->sa);
+
+ break;
+
+ case eLIM_MLM_WT_REASSOC_RSP_STATE:
+ break;
+
+ case eLIM_MLM_WT_FT_REASSOC_RSP_STATE:
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Deauth frame in FT state %X with reasonCode=%d from "),
+ psessionEntry->limMlmState, reasonCode);)
+ break;
+
+ default:
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Deauth frame in state %X with reasonCode=%d from "),
+ psessionEntry->limMlmState, reasonCode);)
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);
+ return;
+ }
+ break;
+
+ case eLIM_STA_IN_IBSS_ROLE:
+ break;
+
+#ifdef WLAN_SOFTAP_FEATURE
+ case eLIM_AP_ROLE:
+ break;
+#endif
+
+ default: // eLIM_AP_ROLE or eLIM_BT_AMP_AP_ROLE
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ /// Check if there exists pre-auth context for this STA
+ if (limSearchPreAuthList(pMac, pHdr->sa) == NULL)
+ {
+ /**
+ * Received Deauthentication from a STA that is neither
+ * Associated nor Pre-authenticated. Log error,
+ * and ignore Deauthentication frame.
+ */
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Deauth frame from peer that does not have context, addr "));
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+ }
+ else
+ {
+ /// Delete STA from pre-auth STA list
+ limDeletePreAuthNode(pMac,
+ pHdr->sa);
+
+ palCopyMemory( pMac->hHdd,
+ (tANI_U8 *) &mlmDeauthInd.peerMacAddr,
+ pHdr->sa,
+ sizeof(tSirMacAddr));
+ mlmDeauthInd.reasonCode = reasonCode;
+ mlmDeauthInd.aid = 0;
+
+ limPostSmeMessage(pMac,
+ LIM_MLM_DEAUTH_IND,
+ (tANI_U32 *) &mlmDeauthInd);
+ }
+#endif
+
+ return;
+ } // end switch (pMac->lim.gLimSystemRole)
+
+
+
+ /**
+ * Extract 'associated' context for STA, if any.
+ * This is maintained by DPH and created by LIM.
+ */
+ if( (pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable)) == NULL)
+ return;
+
+
+ if ((pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_STA_RSP_STATE) ||
+ (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_BSS_RSP_STATE))
+ {
+ /**
+ * Already in the process of deleting context for the peer
+ * and received Deauthentication frame. Log and Ignore.
+ */
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Deauth frame from peer that is in state %X, addr "),
+ pStaDs->mlmStaContext.mlmState);
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+ return;
+ }
+ pStaDs->mlmStaContext.disassocReason = (tSirMacReasonCodes)reasonCode;
+ pStaDs->mlmStaContext.cleanupTrigger = eLIM_PEER_ENTITY_DEAUTH;
+
+ /// Issue Deauth Indication to SME.
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDeauthInd.peerMacAddr,
+ pStaDs->staAddr,
+ sizeof(tSirMacAddr));
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ mlmDeauthInd.aid = pStaDs->assocId;
+#endif
+ mlmDeauthInd.reasonCode = (tANI_U8) pStaDs->mlmStaContext.disassocReason;
+ mlmDeauthInd.deauthTrigger = eLIM_PEER_ENTITY_DEAUTH;
+
+
+ /* If we're in the middle of ReAssoc and received deauth from
+ * the ReAssoc AP, then notify SME by sending REASSOC_RSP with
+ * failure result code. By design, SME will then issue "Disassoc"
+ * and cleanup will happen at that time.
+ */
+ if (limIsReassocInProgress(pMac,psessionEntry)) {
+ /**
+ * AP may have 'aged-out' our Pre-auth
+ * context. Delete local pre-auth context
+ * if any and issue REASSOC_CNF to SME.
+ */
+ if (limSearchPreAuthList(pMac, pHdr->sa))
+ limDeletePreAuthNode(pMac, pHdr->sa);
+
+ if (psessionEntry->limAssocResponseData) {
+ palFreeMemory(pMac->hHdd, psessionEntry->limAssocResponseData);
+ psessionEntry->limAssocResponseData = NULL;
+ }
+
+ PELOGE(limLog(pMac, LOGE, FL("Rcv Deauth from ReAssoc AP. Issue REASSOC_CNF. \n"));)
+ limRestorePreReassocState(pMac, eSIR_SME_REASSOC_REFUSED, reasonCode,psessionEntry);
+ return;
+ }
+
+ /// Deauthentication from peer MAC entity
+ limPostSmeMessage(pMac, LIM_MLM_DEAUTH_IND, (tANI_U32 *) &mlmDeauthInd);
+
+ // send eWNI_SME_DEAUTH_IND to SME
+ limSendSmeDeauthInd(pMac, pStaDs, psessionEntry);
+ return;
+
+} /*** end limProcessDeauthFrame() ***/
+
diff --git a/CORE/MAC/src/pe/lim/limProcessDisassocFrame.c b/CORE/MAC/src/pe/lim/limProcessDisassocFrame.c
new file mode 100644
index 0000000..1e138a9
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limProcessDisassocFrame.c
@@ -0,0 +1,319 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limProcessDisassocFrame.cc contains the code
+ * for processing Disassocation Frame.
+ * Author: Chandra Modumudi
+ * Date: 03/24/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+#include "palTypes.h"
+#include "wniApi.h"
+#include "sirApi.h"
+#include "aniGlobal.h"
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halDataStruct.h"
+#endif
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+#include "wniCfgAp.h"
+#else
+#include "wniCfgSta.h"
+#endif
+
+#include "utilsApi.h"
+#include "limTypes.h"
+#include "limUtils.h"
+#include "limAssocUtils.h"
+#include "limSecurityUtils.h"
+#include "limSerDesUtils.h"
+#include "limSendMessages.h"
+#include "schApi.h"
+
+
+/**
+ * limProcessDisassocFrame
+ *
+ *FUNCTION:
+ * This function is called by limProcessMessageQueue() upon
+ * Disassociation frame reception.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * DPH drops packets for STA with 'valid' bit in pStaDs set to '0'.
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param *pRxPacketInfo - A pointer to Rx packet info structure
+ * @return None
+ */
+void
+limProcessDisassocFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tpPESession psessionEntry)
+{
+ tANI_U8 *pBody;
+ tANI_U16 aid, reasonCode;
+ tpSirMacMgmtHdr pHdr;
+ tpDphHashNode pStaDs;
+ tLimMlmDisassocInd mlmDisassocInd;
+
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+ pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
+
+
+ if (limIsGroupAddr(pHdr->sa))
+ {
+ // Received Disassoc frame from a BC/MC address
+ // Log error and ignore it
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Disassoc frame from a BC/MC address\n"));)
+
+ return;
+ }
+
+ if (limIsGroupAddr(pHdr->da) && !limIsAddrBC(pHdr->da))
+ {
+ // Received Disassoc frame for a MC address
+ // Log error and ignore it
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Disassoc frame for a MC address\n"));)
+
+ return;
+ }
+
+ // Get reasonCode from Disassociation frame body
+ reasonCode = sirReadU16(pBody);
+
+ PELOGE(limLog(pMac, LOGE,
+ FL("Received Disassoc frame (mlm state %d sme state %d), with reason code %d from \n"),
+ psessionEntry->limMlmState, psessionEntry->limSmeState, reasonCode);)
+ limPrintMacAddr(pMac, pHdr->sa, LOGE);
+
+ /**
+ * Extract 'associated' context for STA, if any.
+ * This is maintained by DPH and created by LIM.
+ */
+ pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
+
+ if (pStaDs == NULL)
+ {
+ /**
+ * Disassociating STA is not associated.
+ * Log error.
+ */
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Disassoc frame from STA that does not have context reasonCode=%d, addr "),
+ reasonCode);
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ return;
+ }
+
+ /** If we are in the Wait for ReAssoc Rsp state */
+ if (limIsReassocInProgress(pMac,psessionEntry)) {
+ /** If we had received the DisAssoc from,
+ * a. the Current AP during ReAssociate to different AP in same ESS
+ * b. Unknown AP
+ * drop/ignore the DisAssoc received
+ */
+ if (!IS_REASSOC_BSSID(pMac,pHdr->sa,psessionEntry)) {
+ PELOGW(limLog(pMac, LOGW, FL("Ignore the DisAssoc received, while Processing ReAssoc with different/unknown AP\n"));)
+ return;
+ }
+ /** If the Disassoc is received from the new AP to which we tried to ReAssociate
+ * Drop ReAssoc and Restore the Previous context( current connected AP).
+ */
+ if (!IS_CURRENT_BSSID(pMac, pHdr->sa,psessionEntry)) {
+ PELOGW(limLog(pMac, LOGW, FL("received Disassoc from the New AP to which ReAssoc is sent \n"));)
+ limRestorePreReassocState(pMac,
+ eSIR_SME_REASSOC_REFUSED, reasonCode,psessionEntry);
+ return;
+ }
+ }
+
+ if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
+ (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
+ {
+ switch (reasonCode)
+ {
+ case eSIR_MAC_UNSPEC_FAILURE_REASON:
+ case eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON:
+ case eSIR_MAC_DISASSOC_LEAVING_BSS_REASON:
+ case eSIR_MAC_MIC_FAILURE_REASON:
+ case eSIR_MAC_4WAY_HANDSHAKE_TIMEOUT_REASON:
+ case eSIR_MAC_GR_KEY_UPDATE_TIMEOUT_REASON:
+ case eSIR_MAC_RSN_IE_MISMATCH_REASON:
+ case eSIR_MAC_1X_AUTH_FAILURE_REASON:
+ // Valid reasonCode in received Disassociation frame
+ break;
+
+ default:
+ // Invalid reasonCode in received Disassociation frame
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Disassoc frame with invalid reasonCode %d from \n"),
+ reasonCode);
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+ break;
+ }
+ }
+ else if ( ((psessionEntry->limSystemRole == eLIM_STA_ROLE) ||
+ (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
+ ((psessionEntry->limSmeState != eLIM_SME_WT_JOIN_STATE) &&
+ (psessionEntry->limSmeState != eLIM_SME_WT_AUTH_STATE) &&
+ (psessionEntry->limSmeState != eLIM_SME_WT_ASSOC_STATE) &&
+ (psessionEntry->limSmeState != eLIM_SME_WT_REASSOC_STATE) ))
+ {
+ switch (reasonCode)
+ {
+ case eSIR_MAC_UNSPEC_FAILURE_REASON:
+ case eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON:
+ case eSIR_MAC_DISASSOC_DUE_TO_DISABILITY_REASON:
+ case eSIR_MAC_CLASS2_FRAME_FROM_NON_AUTH_STA_REASON:
+ case eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON:
+ case eSIR_MAC_MIC_FAILURE_REASON:
+ case eSIR_MAC_4WAY_HANDSHAKE_TIMEOUT_REASON:
+ case eSIR_MAC_GR_KEY_UPDATE_TIMEOUT_REASON:
+ case eSIR_MAC_RSN_IE_MISMATCH_REASON:
+ case eSIR_MAC_1X_AUTH_FAILURE_REASON:
+ // Valid reasonCode in received Disassociation frame
+ break;
+
+ case eSIR_MAC_DISASSOC_LEAVING_BSS_REASON:
+ // Valid reasonCode in received Disassociation frame
+ // as long as we're not about to channel switch
+ if(pMac->lim.gLimChannelSwitch.state != eLIM_CHANNEL_SWITCH_IDLE)
+ {
+ limLog(pMac, LOGW,
+ FL("Ignoring disassoc frame due to upcoming "
+ "channel switch, from\n"),
+ reasonCode);
+ limPrintMacAddr(pMac, pHdr->sa, LOGW);
+ return;
+ }
+ break;
+
+ default:
+ // Invalid reasonCode in received Disassociation frame
+ // Log error and ignore the frame
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Disassoc frame with invalid reasonCode %d from \n"),
+ reasonCode);
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+ return;
+ }
+ }
+ else
+ {
+ // Received Disassociation frame in either IBSS
+ // or un-known role. Log error and ignore it
+ limLog(pMac, LOGE,
+ FL("received Disassoc frame with invalid reasonCode %d in role %d in sme state %d from \n"),
+ reasonCode, psessionEntry->limSystemRole, psessionEntry->limSmeState);
+ limPrintMacAddr(pMac, pHdr->sa, LOGE);
+
+ return;
+ }
+
+ // Disassociation from peer MAC entity
+
+ PELOG3(limLog(pMac, LOG3,
+ FL("Received Disassoc frame from sta with assocId=%d, with reasonCode=%d\n"),
+ pStaDs->assocId, reasonCode);)
+
+ if ((pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_STA_RSP_STATE) ||
+ (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_BSS_RSP_STATE))
+ {
+ /**
+ * Already in the process of deleting context for the peer
+ * and received Disassociation frame. Log and Ignore.
+ */
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Disassoc frame in state %d from"),
+ pStaDs->mlmStaContext.mlmState);
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
+ return;
+ }
+
+ if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)
+ {
+ /**
+ * Requesting STA is in some 'transient' state?
+ * Log error.
+ */
+ PELOG1(limLog(pMac, LOG1,
+ FL("received Disassoc frame from peer that is in state %X, addr "),
+ pStaDs->mlmStaContext.mlmState);
+ limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+ } // if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)
+
+ pStaDs->mlmStaContext.cleanupTrigger = eLIM_PEER_ENTITY_DISASSOC;
+ pStaDs->mlmStaContext.disassocReason = (tSirMacReasonCodes) reasonCode;
+
+ // Issue Disassoc Indication to SME.
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDisassocInd.peerMacAddr,
+ (tANI_U8 *) pStaDs->staAddr,
+ sizeof(tSirMacAddr));
+ mlmDisassocInd.reasonCode =
+ (tANI_U8) pStaDs->mlmStaContext.disassocReason;
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ mlmDisassocInd.aid = pStaDs->assocId;
+#endif
+ mlmDisassocInd.disassocTrigger = eLIM_PEER_ENTITY_DISASSOC;
+
+ /* Update PE session Id */
+ mlmDisassocInd.sessionId = psessionEntry->peSessionId;
+
+ if (limIsReassocInProgress(pMac,psessionEntry)) {
+
+ /* If we're in the middle of ReAssoc and received disassoc from
+ * the ReAssoc AP, then notify SME by sending REASSOC_RSP with
+ * failure result code. By design, SME will then issue "Disassoc"
+ * and cleanup will happen at that time.
+ */
+ PELOGE(limLog(pMac, LOGE, FL("received Disassoc from AP while waiting for Reassoc Rsp\n"));)
+
+ if (psessionEntry->limAssocResponseData) {
+ palFreeMemory(pMac->hHdd, psessionEntry->limAssocResponseData);
+ psessionEntry->limAssocResponseData = NULL;
+ }
+
+ limRestorePreReassocState(pMac,eSIR_SME_REASSOC_REFUSED, reasonCode,psessionEntry);
+ return;
+ }
+
+ limPostSmeMessage(pMac, LIM_MLM_DISASSOC_IND,
+ (tANI_U32 *) &mlmDisassocInd);
+
+
+ // send eWNI_SME_DISASSOC_IND to SME
+ limSendSmeDisassocInd(pMac, pStaDs,psessionEntry);
+
+ return;
+} /*** end limProcessDisassocFrame() ***/
+
diff --git a/CORE/MAC/src/pe/lim/limProcessLmmMessages.c b/CORE/MAC/src/pe/lim/limProcessLmmMessages.c
new file mode 100644
index 0000000..27c95ce
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limProcessLmmMessages.c
@@ -0,0 +1,798 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limProcessLmmMessages.cc contains the code
+ * for processing SME/LMM messages related to ANI feature set.
+ * Author: Chandra Modumudi
+ * Date: 10/20/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#include "aniGlobal.h"
+#include "wniApi.h"
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+#include "wniCfgAp.h"
+#else
+#include "wniCfgSta.h"
+#endif
+#include "cfgApi.h"
+#include "sirApi.h"
+#include "schApi.h"
+#include "utilsApi.h"
+#include "limTypes.h"
+#include "limUtils.h"
+#include "limAssocUtils.h"
+#include "limSerDesUtils.h"
+#include "limPropExtsUtils.h"
+#include "limSession.h"
+
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+/**
+ * limIsSmeMeasurementReqValid()
+ *
+ *FUNCTION:
+ * This function is called by limProcessLmmMessages() upon
+ * receiving SME_MEASUREMENT_REQ.
+ *
+ *LOGIC:
+ * Message validity checks are performed in this function
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMeasReq Pointer to Received MEASUREMENT_REQ message
+ * @return true When received SME_MEASUREMENT_REQ is formatted
+ * correctly
+ * false otherwise
+ */
+
+inline static tANI_BOOLEAN
+limIsSmeMeasurementReqValid(tpAniSirGlobal pMac, tpSirSmeMeasurementReq pMeasReq)
+{
+#ifdef ANI_AP_SDK
+ if (!pMeasReq->channelList.numChannels ||
+ ((pMeasReq->measControl.periodicMeasEnabled) &&
+ (!pMeasReq->measIndPeriod)) ||
+ (pMeasReq->measIndPeriod &&
+ ((pMeasReq->measIndPeriod < 1))) ||
+ !pMeasReq->measDuration.shortTermPeriod ||
+ ((pMeasReq->measDuration.shortTermPeriod < 1)) ||
+ !pMeasReq->measDuration.averagingPeriod ||
+ (pMeasReq->measDuration.averagingPeriod <
+ pMeasReq->measDuration.shortTermPeriod) ||
+ !pMeasReq->measDuration.shortChannelScanDuration ||
+ ((pMeasReq->measDuration.shortChannelScanDuration <
+ 1)) ||
+ !pMeasReq->measDuration.longChannelScanDuration ||
+ (pMeasReq->measDuration.longChannelScanDuration <
+ pMeasReq->measDuration.shortChannelScanDuration) ||
+ ((pMeasReq->measDuration.longChannelScanDuration <
+ 1)))
+#else
+ if (!pMeasReq->channelList.numChannels ||
+ ((pMeasReq->measControl.periodicMeasEnabled) &&
+ (!pMeasReq->measIndPeriod)) ||
+ (pMeasReq->measIndPeriod &&
+ ((pMeasReq->measIndPeriod < SYS_TICK_DUR_MS))) ||
+ !pMeasReq->measDuration.shortTermPeriod ||
+ ((pMeasReq->measDuration.shortTermPeriod < SYS_TICK_DUR_MS)) ||
+ !pMeasReq->measDuration.averagingPeriod ||
+ (pMeasReq->measDuration.averagingPeriod <
+ pMeasReq->measDuration.shortTermPeriod) ||
+ !pMeasReq->measDuration.shortChannelScanDuration ||
+ ((pMeasReq->measDuration.shortChannelScanDuration <
+ SYS_TICK_DUR_MS)) ||
+ !pMeasReq->measDuration.longChannelScanDuration ||
+ (pMeasReq->measDuration.longChannelScanDuration <
+ pMeasReq->measDuration.shortChannelScanDuration) ||
+ ((pMeasReq->measDuration.longChannelScanDuration <
+ SYS_TICK_DUR_MS)))
+
+
+#endif
+ {
+ limLog(pMac, LOGW,
+ FL("Received MEASUREMENT_REQ with invalid data\n"));
+
+ return eANI_BOOLEAN_FALSE;
+ }
+ else
+ return eANI_BOOLEAN_TRUE;
+
+} /*** end limIsSmeMeasurementReqValid() ***/
+
+
+/**
+ * limInitMeasResources()
+ *
+ *FUNCTION:
+ * This function is called by limProcessLmmMessages() upon
+ * receiving SME_MEASUREMENT_REQ. This function initializes
+ * resources required for making measurements like creating
+ * timers related to Measurement Request etc.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param None
+ * @return None
+ */
+
+inline static tSirRetStatus
+limInitMeasResources(tpAniSirGlobal pMac)
+{
+ tANI_U32 val;
+ tANI_U32 beaconInterval;
+
+
+ // Create Meas related timers only when
+ // periodic measurements are enabled
+ if (pMac->lim.gpLimMeasReq->measControl.periodicMeasEnabled)
+ {
+ val = SYS_MS_TO_TICKS(pMac->lim.gpLimMeasReq->measIndPeriod);
+ if (tx_timer_create(
+ &pMac->lim.gLimMeasParams.measurementIndTimer,
+ "Meas Ind TIMEOUT",
+ limTimerHandler,
+ SIR_LIM_MEASUREMENT_IND_TIMEOUT,
+ val,
+ val,
+ TX_NO_ACTIVATE) != TX_SUCCESS)
+ {
+ /// Could not create MeasInd timer.
+ // Log error
+ limLog(pMac, LOGP, FL("call to create MeasInd timer failed\n"));
+
+ return eSIR_SYS_TX_TIMER_CREATE_FAILED;
+ }
+ pMac->lim.gLimMeasParams.isMeasIndTimerActive = 0;
+ PELOG3(limLog(pMac, LOG3, FL("MeasurementIndication timer initialized, period = %d\n"),
+ pMac->lim.gpLimMeasReq->measIndPeriod);)
+
+#if defined(ANI_OS_TYPE_RTAI_LINUX)
+ tx_timer_set_expiry_list(
+ &pMac->lim.gLimMeasParams.measurementIndTimer,
+ LIM_TIMER_EXPIRY_LIST);
+#endif
+ }
+
+ tANI_U32 learnInterval =
+ pMac->lim.gpLimMeasReq->measDuration.shortTermPeriod /
+ pMac->lim.gpLimMeasReq->channelList.numChannels;
+ if (tx_timer_create(&pMac->lim.gLimMeasParams.learnIntervalTimer,
+ "Learn interval TIMEOUT",
+ limTimerHandler,
+ SIR_LIM_LEARN_INTERVAL_TIMEOUT,
+ SYS_MS_TO_TICKS(learnInterval),
+ 0,
+ TX_NO_ACTIVATE) != TX_SUCCESS)
+ {
+ /// Could not create learnInterval timer.
+ // Log error
+ limLog(pMac, LOGP, FL("call to create learnInterval timer failed\n"));
+
+ return eSIR_SYS_TX_TIMER_CREATE_FAILED;
+ }
+
+#if defined(ANI_OS_TYPE_RTAI_LINUX)
+ tx_timer_set_expiry_list(
+ &pMac->lim.gLimMeasParams.learnIntervalTimer,
+ LIM_TIMER_EXPIRY_LIST);
+#endif
+
+ val = SYS_MS_TO_TICKS(pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration);
+ if (tx_timer_create(
+ &pMac->lim.gLimMeasParams.learnDurationTimer,
+ "Learn duration TIMEOUT",
+ limTimerHandler,
+ SIR_LIM_LEARN_DURATION_TIMEOUT,
+ val,
+ 0,
+ TX_NO_ACTIVATE) != TX_SUCCESS)
+ {
+ /// Could not create LearnDuration timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to create LearnDuration timer failed\n"));
+
+ return eSIR_SYS_TX_TIMER_CREATE_FAILED;
+ }
+
+#if defined(ANI_OS_TYPE_RTAI_LINUX)
+ tx_timer_set_expiry_list(
+ &pMac->lim.gLimMeasParams.learnDurationTimer,
+ LIM_TIMER_EXPIRY_LIST);
+#endif
+
+ #if 0
+ if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &beaconInterval) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Can't read beacon interval\n"));
+ return eSIR_FAILURE;
+ }
+ #endif // TO SUPPORT BT-AMP
+
+ /* Copy the beacon interval from the sessio Id */
+ beaconInterval = psessionEntry->beaconParams.beaconInterval;
+
+ if ((learnInterval > ( 2 * beaconInterval)) &&
+ (pMac->lim.gLimSystemRole == eLIM_AP_ROLE))
+ {
+ //learinterval should be > 2 * beaconinterval
+ val = SYS_MS_TO_TICKS(learnInterval - (2 * beaconInterval));
+ // Create Quiet BSS Timer
+ if( TX_SUCCESS !=
+ tx_timer_create( &pMac->lim.limTimers.gLimQuietBssTimer,
+ "QUIET BSS TIMER",
+ limQuietBssTimerHandler,
+ SIR_LIM_QUIET_BSS_TIMEOUT,
+ val, // initial_ticks
+ 0, // reschedule_ticks
+ TX_NO_ACTIVATE ))
+ {
+ limLog( pMac, LOGP,
+ FL( "Failed to create gLimQuietBssTimer!\n" ));
+ return eSIR_SYS_TX_TIMER_CREATE_FAILED;
+ }
+
+#if defined(ANI_OS_TYPE_RTAI_LINUX)
+ tx_timer_set_expiry_list(
+ &pMac->lim.limTimers.gLimQuietBssTimer,
+ LIM_TIMER_EXPIRY_LIST );
+#endif
+ pMac->lim.gLimSpecMgmt.fQuietEnabled = eANI_BOOLEAN_TRUE;
+ }
+
+ pMac->lim.gLimMeasParams.shortDurationCount = 0;
+ pMac->lim.gLimMeasParams.nextLearnChannelId = 0;
+
+ pMac->lim.gLimMeasParams.rssiAlpha =
+ (100 * pMac->lim.gpLimMeasReq->measDuration.shortTermPeriod) /
+ pMac->lim.gpLimMeasReq->measDuration.averagingPeriod;
+
+ if (!pMac->lim.gLimMeasParams.rssiAlpha)
+ pMac->lim.gLimMeasParams.rssiAlpha = 1;
+
+ pMac->lim.gLimMeasParams.chanUtilAlpha =
+ (100 * learnInterval) / pMac->lim.gpLimMeasReq->measIndPeriod;
+
+ if (!pMac->lim.gLimMeasParams.chanUtilAlpha)
+ pMac->lim.gLimMeasParams.chanUtilAlpha = 1;
+
+ return eSIR_SUCCESS;
+} /*** end limInitMeasResources() ***/
+
+
+/**-----------------------------------------------
+\fn __limFreeMeasAndSendRsp
+\brief Free the meas related resources and send
+ response to SME.
+\param pMac
+\param resultCode
+\return None
+ ------------------------------------------------*/
+static void
+__limFreeMeasAndSendRsp(tpAniSirGlobal pMac, tSirResultCodes resultCode)
+{
+ if (pMac->lim.gpLimMeasReq != NULL)
+ {
+ palFreeMemory( pMac->hHdd, pMac->lim.gpLimMeasReq);
+ pMac->lim.gpLimMeasReq = NULL;
+ }
+
+ if (pMac->lim.gpLimMeasData != NULL)
+ {
+ palFreeMemory( pMac->hHdd, pMac->lim.gpLimMeasData);
+ pMac->lim.gpLimMeasData = NULL;
+ }
+
+ /// Send failure response to WSM
+ limSendSmeRsp(pMac, eWNI_SME_MEASUREMENT_RSP, resultCode);
+}
+
+/**
+ * limProcessSmeMeasurementReq()
+ *
+ *FUNCTION:
+ * This function is called by limProcessLmmMessages() upon
+ * receiving SME_MEASUREMENT_REQ from WSM.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the SME message buffer
+ *
+ * @return None
+ */
+
+static void
+limProcessSmeMeasurementReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ PELOG1(limLog(pMac, LOG1, FL("SME State = %d\n"), pMac->lim.gLimSmeState);)
+ switch (pMac->lim.gLimSmeState)
+ {
+ case eLIM_SME_OFFLINE_STATE:
+ case eLIM_SME_IDLE_STATE:
+ case eLIM_SME_JOIN_FAILURE_STATE:
+ case eLIM_SME_NORMAL_STATE:
+ case eLIM_SME_LINK_EST_STATE:
+ case eLIM_SME_CHANNEL_SCAN_STATE:
+ case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
+ break;
+
+ default:
+ limLog(pMac, LOGE,
+ FL("Received unexpected MeasReq message in state %X\n"),
+ pMac->lim.gLimSmeState);
+
+ /// Send failure response to host
+ limSendSmeRsp(
+ pMac,
+ eWNI_SME_MEASUREMENT_RSP,
+ eSIR_SME_UNEXPECTED_REQ_RESULT_CODE);
+ return;
+ } // end switch (pMac->lim.gLimSmeState)
+
+ if (pMac->lim.gpLimMeasReq)
+ {
+ // There was a previous measurement req issued.
+ // Cleanup resources allocated for that request.
+ limDeleteMeasTimers(pMac);
+ limCleanupMeasData(pMac);
+ }
+ else
+ {
+ // There was no previous measurement req issued.
+ // Allocate memory required to hold measurements.
+ if (eHAL_STATUS_SUCCESS !=
+ palAllocateMemory(pMac->hHdd,
+ (void **)&pMac->lim.gpLimMeasData,
+ sizeof(tLimMeasData)))
+ {
+ // Log error
+ limLog(pMac, LOGE,
+ FL("memory allocate failed for MeasData\n"));
+
+ /// Send failure response to host
+ limSendSmeRsp(pMac, eWNI_SME_MEASUREMENT_RSP,
+ eSIR_SME_RESOURCES_UNAVAILABLE);
+ return;
+ }
+
+ palZeroMemory(pMac->hHdd, (void *)pMac->lim.gpLimMeasData,
+ sizeof(tLimMeasData));
+ pMac->lim.gpLimMeasData->duration = 120;
+ }
+
+ if (eHAL_STATUS_SUCCESS !=
+ palAllocateMemory(pMac->hHdd,
+ (void **)&pMac->lim.gpLimMeasReq,
+ (sizeof(tSirSmeMeasurementReq) +
+ SIR_MAX_NUM_CHANNELS)))
+ {
+ // Log error
+ PELOGE(limLog(pMac, LOGE, FL("memory allocate failed for MeasReq\n"));)
+
+ __limFreeMeasAndSendRsp(pMac, eSIR_SME_RESOURCES_UNAVAILABLE);
+ return;
+ }
+
+ if ((limMeasurementReqSerDes(
+ pMac,
+ pMac->lim.gpLimMeasReq,
+ (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
+ !limIsSmeMeasurementReqValid(pMac,pMac->lim.gpLimMeasReq))
+ {
+ limLog(pMac, LOGE,
+ FL("Rx'ed MeasReq message with invalid parameters\n"));
+
+ __limFreeMeasAndSendRsp(pMac, eSIR_SME_INVALID_PARAMETERS);
+ return;
+ }
+#ifdef ANI_AP_SDK
+ /* convert from mS to TU and TICKS */
+ limConvertScanDuration(pMac);
+#endif /* ANI_AP_SDK */
+
+ // Initialize Measurement related resources
+ if (limInitMeasResources(pMac) != eSIR_SUCCESS)
+ {
+ __limFreeMeasAndSendRsp(pMac, eSIR_SME_RESOURCES_UNAVAILABLE);
+ return;
+ }
+
+ PELOG3(limLog(pMac, LOG3,
+ FL("NumChannels=%d, shortDuration=%d, shortInterval=%d, longInterval=%d\n"),
+ pMac->lim.gpLimMeasReq->channelList.numChannels,
+ pMac->lim.gpLimMeasReq->measDuration.shortTermPeriod,
+ pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration,
+ pMac->lim.gpLimMeasReq->measDuration.longChannelScanDuration);)
+
+ limRadarInit(pMac);
+
+ /**
+ * Start Learn interval timer so that
+ * measurements are made from that
+ * timeout onwards.
+ */
+ limReEnableLearnMode(pMac);
+
+ /// All is well with MeasReq. Send response to WSM
+ limSendSmeRsp(pMac, eWNI_SME_MEASUREMENT_RSP,
+ eSIR_SME_SUCCESS);
+ PELOG2(limLog(pMac, LOG2, FL("Sending succes response to SME\n"));)
+
+ if (pMac->lim.gpLimMeasReq->channelList.numChannels == 1)
+ limLog(pMac, LOGE, FL("Starting Channel Availability Check on Channel %d... Wait\n"),
+ *pMac->lim.gpLimMeasReq->channelList.channelNumber);
+} /*** end limProcessSmeMeasurementReq() ***/
+
+
+/**
+ * limProcessSmeSetWdsInfoReq()
+ *
+ *FUNCTION:
+ * This function is called by limProcessLmmMessages() upon
+ * receiving SME_SET_WDS_INFO_REQ from WSM.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the SME message buffer
+ *
+ * @return None
+ */
+
+static void
+limProcessSmeSetWdsInfoReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tANI_U16 i;
+ tSirSmeSetWdsInfoReq wdsInfoReq;
+
+ pMac->lim.gLimNumWdsInfoSet++;
+
+ switch (pMac->lim.gLimSmeState)
+ {
+ case eLIM_SME_NORMAL_STATE:
+ break;
+
+ default:
+ limLog(pMac, LOGE,
+ FL("Rx'ed unexp SetWdsInfoReq message in state %X\n"),
+ pMac->lim.gLimSmeState);
+
+ /// Send failure response to host
+ limSendSmeRsp(
+ pMac,
+ eWNI_SME_SET_WDS_INFO_RSP,
+ eSIR_SME_UNEXPECTED_REQ_RESULT_CODE);
+ return;
+ } // end switch (pMac->lim.gLimSmeState)
+
+ if ((limWdsReqSerDes( pMac,
+ &wdsInfoReq,
+ (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
+ {
+ limLog(pMac, LOGW,
+ FL("Rx'ed SetWdsInfoReq message with invalid parameters\n"));
+
+ /// Send failure response to WSM
+ limSendSmeRsp(pMac, eWNI_SME_SET_WDS_INFO_RSP,
+ eSIR_SME_INVALID_PARAMETERS);
+
+ return;
+ }
+
+ // check whether the WDS info is the same as current
+ if ((wdsInfoReq.wdsInfo.wdsLength ==
+ psessionEntry->pLimStartBssReq->wdsInfo.wdsLength) &&
+ (palEqualMemory( pMac->hHdd,wdsInfoReq.wdsInfo.wdsBytes,
+ psessionEntry->pLimStartBssReq->wdsInfo.wdsBytes,
+ psessionEntry->pLimStartBssReq->wdsInfo.wdsLength) ) )
+ {
+ /// Send success response to WSM
+ limSendSmeRsp(pMac,
+ eWNI_SME_SET_WDS_INFO_RSP,
+ eSIR_SME_SUCCESS);
+
+ return;
+ }
+
+ // copy WDS info
+ psessionEntry->pLimStartBssReq->wdsInfo.wdsLength =
+ wdsInfoReq.wdsInfo.wdsLength;
+ for (i=0; i<wdsInfoReq.wdsInfo.wdsLength; i++)
+ psessionEntry->pLimStartBssReq->wdsInfo.wdsBytes[i] =
+ wdsInfoReq.wdsInfo.wdsBytes[i];
+
+ schSetFixedBeaconFields(pMac,psessionEntry);
+
+ /// Send success response to WSM
+ limSendSmeRsp(pMac, eWNI_SME_SET_WDS_INFO_RSP,
+ eSIR_SME_SUCCESS);
+
+} /*** end limProcessSmeMeasurementReq() ***/
+
+
+/**
+ * limProcessLearnDurationTimeout()
+ *
+ *FUNCTION:
+ * This function is called by limProcessLmmMessages() upon
+ * receiving LEARN_DURATION_TIMEOUT.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the SME message buffer
+ *
+ * @return None
+ */
+
+static void
+limProcessLearnDurationTimeout(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ if ( pMac->lim.gLimHalScanState == eLIM_HAL_IDLE_SCAN_STATE)
+ {
+ limSendHalInitScanReq(pMac, eLIM_HAL_INIT_LEARN_WAIT_STATE, eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN );
+ return;
+ }
+
+ // Current learn duration expired.
+ if (pMac->lim.gLimMeasParams.nextLearnChannelId ==
+ pMac->lim.gpLimMeasReq->channelList.numChannels - 1)
+ {
+ //Set the resume channel to Any valid channel (invalid).
+ //This will instruct HAL to set it to any previous valid channel.
+ peSetResumeChannel(pMac, 0, 0);
+ // Send WDA_END_SCAN_REQ to HAL first
+ limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
+ }
+ else
+ {
+ pMac->lim.gLimMeasParams.nextLearnChannelId++;
+
+ if (pMac->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE)
+ {
+ // LIM did not take AP/BP role yet.
+ // So continue Learn process on remaining channels
+ // Send WDA_END_SCAN_REQ to HAL first
+ limSendHalEndScanReq(pMac, (tANI_U8)pMac->lim.gLimMeasParams.nextLearnChannelId,
+ eLIM_HAL_END_LEARN_WAIT_STATE);
+ }
+ else
+ {
+ //Set the resume channel to Any valid channel (invalid).
+ //This will instruct HAL to set it to any previous valid channel.
+ peSetResumeChannel(pMac, 0, 0);
+ // Send WDA_FINISH_SCAN_REQ to HAL first
+ limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
+ }
+ }
+} /*** end limProcessLearnDurationTimeout() ***/
+
+/**
+ * limProcessLearnIntervalTimeout()
+ *
+ *FUNCTION:
+ * This function is called whenever
+ * SIR_LIM_LEARN_INTERVAL_TIMEOUT message is receive.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ *
+ * @return None
+ */
+
+void
+limProcessLearnIntervalTimeout(tpAniSirGlobal pMac)
+{
+
+#ifdef GEN6_TODO
+ //fetch the sessionEntry based on the sessionId
+ //priority - MEDIUM
+ tpPESession sessionEntry;
+
+ if((sessionEntry = peFindSessionBySessionId(pMac, pMac->lim.gLimMeasParams.learnIntervalTimer.sessionId))== NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+#endif
+
+ PELOG2(limLog(pMac, LOG2, FL("SME state = %d\n"), pMac->lim.gLimSmeState);)
+ if (!pMac->sys.gSysEnableLearnMode)
+ {
+ PELOG3(limLog(pMac, LOG3,
+ FL("Ignoring LEARN_INTERVAL_TIMEOUT because gSysEnableLearnMode is disabled...\n"));)
+ limReEnableLearnMode(pMac);
+ return;
+ }
+
+ if (pMac->lim.gLimSystemInScanLearnMode)
+ {
+ limLog(pMac, LOGE,
+ FL("Sending START_SCAN from LIM while one req is pending\n"));
+ return;
+ }
+
+ pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
+ if ((pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) ||
+ (pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) ||
+ (pMac->lim.gLimSmeState == eLIM_SME_JOIN_FAILURE_STATE))
+ pMac->lim.gLimSmeState = eLIM_SME_CHANNEL_SCAN_STATE;
+ else if (pMac->lim.gLimSmeState == eLIM_SME_NORMAL_STATE)
+ pMac->lim.gLimSmeState = eLIM_SME_NORMAL_CHANNEL_SCAN_STATE;
+ else if (pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_STATE)
+ pMac->lim.gLimSmeState = eLIM_SME_LINK_EST_WT_SCAN_STATE;
+ else
+ return;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+
+ /* The commented piece of code here is to handle the Measurement Request from WSM as Scan
+ * request in the LIM in Linux Station. Currently, the station uses Measurement request to
+ * get the scan list. If measurement request itself is used for station also while scanning, this
+ * code can be removed. If we need to handle the measurement request as scan request, we need to
+ * implement the below commented code in a more cleaner way(handling the SCAN_CNF, memory freeing, etc)
+ */
+// if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
+ {
+ pMac->lim.gLimPrevMlmState = pMac->lim.gLimMlmState;
+ pMac->lim.gLimMlmState = eLIM_MLM_LEARN_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+ pMac->lim.gLimSystemInScanLearnMode = eANI_BOOLEAN_TRUE;
+ }
+#if 0
+ /**
+ * start the timer to enter into Learn mode
+ */
+ if (pMac->lim.gLimSystemRole == eLIM_STA_ROLE)
+ {
+ tLimMlmScanReq *pMlmScanReq;
+ tANI_U32 len;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmScanReq,
+ (sizeof(tLimMlmScanReq) + WNI_CFG_VALID_CHANNEL_LIST_LEN)))
+ {
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for mlmScanReq\n"));
+ return;
+ }
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pMlmScanReq,
+ (tANI_U32)(sizeof(tLimMlmScanReq) + WNI_CFG_VALID_CHANNEL_LIST_LEN ));
+
+ len = WNI_CFG_VALID_CHANNEL_LIST_LEN;
+ if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
+ pMlmScanReq->channelList.channelNumber,
+ &len) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP,
+ FL("could not retrieve Valid channel list\n"));
+ }
+ pMlmScanReq->channelList.numChannels = (tANI_U8) len;
+
+ palFillMemory(pMac->hHdd, &pMlmScanReq->bssId, sizeof(tSirMacAddr), 0xff);
+ pMlmScanReq->bssType = eSIR_AUTO_MODE;
+ pMlmScanReq->scanType = eSIR_ACTIVE_SCAN;
+ pMlmScanReq->backgroundScanMode = 0;
+ pMlmScanReq->maxChannelTime = 40;
+ pMlmScanReq->minChannelTime = 20;
+ limPostMlmMessage(pMac, LIM_MLM_SCAN_REQ, (tANI_U32 *) pMlmScanReq);
+ }
+ else
+#endif
+ limSetLearnMode(pMac);
+}
+
+
+/**
+ * limProcessLmmMessages()
+ *
+ *FUNCTION:
+ * This function is called by limProcessMessageQueue(). This
+ * function processes SME messages from WSM and MLM cnf/ind
+ * messages from MLM module.
+ *
+ *LOGIC:
+ * Depending on the message type, corresponding function will be
+ * called.
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param msgType Indicates the SME message type
+ * @param *pMsgBuf A pointer to the SME message buffer
+ *
+ * @return None
+ */
+
+void
+limProcessLmmMessages(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
+{
+ switch (msgType)
+ {
+ case eWNI_SME_MEASUREMENT_REQ:
+ PELOG1(limLog(pMac, LOG1, FL("Received MEASUREMENT_REQ message\n"));)
+ limProcessSmeMeasurementReq(pMac, pMsgBuf);
+
+ break;
+
+ case eWNI_SME_SET_WDS_INFO_REQ:
+
+ limProcessSmeSetWdsInfoReq(pMac, pMsgBuf);
+
+ break;
+
+ case SIR_LIM_MEASUREMENT_IND_TIMEOUT:
+ // Time to send Measurement Indication to WSM
+ limSendSmeMeasurementInd(pMac);
+
+ break;
+
+ case SIR_LIM_LEARN_INTERVAL_TIMEOUT:
+ limProcessLearnIntervalTimeout(pMac);
+ break;
+
+ case SIR_LIM_LEARN_DURATION_TIMEOUT:
+ limProcessLearnDurationTimeout(pMac, pMsgBuf);
+
+ break;
+
+ default:
+
+ break;
+ } // switch (msgType)
+
+ return;
+} /*** end limProcessLmmMessages() ***/
+
+#endif
diff --git a/CORE/MAC/src/pe/lim/limProcessMessageQueue.c b/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
new file mode 100644
index 0000000..a0d3ca7
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
@@ -0,0 +1,2185 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file lim ProcessMessageQueue.cc contains the code
+ * for processing LIM message Queue.
+ * Author: Chandra Modumudi
+ * Date: 02/11/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+#include "palTypes.h"
+#include "wniApi.h"
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halDataStruct.h"
+#include "halCommonApi.h"
+#elif defined FEATURE_WLAN_INTEGRATED_SOC
+#include "wlan_qct_wdi_ds.h"
+#include "wlan_qct_pal_packet.h"
+#include "wlan_qct_wda.h"
+#endif
+
+#ifdef ANI_PRODUCT_TYPE_AP
+#include "wniCfgAp.h"
+#else
+#include "wniCfgSta.h"
+#endif
+#include "cfgApi.h"
+#include "sirCommon.h"
+#include "utilsApi.h"
+#include "limTypes.h"
+#include "limUtils.h"
+#include "limAssocUtils.h"
+#include "limPropExtsUtils.h"
+
+#include "limAdmitControl.h"
+#include "pmmApi.h"
+#include "limIbssPeerMgmt.h"
+#include "schApi.h"
+#include "limSession.h"
+
+#if defined WLAN_FEATURE_VOWIFI
+#include "rrmApi.h"
+#endif
+#if defined FEATURE_WLAN_CCX
+#include "ccxApi.h"
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+#include "limFT.h"
+#endif
+
+#ifdef WMM_APSD
+#include "wmmApsd.h"
+#endif
+
+#ifdef VOSS_ENABLED
+#include "vos_types.h"
+#include "vos_packet.h"
+#include "vos_memory.h"
+#endif
+
+void limLogSessionStates(tpAniSirGlobal pMac);
+
+/** -------------------------------------------------------------
+\fn defMsgDecision
+\brief The function decides whether to defer a message or not in limProcessMessage function
+\param tpAniSirGlobal pMac
+\param tSirMsgQ limMsg
+\param tSirMacTspecIE *ppInfo
+\return none
+ -------------------------------------------------------------*/
+
+tANI_U8 static
+defMsgDecision(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
+{
+
+
+/* this function should not changed */
+ if((pMac->lim.gLimSmeState == eLIM_SME_SUSPEND_STATE) &&
+ (limMsg->type != SIR_LIM_RESUME_ACTIVITY_NTF))
+ {
+ // Defer processsing this message
+ if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Unable to Defer message(0x%X) %s limSmeState %d (prev sme state %d) sysRole %d mlm state %d (prev mlm state %d)\n"),
+ limMsg->type, limMsgStr(limMsg->type), pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
+ pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
+ limLogSessionStates(pMac);
+ limHandleDeferMsgError(pMac, limMsg);
+ }
+ return true;
+ }
+
+ //When defer is requested then defer all the messages except HAL responses.
+ if((!limIsSystemInScanState(pMac)) && (true != GET_LIM_PROCESS_DEFD_MESGS(pMac)) &&
+ !pMac->lim.gLimSystemInScanLearnMode)
+ {
+ if((limMsg->type != WDA_ADD_BSS_RSP) &&
+ (limMsg->type != WDA_DELETE_BSS_RSP) &&
+ (limMsg->type != WDA_ADD_STA_RSP) &&
+ (limMsg->type != WDA_ADD_STA_SELF_RSP) &&
+ (limMsg->type != WDA_DEL_STA_SELF_RSP) &&
+ (limMsg->type != WDA_DELETE_STA_RSP)&&
+ (limMsg->type != WDA_SET_BSSKEY_RSP)&&
+ (limMsg->type != WDA_SET_STAKEY_RSP)&&
+ (limMsg->type != WDA_SET_STA_BCASTKEY_RSP) &&
+ (limMsg->type != SIR_LIM_RESUME_ACTIVITY_NTF)&&
+ (limMsg->type != eWNI_SME_START_REQ) &&
+ (limMsg->type != WDA_AGGR_QOS_RSP) &&
+ (limMsg->type != WDA_REMOVE_BSSKEY_RSP) &&
+ (limMsg->type != WDA_REMOVE_STAKEY_RSP) &&
+ (limMsg->type != WDA_SET_MIMOPS_RSP)&&
+ (limMsg->type != WDA_ADDBA_RSP) &&
+ (limMsg->type != WDA_ENTER_BMPS_RSP) &&
+ (limMsg->type != WDA_EXIT_BMPS_RSP) &&
+ (limMsg->type != WDA_ENTER_IMPS_RSP) &&
+ (limMsg->type != WDA_EXIT_IMPS_RSP) &&
+ (limMsg->type != WDA_ENTER_UAPSD_RSP) &&
+ (limMsg->type != WDA_EXIT_UAPSD_RSP) &&
+ (limMsg->type != WDA_WOWL_ENTER_RSP) &&
+ (limMsg->type != WDA_WOWL_EXIT_RSP) &&
+ (limMsg->type != WDA_SWITCH_CHANNEL_RSP) &&
+#ifdef WLAN_FEATURE_P2P
+ (limMsg->type != WDA_P2P_NOA_ATTR_IND) &&
+#endif
+ (limMsg->type != WDA_ADD_TS_RSP))
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Defer the current message %s , gLimProcessDefdMsgs is false and system is not in scan/learn mode\n"),
+ limMsgStr(limMsg->type));)
+
+ // Defer processsing this message
+ if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Unable to Defer message(0x%X) %s limSmeState %d (prev sme state %d) sysRole %d mlm state %d (prev mlm state %d)\n"),
+ limMsg->type, limMsgStr(limMsg->type), pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
+ pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
+ limLogSessionStates(pMac);
+ limHandleDeferMsgError(pMac, limMsg);
+
+ }
+ return true;
+ }
+ }
+ return false;
+}
+
+/*
+* Beacon Handling Cases:
+* during scanning, when no session is active:
+* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
+* during scanning, when any session is active, but beacon/Pr does not belong to that session, psessionEntry will be null.
+* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
+* during scanning, when any session is active, and beacon/Pr belongs to one of the session, psessionEntry will not be null.
+* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
+* Not scanning, no session:
+* there should not be any beacon coming, if coming, should be dropped.
+* Not Scanning,
+*/
+static void
+__limHandleBeacon(tpAniSirGlobal pMac, tpSirMsgQ pMsg, tpPESession psessionEntry)
+{
+ /* checking for global SME state...*/
+ tANI_U8 *pRxPacketInfo;
+ limGetBDfromRxPacket(pMac, pMsg->bodyptr, (tANI_U32 **)&pRxPacketInfo);
+
+ //This function should not be called if beacon is received in scan state.
+ //So not doing any checks for the global state.
+
+ if(psessionEntry == NULL)
+ {
+ schBeaconProcess(pMac, pRxPacketInfo, NULL);
+ }
+ else if( (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE) ||
+ (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE))
+ {
+ schBeaconProcess(pMac, pRxPacketInfo, psessionEntry);
+ }
+ else
+ limProcessBeaconFrame(pMac, pRxPacketInfo, psessionEntry);
+
+ return;
+}
+
+
+//Fucntion prototype
+void limProcessNormalHddMsg(tpAniSirGlobal pMac, tSirMsgQ *pLimMsg, tANI_U8 fRspReqd);
+
+/**
+ * limProcessMessageQueue
+ *
+ *FUNCTION:
+ * This function is called by LIM thread entry function. This
+ * function fetches messages posted to the message queue
+ * limMsgQ.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limProcessMessageQueue(tpAniSirGlobal pMac)
+{
+ tSirMsgQ limMsg = { 0, 0, 0 };
+
+ if(pMac->gDriverType == eDRIVER_TYPE_MFG)
+ {
+ return;
+ }
+
+#if defined(ANI_OS_TYPE_RTAI_LINUX)
+ ULONG param;
+ while(get_timer_event(LIM_TIMER_EXPIRY_LIST,¶m))
+ {
+ limMsg.type = (tANI_U16) param;
+ limMsg.bodyval = 0;
+ limMsg.bodyptr = NULL;
+ limMessageProcessor(pMac, &limMsg);
+ }
+#endif
+
+ if (tx_queue_receive( &pMac->sys.gSirLimMsgQ, (void *) &limMsg, TX_WAIT_FOREVER)
+ == TX_SUCCESS)
+ {
+ PELOG3(limLog(pMac, LOG3, FL("LIM Received message %s\n"), limMsgStr(limMsg.type));)
+ limPrintMsgInfo(pMac, LOG3, &limMsg);
+ limMessageProcessor(pMac, &limMsg);
+ } // if (tx_queue_receive)
+
+} /*** end limProcessMessageQueue() ***/
+
+
+
+/**
+ * limDeferMsg()
+ *
+ *FUNCTION:
+ * This function is called to defer the messages received
+ * during Learn mode
+ *
+ *LOGIC:
+ * NA
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pMsg of type tSirMsgQ - Pointer to the message structure
+ * @return None
+ */
+
+tANI_U32
+limDeferMsg(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
+{
+ tANI_U32 retCode = TX_SUCCESS;
+#if defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_OSX)
+ PELOG3(limLog(pMac, LOG3, FL("Deferring message %X in Learn mode\n"),
+ pMsg->type);
+ limPrintMsgName(pMac, LOG3, pMsg->type);)
+ retCode = tx_queue_send(&pMac->sys.gSirLimDeferredMsgQ,
+ pMsg,
+ TX_NO_WAIT);
+ if (retCode == TX_SUCCESS)
+ pMac->lim.gLimNumDeferredMsgs++;
+#else
+
+ retCode = limWriteDeferredMsgQ(pMac, pMsg);
+
+#endif
+ if(retCode == TX_SUCCESS)
+ {
+ MTRACE(macTraceMsgRx(pMac, 0, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DEFERRED));)
+ }
+ else
+ {
+ MTRACE(macTraceMsgRx(pMac, 0, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DROPPED));)
+ }
+
+
+ return retCode;
+} /*** end limDeferMsg() ***/
+
+
+
+/**
+ * limHandleFramesInScanState()
+ *
+ *FUNCTION:
+ * This function is called to process 802.11 frames
+ * received by LIM in scan state.
+ *
+ *LOGIC:
+ * NA
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param limMsg - Received message
+ * @param pRxPacketInfo - Pointer to Rx packet info structure
+ * @param deferMsg - Indicates whether the frame shall be deferred
+ * @return None
+ */
+
+static void
+limHandleFramesInScanState(tpAniSirGlobal pMac, tpSirMsgQ limMsg, tANI_U8 *pRxPacketInfo, tANI_U8 *deferMsg, tpPESession psessionEntry)
+{
+ tSirMacFrameCtl fc;
+ tpSirMacMgmtHdr pHdr;
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+ tANI_U32 ignore = 0;
+ tSirMacAddr bssIdRcv;
+#endif
+
+ *deferMsg = false;
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+ fc = pHdr->fc;
+ limLog( pMac, LOG2, FL("ProtVersion %d, Type %d, Subtype %d\n"),
+ fc.protVer, fc.type, fc.subType );
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+ // System is in DFS (Learn) mode
+ pMac->lim.numLearn++;
+
+ // Process all BDs and extract PHY stats
+ limGetBssidFromBD(pMac, (tpHalBufDesc) pRxPacketInfo, bssIdRcv, &ignore);
+
+ if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
+ palEqualMemory( pMac->hHdd,bssIdRcv, psessionEntry->bssId, sizeof(tSirMacAddr)))
+ {
+ /**
+ * Frame from current BSS. Defer processing of
+ * Disassociation/Deauthentication from
+ * STAs that are currently associated.
+ * Collect stats for other received frames.
+ */
+ if ((fc.subType == SIR_MAC_MGMT_DISASSOC) ||
+ (fc.subType == SIR_MAC_MGMT_DEAUTH))
+ {
+ if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Unable to Defer message(0x%X) limSmeState %d (prev sme state %d) sysRole %d mlm state %d (prev mlm state %d)\n"),
+ limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
+ pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
+ limLogSessionStates(pMac);
+ limPrintMsgName(pMac, LOGE, limMsg->type);
+ limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, NULL, limMsg->bodyptr);
+ }
+ return;
+ }
+ pMac->lim.numLearnIgnore++;
+ }
+ else
+ {
+ // Frame received from other BSS
+ if (fc.type == SIR_MAC_DATA_FRAME && psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ {
+ /**
+ * Data Frame from neighbor BSS.
+ * Extract neighbor BSS info as much as possible.
+ */
+ limCollectMeasurementData(pMac, pRxPacketInfo, NULL);
+ }
+ else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_BEACON))
+ {
+ if (psessionEntry == NULL)
+ limProcessBeaconFrameNoSession(pMac, pRxPacketInfo);
+ else
+ limProcessBeaconFrame(pMac, pRxPacketInfo,psessionEntry);
+ }
+ else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_PROBE_RSP))
+ {
+ if (psessionEntry == NULL)
+ limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
+ else
+ limProcessProbeRspFrame(pMac, pRxPacketInfo,psessionEntry);
+ }
+ }
+
+#else
+ // defer all message in scan state except for Beacons and Probe Response
+ if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_BEACON))
+ {
+ if (psessionEntry == NULL)
+ limProcessBeaconFrameNoSession(pMac, pRxPacketInfo);
+ else
+ limProcessBeaconFrame(pMac, pRxPacketInfo,psessionEntry);
+ }
+ else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_PROBE_RSP))
+ {
+ if (psessionEntry == NULL)
+ limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
+ else
+ limProcessProbeRspFrame(pMac, pRxPacketInfo,psessionEntry);
+ }
+ else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_PROBE_REQ))
+ {
+ limProcessProbeReqFrame_multiple_BSS(pMac, pRxPacketInfo, psessionEntry);
+ }
+#if defined WLAN_FEATURE_P2P
+ else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_ACTION))
+ {
+ limProcessActionFrameNoSession( pMac, pRxPacketInfo);
+ }
+#endif
+ else
+ {
+ *deferMsg = true;
+ return;
+ }
+
+#endif
+ limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
+ return;
+
+} /*** end limHandleFramesInScanState() ***/
+
+/** ------------------------------------------------------------
+\brief This function handles Unknown Unicast (A2 Index)
+\ packets.
+\param tpAniSirGlobal pMac Global Mac data structure
+\param void *pRxPacketInfo Pointer to Buffer Descriptor
+\return none
+\
+\ -------------------------------------------------------------- */
+static void limHandleUnknownA2IndexFrames(tpAniSirGlobal pMac, void *pRxPacketInfo,tpPESession psessionEntry)
+{
+#ifndef ANI_CHIPSET_VOLANS
+ tpSirMacDataHdr3a pMacHdr;
+
+ /** This prevents from disassoc/deauth being sent in a burst,
+ and gLimDisassocFrameCredit is reset for every 10 seconds.*/
+ if (pMac->lim.gLimDisassocFrameCredit > pMac->lim.gLimDisassocFrameThreshold)
+ return;
+
+ pMac->lim.gLimDisassocFrameCredit++;
+
+ pMacHdr = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
+
+ if (limIsGroupAddr(pMacHdr->addr2))
+ {
+ PELOG2(limLog(pMac, LOG2, FL("Ignoring A2 Invalid Packet received for MC/BC:\n"));
+ limPrintMacAddr(pMac, pMacHdr->addr2, LOG2);)
+
+ return;
+ }
+
+ if (((psessionEntry->limSystemRole == eLIM_AP_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )&&
+ (psessionEntry->limMlmState == eLIM_MLM_BSS_STARTED_STATE))
+ {
+ switch (pMacHdr->fc.type)
+ {
+ case SIR_MAC_MGMT_FRAME:
+ switch (pMacHdr->fc.subType)
+ {
+ case SIR_MAC_MGMT_ACTION:
+ // Send Disassociation frame to
+ // sender if role is AP
+ PELOG1(limLog(pMac, LOG1, FL("Send Disassoc Frame due to Invalid Addr2 packet"));
+ limPrintMacAddr(pMac, pMacHdr->addr2, LOG1);)
+ limSendDisassocMgmtFrame(pMac,
+ eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON, pMacHdr->addr2,psessionEntry);
+ break;
+
+ default:
+ break;
+
+ }
+ break;
+
+ case SIR_MAC_CTRL_FRAME:
+ switch (pMacHdr->fc.subType)
+ {
+ case SIR_MAC_CTRL_PS_POLL:
+ case SIR_MAC_CTRL_BAR:
+ // Send Disassociation frame to
+ // sender if role is AP
+ PELOG1(limLog(pMac, LOG1, FL("Send Disassoc Frame due to Invalid Addr2 packet"));
+ limPrintMacAddr(pMac, pMacHdr->addr2, LOG1);)
+ limSendDisassocMgmtFrame(pMac,
+ eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON, pMacHdr->addr2,psessionEntry);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case SIR_MAC_DATA_FRAME:
+ switch (pMacHdr->fc.subType)
+ {
+ case SIR_MAC_DATA_NULL:
+ case SIR_MAC_DATA_QOS_NULL:
+ // Send Disassociation frame to
+ // sender if role is AP
+ PELOG1(limLog(pMac, LOG1, FL("Send Disassoc Frame due to Invalid Addr2 packet"));
+ limPrintMacAddr(pMac, pMacHdr->addr2, LOG1);)
+ limSendDisassocMgmtFrame(pMac,
+ eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON, pMacHdr->addr2,psessionEntry);
+ break;
+
+ default:
+ // Send Deauthentication frame to
+ // sender if role is AP
+ PELOG1(limLog(pMac, LOG1, FL("Sending Deauth frame due to Invalid Addr2 packet"));
+ limPrintMacAddr(pMac, pMacHdr->addr2, LOG1);)
+ limSendDeauthMgmtFrame(pMac,
+ eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON, pMacHdr->addr2,psessionEntry);
+ break;
+ }
+ break;
+ }
+ }
+#else
+ /* addr2 mismatch interrupt occurred this means previous
+ disassociation was not successful
+ In Volans pRxPacketInfo only contains pointer 48-bit address2 field */
+ /*Send disassociation message again*/
+ //Dinesh need one more arguement.
+ //limSendDisassocMgmtFrame(pMac, eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON,(tANI_U8 *) pRxPacketInfo);
+#if defined WLAN_FEATURE_P2P
+ //This could be a public action frame.
+ if( psessionEntry->limSystemRole == eLIM_P2P_DEVICE_ROLE )
+ limProcessActionFrameNoSession(pMac, (tANI_U8 *) pRxPacketInfo);
+#endif
+#endif
+
+ return;
+}
+
+#ifdef WLAN_FEATURE_P2P
+/**
+ * limCheckMgmtRegisteredFrames()
+ *
+ *FUNCTION:
+ * This function is called to process to check if received frame match with
+ * any of the registered frame from HDD. If yes pass this frame to SME.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pBd Pointer to the received Buffer Descriptor+payload
+ * @param *psessionEntry Pointer to session on which packet is received
+ * @return None
+ */
+static tANI_BOOLEAN
+limCheckMgmtRegisteredFrames(tpAniSirGlobal pMac, tANI_U8 *pBd,
+ tpPESession psessionEntry)
+{
+ tSirMacFrameCtl fc;
+ tpSirMacMgmtHdr pHdr;
+ tANI_U8 *pBody;
+ tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
+ tANI_U16 frameType;
+ tANI_U16 framelen;
+ tANI_U8 type,subType;
+ tANI_BOOLEAN match = VOS_FALSE;
+ VOS_STATUS vosStatus;
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pBd);
+ fc = pHdr->fc;
+ frameType = (fc.type << 2 ) | (fc.subType << 4);
+ pBody = WDA_GET_RX_MPDU_DATA(pBd);
+ framelen = WDA_GET_RX_PAYLOAD_LEN(pBd);
+
+ vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
+ (vos_list_node_t**)&pLimMgmtRegistration);
+
+ while(pLimMgmtRegistration != NULL)
+ {
+ type = (pLimMgmtRegistration->frameType >> 2) & 0x03;
+ subType = (pLimMgmtRegistration->frameType >> 4) & 0x0f;
+ if ( (type == SIR_MAC_MGMT_FRAME) && (fc.type == SIR_MAC_MGMT_FRAME)
+ && (subType == SIR_MAC_MGMT_RESERVED15) )
+ {
+ limLog( pMac, LOG3,
+ FL("rcvd frame match with SIR_MAC_MGMT_RESERVED15\n"));
+ match = VOS_TRUE;
+ break;
+ }
+
+ if (pLimMgmtRegistration->frameType == frameType)
+ {
+ if (pLimMgmtRegistration->matchLen > 0)
+ {
+ if (pLimMgmtRegistration->matchLen <= framelen)
+ {
+ if (palEqualMemory(pMac, pLimMgmtRegistration->matchData,
+ pBody, pLimMgmtRegistration->matchLen))
+ {
+ /* found match! */
+ match = VOS_TRUE;
+ break;
+ }
+ }
+ }
+ else
+ {
+ /* found match! */
+ match = VOS_TRUE;
+ break;
+ }
+ }
+
+ vosStatus =
+ vos_list_peek_next ( &pMac->lim.gLimMgmtFrameRegistratinQueue,
+ (vos_list_node_t*) pLimMgmtRegistration,
+ (vos_list_node_t**) &pNext );
+ pLimMgmtRegistration = pNext;
+ pNext = NULL;
+ }
+
+ if (match)
+ {
+ limLog( pMac, LOG1,
+ FL("rcvd frame match with registered frame params\n"));
+
+ /* Indicate this to SME */
+ limSendSmeMgmtFrameInd( pMac, pHdr->fc.subType, (tANI_U8*)pHdr,
+ WDA_GET_RX_PAYLOAD_LEN(pBd) + sizeof(tSirMacMgmtHdr),
+ pLimMgmtRegistration->sessionId,
+ WDA_GET_RX_CH(pBd) );
+
+ if ( (type == SIR_MAC_MGMT_FRAME) && (fc.type == SIR_MAC_MGMT_FRAME)
+ && (subType == SIR_MAC_MGMT_RESERVED15) )
+ {
+ // These packets needs to be processed by PE/SME as well as HDD.
+ // If it returns TRUE here, the packet is forwarded to HDD only.
+ match = VOS_FALSE;
+ }
+ }
+
+ return match;
+} /*** end limCheckMgmtRegisteredFrames() ***/
+#endif /* WLAN_FEATURE_P2P */
+
+
+/**
+ * limHandle80211Frames()
+ *
+ *FUNCTION:
+ * This function is called to process 802.11 frames
+ * received by LIM.
+ *
+ *LOGIC:
+ * NA
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pMsg of type tSirMsgQ - Pointer to the message structure
+ * @return None
+ */
+
+static void
+limHandle80211Frames(tpAniSirGlobal pMac, tpSirMsgQ limMsg, tANI_U8 *pDeferMsg)
+{
+ tANI_U8 *pRxPacketInfo = NULL;
+ tSirMacFrameCtl fc;
+ tpSirMacMgmtHdr pHdr=NULL;
+ tpPESession psessionEntry=NULL;
+ tANI_U8 sessionId;
+ tAniBool isFrmFt = FALSE;
+ tANI_U16 fcOffset = WLANHAL_RX_BD_HEADER_SIZE;
+
+ *pDeferMsg= false;
+ limGetBDfromRxPacket(pMac, limMsg->bodyptr, (tANI_U32 **)&pRxPacketInfo);
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+ isFrmFt = WDA_GET_RX_FT_DONE(pRxPacketInfo);
+ fcOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(pRxPacketInfo);
+ fc = pHdr->fc;
+
+ limLog( pMac, LOG1, FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d\n"),
+ fc.protVer, fc.type, fc.subType, WDA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
+
+
+#ifdef FEATURE_WLAN_CCX
+ if (fc.type == SIR_MAC_DATA_FRAME && isFrmFt)
+ {
+#if 0 // CCX TBD Need to PORT
+ tpSirMacDot3Hdr pDataFrmHdr;
+
+ pDataFrmHdr = (tpSirMacDot3Hdr)((tANI_U8 *)pBD+ WLANHAL_RX_BD_GET_MPDU_H_OFFSET(pBD));
+ if((psessionEntry = peFindSessionByBssid(pMac,pDataFrmHdr->sa,&sessionId))== NULL)
+ {
+ limLog( pMac, LOGE, FL("Session not found for Frm type %d, subtype %d, SA: "), fc.type, fc.subType);
+ limPrintMacAddr(pMac, pDataFrmHdr->sa, LOGE);
+ limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pBD, limMsg->bodyptr);
+ return;
+ }
+
+ if (!psessionEntry->isCCXconnection)
+ {
+ limLog( pMac, LOGE, FL("LIM received Type %d, Subtype %d in Non CCX connection\n"),
+ fc.type, fc.subType);
+ limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pBD, limMsg->bodyptr);
+ return;
+ }
+ limLog( pMac, LOGE, FL("Processing IAPP Frm from SA:"));
+ limPrintMacAddr(pMac, pDataFrmHdr->sa, LOGE);
+#else
+ printk("%s: Need to port handling of IAPP frames to PRIMA for CCX\n", __func__);
+#endif
+
+
+ } else
+#endif
+ /* Added For BT-AMP Support */
+ if((psessionEntry = peFindSessionByBssid(pMac,pHdr->bssId,&sessionId))== NULL)
+ {
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ if (fc.subType == SIR_MAC_MGMT_AUTH)
+ {
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+ limLog( pMac, LOGE, FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d\n"),
+ fc.protVer, fc.type, fc.subType, WDA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
+ limPrintMacAddr(pMac, pHdr->bssId, LOGE);
+#endif
+ if (limProcessAuthFrameNoSession(pMac, pRxPacketInfo, limMsg->bodyptr) == eSIR_SUCCESS)
+ {
+ limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, limMsg->bodyptr);
+ return;
+ }
+ }
+#endif
+ if((fc.subType != SIR_MAC_MGMT_PROBE_RSP )&&
+ (fc.subType != SIR_MAC_MGMT_BEACON)&&
+ (fc.subType != SIR_MAC_MGMT_PROBE_REQ)
+#if defined WLAN_FEATURE_P2P
+ && (fc.subType != SIR_MAC_MGMT_ACTION ) //Public action frame can be received from non-associated stations.
+#endif
+ )
+ {
+
+ if((psessionEntry = peFindSessionByPeerSta(pMac,pHdr->sa,&sessionId))== NULL)
+ {
+ limLog(pMac, LOG1, FL("session does not exist for given bssId\n"));
+ limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, limMsg->bodyptr);
+ return;
+ }
+ }
+ }
+
+
+#ifdef WLAN_FEATURE_P2P
+ /* Check if frame is registered by HDD */
+ if(limCheckMgmtRegisteredFrames(pMac, pRxPacketInfo, psessionEntry))
+ {
+ limLog( pMac, LOG1, FL("Received frame is passed to SME\n"));
+ limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, limMsg->bodyptr);
+ return;
+ }
+#endif
+
+
+#ifdef ANI_PRODUCT_TYPE_AP
+ if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) && (LIM_IS_RADAR_DETECTED(pMac)))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Droping the received packets as radar is detected\n"));)
+ limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
+ return;
+ }
+#endif
+
+ if (fc.protVer != SIR_MAC_PROTOCOL_VERSION)
+ { // Received Frame with non-zero Protocol Version
+ limLog(pMac, LOGE, FL("Unexpected frame with protVersion %d received\n"),
+ fc.protVer);
+ limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
+#ifdef WLAN_DEBUG
+ pMac->lim.numProtErr++;
+#endif
+ return;
+ }
+
+
+ if (limIsSystemInScanState(pMac))
+ {
+ limHandleFramesInScanState(pMac, limMsg, pRxPacketInfo, pDeferMsg, psessionEntry);
+ return;
+ }
+
+/* Chance of crashing : to be done BT-AMP ........happens when broadcast probe req is received */
+
+#if 0
+ if (psessionEntry->limSystemRole == eLIM_UNKNOWN_ROLE) {
+ limLog( pMac, LOGW, FL( "gLimSystemRole is %d. Exiting...\n" ),psessionEntry->limSystemRole );
+ limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
+
+#ifdef WLAN_DEBUG
+ pMac->lim.numProtErr++;
+#endif
+ return;
+ }
+ #endif //HACK to continue scanning
+
+
+#ifdef WLAN_DEBUG
+ pMac->lim.numMAC[fc.type][fc.subType]++;
+#endif
+
+ switch (fc.type)
+ {
+ case SIR_MAC_MGMT_FRAME:
+ {
+ #if 0 //TBD-RAJESH fix this
+ if (limIsReassocInProgress( pMac,psessionEntry) && (fc.subType != SIR_MAC_MGMT_DISASSOC) &&
+ (fc.subType != SIR_MAC_MGMT_DEAUTH) && (fc.subType != SIR_MAC_MGMT_REASSOC_RSP))
+ {
+ limLog(pMac, LOGE, FL("Frame with Type - %d, Subtype - %d received in ReAssoc Wait state, dropping...\n"),
+ fc.type, fc.subType);
+ return;
+ }
+ #endif //HACK to continue scanning
+ // Received Management frame
+ switch (fc.subType)
+ {
+ case SIR_MAC_MGMT_ASSOC_REQ:
+ // Make sure the role supports Association
+ if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
+#ifdef WLAN_SOFTAP_FEATURE
+ || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
+#endif
+ )
+ limProcessAssocReqFrame(pMac, pRxPacketInfo, LIM_ASSOC, psessionEntry);
+
+ else
+ {
+ // Unwanted messages - Log error
+ limLog(pMac, LOGE, FL("unexpected message received %X\n"),limMsg->type);
+ limPrintMsgName(pMac, LOGE, limMsg->type);
+ }
+ break;
+
+ case SIR_MAC_MGMT_ASSOC_RSP:
+ limProcessAssocRspFrame(pMac, pRxPacketInfo, LIM_ASSOC,psessionEntry);
+ break;
+
+ case SIR_MAC_MGMT_REASSOC_REQ:
+ // Make sure the role supports Reassociation
+ if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
+#ifdef WLAN_SOFTAP_FEATURE
+ || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
+#endif
+ ){
+ limProcessAssocReqFrame(pMac, pRxPacketInfo, LIM_REASSOC, psessionEntry);
+ }
+ else
+ {
+ // Unwanted messages - Log error
+ limLog(pMac, LOGE, FL("unexpected message received %X\n"),limMsg->type);
+ limPrintMsgName(pMac, LOGE, limMsg->type);
+ }
+ break;
+
+ case SIR_MAC_MGMT_REASSOC_RSP:
+ limProcessAssocRspFrame(pMac, pRxPacketInfo, LIM_REASSOC,psessionEntry);
+ break;
+
+ case SIR_MAC_MGMT_PROBE_REQ:
+ limProcessProbeReqFrame_multiple_BSS(pMac, pRxPacketInfo,psessionEntry);
+ break;
+
+ case SIR_MAC_MGMT_PROBE_RSP:
+ if(psessionEntry == NULL)
+ limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
+ else
+ limProcessProbeRspFrame(pMac, pRxPacketInfo, psessionEntry);
+ break;
+
+ case SIR_MAC_MGMT_BEACON:
+ __limHandleBeacon(pMac, limMsg,psessionEntry);
+ break;
+
+ case SIR_MAC_MGMT_DISASSOC:
+ limProcessDisassocFrame(pMac, pRxPacketInfo,psessionEntry);
+ break;
+
+ case SIR_MAC_MGMT_AUTH:
+ limProcessAuthFrame(pMac, pRxPacketInfo,psessionEntry);
+ break;
+
+ case SIR_MAC_MGMT_DEAUTH:
+ limProcessDeauthFrame(pMac, pRxPacketInfo,psessionEntry);
+ break;
+
+ case SIR_MAC_MGMT_ACTION:
+#if defined WLAN_FEATURE_P2P
+ if(psessionEntry == NULL)
+ limProcessActionFrameNoSession(pMac, pRxPacketInfo);
+ else
+ {
+#endif
+ if (WDA_GET_RX_UNKNOWN_UCAST(pRxPacketInfo))
+ limHandleUnknownA2IndexFrames(pMac, pRxPacketInfo,psessionEntry);
+ else
+ limProcessActionFrame(pMac, pRxPacketInfo,psessionEntry);
+#if defined WLAN_FEATURE_P2P
+ }
+#endif
+ break;
+ default:
+ // Received Management frame of 'reserved' subtype
+ break;
+ } // switch (fc.subType)
+
+ }
+ break;
+#ifdef FEATURE_WLAN_CCX
+ case SIR_MAC_DATA_FRAME:
+ {
+ /* We accept data frame (IAPP frame) only if Session is
+ * present and ccx connection is established on that
+ * session
+ */
+ if (psessionEntry && psessionEntry->isCCXconnection) {
+ limProcessIappFrame(pMac, pRxPacketInfo, psessionEntry);
+ }
+ }
+ break;
+#endif
+ default:
+ // Received frame of type 'reserved'
+ break;
+
+ } // switch (fc.type)
+
+ limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr) ;
+ return;
+} /*** end limHandle80211Frames() ***/
+
+
+/**
+ * limProcessAbortScanInd()
+ *
+ *FUNCTION:
+ * This function is called from HDD to abort the scan which is presently being run
+ *
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the SME message buffer
+ * @return None
+ */
+void
+limProcessAbortScanInd(tpAniSirGlobal pMac)
+{
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_ABORT_IND_EVENT, NULL, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ /* Deactivate the gLimBackgroundScanTimer as part of the abort scan.
+ * SME should send WNI_CFG_BACKGROUND_SCAN_PERIOD indication
+ * to start the background scan again
+ */
+ PELOGE(limLog(pMac, LOGE, FL("Processing AbortScan Ind\n"));)
+
+ limAbortBackgroundScan(pMac);
+
+ /* Abort the scan if its running, else just return */
+ if(limIsSystemInScanState(pMac))
+ {
+ if( (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
+ (eLIM_HAL_START_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
+ (eLIM_HAL_END_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
+ (eLIM_HAL_FINISH_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
+ {
+ //Simply signal we need to abort
+ limLog( pMac, LOGW, FL(" waiting for HAL, simply signal abort gLimHalScanState = %d\n"), pMac->lim.gLimHalScanState );
+ pMac->lim.abortScan = 1;
+ }
+ else
+ {
+ //Force abort
+ limLog( pMac, LOGW, FL(" Force aborting scan\n") );
+ pMac->lim.abortScan = 0;
+ limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
+ limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
+ //Set the resume channel to Any valid channel (invalid).
+ //This will instruct HAL to set it to any previous valid channel.
+ peSetResumeChannel(pMac, 0, 0);
+ limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
+ }
+ }
+ return;
+}
+
+/**
+ * limMessageProcessor
+ *
+ *FUNCTION:
+ * Wrapper function for limProcessMessages when handling messages received by LIM.
+ * Could either defer messages or process them.
+ * @param pMac Pointer to Global MAC structure
+ * @param limMsg Received LIM message
+ * @return None
+ */
+
+void limMessageProcessor(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
+{
+ if (eLIM_MLM_OFFLINE_STATE == pMac->lim.gLimMlmState)
+ {
+ peFreeMsg(pMac, limMsg);
+ return;
+ }
+
+ if (!defMsgDecision(pMac, limMsg))
+ {
+ limProcessMessages(pMac, limMsg);
+#ifdef ANI_PRODUCT_TYPE_CLIENT
+ // process deferred message queue if allowed
+ {
+ if ( (! (pMac->lim.gLimAddtsSent))
+ &&
+ (! (limIsSystemInScanState(pMac)))
+ )
+ {
+ if (true == GET_LIM_PROCESS_DEFD_MESGS(pMac))
+ limProcessDeferredMessageQueue(pMac);
+ }
+ }
+#else
+ {
+ // process deferred message queue if allowed
+ if (! (pMac->lim.gLimSystemInScanLearnMode))
+ {
+#if defined(ANI_AP_CLIENT_SDK)
+ if (pMac->lim.gLimSystemRole != eLIM_AP_ROLE && (pMac->lim.gLimAddtsSent))
+ return;
+#endif
+
+ if (true == GET_LIM_PROCESS_DEFD_MESGS(pMac))
+ limProcessDeferredMessageQueue(pMac);
+ }
+ }
+#endif
+ }
+}
+
+
+
+/**
+ * limProcessMessages
+ *
+ *FUNCTION:
+ * This function is called by limProcessMessageQueue function. This
+ * function processes messages received by LIM.
+ *
+ *LOGIC:
+ * Depending on the message type, corresponding function will be
+ * called, for example limProcessSmeMessages() will be called to
+ * process SME messages received from HDD/Upper layer software module.
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param limMsg Received LIM message
+ * @return None
+ */
+
+void
+limProcessMessages(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
+{
+ tANI_U8 deferMsg = false;
+ tLinkStateParams *linkStateParams;
+#if defined WLAN_FEATURE_VOWIFI_11R
+ tpPESession pSession;
+#endif
+#if defined(ANI_DVT_DEBUG)
+ tSirMsgQ msgQ;
+#endif
+ if(pMac->gDriverType == eDRIVER_TYPE_MFG)
+ {
+ return;
+ }
+#ifdef WLAN_DEBUG
+ pMac->lim.numTot++;
+#endif
+
+
+ PELOG3(limLog(pMac, LOG3, FL("rcvd msgType = %s, sme state = %s, mlm state = %s\n"),
+ limMsgStr(limMsg->type), limSmeStateStr(pMac->lim.gLimSmeState),
+ limMlmStateStr(pMac->lim.gLimMlmState));)
+
+ MTRACE(macTraceMsgRx(pMac, 0, LIM_TRACE_MAKE_RXMSG(limMsg->type, LIM_MSG_PROCESSED));)
+
+ switch (limMsg->type)
+ {
+#if defined(ANI_DVT_DEBUG)
+ case SIR_LIM_SUSPEND_ACTIVITY_REQ:
+ // This message is from HAL notifying LIM
+ // to suspend activity. (PTT needs)
+ // Disable TFP & RHP
+ //halSetStaTxEnable(pMac, 1, eHAL_CLEAR);
+ //halStopDataTraffic(pMac);
+ //halSetRxEnable(pMac, eHAL_CLEAR);
+
+ pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
+ pMac->lim.gLimSmeState = eLIM_SME_SUSPEND_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+
+ // Post message back to HAL
+ msgQ.type = WDA_SUSPEND_ACTIVITY_RSP;
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ wdaPostCtrlMsg(pMac, &msgQ);
+ break;
+#endif
+
+ case SIR_LIM_UPDATE_BEACON:
+ limUpdateBeacon(pMac);
+ break;
+
+ case SIR_LIM_RESUME_ACTIVITY_NTF:
+ // This message is from HAL notifying LIM
+ // to resume activity.
+ if (pMac->lim.gLimSmeState == eLIM_SME_SUSPEND_STATE)
+ {
+ limLog(pMac, LOGE,
+ FL("Received RESUME_NTF in State %s on Role %d\n"),
+ limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSystemRole);
+ pMac->lim.gLimSmeState = pMac->lim.gLimPrevSmeState;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+
+ handleCBCFGChange( pMac, ANI_IGNORE_CFG_ID );
+ handleHTCapabilityandHTInfo(pMac);
+ //initialize the TSPEC admission control table.
+ limAdmitControlInit(pMac);
+ limRegisterHalIndCallBack(pMac);
+ }
+ else
+ {
+ limLog(pMac, LOGE,
+ FL("Received RESUME_NTF in inval State %X on Role %d\n"),
+ pMac->lim.gLimSmeState, pMac->lim.gLimSystemRole);
+ limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
+ }
+
+ break;
+
+ case SIR_CFG_PARAM_UPDATE_IND:
+ /// CFG parameter updated
+ if (limIsSystemInScanState(pMac))
+ {
+ // System is in DFS (Learn) mode
+ // Defer processsing this message
+ if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Unable to Defer message(0x%X) limSmeState %d (prev sme state %d) sysRole %d mlm state %d (prev mlm state %d)\n"),
+ limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
+ pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
+ limLogSessionStates(pMac);
+ limPrintMsgName(pMac, LOGE, limMsg->type);
+ }
+ }
+ else
+ {
+ limHandleCFGparamUpdate(pMac, limMsg->bodyval);
+ }
+
+ break;
+
+ case WDA_INIT_SCAN_RSP:
+ limProcessInitScanRsp(pMac, limMsg->bodyptr);
+ break;
+
+ case WDA_START_SCAN_RSP:
+ limProcessStartScanRsp(pMac, limMsg->bodyptr);
+ break;
+
+ case WDA_END_SCAN_RSP:
+ limProcessEndScanRsp(pMac, limMsg->bodyptr);
+ break;
+
+ case WDA_FINISH_SCAN_RSP:
+ limProcessFinishScanRsp(pMac, limMsg->bodyptr);
+ break;
+
+ case WDA_SWITCH_CHANNEL_RSP:
+ limProcessSwitchChannelRsp(pMac, limMsg->bodyptr);
+ break;
+
+#ifdef ANI_SIR_IBSS_PEER_CACHING
+ case WDA_IBSS_STA_ADD:
+ limIbssStaAdd(pMac, limMsg->bodyptr);
+ break;
+#endif
+ case SIR_BB_XPORT_MGMT_MSG:
+ // These messages are from Peer MAC entity.
+#ifdef WLAN_DEBUG
+ pMac->lim.numBbt++;
+#endif
+
+#ifdef VOSS_ENABLED
+ {
+ v_U16_t pktLen = 0;
+ vos_pkt_t *pVosPkt;
+ VOS_STATUS vosStatus;
+ tSirMsgQ limMsgNew;
+
+ /* The original limMsg which we were deferring have the
+ * bodyPointer point to 'BD' instead of 'Vos pkt'. If we don't make a copy
+ * of limMsg, then vos_pkt_peek_data will overwrite the limMsg->bodyPointer.
+ * and next time when we try to process the msg, we will try to use 'BD' as
+ * 'Vos Pkt' which will cause a crash
+ */
+ palCopyMemory(pMac, (tANI_U8*)&limMsgNew, (tANI_U8*)limMsg, sizeof(tSirMsgQ));
+ pVosPkt = (vos_pkt_t *)limMsgNew.bodyptr;
+ vos_pkt_get_packet_length(pVosPkt, &pktLen);
+
+ vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (v_PVOID_t *)&limMsgNew.bodyptr, VOS_FALSE );
+
+ if( !VOS_IS_STATUS_SUCCESS(vosStatus) )
+ {
+ vos_pkt_return_packet(pVosPkt);
+ break;
+
+ }
+ limHandle80211Frames(pMac, &limMsgNew, &deferMsg);
+
+ if ( deferMsg == true )
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Defer message type=%X \n"), limMsg->type);)
+ if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Unable to Defer message(0x%X) limSmeState %d (prev sme state %d) sysRole %d mlm state %d (prev mlm state %d)\n"),
+ limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
+ pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
+ limLogSessionStates(pMac);
+ limPrintMsgName(pMac, LOGE, limMsg->type);
+ vos_pkt_return_packet(pVosPkt);
+ }
+ }
+ else
+ {
+ /* PE is not deferring this 802.11 frame so we need to call vos_pkt_return.
+ * Asumption here is when Rx mgmt frame processing is done,
+ * voss packet could be freed here.
+ */
+ vos_pkt_return_packet(pVosPkt);
+ }
+ }
+#else
+ limHandle80211Frames(pMac, limMsg);
+#endif
+ break;
+
+ case eWNI_SME_SCAN_REQ:
+#ifdef WLAN_FEATURE_P2P
+ case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
+#endif
+ case eWNI_SME_DISASSOC_REQ:
+ case eWNI_SME_DEAUTH_REQ:
+ case eWNI_SME_STA_STAT_REQ:
+ case eWNI_SME_AGGR_STAT_REQ:
+ case eWNI_SME_GLOBAL_STAT_REQ:
+ case eWNI_SME_STAT_SUMM_REQ:
+ case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
+ case eWNI_SME_GET_STATISTICS_REQ:
+ // These messages are from HDD
+ limProcessNormalHddMsg(pMac, limMsg, true); //need to response to hdd
+ break;
+
+ case eWNI_SME_SCAN_ABORT_IND:
+ vos_mem_free((v_VOID_t *)limMsg->bodyptr);
+ limMsg->bodyptr = NULL;
+ limProcessAbortScanInd(pMac);
+ break;
+
+ case eWNI_SME_START_REQ:
+ case eWNI_SME_SYS_READY_IND:
+#ifndef WNI_ASKEY_NON_SUPPORT_FEATURE
+ case eWNI_SME_JOIN_REQ:
+#endif
+ case eWNI_SME_AUTH_REQ:
+ case eWNI_SME_REASSOC_REQ:
+ case eWNI_SME_START_BSS_REQ:
+ case eWNI_SME_STOP_BSS_REQ:
+ case eWNI_SME_SWITCH_CHL_REQ:
+ case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
+ case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
+ case eWNI_SME_SETCONTEXT_REQ:
+ case eWNI_SME_REMOVEKEY_REQ:
+#ifndef WNI_ASKEY_NON_SUPPORT_FEATURE
+ case eWNI_SME_PROMISCUOUS_MODE_REQ:
+#endif
+ case eWNI_SME_DISASSOC_CNF:
+ case eWNI_SME_DEAUTH_CNF:
+ case eWNI_SME_ASSOC_CNF:
+ case eWNI_SME_REASSOC_CNF:
+ case eWNI_SME_ADDTS_REQ:
+ case eWNI_SME_DELTS_REQ:
+ case eWNI_SME_DEL_BA_PEER_IND:
+ case eWNI_SME_SET_TX_POWER_REQ:
+ case eWNI_SME_GET_TX_POWER_REQ:
+ case eWNI_SME_GET_NOISE_REQ:
+#ifdef WLAN_SOFTAP_FEATURE
+ case eWNI_SME_GET_ASSOC_STAS_REQ:
+ case eWNI_SME_TKIP_CNTR_MEAS_REQ:
+ case eWNI_SME_UPDATE_APWPSIE_REQ:
+ case eWNI_SME_HIDE_SSID_REQ:
+ case eWNI_SME_GET_WPSPBC_SESSION_REQ:
+ case eWNI_SME_SET_APWPARSNIEs_REQ:
+#endif
+#if defined WLAN_FEATURE_VOWIFI
+ case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
+ case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
+#endif
+#if defined FEATURE_WLAN_CCX
+ case eWNI_SME_CCX_ADJACENT_AP_REPORT:
+#endif
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ case eWNI_SME_FT_UPDATE_KEY:
+ case eWNI_SME_FT_PRE_AUTH_REQ:
+ case eWNI_SME_FT_AGGR_QOS_REQ:
+#endif
+ case eWNI_SME_ADD_STA_SELF_REQ:
+ case eWNI_SME_DEL_STA_SELF_REQ:
+#ifdef WLAN_FEATURE_P2P
+ case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
+ case eWNI_SME_UPDATE_NOA:
+#endif
+ // These messages are from HDD
+ limProcessNormalHddMsg(pMac, limMsg, false); //no need to response to hdd
+ break;
+
+ //Power Save Messages From HDD
+ case eWNI_PMC_PWR_SAVE_CFG:
+ case eWNI_PMC_ENTER_BMPS_REQ:
+ case eWNI_PMC_EXIT_BMPS_REQ:
+ case eWNI_PMC_ENTER_IMPS_REQ:
+ case eWNI_PMC_EXIT_IMPS_REQ:
+ case eWNI_PMC_ENTER_UAPSD_REQ:
+ case eWNI_PMC_EXIT_UAPSD_REQ:
+ case eWNI_PMC_ENTER_WOWL_REQ:
+ case eWNI_PMC_EXIT_WOWL_REQ:
+ case eWNI_PMC_WOWL_ADD_BCAST_PTRN:
+ case eWNI_PMC_WOWL_DEL_BCAST_PTRN:
+ pmmProcessMessage(pMac, limMsg);
+ break;
+
+ case eWNI_PMC_SMPS_STATE_IND :
+ {
+#ifdef SUPPORT_eWNI_PMC_SMPS_STATE_IND
+ tSirMbMsg *pMBMsg;
+ tSirMacHTMIMOPowerSaveState mimoPSstate;
+ /** Is System processing any SMPS Indication*/
+ if (!limIsSystemInSetMimopsState(pMac))
+ {
+ pMBMsg = (tSirMbMsg *)limMsg->bodyptr;
+ palCopyMemory(pMac->hHdd, &mimoPSstate, pMBMsg->data, sizeof(tSirMacHTMIMOPowerSaveState));
+ limSMPowerSaveStateInd(pMac, mimoPSstate);
+ }
+ else
+ {
+ if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Unable to Defer message(0x%X) limSmeState %d (prev sme state %d) sysRole %d mlm state %d (prev mlm state %d)\n"),
+ limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
+ pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
+ limLogSessionStates(pMac);
+ limPrintMsgName(pMac, LOGE, limMsg->type);
+ }
+ }
+#endif
+ if(limMsg->bodyptr){
+ palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
+ limMsg->bodyptr = NULL;
+ }
+ }
+ break;
+#if defined WLAN_FEATURE_P2P
+ case eWNI_SME_SEND_ACTION_FRAME_IND:
+ limSendP2PActionFrame(pMac, limMsg);
+ palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
+ limMsg->bodyptr = NULL;
+ break;
+ case eWNI_SME_ABORT_REMAIN_ON_CHAN_IND:
+ limAbortRemainOnChan(pMac);
+ palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
+ limMsg->bodyptr = NULL;
+ break;
+
+ case SIR_HAL_P2P_NOA_ATTR_IND:
+ {
+ tpPESession psessionEntry = &pMac->lim.gpSession[0];
+ tANI_U8 i;
+
+
+ limLog(pMac, LOGW, FL("Received message Noa_ATTR %x\n"), limMsg->type);
+ for(i=0; i < pMac->lim.maxBssId; i++)
+ {
+ if ( (psessionEntry != NULL) && (pMac->lim.gpSession[i].valid) &&
+ (psessionEntry->pePersona == VOS_P2P_GO_MODE))
+ { //Save P2P attributes for P2P Go persona
+
+ palCopyMemory(pMac->hHdd,&psessionEntry->p2pGoPsUpdate, limMsg->bodyptr,sizeof(tSirP2PNoaAttr));
+
+
+ limLog(pMac, LOGE, FL(" &psessionEntry->bssId%02x:%02x:%02x:%02x:%02x:%02x ctWin=%d oppPsFlag=%d\n"),
+ psessionEntry->bssId[0],
+ psessionEntry->bssId[1],
+ psessionEntry->bssId[2],
+ psessionEntry->bssId[3],
+ psessionEntry->bssId[4],
+ psessionEntry->bssId[5],
+ psessionEntry->p2pGoPsUpdate.ctWin,
+ psessionEntry->p2pGoPsUpdate.oppPsFlag);
+
+ limLog(pMac, LOGE, FL(" uNoa1IntervalCnt=%d uNoa1Duration=%d uNoa1Interval=%d uNoa1StartTime=%d\n"),
+ psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt,
+ psessionEntry->p2pGoPsUpdate.uNoa1Duration,
+ psessionEntry->p2pGoPsUpdate.uNoa1Interval,
+ psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
+
+
+ break;
+ }
+ }
+
+ }
+ palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
+ limMsg->bodyptr = NULL;
+
+ break;
+
+
+#endif
+ /* eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER Message comes after the
+ * device comes out of full power for the full power request sent
+ * because of channel switch with switch count as 0, so call the same
+ * function used in timeout case(i.e SIR_LIM_CHANNEL_SWITCH_TIMEOUT)
+ * for switching the channel*/
+ case eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER:
+ limProcessChannelSwitchTimeout(pMac);
+ palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
+ limMsg->bodyptr = NULL;
+ break;
+
+ //Power Save Related Messages From HAL
+ case WDA_ENTER_BMPS_RSP:
+ case WDA_EXIT_BMPS_RSP:
+ case WDA_EXIT_BMPS_IND:
+ case WDA_ENTER_IMPS_RSP:
+ case WDA_EXIT_IMPS_RSP:
+ case WDA_ENTER_UAPSD_RSP:
+ case WDA_EXIT_UAPSD_RSP:
+ case WDA_WOWL_ENTER_RSP:
+ case WDA_WOWL_EXIT_RSP:
+ pmmProcessMessage(pMac, limMsg);
+ break;
+
+ case WDA_LOW_RSSI_IND:
+ //limHandleLowRssiInd(pMac);
+ break;
+
+ case WDA_BMPS_STATUS_IND:
+ limHandleBmpsStatusInd(pMac);
+ break;
+
+ case WDA_MISSED_BEACON_IND:
+ limHandleMissedBeaconInd(pMac);
+ break;
+ case WDA_MIC_FAILURE_IND:
+ limMicFailureInd(pMac, limMsg);
+ palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
+ limMsg->bodyptr = NULL;
+ break;
+
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+ case eWNI_SME_MEASUREMENT_REQ:
+ case eWNI_SME_SET_WDS_INFO_REQ:
+ // Message to support ANI feature set
+ // These are handled by LMM sub module
+ if (limIsSystemInScanState(pMac))
+ {
+ // System is in DFS (Learn) mode
+ // Defer processsing this message
+ if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
+ {
+ pMac->lim.numSme++;
+ PELOGE(limLog(pMac, LOGE, FL("Unable to Defer message(0x%X) limSmeState %d (prev sme state %d) sysRole %d mlm state %d (prev mlm state %d)\n"),
+ limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
+ pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
+ limLogSessionStates(pMac);
+ limPrintMsgName(pMac, LOGE, limMsg->type);
+ // Release body
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) limMsg->bodyptr);
+ break;
+ }
+
+ if (limMsg->type == eWNI_SME_MEASUREMENT_REQ)
+ {
+ if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
+ {
+ //Set the resume channel to Any valid channel (invalid).
+ //This will instruct HAL to set it to any previous valid channel.
+ peSetResumeChannel(pMac, 0, 0);
+ limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
+ }
+ }
+ }
+ else
+ {
+ pMac->lim.numSme++;
+ limProcessLmmMessages(pMac,
+ limMsg->type,
+ (tANI_U32 *) limMsg->bodyptr);
+
+ // Release body
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) limMsg->bodyptr);
+ }
+ break;
+
+ case SIR_LIM_LEARN_INTERVAL_TIMEOUT:
+ if ((pMac->lim.gLimSystemRole == eLIM_STA_ROLE) &&
+ ((pMac->lim.gLimMlmState == eLIM_MLM_WT_DEL_STA_RSP_STATE) ||
+ (pMac->lim.gLimMlmState == eLIM_MLM_WT_DEL_BSS_RSP_STATE)))
+ {
+ // BP is in the process of cleaning up
+ // its state with previously assocaited AP.
+ // Discard processsing this message.
+ PELOG1(limLog(pMac, LOG1,
+ FL("Discarding LEARN_INTERVAL_TO message\n"));)
+ }
+ else
+ limProcessLmmMessages(pMac,
+ limMsg->type,
+ (tANI_U32 *) limMsg->bodyptr);
+ break;
+
+ case SIR_LIM_MEASUREMENT_IND_TIMEOUT:
+ case SIR_LIM_LEARN_DURATION_TIMEOUT:
+ // These measurement related timeouts are
+ // handled by LMM sub module.
+ limProcessLmmMessages(pMac,
+ limMsg->type,
+ (tANI_U32 *) limMsg->bodyptr);
+
+ break;
+
+ case SIR_LIM_RADAR_DETECT_IND:
+ limDetectRadar(pMac, (tANI_U32*)limMsg->bodyptr);
+ palFreeMemory( pMac->hHdd, (tANI_U32*)limMsg->bodyptr);
+ break;
+
+#endif
+
+ case SIR_LIM_ADDTS_RSP_TIMEOUT:
+ limProcessSmeReqMessages(pMac,limMsg);
+ break;
+#ifdef FEATURE_WLAN_CCX
+ case SIR_LIM_CCX_TSM_TIMEOUT:
+ limProcessTsmTimeoutHandler(pMac,limMsg);
+ break;
+ case WDA_TSM_STATS_RSP:
+ limProcessHalCcxTsmRsp(pMac, limMsg);
+ break;
+#endif
+ case WDA_ADD_TS_RSP:
+ limProcessHalAddTsRsp(pMac, limMsg);
+ break;
+
+ case SIR_LIM_DEL_TS_IND:
+ limProcessDelTsInd(pMac, limMsg);
+ case SIR_LIM_ADD_BA_IND:
+ limProcessAddBaInd(pMac, limMsg);
+ break;
+ case SIR_LIM_DEL_BA_ALL_IND:
+ limDelAllBASessions(pMac); // refer notes and change
+ break;
+ case SIR_LIM_DEL_BA_IND:
+ limProcessMlmHalBADeleteInd( pMac, limMsg );
+ break;
+
+ case SIR_LIM_BEACON_GEN_IND: {
+#ifdef ANI_PRODUCT_TYPE_AP
+ if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
+ pmmUpdateTIM(pMac, (tpBeaconGenParams)limMsg->bodyptr);
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if( pMac->lim.gLimSystemRole != eLIM_AP_ROLE )
+#endif
+ schProcessPreBeaconInd(pMac, limMsg);
+
+ }
+ break;
+
+ case SIR_LIM_DELETE_STA_CONTEXT_IND:
+ limDeleteStaContext(pMac, limMsg);
+ break;
+
+ case SIR_LIM_MIN_CHANNEL_TIMEOUT:
+ case SIR_LIM_MAX_CHANNEL_TIMEOUT:
+ case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
+ case SIR_LIM_JOIN_FAIL_TIMEOUT:
+ case SIR_LIM_AUTH_FAIL_TIMEOUT:
+ case SIR_LIM_AUTH_RSP_TIMEOUT:
+ case SIR_LIM_ASSOC_FAIL_TIMEOUT:
+ case SIR_LIM_REASSOC_FAIL_TIMEOUT:
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
+#endif
+#ifdef WLAN_FEATURE_P2P
+ case SIR_LIM_REMAIN_CHN_TIMEOUT:
+#endif
+ // These timeout messages are handled by MLM sub module
+
+ limProcessMlmReqMessages(pMac,
+ limMsg);
+
+ break;
+
+ case SIR_LIM_HEART_BEAT_TIMEOUT:
+ /** check if heart beat failed, even if one Beacon
+ * is rcvd within the Heart Beat interval continue
+ * normal processing
+ */
+
+ #if 0
+ PELOG1(limLog(pMac, LOG1, FL("Heartbeat timeout, SME %d, MLME %d, #bcn %d\n"),
+ pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
+ pMac->lim.gLimRxedBeaconCntDuringHB);)
+
+ if(pMac->lim.gLimSystemRole == eLIM_STA_IN_IBSS_ROLE)
+ limIbssHeartBeatHandle(pMac); //HeartBeat for peers.
+ else
+ /**
+ * Heartbeat failure occurred on STA
+ * This is handled by LMM sub module.
+ */
+ limHandleHeartBeatFailure(pMac);
+
+ break;
+ #endif //TO SUPPORT BT-AMP
+
+ limHandleHeartBeatTimeout(pMac);
+ break;
+
+ case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
+ limHandleHeartBeatFailureTimeout(pMac);
+ break;
+
+ case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ /**
+ * Background scan timeout occurred on STA.
+ * This is handled by LMM sub module.
+ */
+ limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
+
+ //We will do background scan even in bcnps mode
+ //if (pMac->sys.gSysEnableScanMode)
+ pMac->lim.gLimReportBackgroundScanResults = FALSE;
+ limTriggerBackgroundScan(pMac);
+#endif
+ break;
+
+#ifdef ANI_PRODUCT_TYPE_AP
+ case SIR_LIM_PREAUTH_CLNUP_TIMEOUT:
+ if (limIsSystemInScanState(pMac))
+ {
+ // System is in DFS (Learn) mode
+ // Defer processsing this message
+ if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Unable to Defer message(0x%X) limSmeState %d (prev sme state %d) sysRole %d mlm state %d (prev mlm state %d)\n"),
+ limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
+ pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
+ limLogSessionStates(pMac);
+ }
+ }
+ else
+ {
+ // Pre-authentication context cleanup timeout message
+ limPreAuthClnupHandler(pMac);
+ }
+
+ break;
+#endif
+
+ case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
+
+ /*
+ ** clear the credit to the send disassociate frame bucket
+ **/
+
+ pMac->lim.gLimDisassocFrameCredit = 0;
+ break;
+
+ case SIR_LIM_CNF_WAIT_TIMEOUT:
+
+ /*
+ ** Does not receive CNF or dummy packet
+ **/
+ limHandleCnfWaitTimeout(pMac, (tANI_U16) limMsg->bodyval);
+
+ break;
+
+ case SIR_LIM_KEEPALIVE_TIMEOUT:
+ limSendKeepAliveToPeer(pMac);
+
+ break;
+
+ case SIR_LIM_RETRY_INTERRUPT_MSG:
+ // Message from ISR upon TFP's max retry limit interrupt
+
+ break;
+
+ case SIR_LIM_INV_KEY_INTERRUPT_MSG:
+ // Message from ISR upon SP's Invalid session key interrupt
+
+ break;
+
+ case SIR_LIM_KEY_ID_INTERRUPT_MSG:
+ // Message from ISR upon SP's Invalid key ID interrupt
+
+ break;
+
+ case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
+ // Message from ISR upon SP's Replay threshold interrupt
+
+ break;
+
+ case SIR_LIM_CHANNEL_SWITCH_TIMEOUT:
+ limProcessChannelSwitchTimeout(pMac);
+ break;
+
+ case SIR_LIM_QUIET_TIMEOUT:
+ limProcessQuietTimeout(pMac);
+ break;
+
+ case SIR_LIM_QUIET_BSS_TIMEOUT:
+ limProcessQuietBssTimeout(pMac);
+ break;
+
+#ifdef WLAN_SOFTAP_FEATURE
+ case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
+ limHandleUpdateOlbcCache(pMac);
+ break;
+#if 0
+ case SIR_LIM_WPS_OVERLAP_TIMEOUT:
+ limProcessWPSOverlapTimeout(pMac);
+ break;
+#endif
+
+#endif
+
+ case WDA_ADD_BSS_RSP:
+ limProcessMlmAddBssRsp( pMac, limMsg );
+ break;
+
+ case WDA_ADD_STA_RSP:
+
+ //call a wrapper by paasing bodyptr, their get sessionID and and call proper function from there.
+ limProcessAddStaRsp(pMac,limMsg);
+ break;
+
+ case WDA_DELETE_STA_RSP:
+ limProcessMlmDelStaRsp(pMac, limMsg);
+ break;
+
+ case WDA_ADD_STA_SELF_RSP:
+ limProcessAddStaSelfRsp(pMac, limMsg);
+ break;
+ case WDA_DEL_STA_SELF_RSP:
+ limProcessDelStaSelfRsp(pMac, limMsg);
+ break;
+
+ case WDA_DELETE_BSS_RSP:
+ limHandleDeleteBssRsp(pMac,limMsg); //wrapper routine to handle delete bss response
+ break;
+
+ case WDA_SET_BSSKEY_RSP:
+ case WDA_SET_STA_BCASTKEY_RSP:
+ limProcessMlmSetBssKeyRsp( pMac, limMsg );
+ break;
+ case WDA_SET_STAKEY_RSP:
+ limProcessMlmSetStaKeyRsp( pMac, limMsg );
+ break;
+ case WDA_REMOVE_BSSKEY_RSP:
+ case WDA_REMOVE_STAKEY_RSP:
+ limProcessMlmRemoveKeyRsp( pMac, limMsg );
+ break;
+ case WDA_ADDBA_RSP:
+ limProcessMlmHalAddBARsp( pMac, limMsg );
+ break;
+
+ case WDA_STA_STAT_RSP:
+ case WDA_AGGR_STAT_RSP:
+ case WDA_GLOBAL_STAT_RSP:
+ case WDA_STAT_SUMM_RSP:
+ limSendSmeStatsRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
+ break;
+
+ case WDA_GET_STATISTICS_RSP:
+ limSendSmePEStatisticsRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
+ break;
+
+ case WDA_SET_MIMOPS_RSP: //limProcessSetMimoRsp(pMac, limMsg);
+ case WDA_SET_TX_POWER_RSP: //limProcessSetTxPowerRsp(pMac, limMsg);
+ case WDA_GET_TX_POWER_RSP: //limProcessGetTxPowerRsp(pMac, limMsg);
+ case WDA_GET_NOISE_RSP:
+ vos_mem_free((v_VOID_t*)limMsg->bodyptr);
+ limMsg->bodyptr = NULL;
+ //limProcessGetNoiseRsp(pMac, limMsg);
+ break;
+
+ case WDA_SET_MAX_TX_POWER_RSP:
+#if defined WLAN_FEATURE_VOWIFI
+ rrmSetMaxTxPowerRsp( pMac, limMsg );
+#endif
+ if(limMsg->bodyptr != NULL)
+ {
+ vos_mem_free((v_VOID_t*)limMsg->bodyptr);
+ limMsg->bodyptr = NULL;
+ }
+ break;
+
+#ifdef ANI_CHIPSET_VOLANS
+ case SIR_LIM_ADDR2_MISS_IND:
+ {
+ limLog(pMac, LOGE,
+ FL("Addr2 mismatch interrupt received %X\n"),
+ limMsg->type);
+ /*a message from HAL indicating addr2 mismatch interrupt occurred
+ limMsg->bodyptr contains only pointer to 48-bit addr2 field*/
+ //Dinesh fix this. the third parameter should be sessionentry.
+ //limHandleUnknownA2IndexFrames(pMac, (void *)limMsg->bodyptr);
+
+ /*Free message body pointer*/
+ vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
+ break;
+ }
+#endif
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ case WDA_AGGR_QOS_RSP:
+ limProcessFTAggrQoSRsp( pMac, limMsg );
+ break;
+#endif
+
+ case WDA_SET_LINK_STATE_RSP:
+ linkStateParams = (tLinkStateParams *)limMsg->bodyptr;
+#if defined WLAN_FEATURE_VOWIFI_11R
+ pSession = linkStateParams->session;
+ if(linkStateParams->ft)
+ {
+ limSendReassocReqWithFTIEsMgmtFrame(pMac,
+ pSession->pLimMlmReassocReq,
+ pSession);
+ }
+#endif
+ if( linkStateParams->callback )
+ {
+ linkStateParams->callback( pMac, linkStateParams->callbackArg );
+ }
+ vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
+ break;
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+ case WDA_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
+ pmmProcessMessage(pMac, limMsg);
+ break;
+#endif // WLAN_FEATURE_PACKET_FILTERING
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+ case WDA_GTK_OFFLOAD_GETINFO_RSP:
+ pmmProcessMessage(pMac, limMsg);
+ break;
+#endif // WLAN_FEATURE_GTK_OFFLOAD
+
+ default:
+ vos_mem_free((v_VOID_t*)limMsg->bodyptr);
+ limMsg->bodyptr = NULL;
+ // Unwanted messages
+ // Log error
+ limLog(pMac, LOGE,
+ FL("Discarding unexpected message received %X\n"),
+ limMsg->type);
+ limPrintMsgName(pMac, LOGE, limMsg->type);
+ break;
+
+ } // switch (limMsg->type)
+
+ PELOG2(limLog(pMac, LOG2, FL("Done Processing msgType = %d, sme state = %s, mlm state = %s\n"),
+ limMsg->type, limSmeStateStr(pMac->lim.gLimSmeState),
+ limMlmStateStr(pMac->lim.gLimMlmState));)
+
+} /*** end limProcessMessages() ***/
+
+
+
+/**
+ * limProcessDeferredMessageQueue
+ *
+ *FUNCTION:
+ * This function is called by LIM while exiting from Learn
+ * mode. This function fetches messages posted to the LIM
+ * deferred message queue limDeferredMsgQ.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limProcessDeferredMessageQueue(tpAniSirGlobal pMac)
+{
+ tSirMsgQ limMsg = { 0, 0, 0 };
+
+#if defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_OSX)
+ while (TX_SUCCESS == tx_queue_receive(&pMac->sys.gSirLimDeferredMsgQ, (void *) &limMsg, TX_NO_WAIT))
+ {
+ PELOG3(limLog(pMac, LOG3, FL("Processing deferred message %X\n"), limMsg.type);)
+ limPrintMsgName(pMac, LOG3, limMsg.type);
+ pMac->lim.gLimNumDeferredMsgs--;
+ limProcessMessages(pMac, &limMsg);
+
+ if(true != GET_LIM_PROCESS_DEFD_MESGS(pMac))
+ break;
+ }
+#else
+ tSirMsgQ *readMsg;
+ tANI_U16 size;
+
+ /*
+ ** check any deferred messages need to be processed
+ **/
+ size = pMac->lim.gLimDeferredMsgQ.size;
+ if (size > 0)
+ {
+ while ((readMsg = limReadDeferredMsgQ(pMac)) != NULL)
+ {
+ palCopyMemory( pMac->hHdd, (tANI_U8*) &limMsg,
+ (tANI_U8*) readMsg, sizeof(tSirMsgQ));
+ size--;
+ limProcessMessages(pMac, &limMsg);
+
+ if((limIsSystemInScanState(pMac)) || (true != GET_LIM_PROCESS_DEFD_MESGS(pMac)) ||
+ (pMac->lim.gLimSystemInScanLearnMode))
+ break;
+ }
+ }
+#endif
+} /*** end limProcessDeferredMessageQueue() ***/
+
+
+/*
+ * limProcessNormalHddMsg
+ * Function: this function checks the current lim state and decide whether the message passed shall be deffered.
+ * @param pMac - Pointer to Global MAC structure
+ * pLimMsg -- the message need to be processed
+ * fRspReqd -- whether return result to hdd
+ * @return None
+ */
+void limProcessNormalHddMsg(tpAniSirGlobal pMac, tSirMsgQ *pLimMsg, tANI_U8 fRspReqd)
+{
+ tANI_BOOLEAN fDeferMsg = eANI_BOOLEAN_TRUE;
+
+ /* Added For BT-AMP Support */
+ if ((pMac->lim.gLimSystemRole == eLIM_AP_ROLE) ||(pMac->lim.gLimSystemRole == eLIM_BT_AMP_AP_ROLE )
+ ||(pMac->lim.gLimSystemRole == eLIM_BT_AMP_STA_ROLE)
+ ||(pMac->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE))
+ {
+ /** This check is required only for the AP and in 2 cases.
+ * 1. If we are in learn mode and we receive any of these messages,
+ * you have to come out of scan and process the message, hence dont
+ * defer the message here. In handler, these message could be defered
+ * till we actually come out of scan mode.
+ * 2. If radar is detected, you might have to defer all of these
+ * messages except Stop BSS request/ Switch channel request. This
+ * decision is also made inside its handler.
+ *
+ * Please be careful while using the flag fDeferMsg. Possibly you
+ * might end up in an infinite loop.
+ **/
+ if (((pLimMsg->type == eWNI_SME_START_BSS_REQ) ||
+ (pLimMsg->type == eWNI_SME_STOP_BSS_REQ) ||
+ (pLimMsg->type == eWNI_SME_SWITCH_CHL_REQ) ||
+ (pLimMsg->type == eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ) ||
+ (pLimMsg->type == eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ)))
+ {
+ fDeferMsg = eANI_BOOLEAN_FALSE;
+ }
+ }
+
+ /* limInsystemInscanState() refers the psessionEntry, how to get session Entry????*/
+ if (((pMac->lim.gLimAddtsSent) || (limIsSystemInScanState(pMac)) ||
+ (LIM_IS_RADAR_DETECTED(pMac))) && fDeferMsg)
+ {
+ // System is in DFS (Learn) mode or awaiting addts response
+ // or if radar is detected, Defer processsing this message
+ if (limDeferMsg(pMac, pLimMsg) != TX_SUCCESS)
+ {
+#ifdef WLAN_DEBUG
+ pMac->lim.numSme++;
+#endif
+ PELOGE(limLog(pMac, LOGE, FL("Unable to Defer message(0x%X) limSmeState %d (prev sme state %d) sysRole %d mlm state %d (prev mlm state %d)\n"),
+ pLimMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
+ pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
+ limLogSessionStates(pMac);
+ limPrintMsgName(pMac, LOGE, pLimMsg->type);
+ // Release body
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pLimMsg->bodyptr);
+ }
+ }
+ else
+ {
+ if(fRspReqd)
+ {
+ // These messages are from HDD
+ // Since these requests may also be generated
+ // internally within LIM module, need to
+ // distinquish and send response to host
+ pMac->lim.gLimRspReqd = eANI_BOOLEAN_TRUE;
+ }
+#ifdef WLAN_DEBUG
+ pMac->lim.numSme++;
+#endif
+ if(limProcessSmeReqMessages(pMac, pLimMsg))
+ {
+ // Release body
+ // limProcessSmeReqMessage consumed the buffer. We can free it.
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pLimMsg->bodyptr);
+ }
+ }
+}
+
+void
+handleHTCapabilityandHTInfo(struct sAniSirGlobal *pMac)
+{
+ tSirMacHTCapabilityInfo macHTCapabilityInfo;
+ tSirMacHTParametersInfo macHTParametersInfo;
+ tSirMacHTInfoField1 macHTInfoField1;
+ tSirMacHTInfoField2 macHTInfoField2;
+ tSirMacHTInfoField3 macHTInfoField3;
+ tANI_U32 cfgValue;
+ tANI_U8 *ptr;
+ tpPESession psessionEntry = &pMac->lim.gpSession[0];//TBD-RAJESH HOW TO GET sessionEntry?????
+
+ pMac->lim.htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
+
+
+
+ // Get HT Capabilities
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &cfgValue) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_CAP_INFO value\n"));
+ return ;
+ }
+ ptr = (tANI_U8 *) &macHTCapabilityInfo;
+ *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
+ pMac->lim.gHTLsigTXOPProtection = (tANI_U8)macHTCapabilityInfo.lsigTXOPProtection;
+ pMac->lim.gHTMIMOPSState = (tSirMacHTMIMOPowerSaveState) macHTCapabilityInfo.mimoPowerSave;
+ pMac->lim.gHTGreenfield = (tANI_U8)macHTCapabilityInfo.greenField;
+ pMac->lim.gHTMaxAmsduLength = (tANI_U8)macHTCapabilityInfo.maximalAMSDUsize;
+ pMac->lim.gHTShortGI20Mhz = (tANI_U8)macHTCapabilityInfo.shortGI20MHz;
+ pMac->lim.gHTShortGI40Mhz = (tANI_U8)macHTCapabilityInfo.shortGI40MHz;
+ pMac->lim.gHTSupportedChannelWidthSet = (tANI_U8)macHTCapabilityInfo.supportedChannelWidthSet;
+ pMac->lim.gHTPSMPSupport = (tANI_U8)macHTCapabilityInfo.psmp;
+ pMac->lim.gHTDsssCckRate40MHzSupport = (tANI_U8)macHTCapabilityInfo.dsssCckMode40MHz;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &cfgValue) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_PARAM_INFO value\n"));
+ return ;
+ }
+ ptr = (tANI_U8 *) &macHTParametersInfo;
+ *ptr = (tANI_U8) (cfgValue & 0xff);
+ pMac->lim.gHTAMpduDensity = (tANI_U8)macHTParametersInfo.mpduDensity;
+ pMac->lim.gHTMaxRxAMpduFactor = (tANI_U8)macHTParametersInfo.maxRxAMPDUFactor;
+
+ // Get HT IE Info
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &cfgValue) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD1 value\n"));
+ return ;
+ }
+ ptr = (tANI_U8 *) &macHTInfoField1;
+ *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
+ pMac->lim.gHTServiceIntervalGranularity = (tANI_U8)macHTInfoField1.serviceIntervalGranularity;
+ pMac->lim.gHTControlledAccessOnly = (tANI_U8)macHTInfoField1.controlledAccessOnly;
+ pMac->lim.gHTRifsMode = (tANI_U8)macHTInfoField1.rifsMode;
+ pMac->lim.gHTRecommendedTxWidthSet = (tANI_U8)macHTInfoField1.recommendedTxWidthSet;
+ pMac->lim.gHTSecondaryChannelOffset = (tSirMacHTSecondaryChannelOffset)macHTInfoField1.secondaryChannelOffset;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD2, &cfgValue) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD2 value\n"));
+ return ;
+ }
+ ptr = (tANI_U8 *) &macHTInfoField2;
+ *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
+ pMac->lim.gHTOperMode = (tSirMacHTOperatingMode) macHTInfoField2.opMode;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD3, &cfgValue) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD3 value\n"));
+ return ;
+ }
+ ptr = (tANI_U8 *) &macHTInfoField3;
+ *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
+ pMac->lim.gHTPCOActive = (tANI_U8)macHTInfoField3.pcoActive;
+ pMac->lim.gHTPCOPhase = (tANI_U8)macHTInfoField3.pcoPhase;
+ psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = (tANI_U8)macHTInfoField3.lsigTXOPProtectionFullSupport;
+ pMac->lim.gHTSecondaryBeacon = (tANI_U8)macHTInfoField3.secondaryBeacon;
+ pMac->lim.gHTDualCTSProtection = (tANI_U8)macHTInfoField3.dualCTSProtection;
+ pMac->lim.gHTSTBCBasicMCS = (tANI_U8)macHTInfoField3.basicSTBCMCS;
+}
+
+void limLogSessionStates(tpAniSirGlobal pMac)
+{
+#ifdef WLAN_DEBUG
+ int i;
+
+ for(i = 0; i < pMac->lim.maxBssId; i++)
+ {
+ if(pMac->lim.gpSession[i].valid)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Session[%d] sysRole(%d) limSmeState %d (prev sme state %d) mlm state %d (prev mlm state %d)\n"),
+ i, pMac->lim.gpSession[i].limSystemRole, pMac->lim.gpSession[i].limSmeState,
+ pMac->lim.gpSession[i].limPrevSmeState, pMac->lim.gpSession[i].limMlmState,
+ pMac->lim.gpSession[i].limPrevMlmState);)
+ }
+ }
+#endif //ifdef WLAN_DEBUG
+}
diff --git a/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c b/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c
new file mode 100644
index 0000000..ade531d
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c
@@ -0,0 +1,4367 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limProcessMlmMessages.cc contains the code
+ * for processing MLM request messages.
+ * Author: Chandra Modumudi
+ * Date: 02/12/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+#include "palTypes.h"
+#ifdef ANI_PRODUCT_TYPE_AP
+#include "wniCfgAp.h"
+#else
+#include "wniCfgSta.h"
+#endif
+#include "aniGlobal.h"
+#include "sirApi.h"
+#include "sirParams.h"
+#include "cfgApi.h"
+
+#include "schApi.h"
+#include "utilsApi.h"
+#include "limUtils.h"
+#include "limAssocUtils.h"
+#include "limPropExtsUtils.h"
+#include "limSecurityUtils.h"
+#include "limSendMessages.h"
+#include "pmmApi.h"
+#include "limSendMessages.h"
+//#include "limSessionUtils.h"
+#include "limSessionUtils.h"
+#ifdef WLAN_FEATURE_VOWIFI_11R
+#include <limFT.h>
+#endif
+
+
+
+// MLM REQ processing function templates
+static void limProcessMlmStartReq(tpAniSirGlobal, tANI_U32 *);
+static void limProcessMlmScanReq(tpAniSirGlobal, tANI_U32 *);
+static void limProcessMlmJoinReq(tpAniSirGlobal, tANI_U32 *);
+static void limProcessMlmAuthReq(tpAniSirGlobal, tANI_U32 *);
+static void limProcessMlmAssocReq(tpAniSirGlobal, tANI_U32 *);
+static void limProcessMlmReassocReq(tpAniSirGlobal, tANI_U32 *);
+static void limProcessMlmDisassocReq(tpAniSirGlobal, tANI_U32 *);
+static void limProcessMlmDeauthReq(tpAniSirGlobal, tANI_U32 *);
+static void limProcessMlmSetKeysReq(tpAniSirGlobal, tANI_U32 *);
+
+static void limProcessMlmAddBAReq( tpAniSirGlobal, tANI_U32 * );
+static void limProcessMlmAddBARsp( tpAniSirGlobal, tANI_U32 * );
+static void limProcessMlmDelBAReq( tpAniSirGlobal, tANI_U32 * );
+
+// MLM Timeout event handler templates
+static void limProcessMinChannelTimeout(tpAniSirGlobal);
+static void limProcessMaxChannelTimeout(tpAniSirGlobal);
+static void limProcessPeriodicProbeReqTimer(tpAniSirGlobal pMac);
+static void limProcessJoinFailureTimeout(tpAniSirGlobal);
+static void limProcessAuthFailureTimeout(tpAniSirGlobal);
+static void limProcessAuthRspTimeout(tpAniSirGlobal, tANI_U32);
+static void limProcessAssocFailureTimeout(tpAniSirGlobal, tANI_U32);
+
+static void limProcessMlmRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 * pMsgBuf);
+void
+limSetChannel(tpAniSirGlobal pMac, tANI_U32 titanHtcap, tANI_U8 channel, tPowerdBm maxTxPower, tANI_U8 peSessionId);
+
+
+/*
+ * determine the secondary channel state for hal
+ */
+static ePhyChanBondState
+mlm_get_ext_chnl(
+ tpAniSirGlobal pMac,
+ tAniCBSecondaryMode chnl)
+{
+ if (chnl == eANI_CB_SECONDARY_UP)
+ return PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
+ if (chnl == eANI_CB_SECONDARY_DOWN)
+ return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
+ return PHY_SINGLE_CHANNEL_CENTERED;
+
+}
+
+
+#define IS_MLM_SCAN_REQ_BACKGROUND_SCAN_AGGRESSIVE(pMac) (pMac->lim.gpLimMlmScanReq->backgroundScanMode == eSIR_AGGRESSIVE_BACKGROUND_SCAN)
+
+
+/**
+ * limProcessMlmReqMessages()
+ *
+ *FUNCTION:
+ * This function is called by limPostMlmMessage(). This
+ * function handles MLM primitives invoked by SME.
+ *
+ *LOGIC:
+ * Depending on the message type, corresponding function will be
+ * called.
+ *
+ *ASSUMPTIONS:
+ * 1. Upon receiving Beacon in WT_JOIN_STATE, MLM module invokes
+ * APIs exposed by Beacon Processing module for setting parameters
+ * at MAC hardware.
+ * 2. If attempt to Reassociate with an AP fails, link with current
+ * AP is restored back.
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param msgType Indicates the MLM primitive message type
+ * @param *pMsgBuf A pointer to the MLM message buffer
+ *
+ * @return None
+ */
+
+void
+limProcessMlmReqMessages(tpAniSirGlobal pMac, tpSirMsgQ Msg)
+{
+ switch (Msg->type)
+ {
+ case LIM_MLM_START_REQ: limProcessMlmStartReq(pMac, Msg->bodyptr); break;
+ case LIM_MLM_SCAN_REQ: limProcessMlmScanReq(pMac, Msg->bodyptr); break;
+ case LIM_MLM_JOIN_REQ: limProcessMlmJoinReq(pMac, Msg->bodyptr); break;
+ case LIM_MLM_AUTH_REQ: limProcessMlmAuthReq(pMac, Msg->bodyptr); break;
+ case LIM_MLM_ASSOC_REQ: limProcessMlmAssocReq(pMac, Msg->bodyptr); break;
+ case LIM_MLM_REASSOC_REQ: limProcessMlmReassocReq(pMac, Msg->bodyptr); break;
+ case LIM_MLM_DISASSOC_REQ: limProcessMlmDisassocReq(pMac, Msg->bodyptr); break;
+ case LIM_MLM_DEAUTH_REQ: limProcessMlmDeauthReq(pMac, Msg->bodyptr); break;
+ case LIM_MLM_SETKEYS_REQ: limProcessMlmSetKeysReq(pMac, Msg->bodyptr); break;
+ case LIM_MLM_REMOVEKEY_REQ: limProcessMlmRemoveKeyReq(pMac, Msg->bodyptr); break;
+ case SIR_LIM_MIN_CHANNEL_TIMEOUT: limProcessMinChannelTimeout(pMac); break;
+ case SIR_LIM_MAX_CHANNEL_TIMEOUT: limProcessMaxChannelTimeout(pMac); break;
+ case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
+ limProcessPeriodicProbeReqTimer(pMac); break;
+ case SIR_LIM_JOIN_FAIL_TIMEOUT: limProcessJoinFailureTimeout(pMac); break;
+ case SIR_LIM_AUTH_FAIL_TIMEOUT: limProcessAuthFailureTimeout(pMac); break;
+ case SIR_LIM_AUTH_RSP_TIMEOUT: limProcessAuthRspTimeout(pMac, Msg->bodyval); break;
+ case SIR_LIM_ASSOC_FAIL_TIMEOUT: limProcessAssocFailureTimeout(pMac, Msg->bodyval); break;
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:limProcessFTPreauthRspTimeout(pMac); break;
+#endif
+#ifdef WLAN_FEATURE_P2P
+ case SIR_LIM_REMAIN_CHN_TIMEOUT: limProcessRemainOnChnTimeout(pMac); break;
+#endif
+ case LIM_MLM_ADDBA_REQ: limProcessMlmAddBAReq( pMac, Msg->bodyptr ); break;
+ case LIM_MLM_ADDBA_RSP: limProcessMlmAddBARsp( pMac, Msg->bodyptr ); break;
+ case LIM_MLM_DELBA_REQ: limProcessMlmDelBAReq( pMac, Msg->bodyptr ); break;
+ case LIM_MLM_TSPEC_REQ:
+ default:
+ break;
+ } // switch (msgType)
+} /*** end limProcessMlmReqMessages() ***/
+
+
+/**
+ * limSetScanMode()
+ *
+ *FUNCTION:
+ * This function is called to setup system into Scan mode
+ *
+ *LOGIC:
+ * NA
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limSetScanMode(tpAniSirGlobal pMac)
+{
+ tSirLinkTrafficCheck checkTraffic;
+
+ /// Set current scan channel id to the first in the channel list
+ pMac->lim.gLimCurrentScanChannelId = 0;
+
+#ifdef ANI_PRODUCT_TYPE_CLIENT
+ if ( IS_MLM_SCAN_REQ_BACKGROUND_SCAN_AGGRESSIVE(pMac) )
+ checkTraffic = eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN;
+ else
+ checkTraffic = eSIR_CHECK_LINK_TRAFFIC_BEFORE_SCAN;
+#else
+ /* Currently checking the traffic before scan for Linux station. This is because MLM
+ * scan request is not filled as scan is received via Measurement req in Linux. This
+ * should be made as common code for Windows/Linux station once the scan requests are
+ * enabled in Linux
+ * TODO */
+ checkTraffic = eSIR_CHECK_LINK_TRAFFIC_BEFORE_SCAN;
+#endif
+
+ PELOG1(limLog(pMac, LOG1, FL("Calling limSendHalInitScanReq\n"));)
+ limSendHalInitScanReq(pMac, eLIM_HAL_INIT_SCAN_WAIT_STATE, checkTraffic);
+
+ return ;
+} /*** end limSetScanMode() ***/
+
+//WLAN_SUSPEND_LINK Related
+
+/* limIsLinkSuspended()
+ *
+ *FUNCTION:
+ * This function returns is link is suspended or not.
+ *
+ *LOGIC:
+ * Since Suspen link uses init scan, it just returns
+ * gLimSystemInScanLearnMode flag.
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+tANI_U8
+limIsLinkSuspended(tpAniSirGlobal pMac)
+{
+ return pMac->lim.gLimSystemInScanLearnMode;
+}
+/**
+ * limSuspendLink()
+ *
+ *FUNCTION:
+ * This function is called to suspend traffic. Internally this function uses WDA_INIT_SCAN_REQ.
+ *
+ *LOGIC:
+ * NA
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param trafficCheck - Takes value from enum tSirLinkTrafficCheck.
+ * @param callback - Callback function to be called after suspending the link.
+ * @param data - Pointer to any buffer that will be passed to callback.
+ * @return None
+ */
+void
+limSuspendLink(tpAniSirGlobal pMac, tSirLinkTrafficCheck trafficCheck, SUSPEND_RESUME_LINK_CALLBACK callback, tANI_U32 *data)
+{
+ if( NULL == callback )
+ {
+ limLog( pMac, LOGE, "%s:%d: Invalid parameters\n", __FUNCTION__, __LINE__ );
+ return;
+ }
+
+ if( pMac->lim.gpLimSuspendCallback )
+ {
+ limLog( pMac, LOGE, "%s:%d: gLimSuspendLink callback is not NULL...something is wrong\n", __FUNCTION__, __LINE__ );
+ callback( pMac, eHAL_STATUS_FAILURE, data );
+ return;
+ }
+
+ pMac->lim.gLimSystemInScanLearnMode = 1;
+ pMac->lim.gpLimSuspendCallback = callback;
+ pMac->lim.gpLimSuspendData = data;
+ limSendHalInitScanReq(pMac, eLIM_HAL_SUSPEND_LINK_WAIT_STATE, trafficCheck );
+}
+
+/**
+ * limResumeLink()
+ *
+ *FUNCTION:
+ * This function is called to Resume traffic after a suspend. Internally this function uses WDA_FINISH_SCAN_REQ.
+ *
+ *LOGIC:
+ * NA
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param callback - Callback function to be called after Resuming the link.
+ * @param data - Pointer to any buffer that will be passed to callback.
+ * @return None
+ */
+void
+limResumeLink(tpAniSirGlobal pMac, SUSPEND_RESUME_LINK_CALLBACK callback, tANI_U32 *data)
+{
+ if( NULL == callback )
+ {
+ limLog( pMac, LOGE, "%s:%d: Invalid parameters\n", __FUNCTION__, __LINE__ );
+ return;
+ }
+
+ if( pMac->lim.gpLimResumeCallback )
+ {
+ limLog( pMac, LOGE, "%s:%d: gLimResumeLink callback is not NULL...something is wrong\n", __FUNCTION__, __LINE__ );
+ callback( pMac, eHAL_STATUS_FAILURE, data );
+ return;
+ }
+
+ pMac->lim.gpLimResumeCallback = callback;
+ pMac->lim.gpLimResumeData = data;
+ limSendHalFinishScanReq(pMac, eLIM_HAL_RESUME_LINK_WAIT_STATE );
+}
+//end WLAN_SUSPEND_LINK Related
+
+
+/**
+ *
+ * limChangeChannelWithCallback()
+ *
+ * FUNCTION:
+ * This function is called to change channel and perform off channel operation
+ * if required. The caller registers a callback to be called at the end of the
+ * channel change.
+ *
+ */
+void
+limChangeChannelWithCallback(tpAniSirGlobal pMac, tANI_U8 newChannel,
+ CHANGE_CHANNEL_CALLBACK callback,
+ tANI_U32 *cbdata, tpPESession psessionEntry)
+{
+ // Sanity checks for the current and new channel
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, "Switching channel to %d\n", newChannel);)
+#endif
+ psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
+
+ pMac->lim.gpchangeChannelCallback = callback;
+ pMac->lim.gpchangeChannelData = cbdata;
+
+ limSendSwitchChnlParams(pMac, newChannel,
+ eHT_SECONDARY_CHANNEL_OFFSET_NONE,
+ psessionEntry->maxTxPower, psessionEntry->peSessionId);
+
+ return;
+}
+
+
+/**
+ * limContinuePostChannelScan()
+ *
+ *FUNCTION:
+ * This function is called to scan the current channel.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ *
+ * @return None
+ */
+
+void limContinuePostChannelScan(tpAniSirGlobal pMac)
+{
+ tANI_U8 channelNum;
+ tANI_U8 handleError = 0;
+ tANI_U8 i = 0;
+ tSirRetStatus status = eSIR_SUCCESS;
+
+ if( pMac->lim.abortScan || (NULL == pMac->lim.gpLimMlmScanReq ) ||
+ (pMac->lim.gLimCurrentScanChannelId >
+ (tANI_U32)(pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1)))
+ {
+ pMac->lim.abortScan = 0;
+ limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
+ limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
+ //Set the resume channel to Any valid channel (invalid).
+ //This will instruct HAL to set it to any previous valid channel.
+ peSetResumeChannel(pMac, 0, 0);
+
+ limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
+ return;
+ }
+
+ channelNum = limGetCurrentScanChannel(pMac);
+ if ((pMac->lim.gpLimMlmScanReq->scanType == eSIR_ACTIVE_SCAN) &&
+ (limActiveScanAllowed(pMac, channelNum)))
+ {
+ TX_TIMER *periodicScanTimer;
+ PELOG2(limLog(pMac, LOG2, FL("ACTIVE Scan chan %d, sending probe\n"), channelNum);)
+
+ do
+ {
+ /* Prepare and send Probe Request frame for all the SSIDs present in the saved MLM
+ */
+
+ PELOGE(limLog(pMac, LOG1, FL("sending ProbeReq number %d, for SSID %s on channel: %d\n"),
+ i, pMac->lim.gpLimMlmScanReq->ssId[i].ssId, channelNum);)
+ // include additional IE if there is
+ status = limSendProbeReqMgmtFrame( pMac, &pMac->lim.gpLimMlmScanReq->ssId[i],
+ pMac->lim.gpLimMlmScanReq->bssId, channelNum, pMac->lim.gSelfMacAddr,
+ pMac->lim.gpLimMlmScanReq->dot11mode,
+ pMac->lim.gpLimMlmScanReq->uIEFieldLen,
+ (tANI_U8 *)(pMac->lim.gpLimMlmScanReq)+pMac->lim.gpLimMlmScanReq->uIEFieldOffset);
+
+ if ( status != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("send ProbeReq failed for SSID %s on channel: %d\n"),
+ pMac->lim.gpLimMlmScanReq->ssId[i].ssId, channelNum);)
+ limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
+ limSendHalEndScanReq(pMac, channelNum, eLIM_HAL_END_SCAN_WAIT_STATE);
+ return;
+ }
+ i++;
+ } while (i < pMac->lim.gpLimMlmScanReq->numSsid);
+
+ {
+#if defined WLAN_FEATURE_VOWIFI
+ //If minChannelTime is set to zero, SME is requesting scan to not use min channel timer.
+ //This is used in 11k to request for beacon measurement request with a fixed duration in
+ //max channel time.
+ if( pMac->lim.gpLimMlmScanReq->minChannelTime != 0 )
+ {
+#endif
+ /// TXP has sent Probe Request
+ /// Activate minChannelTimer
+ limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
+
+#ifdef GEN6_TODO
+ /* revisit this piece of code to assign the appropriate sessionId below
+ * priority - LOW/might not be needed
+ */
+ pMac->lim.limTimers.gLimMinChannelTimer.sessionId = sessionId;
+#endif
+
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_MIN_CHANNEL_TIMER));
+
+ if (tx_timer_activate(&pMac->lim.limTimers.gLimMinChannelTimer) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("could not start min channel timer\n"));
+ return;
+ }
+
+ // Initialize max timer too
+ limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
+#if defined WLAN_FEATURE_VOWIFI
+ }
+ else
+ {
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, "Min channel time == 0, Use only max chan timer\n" );)
+#endif
+ //No Need to start Min channel timer. Start Max Channel timer.
+ limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
+ if (tx_timer_activate(&pMac->lim.limTimers.gLimMaxChannelTimer)
+ == TX_TIMER_ERROR)
+ {
+ /// Could not activate max channel timer.
+ // Log error
+ limLog(pMac,LOGP, FL("could not start max channel timer\n"));
+ return;
+ }
+
+ }
+#endif
+ }
+ /* Start peridic timer which will trigger probe req based on min/max
+ channel timer */
+ periodicScanTimer = &pMac->lim.limTimers.gLimPeriodicProbeReqTimer;
+ if (tx_timer_activate(periodicScanTimer) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("could not start periodic probe req "
+ "timer\n"));
+ return;
+ }
+ periodicScanTimer->sessionId = channelNum;
+ }
+ else
+ {
+ tANI_U32 val;
+ PELOG2(limLog(pMac, LOG2, FL("START PASSIVE Scan chan %d\n"), channelNum);)
+
+ /// Passive Scanning. Activate maxChannelTimer
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_MAX_CHANNEL_TIMER));
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer)
+ != TX_SUCCESS)
+ {
+ // Could not deactivate max channel timer.
+ // Log error
+ limLog(pMac, LOGP, FL("Unable to deactivate max channel timer\n"));
+ return;
+ }
+ else
+ {
+ if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME,
+ &val) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get max channel value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP, FL("could not retrieve passive max channel value\n"));
+ return;
+ }
+ else
+ {
+ tANI_U32 val1 = 0;
+
+ val = SYS_MS_TO_TICKS(val);
+#ifdef ANI_PRODUCT_TYPE_CLIENT
+ // If a background was triggered via Quiet BSS,
+ // then we need to adjust the MIN and MAX channel
+ // timer's accordingly to the Quiet duration that
+ // was specified
+ if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
+ pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
+ {
+ // gLimQuietDuration is already cached in units of
+ // system ticks. No conversion is reqd...
+ val1 = pMac->lim.gLimSpecMgmt.quietDuration;
+ }
+ else
+ {
+ val1 = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTime);
+ }
+#endif
+ //Pick the longer stay time
+ val = (val > val1) ? val : val1;
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_MAX_CHANNEL_TIMER));
+ if (tx_timer_change(&pMac->lim.limTimers.gLimMaxChannelTimer,
+ val, 0) != TX_SUCCESS)
+ {
+ // Could not change max channel timer.
+ // Log error
+ limLog(pMac, LOGP, FL("Unable to change max channel timer\n"));
+ return;
+ }
+ else if (tx_timer_activate(&pMac->lim.limTimers.gLimMaxChannelTimer) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("could not start max channel timer\n"));
+ return;
+ }
+
+ }
+ }
+ // Wait for Beacons to arrive
+ } // if (pMac->lim.gLimMlmScanReq->scanType == eSIR_ACTIVE_SCAN)
+
+ if( handleError )
+ {
+ //
+ // FIXME - With this, LIM/SoftMAC will try and recover
+ // state, but eWNI_SME_SCAN_CNF maybe reporting an
+ // incorrect status back to the SME. Some of the possible
+ // errors are:
+ // eSIR_SME_HAL_SCAN_INIT_FAILED
+ // eSIR_SME_RESOURCES_UNAVAILABLE
+ //
+ //Set the resume channel to Any valid channel (invalid).
+ //This will instruct HAL to set it to any previous valid channel.
+ peSetResumeChannel(pMac, 0, 0);
+ limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE );
+ //limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
+ }
+ else
+ {
+ limAddScanChannelInfo(pMac, channelNum);
+ }
+
+ return;
+}
+
+
+
+
+/*
+* Creates a Raw frame to be sent before every Scan, if required.
+* If only infra link is active (mlmState = Link Estb), then send Data Null
+* If only BT-AMP-AP link is active(mlmState = BSS_STARTED), then send CTS2Self frame.
+* If only BT-AMP-STA link is active(mlmState = BSS_STARTED or Link Est) then send CTS2Self
+* If Only IBSS link is active, then send CTS2Self
+* for concurrent scenario: Infra+BT or Infra+IBSS, always send CTS2Self, no need to send Data Null
+*
+*/
+static void __limCreateInitScanRawFrame(tpAniSirGlobal pMac,
+ tpInitScanParams pInitScanParam)
+{
+ tANI_U8 i;
+ pInitScanParam->scanEntry.activeBSScnt = 0;
+
+ /* Don't send CTS to self as we have issue with BTQM queues where BTQM can
+ * not handle transmition of CTS2self frames. Sending CTS 2 self at this
+ * juncture also doesn't serve much purpose as probe request frames go out
+ * immediately, No need to notify BSS in IBSS case.
+ * */
+
+ for(i =0; i < pMac->lim.maxBssId; i++)
+ {
+ if(pMac->lim.gpSession[i].valid == TRUE)
+ {
+ if(pMac->lim.gpSession[i].limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
+ {
+ if ((pMac->lim.gpSession[i].limSystemRole != eLIM_BT_AMP_STA_ROLE) &&
+ (pInitScanParam->scanEntry.activeBSScnt < HAL_NUM_BSSID))
+ {
+ pInitScanParam->scanEntry.bssIdx[pInitScanParam->scanEntry.activeBSScnt]
+ = pMac->lim.gpSession[i].bssIdx;
+ pInitScanParam->scanEntry.activeBSScnt++;
+
+ }
+ }
+#ifdef WLAN_FEATURE_P2P
+ else if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
+ && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
+ )
+ {
+ pInitScanParam->useNoA = TRUE;
+ }
+#endif
+ }
+ }
+ if (pInitScanParam->scanEntry.activeBSScnt)
+ {
+ pInitScanParam->notifyBss = TRUE;
+ pInitScanParam->frameType = SIR_MAC_DATA_FRAME;
+ pInitScanParam->frameLength = 0;
+ }
+}
+
+/*
+* Creates a Raw frame to be sent during finish scan, if required.
+* Send data null frame, only when there is just one session active and that session is
+* in 'link Estb' state.
+* if more than one session is active, don't send any frame.
+* for concurrent scenario: Infra+BT or Infra+IBSS, no need to send Data Null
+*
+*/
+static void __limCreateFinishScanRawFrame(tpAniSirGlobal pMac,
+ tpFinishScanParams pFinishScanParam)
+{
+ tANI_U8 i;
+ pFinishScanParam->scanEntry.activeBSScnt = 0;
+
+ for(i =0; i < pMac->lim.maxBssId; i++)
+ {
+ if(pMac->lim.gpSession[i].valid == TRUE)
+ {
+ if(pMac->lim.gpSession[i].limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
+ {
+ //BT-STA can either be in LINK-ESTB state or BSS_STARTED State
+ //for BT, need to send CTS2Self
+ if ((pMac->lim.gpSession[i].limSystemRole != eLIM_BT_AMP_STA_ROLE) &&
+ (pFinishScanParam->scanEntry.activeBSScnt < HAL_NUM_BSSID))
+ {
+ pFinishScanParam->scanEntry.bssIdx[pFinishScanParam->scanEntry.activeBSScnt]
+ = pMac->lim.gpSession[i].bssIdx;
+ pFinishScanParam->scanEntry.activeBSScnt++;
+ }
+ }
+ }
+ }
+
+ if (pFinishScanParam->scanEntry.activeBSScnt)
+ {
+ pFinishScanParam->notifyBss = TRUE;
+ pFinishScanParam->frameType = SIR_MAC_DATA_FRAME;
+ pFinishScanParam->frameLength = 0;
+ }
+}
+
+void
+limSendHalInitScanReq(tpAniSirGlobal pMac, tLimLimHalScanState nextState, tSirLinkTrafficCheck trafficCheck)
+{
+
+
+ tSirMsgQ msg;
+ tpInitScanParams pInitScanParam;
+ tSirRetStatus rc = eSIR_SUCCESS;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pInitScanParam,
+ sizeof(*pInitScanParam)))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("palAllocateMemory() failed\n"));)
+ goto error;
+ }
+
+ /*Initialize the pInitScanParam with 0*/
+ palZeroMemory( pMac->hHdd, (tANI_U8 *)pInitScanParam, sizeof(*pInitScanParam));
+
+ msg.type = WDA_INIT_SCAN_REQ;
+ msg.bodyptr = pInitScanParam;
+ msg.bodyval = 0;
+
+ palZeroMemory( pMac->hHdd, (tANI_U8 *)&pInitScanParam->macMgmtHdr, sizeof(tSirMacMgmtHdr));
+ if (nextState == eLIM_HAL_INIT_LEARN_WAIT_STATE)
+ {
+ pInitScanParam->notifyBss = TRUE;
+ pInitScanParam->notifyHost = FALSE;
+ pInitScanParam->scanMode = eHAL_SYS_MODE_LEARN;
+
+#if defined(ANI_AP_CLIENT_SDK)
+ if (GET_LIM_SYSTEM_ROLE(pMac) == eLIM_STA_ROLE)
+ {
+ pInitScanParam->frameType = SIR_MAC_DATA_NULL;
+ // We need to inform the AP only when we are
+ // in the LINK_ESTABLISHED state
+ if( eLIM_SME_LINK_EST_WT_SCAN_STATE != pMac->lim.gLimSmeState )
+ {
+ pInitScanParam->notifyBss = FALSE;
+ // FIXME - Handle this one carefully
+ pInitScanParam->notifyHost = FALSE;
+ }
+ __limCreateInitScanRawFrame(pMac, pInitScanParam);
+ pInitScanParam->checkLinkTraffic = trafficCheck;
+ }
+ else
+#endif
+ {
+ pInitScanParam->frameType = SIR_MAC_CTRL_CTS;
+ __limCreateInitScanRawFrame(pMac, pInitScanParam);
+ pInitScanParam->checkLinkTraffic = trafficCheck;
+ }
+
+#if (defined(ANI_PRODUCT_TYPE_AP) ||defined(ANI_PRODUCT_TYPE_AP_SDK))
+ /* Currently using the AP's scanDuration values for Linux station also. This should
+ * be revisited if this needs to changed depending on AP or Station */
+ {
+ if (pMac->lim.gpLimMeasReq->measControl.longChannelScanPeriodicity &&
+ (pMac->lim.gLimMeasParams.shortDurationCount ==
+ pMac->lim.gpLimMeasReq->measControl.longChannelScanPeriodicity))
+ {
+#ifdef ANI_AP_SDK
+ pInitScanParam->scanDuration = (tANI_U16)pMac->lim.gLimScanDurationConvert.longChannelScanDuration_tick;
+#else
+ pInitScanParam->scanDuration = (tANI_U16)pMac->lim.gpLimMeasReq->measDuration.longChannelScanDuration;
+#endif /* ANI_AP_SDK */
+ }
+ else
+ {
+#ifdef ANI_AP_SDK
+ pInitScanParam->scanDuration = pMac->lim.gLimScanDurationConvert.shortChannelScanDuration_tick;
+#else
+ pInitScanParam->scanDuration = (tANI_U16)pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration;
+#endif /* ANI_AP_SDK */
+ }
+ }
+#endif //#if (defined(ANI_PRODUCT_TYPE_AP) ||defined(ANI_PRODUCT_TYPE_AP_SDK))
+ }
+ else
+ {
+ if(nextState == eLIM_HAL_SUSPEND_LINK_WAIT_STATE)
+ {
+ pInitScanParam->scanMode = eHAL_SYS_MODE_SUSPEND_LINK;
+ }
+ else
+ {
+ pInitScanParam->scanMode = eHAL_SYS_MODE_SCAN;
+ }
+ __limCreateInitScanRawFrame(pMac, pInitScanParam);
+#ifdef WLAN_FEATURE_P2P
+ if (pInitScanParam->useNoA)
+ {
+ pInitScanParam->scanDuration = pMac->lim.gTotalScanDuration;
+ }
+#endif
+ /* Inform HAL whether it should check for traffic on the link
+ * prior to performing a background scan
+ */
+ pInitScanParam->checkLinkTraffic = trafficCheck;
+ }
+
+ pMac->lim.gLimHalScanState = nextState;
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+ MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+
+ rc = wdaPostCtrlMsg(pMac, &msg);
+ if (rc == eSIR_SUCCESS) {
+ PELOG3(limLog(pMac, LOG3, FL("wdaPostCtrlMsg() return eSIR_SUCCESS pMac=%x nextState=%d\n"),
+ pMac, pMac->lim.gLimHalScanState);)
+ return;
+ }
+
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+ palFreeMemory(pMac->hHdd, (void *)pInitScanParam);
+ PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg failed, error code %d\n"), rc);)
+
+error:
+ switch(nextState)
+ {
+ case eLIM_HAL_START_SCAN_WAIT_STATE:
+ limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
+ break;
+
+#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ case eLIM_HAL_START_LEARN_WAIT_STATE:
+ // if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
+ {
+ limRestorePreLearnState(pMac);
+ limReEnableLearnMode(pMac);
+ }
+ break;
+
+#endif
+
+ //WLAN_SUSPEND_LINK Related
+ case eLIM_HAL_SUSPEND_LINK_WAIT_STATE:
+ pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
+ if( pMac->lim.gpLimSuspendCallback )
+ {
+ pMac->lim.gpLimSuspendCallback( pMac, rc, pMac->lim.gpLimSuspendData );
+ pMac->lim.gpLimSuspendCallback = NULL;
+ pMac->lim.gpLimSuspendData = NULL;
+ }
+ pMac->lim.gLimSystemInScanLearnMode = 0;
+ break;
+ //end WLAN_SUSPEND_LINK Related
+ default:
+ break;
+ }
+ pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
+
+ return ;
+}
+
+void
+limSendHalStartScanReq(tpAniSirGlobal pMac, tANI_U8 channelNum, tLimLimHalScanState nextState)
+{
+ tSirMsgQ msg;
+ tpStartScanParams pStartScanParam;
+ tSirRetStatus rc = eSIR_SUCCESS;
+
+ /**
+ * The Start scan request to be sent only if Start Scan is not already requested
+ */
+ if(pMac->lim.gLimHalScanState != eLIM_HAL_START_SCAN_WAIT_STATE)
+ {
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **)&pStartScanParam,
+ sizeof(*pStartScanParam)))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("palAllocateMemory() failed\n"));)
+ goto error;
+ }
+
+ msg.type = WDA_START_SCAN_REQ;
+ msg.bodyptr = pStartScanParam;
+ msg.bodyval = 0;
+ pStartScanParam->status = eHAL_STATUS_SUCCESS;
+ pStartScanParam->scanChannel = (tANI_U8)channelNum;
+
+ pMac->lim.gLimHalScanState = nextState;
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+
+ MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+ PELOGW(limLog(pMac, LOGW, FL("Channel %d\n"), channelNum);)
+
+ rc = wdaPostCtrlMsg(pMac, &msg);
+ if (rc == eSIR_SUCCESS) {
+ return;
+ }
+
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+ palFreeMemory(pMac->hHdd, (void *)pStartScanParam);
+ PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg failed, error code %d\n"), rc);)
+
+error:
+ switch(nextState)
+ {
+ case eLIM_HAL_START_SCAN_WAIT_STATE:
+ limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
+ break;
+
+#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ case eLIM_HAL_START_LEARN_WAIT_STATE:
+ //if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
+ {
+ limRestorePreLearnState(pMac);
+ limReEnableLearnMode(pMac);
+ }
+ break;
+
+#endif
+
+ default:
+ break;
+ }
+ pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
+
+ }
+ else
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Invalid state for START_SCAN_REQ message=%d\n"), pMac->lim.gLimHalScanState);)
+ }
+
+ return;
+}
+
+void limSendHalEndScanReq(tpAniSirGlobal pMac, tANI_U8 channelNum, tLimLimHalScanState nextState)
+{
+ tSirMsgQ msg;
+ tpEndScanParams pEndScanParam;
+ tSirRetStatus rc = eSIR_SUCCESS;
+
+ /**
+ * The End scan request to be sent only if End Scan is not already requested or
+ * Start scan is not already requestd
+ */
+ if((pMac->lim.gLimHalScanState != eLIM_HAL_END_SCAN_WAIT_STATE) &&
+ (pMac->lim.gLimHalScanState != eLIM_HAL_START_SCAN_WAIT_STATE))
+ {
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pEndScanParam,
+ sizeof(*pEndScanParam)))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("palAllocateMemory() failed\n"));)
+ goto error;
+ }
+
+ msg.type = WDA_END_SCAN_REQ;
+ msg.bodyptr = pEndScanParam;
+ msg.bodyval = 0;
+ pEndScanParam->status = eHAL_STATUS_SUCCESS;
+ pEndScanParam->scanChannel = (tANI_U8)channelNum;
+
+ pMac->lim.gLimHalScanState = nextState;
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+ MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+
+ rc = wdaPostCtrlMsg(pMac, &msg);
+ if (rc == eSIR_SUCCESS) {
+ return;
+ }
+
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+ palFreeMemory(pMac->hHdd, (void *)pEndScanParam);
+ PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg failed, error code %d\n"), rc);)
+
+ error:
+ switch(nextState)
+ {
+ case eLIM_HAL_END_SCAN_WAIT_STATE:
+ limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_END_FAILED);
+ break;
+
+#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ case eLIM_HAL_END_LEARN_WAIT_STATE:
+ // if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
+ {
+ limRestorePreLearnState(pMac);
+ limReEnableLearnMode(pMac);
+ }
+ break;
+#endif
+
+ default:
+ PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg Rcvd invalid nextState %d\n"), nextState);)
+ break;
+ }
+ pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
+ PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg failed, error code %d\n"), rc);)
+ }
+ else
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Invalid state for END_SCAN_REQ message=%d\n"), pMac->lim.gLimHalScanState);)
+ }
+
+
+ return;
+}
+
+/**
+ * limSendHalFinishScanReq()
+ *
+ *FUNCTION:
+ * This function is called to finish scan/learn request..
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param nextState - this parameters determines whether this call is for scan or learn
+ *
+ * @return None
+ */
+void limSendHalFinishScanReq(tpAniSirGlobal pMac, tLimLimHalScanState nextState)
+{
+
+ tSirMsgQ msg;
+ tpFinishScanParams pFinishScanParam;
+ tSirRetStatus rc = eSIR_SUCCESS;
+
+ if(pMac->lim.gLimHalScanState == nextState)
+ {
+ /*
+ * PE may receive multiple probe responses, while waiting for HAL to send 'FINISH_SCAN_RSP' message
+ * PE was sending multiple finish scan req messages to HAL
+ * this check will avoid that.
+ * If PE is already waiting for the 'finish_scan_rsp' message from HAL, it will ignore this request.
+ */
+ PELOGW(limLog(pMac, LOGW, FL("Next Scan State is same as the current state: %d \n"), nextState);)
+ return;
+ }
+
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pFinishScanParam,
+ sizeof(*pFinishScanParam)))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("palAllocateMemory() failed\n"));)
+ goto error;
+ }
+
+ msg.type = WDA_FINISH_SCAN_REQ;
+ msg.bodyptr = pFinishScanParam;
+ msg.bodyval = 0;
+ pFinishScanParam->currentOperChannel = peGetResumeChannel(pMac);
+ //TODO: Fix CB State. Get it from session. similar to getChannel.
+ pFinishScanParam->cbState = limGetPhyCBState( pMac );
+ palZeroMemory( pMac->hHdd, (tANI_U8 *)&pFinishScanParam->macMgmtHdr, sizeof(tSirMacMgmtHdr));
+
+ if (nextState == eLIM_HAL_FINISH_LEARN_WAIT_STATE)
+ {
+ //AP - No pkt need to be transmitted
+ pFinishScanParam->scanMode = eHAL_SYS_MODE_LEARN;
+ pFinishScanParam->notifyBss = FALSE;
+ pFinishScanParam->notifyHost = FALSE;
+ pFinishScanParam->frameType = 0;
+ pFinishScanParam->frameLength = 0;
+ pMac->lim.gLimHalScanState = nextState;
+ }
+ else
+ {
+ /* If STA is associated with an AP (ie. STA is in
+ * LINK_ESTABLISHED state), then STA need to inform
+ * the AP via either DATA-NULL
+ */
+ if (nextState == eLIM_HAL_RESUME_LINK_WAIT_STATE)
+ {
+ pFinishScanParam->scanMode = eHAL_SYS_MODE_SUSPEND_LINK;
+ }
+ else
+ {
+ pFinishScanParam->scanMode = eHAL_SYS_MODE_SCAN;
+ }
+ pFinishScanParam->notifyHost = FALSE;
+ __limCreateFinishScanRawFrame(pMac, pFinishScanParam);
+ //WLAN_SUSPEND_LINK Related
+ pMac->lim.gLimHalScanState = nextState;
+ //end WLAN_SUSPEND_LINK Related
+ }
+
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+ MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+
+ rc = wdaPostCtrlMsg(pMac, &msg);
+ if (rc == eSIR_SUCCESS) {
+ return;
+ }
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+ palFreeMemory(pMac->hHdd, (void *)pFinishScanParam);
+ PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg failed, error code %d\n"), rc);)
+
+ error:
+ if(nextState == eLIM_HAL_FINISH_SCAN_WAIT_STATE)
+ limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_FINISH_FAILED);
+ //WLAN_SUSPEND_LINK Related
+ else if ( nextState == eLIM_HAL_RESUME_LINK_WAIT_STATE )
+ {
+ if( pMac->lim.gpLimResumeCallback )
+ {
+ pMac->lim.gpLimResumeCallback( pMac, rc, pMac->lim.gpLimResumeData );
+ pMac->lim.gpLimResumeCallback = NULL;
+ pMac->lim.gpLimResumeData = NULL;
+ pMac->lim.gLimSystemInScanLearnMode = 0;
+ }
+ }
+ //end WLAN_SUSPEND_LINK Related
+ pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
+ return;
+}
+
+/**
+ * limContinueChannelScan()
+ *
+ *FUNCTION:
+ * This function is called by limPerformChannelScan().
+ * This function is called to continue channel scanning when
+ * Beacon/Probe Response frame are received.
+ *
+ *LOGIC:
+ * Scan criteria stored in pMac->lim.gLimMlmScanReq is used
+ * to perform channel scan. In this function MLM sub module
+ * makes channel switch, sends PROBE REQUEST frame in case of
+ * ACTIVE SCANNING, starts min/max channel timers, programs
+ * NAV to probeDelay timer and waits for Beacon/Probe Response.
+ * Once all required channels are scanned, LIM_MLM_SCAN_CNF
+ * primitive is used to send Scan results to SME sub module.
+ *
+ *ASSUMPTIONS:
+ * 1. In case of Active scanning, start MAX channel time iff
+ * MIN channel timer expired and activity is observed on
+ * the channel.
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return None
+ */
+void
+limContinueChannelScan(tpAniSirGlobal pMac)
+{
+ tANI_U8 channelNum;
+
+ PELOG1(limLog(pMac, LOG1, FL("Continue SCAN : chan %d tot %d\n"),
+ pMac->lim.gLimCurrentScanChannelId,
+ pMac->lim.gpLimMlmScanReq->channelList.numChannels);)
+
+ if (pMac->lim.gLimCurrentScanChannelId >
+ (tANI_U32) (pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1)
+ || pMac->lim.abortScan)
+ {
+#ifndef ANI_SNIFFER
+ pMac->lim.abortScan = 0;
+ limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
+ limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
+
+ //Set the resume channel to Any valid channel (invalid).
+ //This will instruct HAL to set it to any previous valid channel.
+ peSetResumeChannel(pMac, 0, 0);
+
+ /// Done scanning all required channels
+ limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
+#endif
+ return;
+ }
+
+ /// Atleast one more channel is to be scanned
+
+ if ((pMac->lim.gLimReturnAfterFirstMatch & 0x40) ||
+ (pMac->lim.gLimReturnAfterFirstMatch & 0x80))
+ {
+ while (pMac->lim.gLimCurrentScanChannelId <=
+ (tANI_U32) (pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1))
+ {
+ if (((limGetCurrentScanChannel(pMac) <= 14) &&
+ pMac->lim.gLim24Band11dScanDone) ||
+ ((limGetCurrentScanChannel(pMac) > 14) &&
+ pMac->lim.gLim50Band11dScanDone))
+ {
+ limLog(pMac, LOGW, FL("skipping chan %d\n"),
+ limGetCurrentScanChannel(pMac));
+ pMac->lim.gLimCurrentScanChannelId++;
+ }
+ else
+ break;
+ }
+
+ if (pMac->lim.gLimCurrentScanChannelId >
+ (tANI_U32) (pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1))
+ {
+ pMac->lim.abortScan = 0;
+ limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
+ limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
+ /// Done scanning all required channels
+ //Set the resume channel to Any valid channel (invalid).
+ //This will instruct HAL to set it to any previous valid channel.
+ peSetResumeChannel(pMac, 0, 0);
+ limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
+ return;
+ }
+ }
+
+ channelNum = limGetCurrentScanChannel(pMac);
+ PELOG2(limLog(pMac, LOG2, FL("Current Channel to be scanned is %d\n"),
+ channelNum);)
+
+ limSendHalStartScanReq(pMac, channelNum, eLIM_HAL_START_SCAN_WAIT_STATE);
+ return;
+} /*** end limContinueChannelScan() ***/
+
+
+
+/**
+ * limRestorePreScanState()
+ *
+ *FUNCTION:
+ * This function is called by limContinueChannelScan()
+ * to restore HW state prior to entering 'scan state'
+ *
+ *LOGIC
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return None
+ */
+void
+limRestorePreScanState(tpAniSirGlobal pMac)
+{
+ int i;
+
+ /// Deactivate MIN/MAX channel timers if running
+ limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
+ limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
+
+ /* Re-activate Heartbeat timers for connected sessions as scan
+ * is done if the DUT is in active mode*/
+ if((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
+ (ePMM_STATE_READY == pMac->pmm.gPmmState))
+ {
+ for(i=0;i<pMac->lim.maxBssId;i++)
+ {
+ if((pMac->lim.gpSession[i].valid == TRUE) &&
+ (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
+ {
+ limReactivateHeartBeatTimer(pMac, peFindSessionBySessionId(pMac,i));
+ }
+ }
+ }
+
+ /**
+ * clean up message queue.
+ * If SME messages, redirect to deferred queue.
+ * The rest will be discarded.
+ */
+ //limCleanupMsgQ(pMac);
+
+ pMac->lim.gLimSystemInScanLearnMode = 0;
+ PELOG1(limLog(pMac, LOG1, FL("Scan ended, took %d tu\n"), (tx_time_get() - pMac->lim.scanStartTime));)
+} /*** limRestorePreScanState() ***/
+
+
+static void
+mlm_add_sta(
+ tpAniSirGlobal pMac,
+ tpAddStaParams pSta,
+ tANI_U8 *pBssid,
+ tANI_U8 htCapable,
+ tpPESession psessionEntry) //psessionEntry may required in future
+{
+ tANI_U32 val;
+ int i;
+
+
+ pSta->staType = STA_ENTRY_SELF; // Identifying self
+
+ palCopyMemory( pMac->hHdd, pSta->bssId, pBssid, sizeof( tSirMacAddr ));
+ palCopyMemory( pMac->hHdd, pSta->staMac, psessionEntry->selfMacAddr, sizeof(tSirMacAddr));
+
+ /* Configuration related parameters to be changed to support BT-AMP */
+
+ if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_LISTEN_INTERVAL, &val ))
+ limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL\n"));
+
+ pSta->listenInterval = (tANI_U16) val;
+
+ if (eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) )
+ limLog(pMac, LOGP, FL("Couldn't get SHORT_PREAMBLE\n"));
+ pSta->shortPreambleSupported = (tANI_U8)val;
+
+ pSta->assocId = 0; // Is SMAC OK with this?
+ pSta->wmmEnabled = 0;
+ pSta->uAPSD = 0;
+ pSta->maxSPLen = 0;
+ pSta->us32MaxAmpduDuration = 0;
+ pSta->maxAmpduSize = 0; // 0: 8k, 1: 16k,2: 32k,3: 64k
+
+
+ if(IS_DOT11_MODE_HT(psessionEntry->dot11mode))
+ {
+ pSta->htCapable = htCapable;
+#ifdef WLAN_SOFTAP_FEATURE
+ pSta->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
+ pSta->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry );
+ pSta->mimoPS = (tSirMacHTMIMOPowerSaveState)limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
+ pSta->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
+ pSta->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
+ pSta->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
+ pSta->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
+ pSta->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
+ pSta->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
+ pSta->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry);
+ pSta->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry);
+#else
+ pSta->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD );
+ pSta->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET );
+ pSta->mimoPS = (tSirMacHTMIMOPowerSaveState)limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE );
+ pSta->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE );
+ pSta->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION );
+ pSta->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA );
+ pSta->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY );
+ pSta->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH );
+ pSta->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ);
+ pSta->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ);
+ pSta->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ);
+
+#endif
+ }
+
+ limPopulateOwnRateSet(pMac, &pSta->supportedRates, NULL, false,psessionEntry);
+ limFillSupportedRatesInfo(pMac, NULL, &pSta->supportedRates,psessionEntry);
+
+ limLog( pMac, LOGE, FL( "GF: %d, ChnlWidth: %d, MimoPS: %d, lsigTXOP: %d, dsssCCK: %d, SGI20: %d, SGI40%d\n") ,
+ pSta->greenFieldCapable, pSta->txChannelWidthSet, pSta->mimoPS, pSta->lsigTxopProtection,
+ pSta->fDsssCckMode40Mhz,pSta->fShortGI20Mhz, pSta->fShortGI40Mhz);
+
+#ifdef WLAN_FEATURE_P2P
+ if (VOS_P2P_GO_MODE == psessionEntry->pePersona)
+ {
+ pSta->p2pCapableSta = 1;
+ }
+#endif
+
+ //Disable BA. It will be set as part of ADDBA negotiation.
+ for( i = 0; i < STACFG_MAX_TC; i++ )
+ {
+ pSta->staTCParams[i].txUseBA = eBA_DISABLE;
+ pSta->staTCParams[i].rxUseBA = eBA_DISABLE;
+ }
+
+}
+
+//
+// New HAL interface - WDA_ADD_BSS_REQ
+// Package WDA_ADD_BSS_REQ to HAL, in order to start a BSS
+//
+tSirResultCodes
+limMlmAddBss (
+ tpAniSirGlobal pMac,
+ tLimMlmStartReq *pMlmStartReq,
+ tpPESession psessionEntry)
+{
+ tSirMsgQ msgQ;
+ tpAddBssParams pAddBssParams = NULL;
+ tANI_U32 retCode;
+
+#ifdef WLAN_SOFTAP_FEATURE
+ tANI_U32 val = 0;
+#endif
+
+ // Package WDA_ADD_BSS_REQ message parameters
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pAddBssParams, sizeof( tAddBssParams )))
+ {
+ limLog( pMac, LOGE, FL( "Unable to PAL allocate memory during ADD_BSS\n" ));
+ // Respond to SME with LIM_MLM_START_CNF
+ return eSIR_SME_HAL_SEND_MESSAGE_FAIL;
+ }
+
+ palZeroMemory(pMac->hHdd, pAddBssParams, sizeof(tAddBssParams));
+
+ // Fill in tAddBssParams members
+ palCopyMemory( pMac->hHdd, pAddBssParams->bssId, pMlmStartReq->bssId,
+ sizeof( tSirMacAddr ));
+
+ // Fill in tAddBssParams selfMacAddr
+ palCopyMemory ( pMac->hHdd, pAddBssParams->selfMacAddr,
+ psessionEntry->selfMacAddr,
+ sizeof( tSirMacAddr ));
+
+ pAddBssParams->bssType = pMlmStartReq->bssType;
+ if ((pMlmStartReq->bssType == eSIR_IBSS_MODE) ||
+ (pMlmStartReq->bssType == eSIR_BTAMP_AP_MODE)||
+ (pMlmStartReq->bssType == eSIR_BTAMP_STA_MODE)) {
+ pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
+ }
+#ifdef WLAN_SOFTAP_FEATURE
+ else if (pMlmStartReq->bssType == eSIR_INFRA_AP_MODE){
+#else
+ else{
+#endif
+ pAddBssParams->operMode = BSS_OPERATIONAL_MODE_AP;
+ }
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if( wlan_cfgGetInt ( pMac, WNI_CFG_SHORT_SLOT_TIME, &val ) != eSIR_SME_SUCCESS)
+ {
+ limLog ( pMac, LOGP, FL(" Error : unable to fetch the WNI_CFG_SHORT_SLOT_TIME\n"));
+ palFreeMemory(pMac->hHdd,(void *)pAddBssParams);
+ return eSIR_SME_HAL_SEND_MESSAGE_FAIL;
+ }
+ pAddBssParams->shortSlotTimeSupported = (tANI_U8)val;
+#endif
+
+
+ pAddBssParams->beaconInterval = pMlmStartReq->beaconPeriod;
+ pAddBssParams->dtimPeriod = pMlmStartReq->dtimPeriod;
+ pAddBssParams->cfParamSet.cfpCount = pMlmStartReq->cfParamSet.cfpCount;
+ pAddBssParams->cfParamSet.cfpPeriod = pMlmStartReq->cfParamSet.cfpPeriod;
+ pAddBssParams->cfParamSet.cfpMaxDuration = pMlmStartReq->cfParamSet.cfpMaxDuration;
+ pAddBssParams->cfParamSet.cfpDurRemaining = pMlmStartReq->cfParamSet.cfpDurRemaining;
+
+ pAddBssParams->rateSet.numRates = pMlmStartReq->rateSet.numRates;
+ palCopyMemory( pMac->hHdd, pAddBssParams->rateSet.rate,
+ pMlmStartReq->rateSet.rate, pMlmStartReq->rateSet.numRates );
+
+ pAddBssParams->nwType = pMlmStartReq->nwType;
+
+ pAddBssParams->htCapable = pMlmStartReq->htCapable;
+ pAddBssParams->htOperMode = pMlmStartReq->htOperMode;
+ pAddBssParams->dualCTSProtection = pMlmStartReq->dualCTSProtection;
+ pAddBssParams->txChannelWidthSet = pMlmStartReq->txChannelWidthSet;
+
+ pAddBssParams->currentOperChannel = pMlmStartReq->channelNumber;
+ pAddBssParams->currentExtChannel = mlm_get_ext_chnl(pMac, pMlmStartReq->cbMode);
+
+ /* Update PE sessionId*/
+ pAddBssParams->sessionId = pMlmStartReq->sessionId;
+
+ //Send the SSID to HAL to enable SSID matching for IBSS
+ palCopyMemory( pMac->hHdd, &(pAddBssParams->ssId.ssId),
+ pMlmStartReq->ssId.ssId,
+ pMlmStartReq->ssId.length);
+ pAddBssParams->ssId.length = pMlmStartReq->ssId.length;
+#ifdef WLAN_SOFTAP_FEATURE
+ pAddBssParams->bHiddenSSIDEn = pMlmStartReq->ssidHidden;
+ limLog( pMac, LOGE, FL( "TRYING TO HIDE SSID %d\n" ),pAddBssParams->bHiddenSSIDEn);
+ // CR309183. Disable Proxy Probe Rsp. Host handles Probe Requests. Until FW fixed.
+ pAddBssParams->bProxyProbeRespEn = 0;
+ pAddBssParams->obssProtEnabled = pMlmStartReq->obssProtEnabled;
+
+#endif
+#if defined WLAN_FEATURE_VOWIFI
+ pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
+#endif
+ mlm_add_sta(pMac, &pAddBssParams->staContext,
+ pAddBssParams->bssId, pAddBssParams->htCapable,psessionEntry);
+
+ pAddBssParams->status = eHAL_STATUS_SUCCESS;
+ pAddBssParams->respReqd = 1;
+
+ // Set a new state for MLME
+ psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+ pAddBssParams->halPersona=psessionEntry->pePersona; //pass on the session persona to hal
+
+ pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled;
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+ pAddBssParams->extSetStaKeyParamValid = 0;
+#endif
+
+ //
+ // FIXME_GEN4
+ // A global counter (dialog token) is required to keep track of
+ // all PE <-> HAL communication(s)
+ //
+ msgQ.type = WDA_ADD_BSS_REQ;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pAddBssParams;
+ msgQ.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+
+ limLog( pMac, LOGW, FL( "Sending WDA_ADD_BSS_REQ...\n" ));
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ {
+ limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X\n"), retCode );
+ palFreeMemory(pMac->hHdd,(void *)pAddBssParams);
+ return eSIR_SME_HAL_SEND_MESSAGE_FAIL;
+ }
+
+ return eSIR_SME_SUCCESS;
+}
+
+
+/**
+ * limProcessMlmStartReq()
+ *
+ *FUNCTION:
+ * This function is called to process MLM_START_REQ message
+ * from SME
+ *
+ *LOGIC:
+ * 1) MLME receives LIM_MLM_START_REQ from LIM
+ * 2) MLME sends WDA_ADD_BSS_REQ to HAL
+ * 3) MLME changes state to eLIM_MLM_WT_ADD_BSS_RSP_STATE
+ * MLME now waits for HAL to send WDA_ADD_BSS_RSP
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the MLM message buffer
+ * @return None
+ */
+
+static void
+limProcessMlmStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tLimMlmStartReq *pMlmStartReq;
+ tLimMlmStartCnf mlmStartCnf;
+ tpPESession psessionEntry = NULL;
+
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+
+ pMlmStartReq = (tLimMlmStartReq *) pMsgBuf;
+ if((psessionEntry = peFindSessionBySessionId(pMac,pMlmStartReq->sessionId))==NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ mlmStartCnf.resultCode = eSIR_SME_REFUSED;
+ goto end;
+ }
+
+ if (psessionEntry->limMlmState != eLIM_MLM_IDLE_STATE)
+ {
+ /**
+ * Should not have received Start req in states other than idle.
+ * Return Start confirm with failure code.
+ */
+ PELOGE(limLog(pMac, LOGE, FL("received unexpected MLM_START_REQ in state %X\n"),psessionEntry->limMlmState);)
+ limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
+ mlmStartCnf.resultCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
+ goto end;
+ }
+
+ #if 0
+ if (cfgSetInt(pMac, WNI_CFG_CURRENT_CHANNEL, pMlmStartReq->channelNumber)!= eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("could not set CURRENT_CHANNEL at CFG\n"));
+
+ pMac->lim.gLimCurrentChannelId = pMlmStartReq->channelNumber;
+ #endif //TO SUPPORT BT-AMP
+
+
+ // Update BSSID & SSID at CFG database
+ #if 0 //We are not using the BSSID and SSID from the config file, instead we are reading form the session table
+ if (cfgSetStr(pMac, WNI_CFG_BSSID, (tANI_U8 *) pMlmStartReq->bssId, sizeof(tSirMacAddr))
+ != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("could not update BSSID at CFG\n"));
+
+
+
+ palCopyMemory( pMac->hHdd, pMac->lim.gLimCurrentBssId,
+ pMlmStartReq->bssId,
+ sizeof(tSirMacAddr));
+ #endif //TO SUPPORT BT-AMP
+
+ #if 0
+ if (cfgSetStr(pMac, WNI_CFG_SSID, (tANI_U8 *) &pMlmStartReq->ssId.ssId, pMlmStartReq->ssId.length)
+ != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("could not update SSID at CFG\n"));
+ #endif //To SUPPORT BT-AMP
+
+
+ // pMac->lim.gLimCurrentSSID.length = pMlmStartReq->ssId.length;
+
+ #if 0
+ if (cfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET,
+ (tANI_U8 *) &pMac->lim.gpLimStartBssReq->operationalRateSet.rate,
+ pMac->lim.gpLimStartBssReq->operationalRateSet.numRates)
+ != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("could not update Operational Rateset at CFG\n"));
+ #endif //TO SUPPORT BT-AMP
+
+
+#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ if (cfgSetInt(pMac, WNI_CFG_CURRENT_TX_POWER_LEVEL, pMac->lim.gpLimStartBssReq->powerLevel)
+ != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("could not set WNI_CFG_CURRENT_TX_POWER_LEVEL at CFG\n"));
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE
+#if 0 // Periodic timer for remove WPS PBC proble response entry in PE is disbaled now.
+ if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ {
+ if(pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated == eANI_BOOLEAN_FALSE)
+ {
+ if (tx_timer_create(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer,
+ "PS OVERLAP Timer",
+ limWPSOverlapTimerHandler,
+ SIR_LIM_WPS_OVERLAP_TIMEOUT, // expiration_input
+ SYS_MS_TO_TICKS(LIM_WPS_OVERLAP_TIMER_MS), // initial_ticks
+ SYS_MS_TO_TICKS(LIM_WPS_OVERLAP_TIMER_MS), // reschedule_ticks
+ TX_AUTO_ACTIVATE /* TX_NO_ACTIVATE*/) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("failed to create WPS overlap Timer\n"));
+ }
+
+ pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId = pMlmStartReq->sessionId;
+ pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated = eANI_BOOLEAN_TRUE;
+ limLog(pMac, LOGE, FL("Create WPS overlap Timer, session=%d\n"), pMlmStartReq->sessionId);
+
+ if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("tx_timer_activate failed\n"));
+ }
+ }
+ }
+#endif
+#endif
+
+
+
+ mlmStartCnf.resultCode = limMlmAddBss(pMac, pMlmStartReq,psessionEntry);
+
+end:
+ /* Update PE session Id */
+ mlmStartCnf.sessionId = pMlmStartReq->sessionId;
+
+ /// Free up buffer allocated for LimMlmScanReq
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf);
+
+ //
+ // Respond immediately to LIM, only if MLME has not been
+ // successfully able to send WDA_ADD_BSS_REQ to HAL.
+ // Else, LIM_MLM_START_CNF will be sent after receiving
+ // WDA_ADD_BSS_RSP from HAL
+ //
+ if( eSIR_SME_SUCCESS != mlmStartCnf.resultCode )
+ limPostSmeMessage(pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf);
+} /*** limProcessMlmStartReq() ***/
+
+
+/*
+* This function checks if Scan is allowed or not.
+* It checks each session and if any session is not in the normal state,
+* it will return false.
+* Note: BTAMP_STA can be in LINK_EST as well as BSS_STARTED State, so
+* both cases are handled below.
+*/
+
+static tANI_U8 __limMlmScanAllowed(tpAniSirGlobal pMac)
+{
+ int i;
+
+ if(pMac->lim.gLimMlmState != eLIM_SME_IDLE_STATE)
+ {
+ return FALSE;
+ }
+ for(i =0; i < pMac->lim.maxBssId; i++)
+ {
+ if(pMac->lim.gpSession[i].valid == TRUE)
+ {
+ if(!( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) ||
+ (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
+ (pMac->lim.gpSession[i].limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE) )||
+
+ ( ( (pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)||
+ (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
+ (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE) )&&
+ (pMac->lim.gpSession[i].limMlmState == eLIM_MLM_BSS_STARTED_STATE) )
+#ifdef WLAN_FEATURE_P2P
+ || ( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRA_AP_MODE)
+ && ( pMac->lim.gpSession[i].pePersona == VOS_P2P_GO_MODE) )
+ || (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) )
+ && (pMac->lim.gpSession[i].limMlmState == eLIM_MLM_BSS_STARTED_STATE) )
+#endif
+ ))
+ {
+ return FALSE;
+
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+
+
+/**
+ * limProcessMlmScanReq()
+ *
+ *FUNCTION:
+ * This function is called to process MLM_SCAN_REQ message
+ * from SME
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the MLM message buffer
+ * @return None
+ */
+
+static void
+limProcessMlmScanReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tLimMlmScanCnf mlmScanCnf;
+
+ if (pMac->lim.gLimSystemInScanLearnMode)
+ {
+ PELOGE(limLog(pMac, LOGE,
+ FL("Sending START_SCAN from LIM while one req is pending\n"));)
+ return;
+ }
+
+ if(__limMlmScanAllowed(pMac) &&
+ (((tLimMlmScanReq *) pMsgBuf)->channelList.numChannels != 0))
+
+ {
+ /// Hold onto SCAN REQ criteria
+ pMac->lim.gpLimMlmScanReq = (tLimMlmScanReq *) pMsgBuf;
+
+ PELOG3(limLog(pMac, LOG3, FL("Number of channels to scan are %d \n"),
+ pMac->lim.gpLimMlmScanReq->channelList.numChannels);)
+
+ pMac->lim.gLimPrevMlmState = pMac->lim.gLimMlmState;
+
+ if (pMac->lim.gpLimMlmScanReq->scanType == eSIR_ACTIVE_SCAN)
+ pMac->lim.gLimMlmState = eLIM_MLM_WT_PROBE_RESP_STATE;
+ else // eSIR_PASSIVE_SCAN
+ pMac->lim.gLimMlmState = eLIM_MLM_PASSIVE_SCAN_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+ pMac->lim.gLimSystemInScanLearnMode = 1;
+
+#ifdef WLAN_FEATURE_P2P
+ pMac->lim.gTotalScanDuration =
+ pMac->lim.gpLimMlmScanReq->maxChannelTime*
+ pMac->lim.gpLimMlmScanReq->channelList.numChannels;
+#endif
+ limSetScanMode(pMac);
+ }
+ else
+ {
+ /**
+ * Should not have received SCAN req in other states
+ * OR should not have received LIM_MLM_SCAN_REQ with
+ * zero number of channels
+ * Log error
+ */
+ limLog(pMac, LOGW,
+ FL("received unexpected MLM_SCAN_REQ in state %X OR zero number of channels: %X\n"),
+ pMac->lim.gLimMlmState, ((tLimMlmScanReq *) pMsgBuf)->channelList.numChannels);
+ limPrintMlmState(pMac, LOGW, pMac->lim.gLimMlmState);
+
+ /// Free up buffer allocated for
+ /// pMac->lim.gLimMlmScanReq
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf);
+
+ /// Return Scan confirm with INVALID_PARAMETERS
+
+ mlmScanCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
+ mlmScanCnf.scanResultLength = 0;
+ limPostSmeMessage(pMac,
+ LIM_MLM_SCAN_CNF,
+ (tANI_U32 *) &mlmScanCnf);
+ }
+} /*** limProcessMlmScanReq() ***/
+
+
+
+/**
+ * limProcessMlmPostJoinSuspendLink()
+ *
+ *FUNCTION:
+ * This function is called after the suspend link while joining
+ * off channel.
+ *
+ *LOGIC:
+ * Check for suspend state.
+ * If success, proceed with setting link state to recieve the
+ * probe response/beacon from intended AP.
+ * Switch to the APs channel.
+ * On an error case, send the MLM_JOIN_CNF with error status.
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param status status of suspend link.
+ * @param ctx passed while calling suspend link(psessionEntry)
+ * @return None
+ */
+static void
+limProcessMlmPostJoinSuspendLink(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *ctx)
+{
+ tANI_U8 chanNum;
+ tLimMlmJoinCnf mlmJoinCnf;
+ tpPESession psessionEntry = (tpPESession)ctx;
+ tSirLinkState linkState;
+
+ if( eHAL_STATUS_SUCCESS != status )
+ {
+ limLog(pMac, LOGP, FL("Suspend link failed. Not proceeding with join\n"));
+ goto error;
+ }
+ psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
+ psessionEntry->limMlmState = eLIM_MLM_WT_JOIN_BEACON_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+ limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER);
+
+ //assign appropriate sessionId to the timer object
+ pMac->lim.limTimers.gLimJoinFailureTimer.sessionId = psessionEntry->peSessionId;
+
+ linkState = ((psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) ? eSIR_LINK_BTAMP_PREASSOC_STATE : eSIR_LINK_PREASSOC_STATE);
+ limLog(pMac, LOG1, FL("[limProcessMlmJoinReq]: linkState:%d\n"),linkState);
+
+ if (limSetLinkState(pMac, linkState,
+ psessionEntry->pLimMlmJoinReq->bssDescription.bssId,
+ psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
+ {
+ limLog(pMac, LOGE, FL("limSetLinkState to eSIR_LINK_PREASSOC_STATE Failed!!\n"));
+ mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
+ goto error;
+ }
+
+ /** Derive channel from BSS description and store it in the CFG */
+ // chanNum = pMac->lim.gpLimMlmJoinReq->bssDescription.channelId;
+
+ chanNum = psessionEntry->currentOperChannel;
+ //store the channel switch sessionEntry in the lim global var
+ psessionEntry->channelChangeReasonCode = LIM_SWITCH_CHANNEL_JOIN;
+
+ limSetChannel(pMac, psessionEntry->pLimMlmJoinReq->bssDescription.titanHtCaps,
+ chanNum, psessionEntry->maxTxPower, psessionEntry->peSessionId);
+
+ return;
+error:
+ mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ mlmJoinCnf.sessionId = psessionEntry->peSessionId;
+ mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+ limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
+
+}
+
+
+
+/**
+ * limProcessMlmJoinReq()
+ *
+ *FUNCTION:
+ * This function is called to process MLM_JOIN_REQ message
+ * from SME
+ *
+ *LOGIC:
+ * 1) Initialize LIM, HAL, DPH
+ * 2) Configure the BSS for which the JOIN REQ was received
+ * a) Send WDA_ADD_BSS_REQ to HAL -
+ * This will identify the BSS that we are interested in
+ * --AND--
+ * Add a STA entry for the AP (in a STA context)
+ * b) Wait for WDA_ADD_BSS_RSP
+ * c) Send WDA_ADD_STA_REQ to HAL
+ * This will add the "local STA" entry to the STA table
+ * 3) Continue as before, i.e,
+ * a) Send a PROBE REQ
+ * b) Wait for PROBE RSP/BEACON containing the SSID that
+ * we are interested in
+ * c) Then start an AUTH seq
+ * d) Followed by the ASSOC seq
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the MLM message buffer
+ * @return None
+ */
+
+static void
+limProcessMlmJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tLimMlmJoinCnf mlmJoinCnf;
+ tANI_U8 sessionId;
+ tpPESession psessionEntry;
+
+ sessionId = ((tpLimMlmJoinReq)pMsgBuf)->sessionId;
+
+ if((psessionEntry = peFindSessionBySessionId(pMac,sessionId))== NULL)
+ {
+ limLog(pMac, LOGP, FL("session does not exist for given sessionId\n"));
+
+ goto error;
+ }
+
+ if (( (psessionEntry->limSystemRole != eLIM_AP_ROLE ) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE )) &&
+ ( (psessionEntry->limMlmState == eLIM_MLM_IDLE_STATE) ||
+ (psessionEntry->limMlmState == eLIM_MLM_JOINED_STATE)) &&
+ (SIR_MAC_GET_ESS( ((tpLimMlmJoinReq) pMsgBuf)->bssDescription.capabilityInfo) !=
+ SIR_MAC_GET_IBSS( ((tpLimMlmJoinReq) pMsgBuf)->bssDescription.capabilityInfo)))
+ {
+ #if 0
+ if (pMac->lim.gpLimMlmJoinReq)
+ palFreeMemory( pMac->hHdd, pMac->lim.gpLimMlmJoinReq);
+ #endif //TO SUPPORT BT-AMP , review 23sep
+
+ /// Hold onto Join request parameters
+
+ psessionEntry->pLimMlmJoinReq =(tpLimMlmJoinReq) pMsgBuf;
+
+ if( isLimSessionOffChannel(pMac, sessionId) )
+ {
+ //suspend link
+ limSuspendLink(pMac, eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN,
+ limProcessMlmPostJoinSuspendLink, (tANI_U32*)psessionEntry );
+ }
+ else
+ {
+ //No need to suspend link.
+ limProcessMlmPostJoinSuspendLink( pMac, eHAL_STATUS_SUCCESS,
+ (tANI_U32*) psessionEntry );
+ }
+
+ return;
+ }
+ else
+ {
+ /**
+ * Should not have received JOIN req in states other than
+ * Idle state or on AP.
+ * Return join confirm with invalid parameters code.
+ */
+ PELOGE(limLog(pMac, LOGE,
+ FL("Unexpected Join request for role %d state %X\n"),
+ psessionEntry->limSystemRole,
+ psessionEntry->limMlmState);)
+ limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
+
+ limLog(pMac, LOGE, FL("Unexpected Join request for role %d state %X\n"),
+ psessionEntry->limSystemRole, pMac->lim.gLimMlmState);
+ }
+
+error:
+
+
+ mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ mlmJoinCnf.sessionId = sessionId;
+ mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+ limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
+
+
+} /*** limProcessMlmJoinReq() ***/
+
+
+
+/**
+ * limProcessMlmAuthReq()
+ *
+ *FUNCTION:
+ * This function is called to process MLM_AUTH_REQ message
+ * from SME
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the MLM message buffer
+ * @return None
+ */
+
+static void
+limProcessMlmAuthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tANI_U32 numPreAuthContexts;
+ tSirMacAddr currentBssId;
+ tSirMacAuthFrameBody authFrameBody;
+ tLimMlmAuthCnf mlmAuthCnf;
+ struct tLimPreAuthNode *preAuthNode;
+ tpDphHashNode pStaDs;
+ tANI_U8 sessionId;
+ tpPESession psessionEntry;
+
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+
+ pMac->lim.gpLimMlmAuthReq = (tLimMlmAuthReq *) pMsgBuf;
+ sessionId = pMac->lim.gpLimMlmAuthReq->sessionId;
+ if((psessionEntry= peFindSessionBySessionId(pMac,sessionId) )== NULL)
+ {
+ limLog(pMac, LOGP, FL("Session Does not exist for given sessionId\n"));
+ return;
+ }
+
+ /**
+ * Expect Auth request only when:
+ * 1. STA joined/associated with a BSS or
+ * 2. STA is in IBSS mode
+ * and STA is going to authenticate with a unicast
+ * adress and requested authentication algorithm is
+ * supported.
+ */
+ #if 0
+ if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) !=
+ eSIR_SUCCESS)
+ {
+ /// Could not get BSSID from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
+ }
+ #endif //To SuppoRT BT-AMP
+
+ sirCopyMacAddr(currentBssId,psessionEntry->bssId);
+
+ if (((((psessionEntry->limSystemRole== eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
+ ((psessionEntry->limMlmState == eLIM_MLM_JOINED_STATE) ||
+ (psessionEntry->limMlmState ==
+ eLIM_MLM_LINK_ESTABLISHED_STATE))) ||
+ ((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) &&
+ (psessionEntry->limMlmState == eLIM_MLM_BSS_STARTED_STATE))) &&
+ (limIsGroupAddr(pMac->lim.gpLimMlmAuthReq->peerMacAddr)
+ == false) &&
+#ifdef WLAN_SOFTAP_FEATURE
+ (limIsAuthAlgoSupported(
+ pMac,
+ pMac->lim.gpLimMlmAuthReq->authType,
+ psessionEntry) == true)
+#else
+ (limIsAuthAlgoSupported(
+ pMac,
+ pMac->lim.gpLimMlmAuthReq->authType) == true)
+#endif
+ )
+ {
+ /**
+ * This is a request for pre-authentication.
+ * Check if there exists context already for
+ * the requsted peer OR
+ * if this request is for the AP we're currently
+ * associated with.
+ * If yes, return auth confirm immediately when
+ * requested auth type is same as the one used before.
+ */
+ if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) )&&
+ (psessionEntry->limMlmState ==
+ eLIM_MLM_LINK_ESTABLISHED_STATE) &&
+ (((pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) != NULL) &&
+ (pMac->lim.gpLimMlmAuthReq->authType ==
+ pStaDs->mlmStaContext.authType)) &&
+ (palEqualMemory( pMac->hHdd,pMac->lim.gpLimMlmAuthReq->peerMacAddr,
+ currentBssId,
+ sizeof(tSirMacAddr)) )) ||
+ (((preAuthNode =
+ limSearchPreAuthList(
+ pMac,
+ pMac->lim.gpLimMlmAuthReq->peerMacAddr)) != NULL) &&
+ (preAuthNode->authType ==
+ pMac->lim.gpLimMlmAuthReq->authType)))
+ {
+ PELOG2(limLog(pMac, LOG2,
+ FL("Already have pre-auth context with peer\n"));
+ limPrintMacAddr(pMac, pMac->lim.gpLimMlmAuthReq->peerMacAddr,
+ LOG2);)
+
+ mlmAuthCnf.resultCode = (tSirResultCodes)
+ eSIR_MAC_SUCCESS_STATUS;
+
+
+ goto end;
+ }
+ else
+ {
+ if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_NUM_PRE_AUTH,
+ (tANI_U32 *) &numPreAuthContexts) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP,
+ FL("Could not retrieve NumPreAuthLimit from CFG\n"));
+ }
+#ifdef ANI_AP_SDK_OPT
+ if(numPreAuthContexts > SIR_SDK_OPT_MAX_NUM_PRE_AUTH)
+ numPreAuthContexts = SIR_SDK_OPT_MAX_NUM_PRE_AUTH;
+#endif // ANI_AP_SDK_OPT
+
+ if (pMac->lim.gLimNumPreAuthContexts == numPreAuthContexts)
+ {
+ PELOGW(limLog(pMac, LOGW,
+ FL("Number of pre-auth reached max limit\n"));)
+
+ /// Return Auth confirm with reject code
+ mlmAuthCnf.resultCode =
+ eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED;
+
+ goto end;
+ }
+ }
+
+ // Delete pre-auth node if exists
+ if (preAuthNode)
+ limDeletePreAuthNode(pMac,
+ pMac->lim.gpLimMlmAuthReq->peerMacAddr);
+
+ //assign appropriate sessionId to the timer object
+ pMac->lim.limTimers.gLimAuthFailureTimer.sessionId = sessionId;
+
+ // Activate Auth failure timer
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_AUTH_FAIL_TIMER));
+ if (tx_timer_activate(&pMac->lim.limTimers.gLimAuthFailureTimer)
+ != TX_SUCCESS)
+ {
+ /// Could not start Auth failure timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("could not start Auth failure timer\n"));
+
+ /// Return Auth confirm with Resources Unavailable
+ mlmAuthCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+
+ goto end;
+ }
+
+ psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
+ psessionEntry->limMlmState = eLIM_MLM_WT_AUTH_FRAME2_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+ /// Prepare & send Authentication frame
+ authFrameBody.authAlgoNumber =
+ (tANI_U8) pMac->lim.gpLimMlmAuthReq->authType;
+ authFrameBody.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
+ authFrameBody.authStatusCode = 0;
+ limSendAuthMgmtFrame(pMac,
+ &authFrameBody,
+ pMac->lim.gpLimMlmAuthReq->peerMacAddr,
+ LIM_NO_WEP_IN_FC,psessionEntry);
+
+ return;
+ }
+ else
+ {
+ /**
+ * Unexpected auth request.
+ * Return Auth confirm with Invalid parameters code.
+ */
+ mlmAuthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
+
+ goto end;
+ }
+
+end:
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmAuthCnf.peerMacAddr,
+ (tANI_U8 *) &pMac->lim.gpLimMlmAuthReq->peerMacAddr,
+ sizeof(tSirMacAddr));
+
+ mlmAuthCnf.authType = pMac->lim.gpLimMlmAuthReq->authType;
+ mlmAuthCnf.sessionId = sessionId;
+
+ /// Free up buffer allocated
+ /// for pMac->lim.gLimMlmAuthReq
+ palFreeMemory( pMac->hHdd, pMac->lim.gpLimMlmAuthReq);
+ pMac->lim.gpLimMlmAuthReq = NULL;
+ limPostSmeMessage(pMac, LIM_MLM_AUTH_CNF, (tANI_U32 *) &mlmAuthCnf);
+} /*** limProcessMlmAuthReq() ***/
+
+
+
+/**
+ * limProcessMlmAssocReq()
+ *
+ *FUNCTION:
+ * This function is called to process MLM_ASSOC_REQ message
+ * from SME
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the MLM message buffer
+ * @return None
+ */
+
+static void
+limProcessMlmAssocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tSirMacAddr currentBssId;
+ tLimMlmAssocReq *pMlmAssocReq;
+ tLimMlmAssocCnf mlmAssocCnf;
+ tpPESession psessionEntry;
+ // tANI_U8 sessionId;
+
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+ pMlmAssocReq = (tLimMlmAssocReq *) pMsgBuf;
+
+ if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmAssocReq->sessionId) )== NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+
+ #if 0
+ if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) !=
+ eSIR_SUCCESS)
+ {
+ /// Could not get BSSID from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
+ }
+ #endif //TO SUPPORT BT-AMP
+ sirCopyMacAddr(currentBssId,psessionEntry->bssId);
+
+ if ( (psessionEntry->limSystemRole != eLIM_AP_ROLE && psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE) &&
+ (psessionEntry->limMlmState == eLIM_MLM_AUTHENTICATED_STATE || psessionEntry->limMlmState == eLIM_MLM_JOINED_STATE) &&
+ (palEqualMemory(pMac->hHdd,pMlmAssocReq->peerMacAddr, currentBssId, sizeof(tSirMacAddr))) )
+ {
+ /// map the session entry pointer to the AssocFailureTimer
+ pMac->lim.limTimers.gLimAssocFailureTimer.sessionId = pMlmAssocReq->sessionId;
+
+
+ /// Start association failure timer
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_ASSOC_FAIL_TIMER));
+ if (tx_timer_activate(&pMac->lim.limTimers.gLimAssocFailureTimer)
+ != TX_SUCCESS)
+ {
+ /// Could not start Assoc failure timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("could not start Association failure timer\n"));
+
+ /// Return Assoc confirm with Resources Unavailable
+
+ mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+
+ goto end;
+ }
+
+ psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
+ psessionEntry->limMlmState = eLIM_MLM_WT_ASSOC_RSP_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+ /// Prepare and send Association request frame
+ limSendAssocReqMgmtFrame(pMac, pMlmAssocReq,psessionEntry);
+
+ //Set the link state to postAssoc, so HW can start receiving frames from AP.
+ if ((psessionEntry->bssType == eSIR_BTAMP_STA_MODE)||
+ ((psessionEntry->bssType == eSIR_BTAMP_AP_MODE) && (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)))
+ {
+ if(limSetLinkState(pMac, eSIR_LINK_BTAMP_POSTASSOC_STATE, currentBssId,
+ psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState\n"));)
+ } else {
+ if(limSetLinkState(pMac, eSIR_LINK_POSTASSOC_STATE, currentBssId,
+ psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState\n"));)
+ }
+
+ return;
+ }
+ else
+ {
+ /**
+ * Received Association request either in invalid state
+ * or to a peer MAC entity whose address is different
+ * from one that STA is currently joined with or on AP.
+ * Return Assoc confirm with Invalid parameters code.
+ */
+
+ // Log error
+ PELOGW(limLog(pMac, LOGW,
+ FL("received unexpected MLM_ASSOC_CNF in state %X for role=%d, MAC addr= "),
+ psessionEntry->limMlmState,
+ psessionEntry->limSystemRole);)
+ limPrintMacAddr(pMac, pMlmAssocReq->peerMacAddr, LOGW);
+ limPrintMlmState(pMac, LOGW, psessionEntry->limMlmState);
+
+ mlmAssocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
+ mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+
+ goto end;
+ }
+
+end:
+ /* Update PE session Id*/
+ mlmAssocCnf.sessionId = pMlmAssocReq->sessionId;
+
+ /// Free up buffer allocated for assocReq
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmAssocReq);
+
+ limPostSmeMessage(pMac, LIM_MLM_ASSOC_CNF, (tANI_U32 *) &mlmAssocCnf);
+} /*** limProcessMlmAssocReq() ***/
+
+
+
+/**
+ * limProcessMlmReassocReq()
+ *
+ *FUNCTION:
+ * This function is called to process MLM_REASSOC_REQ message
+ * from SME
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the MLM message buffer
+ * @return None
+ */
+
+static void
+limProcessMlmReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tANI_U8 chanNum;
+ struct tLimPreAuthNode *pAuthNode;
+ tLimMlmReassocReq *pMlmReassocReq;
+ tLimMlmReassocCnf mlmReassocCnf;
+ tpPESession psessionEntry;
+
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+
+ pMlmReassocReq = (tLimMlmReassocReq *) pMsgBuf;
+
+ if((psessionEntry = peFindSessionBySessionId(pMac,pMlmReassocReq->sessionId)) == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Session Does not exist for given sessionId\n"));)
+ return;
+ }
+
+ if (((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) &&
+ (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE))
+ {
+ if (psessionEntry->pLimMlmReassocReq)
+ palFreeMemory( pMac->hHdd, psessionEntry->pLimMlmReassocReq);
+
+ /* Hold Re-Assoc request as part of Session, knock-out pMac */
+ /// Hold onto Reassoc request parameters
+ psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
+
+ // See if we have pre-auth context with new AP
+ pAuthNode = limSearchPreAuthList(pMac, psessionEntry->limReAssocbssId);
+
+ if (!pAuthNode &&
+ (!palEqualMemory( pMac->hHdd,pMlmReassocReq->peerMacAddr,
+ psessionEntry->bssId,
+ sizeof(tSirMacAddr)) ))
+ {
+ // Either pre-auth context does not exist AND
+ // we are not reassociating with currently
+ // associated AP.
+ // Return Reassoc confirm with not authenticated
+ mlmReassocCnf.resultCode = eSIR_SME_STA_NOT_AUTHENTICATED;
+ mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+
+ goto end;
+ }
+
+ //assign the sessionId to the timer object
+ pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = pMlmReassocReq->sessionId;
+
+ psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
+ psessionEntry->limMlmState = eLIM_MLM_WT_REASSOC_RSP_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+#if 0
+ // Update BSSID at CFG database
+ if (wlan_cfgSetStr(pMac, WNI_CFG_BSSID,
+ pMac->lim.gLimReassocBssId,
+ sizeof(tSirMacAddr)) != eSIR_SUCCESS)
+ {
+ /// Could not update BSSID at CFG. Log error.
+ limLog(pMac, LOGP, FL("could not update BSSID at CFG\n"));
+ }
+#endif //TO SUPPORT BT-AMP
+
+ /* Copy Global Reassoc ID*/
+ // sirCopyMacAddr(psessionEntry->reassocbssId,pMac->lim.gLimReAssocBssId);
+
+ /**
+ * Derive channel from BSS description and
+ * store it at CFG.
+ */
+
+ chanNum = psessionEntry->limReassocChannelId;
+
+
+ /* To Support BT-AMP .. read channel number from psessionEntry*/
+ //chanNum = psessionEntry->currentOperChannel;
+
+ // Apply previously set configuration at HW
+ limApplyConfiguration(pMac,psessionEntry);
+
+ //store the channel switch sessionEntry in the lim global var
+ /* We have already saved the ReAssocreq Pointer abobe */
+ //psessionEntry->pLimReAssocReq = (void *)pMlmReassocReq;
+ psessionEntry->channelChangeReasonCode = LIM_SWITCH_CHANNEL_REASSOC;
+
+ /** Switch channell to the new Operating channel for Reassoc*/
+ limSetChannel(pMac, psessionEntry->limReassocTitanHtCaps, chanNum, psessionEntry->maxTxPower, psessionEntry->peSessionId);
+
+ return;
+ }
+ else
+ {
+ /**
+ * Received Reassoc request in invalid state or
+ * in AP role.Return Reassoc confirm with Invalid
+ * parameters code.
+ */
+
+ // Log error
+ PELOGW(limLog(pMac, LOGW,
+ FL("received unexpected MLM_REASSOC_CNF in state %X for role=%d, MAC addr= "),
+ psessionEntry->limMlmState,
+ psessionEntry->limSystemRole);)
+ limPrintMacAddr(pMac, pMlmReassocReq->peerMacAddr,
+ LOGW);
+ limPrintMlmState(pMac, LOGW, psessionEntry->limMlmState);
+
+ mlmReassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
+ mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+
+ goto end;
+ }
+
+end:
+ mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+ /* Update PE sessio Id*/
+ mlmReassocCnf.sessionId = pMlmReassocReq->sessionId;
+ /// Free up buffer allocated for reassocReq
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmReassocReq);
+ psessionEntry->pLimReAssocReq = NULL;
+
+ limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
+} /*** limProcessMlmReassocReq() ***/
+
+
+static void
+limProcessMlmDisassocReqPostSuspend(tpAniSirGlobal pMac, eHalStatus suspendStatus, tANI_U32 *pMsgBuf)
+{
+ tANI_U16 aid;
+ tSirMacAddr currentBssId;
+ tpDphHashNode pStaDs;
+ tLimMlmDisassocReq *pMlmDisassocReq;
+ tLimMlmDisassocCnf mlmDisassocCnf;
+ tpPESession psessionEntry;
+ extern tANI_BOOLEAN sendDisassocFrame;
+
+ if(eHAL_STATUS_SUCCESS != suspendStatus)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Suspend Status is not success %X\n"), suspendStatus);)
+#if 0
+ //It can ignore the status and proceed with the disassoc processing.
+ mlmDisassocCnf.resultCode = eSIR_SME_REFUSED;
+ goto end;
+#endif
+ }
+
+ pMlmDisassocReq = (tLimMlmDisassocReq *) pMsgBuf;
+
+
+ if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocReq->sessionId))== NULL)
+ {
+
+ PELOGE(limLog(pMac, LOGE,
+ FL("session does not exist for given sessionId\n"));)
+ mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
+ goto end;
+ }
+ #if 0
+ if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) !=
+ eSIR_SUCCESS)
+ {
+ /// Could not get BSSID from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
+ }
+ #endif //BT-AMP Support
+ sirCopyMacAddr(currentBssId,psessionEntry->bssId);
+
+ switch (psessionEntry->limSystemRole)
+ {
+ case eLIM_STA_ROLE:
+ case eLIM_BT_AMP_STA_ROLE:
+ if ( !palEqualMemory( pMac->hHdd,pMlmDisassocReq->peerMacAddr,
+ currentBssId,
+ sizeof(tSirMacAddr)) )
+ {
+ PELOGW(limLog(pMac, LOGW,
+ FL("received MLM_DISASSOC_REQ with invalid BSS id "));)
+ limPrintMacAddr(pMac, pMlmDisassocReq->peerMacAddr, LOGW);
+
+ /// Prepare and Send LIM_MLM_DISASSOC_CNF
+
+ mlmDisassocCnf.resultCode =
+ eSIR_SME_INVALID_PARAMETERS;
+
+ goto end;
+ }
+
+ break;
+
+ case eLIM_STA_IN_IBSS_ROLE:
+
+ break;
+
+ default: // eLIM_AP_ROLE
+
+ // Fall through
+ break;
+
+ } // end switch (psessionEntry->limSystemRole)
+
+ /**
+ * Check if there exists a context for the peer entity
+ * to be disassociated with.
+ */
+ pStaDs = dphLookupHashEntry(pMac, pMlmDisassocReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
+ if ((pStaDs == NULL) ||
+ (pStaDs &&
+ ((pStaDs->mlmStaContext.mlmState !=
+ eLIM_MLM_LINK_ESTABLISHED_STATE) &&
+ (pStaDs->mlmStaContext.mlmState !=
+ eLIM_MLM_WT_ASSOC_CNF_STATE) &&
+ (pStaDs->mlmStaContext.mlmState !=
+ eLIM_MLM_ASSOCIATED_STATE))))
+ {
+ /**
+ * Received LIM_MLM_DISASSOC_REQ for STA that does not
+ * have context or in some transit state.
+ * Log error
+ */
+ PELOGW(limLog(pMac, LOGW,
+ FL("received MLM_DISASSOC_REQ for STA that either has no context or in some transit state, Addr= "));)
+ limPrintMacAddr(pMac, pMlmDisassocReq->peerMacAddr, LOGW);
+
+ /// Prepare and Send LIM_MLM_DISASSOC_CNF
+
+ mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
+
+ goto end;
+ }
+
+ //pStaDs->mlmStaContext.rxPurgeReq = 1;
+ pStaDs->mlmStaContext.disassocReason = (tSirMacReasonCodes)
+ pMlmDisassocReq->reasonCode;
+ pStaDs->mlmStaContext.cleanupTrigger = pMlmDisassocReq->disassocTrigger;
+
+ /// Send Disassociate frame to peer entity
+ if (sendDisassocFrame)
+ {
+ limSendDisassocMgmtFrame(pMac,
+ pMlmDisassocReq->reasonCode,
+ pMlmDisassocReq->peerMacAddr,psessionEntry);
+ }
+ else
+ {
+ sendDisassocFrame = 1;
+ }
+
+ if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ {
+ //SAP mode delay DEL STA for 300ms such that disassoc can be delivered at TIM
+ //100 ms for normal TIM and 300 ms for dynamic TIM
+ vos_sleep(300);
+ }
+
+ /// Receive path cleanup with dummy packet
+ if(eSIR_SUCCESS != limCleanupRxPath(pMac, pStaDs,psessionEntry))
+ {
+ mlmDisassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ goto end;
+ }
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE ) &&
+ (
+#ifdef FEATURE_WLAN_CCX
+ (psessionEntry->isCCXconnection ) ||
+#endif
+ (psessionEntry->is11Rconnection )) &&
+ (pMlmDisassocReq->reasonCode != eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("FT Preauth Session Cleanup \n"));)
+ limFTCleanup(pMac);
+ }
+#endif
+
+ /// Free up buffer allocated for mlmDisassocReq
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmDisassocReq);
+
+ return;
+
+end:
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDisassocCnf.peerMacAddr,
+ (tANI_U8 *) pMlmDisassocReq->peerMacAddr,
+ sizeof(tSirMacAddr));
+ mlmDisassocCnf.aid = pMlmDisassocReq->aid;
+ mlmDisassocCnf.disassocTrigger = pMlmDisassocReq->disassocTrigger;
+
+ /* Update PE session ID*/
+ mlmDisassocCnf.sessionId = pMlmDisassocReq->sessionId;
+
+ /// Free up buffer allocated for mlmDisassocReq
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmDisassocReq);
+
+ limPostSmeMessage(pMac,
+ LIM_MLM_DISASSOC_CNF,
+ (tANI_U32 *) &mlmDisassocCnf);
+}
+
+/**
+ * limProcessMlmDisassocReq()
+ *
+ *FUNCTION:
+ * This function is called to process MLM_DISASSOC_REQ message
+ * from SME
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the MLM message buffer
+ * @return None
+ */
+
+static void
+limProcessMlmDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+// tANI_U16 aid;
+// tSirMacAddr currentBssId;
+// tpDphHashNode pStaDs;
+ tLimMlmDisassocReq *pMlmDisassocReq;
+// tLimMlmDisassocCnf mlmDisassocCnf;
+ tpPESession psessionEntry;
+// extern tANI_BOOLEAN sendDisassocFrame;
+
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+
+ pMlmDisassocReq = (tLimMlmDisassocReq *) pMsgBuf;
+
+ if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocReq->sessionId))== NULL)
+ {
+
+ PELOGE(limLog(pMac, LOGE,
+ FL("session does not exist for given sessionId\n"));)
+ return;
+ }
+
+ if( isLimSessionOffChannel(pMac, pMlmDisassocReq->sessionId) )
+ {
+ //suspend link
+ limSuspendLink(pMac, eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN,
+ limProcessMlmDisassocReqPostSuspend, (tANI_U32*)pMsgBuf );
+ }
+ else
+ {
+ //No need to suspend link.
+ limProcessMlmDisassocReqPostSuspend( pMac, eHAL_STATUS_SUCCESS,
+ (tANI_U32*) pMsgBuf );
+ }
+} /*** limProcessMlmDisassocReq() ***/
+
+static void
+limProcessMlmDeauthReqPostSuspend(tpAniSirGlobal pMac, eHalStatus suspendStatus, tANI_U32 *pMsgBuf)
+{
+ tANI_U16 aid;
+ tSirMacAddr currentBssId;
+ tpDphHashNode pStaDs;
+ struct tLimPreAuthNode *pAuthNode;
+ tLimMlmDeauthReq *pMlmDeauthReq;
+ tLimMlmDeauthCnf mlmDeauthCnf;
+ tpPESession psessionEntry;
+
+
+ if(eHAL_STATUS_SUCCESS != suspendStatus)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Suspend Status is not success %X\n"), suspendStatus);)
+#if 0
+ //It can ignore the status and proceed with the disassoc processing.
+ mlmDisassocCnf.resultCode = eSIR_SME_REFUSED;
+ goto end;
+#endif
+ }
+
+ pMlmDeauthReq = (tLimMlmDeauthReq *) pMsgBuf;
+
+ if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthReq->sessionId))== NULL)
+ {
+
+ PELOGE(limLog(pMac, LOGE, FL("session does not exist for given sessionId\n"));)
+ return;
+ }
+ #if 0
+ if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) !=
+ eSIR_SUCCESS)
+ {
+ /// Could not get BSSID from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
+ }
+ #endif //SUPPORT BT-AMP
+ sirCopyMacAddr(currentBssId,psessionEntry->bssId);
+
+ switch (psessionEntry->limSystemRole)
+ {
+ case eLIM_STA_ROLE:
+ case eLIM_BT_AMP_STA_ROLE:
+ switch (psessionEntry->limMlmState)
+ {
+ case eLIM_MLM_IDLE_STATE:
+ // Attempting to Deauthenticate
+ // with a pre-authenticated peer.
+ // Deauthetiate with peer if there
+ // exists a pre-auth context below.
+ break;
+
+ case eLIM_MLM_AUTHENTICATED_STATE:
+ case eLIM_MLM_WT_ASSOC_RSP_STATE:
+ case eLIM_MLM_LINK_ESTABLISHED_STATE:
+ if (!palEqualMemory( pMac->hHdd,pMlmDeauthReq->peerMacAddr,
+ currentBssId,
+ sizeof(tSirMacAddr)) )
+ {
+ PELOGW(limLog(pMac, LOGW,
+ FL("received MLM_DEAUTH_REQ with invalid BSS id "));)
+ PELOGE(limLog(pMac, LOGE, FL("Peer MAC Addr : "));)
+ limPrintMacAddr(pMac, pMlmDeauthReq->peerMacAddr,LOGE);
+
+ PELOGE(limLog(pMac, LOGE, FL("\n CFG BSSID Addr : "));)
+ limPrintMacAddr(pMac, currentBssId,LOGE);
+
+ /// Prepare and Send LIM_MLM_DEAUTH_CNF
+
+ mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
+
+ goto end;
+ }
+
+ if ((psessionEntry->limMlmState ==
+ eLIM_MLM_AUTHENTICATED_STATE) ||
+ (psessionEntry->limMlmState ==
+ eLIM_MLM_WT_ASSOC_RSP_STATE))
+ {
+ // Send Deauthentication frame
+ // to peer entity
+ limSendDeauthMgmtFrame(
+ pMac,
+ pMlmDeauthReq->reasonCode,
+ pMlmDeauthReq->peerMacAddr,psessionEntry);
+
+ /// Prepare and Send LIM_MLM_DEAUTH_CNF
+ mlmDeauthCnf.resultCode = eSIR_SME_SUCCESS;
+ psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+ goto end;
+ }
+ else
+ {
+ // LINK_ESTABLISED_STATE
+ // Cleanup RX & TX paths
+ // below
+ }
+
+ break;
+
+ default:
+
+ PELOGW(limLog(pMac, LOGW,
+ FL("received MLM_DEAUTH_REQ with in state %d for peer "),
+ psessionEntry->limMlmState);)
+ limPrintMacAddr(pMac, pMlmDeauthReq->peerMacAddr, LOGW);
+ limPrintMlmState(pMac, LOGW, psessionEntry->limMlmState);
+
+ /// Prepare and Send LIM_MLM_DEAUTH_CNF
+ mlmDeauthCnf.resultCode =
+ eSIR_SME_STA_NOT_AUTHENTICATED;
+
+ goto end;
+ }
+
+ break;
+
+ case eLIM_STA_IN_IBSS_ROLE:
+
+ return;
+
+ default: // eLIM_AP_ROLE
+ break;
+
+ } // end switch (psessionEntry->limSystemRole)
+
+ /**
+ * Check if there exists a context for the peer entity
+ * to be deauthenticated with.
+ */
+ pStaDs = dphLookupHashEntry(pMac, pMlmDeauthReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
+
+ if (pStaDs == NULL)
+ {
+ /// Check if there exists pre-auth context for this STA
+ pAuthNode = limSearchPreAuthList(pMac,
+ pMlmDeauthReq->peerMacAddr);
+
+ if (pAuthNode == NULL)
+ {
+ /**
+ * Received DEAUTH REQ for a STA that is neither
+ * Associated nor Pre-authenticated. Log error,
+ * Prepare and Send LIM_MLM_DEAUTH_CNF
+ */
+ PELOGW(limLog(pMac, LOGW,
+ FL("received MLM_DEAUTH_REQ for STA that does not have context, Addr="));)
+ limPrintMacAddr(pMac, pMlmDeauthReq->peerMacAddr, LOGW);
+
+ mlmDeauthCnf.resultCode =
+ eSIR_SME_STA_NOT_AUTHENTICATED;
+ }
+ else
+ {
+ mlmDeauthCnf.resultCode = eSIR_SME_SUCCESS;
+
+ /// Delete STA from pre-auth STA list
+ limDeletePreAuthNode(pMac, pMlmDeauthReq->peerMacAddr);
+
+ /// Send Deauthentication frame to peer entity
+ limSendDeauthMgmtFrame(pMac,
+ pMlmDeauthReq->reasonCode,
+ pMlmDeauthReq->peerMacAddr,psessionEntry);
+ }
+
+ goto end;
+ }
+ else if ((pStaDs->mlmStaContext.mlmState !=
+ eLIM_MLM_LINK_ESTABLISHED_STATE) &&
+ (pStaDs->mlmStaContext.mlmState !=
+ eLIM_MLM_WT_ASSOC_CNF_STATE))
+ {
+ /**
+ * Received LIM_MLM_DEAUTH_REQ for STA that is n
+ * some transit state. Log error.
+ */
+ PELOGW(limLog(pMac, LOGW,
+ FL("received MLM_DEAUTH_REQ for STA that either has no context or in some transit state, Addr="));)
+ limPrintMacAddr(pMac, pMlmDeauthReq->peerMacAddr, LOGW);
+
+ /// Prepare and Send LIM_MLM_DEAUTH_CNF
+
+ mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
+
+ goto end;
+ }
+
+ //pStaDs->mlmStaContext.rxPurgeReq = 1;
+ pStaDs->mlmStaContext.disassocReason = (tSirMacReasonCodes)
+ pMlmDeauthReq->reasonCode;
+ pStaDs->mlmStaContext.cleanupTrigger = pMlmDeauthReq->deauthTrigger;
+
+ /// Send Deauthentication frame to peer entity
+ limSendDeauthMgmtFrame(pMac, pMlmDeauthReq->reasonCode,
+ pMlmDeauthReq->peerMacAddr,psessionEntry);
+
+ if( (psessionEntry->limSystemRole == eSYSTEM_AP_ROLE))
+ {
+ // Delay DEL STA for 300ms such that unicast deauth is
+ // delivered at TIM(100 for normal or 300ms for dynamic)
+ // to power save stations after setting PVB
+ vos_sleep(300);
+ }
+
+ /// Receive path cleanup with dummy packet
+ limCleanupRxPath(pMac, pStaDs,psessionEntry);
+
+ /// Free up buffer allocated for mlmDeauthReq
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmDeauthReq);
+
+ return;
+
+end:
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDeauthCnf.peerMacAddr,
+ (tANI_U8 *) pMlmDeauthReq->peerMacAddr,
+ sizeof(tSirMacAddr));
+ mlmDeauthCnf.deauthTrigger = pMlmDeauthReq->deauthTrigger;
+ mlmDeauthCnf.aid = pMlmDeauthReq->aid;
+ mlmDeauthCnf.sessionId = pMlmDeauthReq->sessionId;
+
+ // Free up buffer allocated
+ // for mlmDeauthReq
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmDeauthReq);
+
+ limPostSmeMessage(pMac,
+ LIM_MLM_DEAUTH_CNF,
+ (tANI_U32 *) &mlmDeauthCnf);
+
+}
+
+/**
+ * limProcessMlmDeauthReq()
+ *
+ *FUNCTION:
+ * This function is called to process MLM_DEAUTH_REQ message
+ * from SME
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the MLM message buffer
+ * @return None
+ */
+
+static void
+limProcessMlmDeauthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+// tANI_U16 aid;
+// tSirMacAddr currentBssId;
+// tpDphHashNode pStaDs;
+// struct tLimPreAuthNode *pAuthNode;
+ tLimMlmDeauthReq *pMlmDeauthReq;
+// tLimMlmDeauthCnf mlmDeauthCnf;
+ tpPESession psessionEntry;
+
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+
+ pMlmDeauthReq = (tLimMlmDeauthReq *) pMsgBuf;
+
+ if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthReq->sessionId))== NULL)
+ {
+
+ PELOGE(limLog(pMac, LOGE, FL("session does not exist for given sessionId\n"));)
+ return;
+ }
+
+ if( isLimSessionOffChannel(pMac, pMlmDeauthReq->sessionId) )
+ {
+ //suspend link
+ limSuspendLink(pMac, eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN,
+ limProcessMlmDeauthReqPostSuspend, (tANI_U32*)pMsgBuf );
+ }
+ else
+ {
+ //No need to suspend link.
+ limProcessMlmDeauthReqPostSuspend( pMac, eHAL_STATUS_SUCCESS,
+ (tANI_U32*) pMsgBuf );
+ }
+} /*** limProcessMlmDeauthReq() ***/
+
+
+
+/**
+ * @function : limProcessMlmSetKeysReq()
+ *
+ * @brief : This function is called to process MLM_SETKEYS_REQ message
+ * from SME
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the MLM message buffer
+ * @return None
+ */
+
+static void
+limProcessMlmSetKeysReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+tANI_U16 aid;
+tANI_U16 staIdx = 0;
+tANI_U32 defaultKeyId = 0;
+tSirMacAddr currentBssId;
+tpDphHashNode pStaDs;
+tLimMlmSetKeysReq *pMlmSetKeysReq;
+tLimMlmSetKeysCnf mlmSetKeysCnf;
+tpPESession psessionEntry;
+
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+
+
+ pMlmSetKeysReq = (tLimMlmSetKeysReq *) pMsgBuf;
+ // Hold onto the SetKeys request parameters
+ pMac->lim.gpLimMlmSetKeysReq = (void *) pMlmSetKeysReq;
+
+ if((psessionEntry = peFindSessionBySessionId(pMac,pMlmSetKeysReq->sessionId))== NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
+ return;
+ }
+
+ limLog( pMac, LOGW,
+ FL( "Received MLM_SETKEYS_REQ with parameters:\n"
+ "AID [%d], ED Type [%d], # Keys [%d] & Peer MAC Addr - "),
+ pMlmSetKeysReq->aid,
+ pMlmSetKeysReq->edType,
+ pMlmSetKeysReq->numKeys );
+ limPrintMacAddr( pMac, pMlmSetKeysReq->peerMacAddr, LOGW );
+
+ #if 0
+ if( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, currentBssId, &cfg )) {
+ limLog( pMac, LOGP, FL("Could not retrieve BSSID\n"));
+ return;
+ }
+ #endif //TO SUPPORT BT-AMP
+ sirCopyMacAddr(currentBssId,psessionEntry->bssId);
+
+ switch( psessionEntry->limSystemRole ) {
+ case eLIM_STA_ROLE:
+ case eLIM_BT_AMP_STA_ROLE:
+ if((!limIsAddrBC( pMlmSetKeysReq->peerMacAddr ) ) &&
+ (!palEqualMemory( pMac->hHdd,pMlmSetKeysReq->peerMacAddr,
+ currentBssId, sizeof(tSirMacAddr))) ){
+ limLog( pMac, LOGW, FL("Received MLM_SETKEYS_REQ with invalid BSSID\n"));
+ limPrintMacAddr( pMac, pMlmSetKeysReq->peerMacAddr, LOGW );
+
+ // Prepare and Send LIM_MLM_SETKEYS_CNF with error code
+ mlmSetKeysCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
+ goto end;
+ }
+ // Fall thru' & 'Plumb' keys below
+ break;
+ case eLIM_STA_IN_IBSS_ROLE:
+ default: // others
+ // Fall thru...
+ break;
+ }
+
+ /**
+ * Use the "unicast" parameter to determine if the "Group Keys"
+ * are being set.
+ * pMlmSetKeysReq->key.unicast = 0 -> Multicast/broadcast
+ * pMlmSetKeysReq->key.unicast - 1 -> Unicast keys are being set
+ */
+ if( limIsAddrBC( pMlmSetKeysReq->peerMacAddr )) {
+ limLog( pMac, LOG1, FL("Trying to set Group Keys...%d \n"), pMlmSetKeysReq->sessionId);
+ /** When trying to set Group Keys for any
+ * security mode other than WEP, use the
+ * STA Index corresponding to the AP...
+ */
+ switch( pMlmSetKeysReq->edType ) {
+ case eSIR_ED_CCMP:
+
+#ifdef WLAN_FEATURE_11W
+ case eSIR_ED_AES_128_CMAC:
+#endif
+ staIdx = psessionEntry->staId;
+ break;
+
+ default:
+ break;
+ }
+ }else {
+ limLog( pMac, LOG1, FL("Trying to set Unicast Keys...\n"));
+ /**
+ * Check if there exists a context for the
+ * peer entity for which keys need to be set.
+ */
+
+
+ pStaDs = dphLookupHashEntry( pMac, pMlmSetKeysReq->peerMacAddr, &aid , &psessionEntry->dph.dphHashTable);
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if ((pStaDs == NULL) ||
+ ((pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE) && (psessionEntry->limSystemRole != eLIM_AP_ROLE))) {
+#else
+ if ((pStaDs == NULL) ||
+ ((pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE) )) {
+#endif
+ /**
+ * Received LIM_MLM_SETKEYS_REQ for STA
+ * that does not have context or in some
+ * transit state. Log error.
+ */
+ limLog( pMac, LOG1,
+ FL("Received MLM_SETKEYS_REQ for STA that either has no context or in some transit state, Addr = "));
+ limPrintMacAddr( pMac, pMlmSetKeysReq->peerMacAddr, LOGW );
+
+ // Prepare and Send LIM_MLM_SETKEYS_CNF
+ mlmSetKeysCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
+ goto end;
+ } else
+ staIdx = pStaDs->staIndex;
+ }
+
+ if ((pMlmSetKeysReq->numKeys == 0) && (pMlmSetKeysReq->edType != eSIR_ED_NONE)) {
+ //
+ // Broadcast/Multicast Keys (for WEP!!) are NOT sent
+ // via this interface!!
+ //
+ // This indicates to HAL that the WEP Keys need to be
+ // extracted from the CFG and applied to hardware
+ defaultKeyId = 0xff;
+ }else
+ defaultKeyId = 0;
+
+ limLog( pMac, LOG1,
+ FL( "Trying to set keys for STA Index [%d], using defaultKeyId [%d]\n" ),
+ staIdx,
+ defaultKeyId );
+
+ if(limIsAddrBC( pMlmSetKeysReq->peerMacAddr )) {
+ psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
+ psessionEntry->limMlmState = eLIM_MLM_WT_SET_BSS_KEY_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+ limLog( pMac, LOG1, FL("Trying to set Group Keys...%d \n"),
+ psessionEntry->peSessionId);
+
+ // Package WDA_SET_BSSKEY_REQ message parameters
+ limSendSetBssKeyReq(pMac, pMlmSetKeysReq,psessionEntry);
+ return;
+ }else {
+ // Package WDA_SET_STAKEY_REQ / WDA_SET_STA_BCASTKEY_REQ message parameters
+ limSendSetStaKeyReq(pMac, pMlmSetKeysReq, staIdx, (tANI_U8) defaultKeyId,psessionEntry);
+ return;
+ }
+
+end:
+ mlmSetKeysCnf.sessionId= pMlmSetKeysReq->sessionId;
+ limPostSmeSetKeysCnf( pMac, pMlmSetKeysReq, &mlmSetKeysCnf );
+
+} /*** limProcessMlmSetKeysReq() ***/
+
+/**
+ * limProcessMlmRemoveKeyReq()
+ *
+ *FUNCTION:
+ * This function is called to process MLM_REMOVEKEY_REQ message
+ * from SME
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the MLM message buffer
+ * @return None
+ */
+
+static void
+limProcessMlmRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+tANI_U16 aid;
+tANI_U16 staIdx = 0;
+tSirMacAddr currentBssId;
+tpDphHashNode pStaDs;
+tLimMlmRemoveKeyReq *pMlmRemoveKeyReq;
+tLimMlmRemoveKeyCnf mlmRemoveKeyCnf;
+ tpPESession psessionEntry;
+
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+
+ pMlmRemoveKeyReq = (tLimMlmRemoveKeyReq *) pMsgBuf;
+
+
+ if((psessionEntry = peFindSessionBySessionId(pMac,pMlmRemoveKeyReq->sessionId))== NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,
+ FL("session does not exist for given sessionId\n"));)
+ return;
+ }
+
+
+ if( pMac->lim.gpLimMlmRemoveKeyReq != NULL )
+ {
+ // Free any previous requests.
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmRemoveKeyReq);
+ pMac->lim.gpLimMlmRemoveKeyReq = NULL;
+ }
+ // Hold onto the RemoveKeys request parameters
+ pMac->lim.gpLimMlmRemoveKeyReq = (void *) pMlmRemoveKeyReq;
+
+ #if 0
+ if( eSIR_SUCCESS != wlan_cfgGetStr( pMac,
+ WNI_CFG_BSSID,
+ currentBssId,
+ &cfg ))
+ limLog( pMac, LOGP, FL("Could not retrieve BSSID\n"));
+ #endif //TO-SUPPORT BT-AMP
+ sirCopyMacAddr(currentBssId,psessionEntry->bssId);
+
+ switch( psessionEntry->limSystemRole )
+ {
+ case eLIM_STA_ROLE:
+ case eLIM_BT_AMP_STA_ROLE:
+ if(( limIsAddrBC( pMlmRemoveKeyReq->peerMacAddr ) != true ) &&
+ (!palEqualMemory( pMac->hHdd,pMlmRemoveKeyReq->peerMacAddr,
+ currentBssId,
+ sizeof(tSirMacAddr))))
+ {
+ limLog( pMac, LOGW,
+ FL("Received MLM_REMOVEKEY_REQ with invalid BSSID\n"));
+ limPrintMacAddr( pMac, pMlmRemoveKeyReq->peerMacAddr, LOGW );
+
+ // Prepare and Send LIM_MLM_REMOVEKEY_CNF with error code
+ mlmRemoveKeyCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
+ goto end;
+ }
+ break;
+
+ case eLIM_STA_IN_IBSS_ROLE:
+ default: // eLIM_AP_ROLE
+ // Fall thru...
+ break;
+ }
+
+
+ psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
+ if(limIsAddrBC( pMlmRemoveKeyReq->peerMacAddr )) //Second condition for IBSS or AP role.
+ {
+ psessionEntry->limMlmState = eLIM_MLM_WT_REMOVE_BSS_KEY_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+ // Package WDA_REMOVE_BSSKEY_REQ message parameters
+ limSendRemoveBssKeyReq( pMac,pMlmRemoveKeyReq,psessionEntry);
+ return;
+ }
+
+ /**
+ * Check if there exists a context for the
+ * peer entity for which keys need to be removed.
+ */
+ pStaDs = dphLookupHashEntry( pMac, pMlmRemoveKeyReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
+ if ((pStaDs == NULL) ||
+ (pStaDs &&
+ (pStaDs->mlmStaContext.mlmState !=
+ eLIM_MLM_LINK_ESTABLISHED_STATE)))
+ {
+ /**
+ * Received LIM_MLM_REMOVEKEY_REQ for STA
+ * that does not have context or in some
+ * transit state. Log error.
+ */
+ limLog( pMac, LOGW,
+ FL("Received MLM_REMOVEKEYS_REQ for STA that either has no context or in some transit state, Addr = "));
+ limPrintMacAddr( pMac, pMlmRemoveKeyReq->peerMacAddr, LOGW );
+
+ // Prepare and Send LIM_MLM_REMOVEKEY_CNF
+ mlmRemoveKeyCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
+ mlmRemoveKeyCnf.sessionId = pMlmRemoveKeyReq->sessionId;
+
+
+ goto end;
+ }
+ else
+ staIdx = pStaDs->staIndex;
+
+
+
+ psessionEntry->limMlmState = eLIM_MLM_WT_REMOVE_STA_KEY_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+ // Package WDA_REMOVE_STAKEY_REQ message parameters
+ limSendRemoveStaKeyReq( pMac,pMlmRemoveKeyReq,staIdx,psessionEntry);
+ return;
+
+end:
+ limPostSmeRemoveKeyCnf( pMac,
+ pMlmRemoveKeyReq,
+ &mlmRemoveKeyCnf );
+
+} /*** limProcessMlmRemoveKeyReq() ***/
+
+
+/**
+ * limProcessMinChannelTimeout()
+ *
+ *FUNCTION:
+ * This function is called to process Min Channel Timeout
+ * during channel scan.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return None
+ */
+
+static void
+limProcessMinChannelTimeout(tpAniSirGlobal pMac)
+{
+ tANI_U8 channelNum;
+
+#ifdef GEN6_TODO
+ //if the min Channel is maintained per session, then use the below seesionEntry
+ //priority - LOW/might not be needed
+
+ //TBD-RAJESH HOW TO GET sessionEntry?????
+ tpPESession psessionEntry;
+
+ if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimMinChannelTimer.sessionId))== NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+#endif
+
+
+ if (pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Scanning : min channel timeout occurred\n"));)
+
+ /// Min channel timer timed out
+ pMac->lim.limTimers.gLimPeriodicProbeReqTimer.sessionId = 0xff;
+ limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
+ limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_PROBE_REQ_TIMER);
+ if (pMac->lim.gLimCurrentScanChannelId <=
+ (tANI_U32)(pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1))
+ {
+ channelNum = (tANI_U8)limGetCurrentScanChannel(pMac);
+ }
+ else
+ {
+ // This shouldn't be the case, but when this happens, this timeout should be for the last channelId.
+ // Get the channelNum as close to correct as possible.
+ if(pMac->lim.gpLimMlmScanReq->channelList.channelNumber)
+ {
+ channelNum = pMac->lim.gpLimMlmScanReq->channelList.channelNumber[pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1];
+ }
+ else
+ {
+ channelNum = 1;
+ }
+ }
+
+ limSendHalEndScanReq(pMac, channelNum, eLIM_HAL_END_SCAN_WAIT_STATE);
+ }
+ else
+ {
+ /**
+ * MIN channel timer should not have timed out
+ * in states other than wait_probe_response.
+ * Log error.
+ */
+ limLog(pMac, LOGW,
+ FL("received unexpected MIN channel timeout in state %X\n"),
+ pMac->lim.gLimMlmState);
+ limPrintMlmState(pMac, LOGE, pMac->lim.gLimMlmState);
+ }
+} /*** limProcessMinChannelTimeout() ***/
+
+
+
+/**
+ * limProcessMaxChannelTimeout()
+ *
+ *FUNCTION:
+ * This function is called to process Max Channel Timeout
+ * during channel scan.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return None
+ */
+
+static void
+limProcessMaxChannelTimeout(tpAniSirGlobal pMac)
+{
+ tANI_U8 channelNum;
+
+
+ if (pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE ||
+ pMac->lim.gLimMlmState == eLIM_MLM_PASSIVE_SCAN_STATE)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Scanning : Max channel timed out\n"));)
+ /**
+ * MAX channel timer timed out
+ * Continue channel scan.
+ */
+ limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
+ limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_PROBE_REQ_TIMER);
+ pMac->lim.limTimers.gLimPeriodicProbeReqTimer.sessionId = 0xff;
+ if (pMac->lim.gLimCurrentScanChannelId <=
+ (tANI_U32)(pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1))
+ {
+ channelNum = limGetCurrentScanChannel(pMac);
+ }
+ else
+ {
+ if(pMac->lim.gpLimMlmScanReq->channelList.channelNumber)
+ {
+ channelNum = pMac->lim.gpLimMlmScanReq->channelList.channelNumber[pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1];
+ }
+ else
+ {
+ channelNum = 1;
+ }
+ }
+ limSendHalEndScanReq(pMac, channelNum, eLIM_HAL_END_SCAN_WAIT_STATE);
+ }
+ else
+ {
+ /**
+ * MAX channel timer should not have timed out
+ * in states other than wait_scan.
+ * Log error.
+ */
+ limLog(pMac, LOGW,
+ FL("received unexpected MAX channel timeout in state %X\n"),
+ pMac->lim.gLimMlmState);
+ limPrintMlmState(pMac, LOGW, pMac->lim.gLimMlmState);
+ }
+} /*** limProcessMaxChannelTimeout() ***/
+
+/**
+ * limProcessPeriodicProbeReqTimer()
+ *
+ *FUNCTION:
+ * This function is called to process periodic probe request
+ * to send during scan.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return None
+ */
+
+static void
+limProcessPeriodicProbeReqTimer(tpAniSirGlobal pMac)
+{
+ tANI_U8 channelNum;
+ tANI_U8 i = 0;
+ tSirRetStatus status = eSIR_SUCCESS;
+ TX_TIMER *pPeriodicProbeReqTimer;
+ pPeriodicProbeReqTimer = &pMac->lim.limTimers.gLimPeriodicProbeReqTimer;
+
+ if(vos_timer_getCurrentState(&pPeriodicProbeReqTimer->vosTimer)
+ != VOS_TIMER_STATE_STOPPED)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Invalid state of timer\n"));)
+ return;
+ }
+
+ if ((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) &&
+ (pPeriodicProbeReqTimer->sessionId != 0xff))
+ {
+ tLimMlmScanReq *pLimMlmScanReq = pMac->lim.gpLimMlmScanReq;
+ PELOG1(limLog(pMac, LOG1, FL("Scanning : Periodic scanning\n"));)
+ /**
+ * Periodic channel timer timed out
+ * to send probe request.
+ */
+ channelNum = limGetCurrentScanChannel(pMac);
+ do
+ {
+ /* Prepare and send Probe Request frame for all the SSIDs
+ * present in the saved MLM
+ */
+
+ /*
+ * PELOGE(limLog(pMac, LOGW, FL("sending ProbeReq number %d,"
+ * " for SSID %s on channel: %d\n"),
+ * i, pLimMlmScanReq->ssId[i].ssId,
+ * channelNum);)
+ */
+ status = limSendProbeReqMgmtFrame( pMac, &pLimMlmScanReq->ssId[i],
+ pLimMlmScanReq->bssId, channelNum, pMac->lim.gSelfMacAddr,
+ pLimMlmScanReq->dot11mode, pLimMlmScanReq->uIEFieldLen,
+ (tANI_U8 *)(pLimMlmScanReq) + pLimMlmScanReq->uIEFieldOffset);
+
+
+ if ( status != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("send ProbeReq failed for SSID "
+ "%s on channel: %d\n"),
+ pLimMlmScanReq->ssId[i].ssId,
+ channelNum);)
+ return;
+ }
+ i++;
+ } while (i < pLimMlmScanReq->numSsid);
+
+ /* Activate timer again */
+ if (tx_timer_activate(pPeriodicProbeReqTimer) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("could not start periodic probe"
+ " req timer\n"));
+ return;
+ }
+ }
+ else
+ {
+ /**
+ * Periodic scan is timeout is happening in
+ * in states other than wait_scan.
+ * Log error.
+ */
+ limLog(pMac, LOGW,
+ FL("received unexpected Periodic scan timeout in state %X\n"),
+ pMac->lim.gLimMlmState);
+ }
+} /*** limProcessPeriodicProbeReqTimer() ***/
+
+/**
+ * limProcessJoinFailureTimeout()
+ *
+ *FUNCTION:
+ * This function is called to process JoinFailureTimeout
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return None
+ */
+
+static void
+limProcessJoinFailureTimeout(tpAniSirGlobal pMac)
+{
+ tLimMlmJoinCnf mlmJoinCnf;
+ tSirMacAddr bssid;
+ tANI_U32 len;
+
+ //fetch the sessionEntry based on the sessionId
+ tpPESession psessionEntry;
+
+ if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimJoinFailureTimer.sessionId))== NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+
+ if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
+ {
+ len = sizeof(tSirMacAddr);
+
+ if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, bssid, &len) !=
+ eSIR_SUCCESS)
+ {
+ /// Could not get BSSID from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
+ return;
+ }
+
+ // 'Change' timer for future activations
+ limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER);
+
+ /**
+ * Issue MLM join confirm with timeout reason code
+ */
+ PELOGE(limLog(pMac, LOGE, FL(" Join Failure Timeout occurred.\n"));)
+
+ mlmJoinCnf.resultCode = eSIR_SME_JOIN_TIMEOUT_RESULT_CODE;
+ mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+
+ psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+ if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId,
+ psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState\n"));)
+ /* Update PE session Id */
+ mlmJoinCnf.sessionId = psessionEntry->peSessionId;
+
+
+ // Freeup buffer allocated to join request
+ if (psessionEntry->pLimMlmJoinReq)
+ {
+ palFreeMemory( pMac->hHdd, psessionEntry->pLimMlmJoinReq);
+ psessionEntry->pLimMlmJoinReq = NULL;
+ }
+
+ limPostSmeMessage(pMac,
+ LIM_MLM_JOIN_CNF,
+ (tANI_U32 *) &mlmJoinCnf);
+
+ return;
+ }
+ else
+ {
+ /**
+ * Join failure timer should not have timed out
+ * in states other than wait_join_beacon state.
+ * Log error.
+ */
+ limLog(pMac, LOGW,
+ FL("received unexpected JOIN failure timeout in state %X\n"),psessionEntry->limMlmState);
+ limPrintMlmState(pMac, LOGW, psessionEntry->limMlmState);
+ }
+} /*** limProcessJoinFailureTimeout() ***/
+
+
+
+/**
+ * limProcessAuthFailureTimeout()
+ *
+ *FUNCTION:
+ * This function is called to process Min Channel Timeout
+ * during channel scan.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return None
+ */
+
+static void
+limProcessAuthFailureTimeout(tpAniSirGlobal pMac)
+{
+ //fetch the sessionEntry based on the sessionId
+ tpPESession psessionEntry;
+
+ if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAuthFailureTimer.sessionId))== NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+
+ switch (psessionEntry->limMlmState)
+ {
+ case eLIM_MLM_WT_AUTH_FRAME2_STATE:
+ case eLIM_MLM_WT_AUTH_FRAME4_STATE:
+ /**
+ * Requesting STA did not receive next auth frame
+ * before Auth Failure timeout.
+ * Issue MLM auth confirm with timeout reason code
+ */
+
+
+ limRestoreFromAuthState(pMac,eSIR_SME_AUTH_TIMEOUT_RESULT_CODE,eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry);
+ break;
+
+ default:
+ /**
+ * Auth failure timer should not have timed out
+ * in states other than wt_auth_frame2/4
+ * Log error.
+ */
+ PELOGE(limLog(pMac, LOGE, FL("received unexpected AUTH failure timeout in state %X\n"), psessionEntry->limMlmState);)
+ limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
+
+ break;
+ }
+} /*** limProcessAuthFailureTimeout() ***/
+
+
+
+/**
+ * limProcessAuthRspTimeout()
+ *
+ *FUNCTION:
+ * This function is called to process Min Channel Timeout
+ * during channel scan.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return None
+ */
+
+static void
+limProcessAuthRspTimeout(tpAniSirGlobal pMac, tANI_U32 authIndex)
+{
+ struct tLimPreAuthNode *pAuthNode;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId;
+
+ pAuthNode = limGetPreAuthNodeFromIndex(pMac, &pMac->lim.gLimPreAuthTimerTable, authIndex);
+
+ if((psessionEntry = peFindSessionByBssid(pMac, pAuthNode->peerMacAddr, &sessionId)) == NULL)
+ {
+ limLog(pMac, LOGW, FL("session does not exist for given BSSID \n"));
+ return;
+ }
+
+ if (psessionEntry->limSystemRole == eLIM_AP_ROLE ||
+ psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
+ {
+ // Check if there exists a context for the STA
+
+ if (pAuthNode == NULL)
+ {
+ /**
+ * Authentication response timer timedout for an STA
+ * that does not have context at AP/STA in IBSS mode.
+ */
+
+ // Log error
+ PELOGE(limLog(pMac, LOGE, FL("received unexpected message\n"));)
+ }
+ else
+ {
+ if (pAuthNode->mlmState != eLIM_MLM_WT_AUTH_FRAME3_STATE)
+ {
+ /**
+ * Authentication response timer timedout
+ * in unexpected state. Log error
+ */
+ PELOGE(limLog(pMac, LOGE,
+ FL("received unexpected AUTH rsp timeout for MAC address "));
+ limPrintMacAddr(pMac, pAuthNode->peerMacAddr, LOGE);)
+ }
+ else
+ {
+ // Authentication response timer
+ // timedout for an STA.
+ pAuthNode->mlmState = eLIM_MLM_AUTH_RSP_TIMEOUT_STATE;
+ pAuthNode->fTimerStarted = 0;
+ PELOG1( limLog(pMac, LOG1,
+ FL("AUTH rsp timedout for MAC address "));
+ limPrintMacAddr(pMac, pAuthNode->peerMacAddr, LOG1);)
+
+ // Change timer to reactivate it in future
+ limDeactivateAndChangePerStaIdTimer(pMac,
+ eLIM_AUTH_RSP_TIMER,
+ pAuthNode->authNodeIdx);
+
+ limDeletePreAuthNode(pMac, pAuthNode->peerMacAddr);
+ }
+ }
+ }
+} /*** limProcessAuthRspTimeout() ***/
+
+
+/**
+ * limProcessAssocFailureTimeout()
+ *
+ *FUNCTION:
+ * This function is called to process Min Channel Timeout
+ * during channel scan.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return None
+ */
+
+static void
+limProcessAssocFailureTimeout(tpAniSirGlobal pMac, tANI_U32 MsgType)
+{
+
+ tLimMlmAssocCnf mlmAssocCnf;
+ tpPESession psessionEntry;
+
+ //to fetch the lim/mlm state based on the sessionId, use the below sessionEntry
+ tANI_U8 sessionId;
+
+ if(MsgType == LIM_ASSOC)
+ {
+ sessionId = pMac->lim.limTimers.gLimAssocFailureTimer.sessionId;
+ }
+ else
+ {
+ sessionId = pMac->lim.limTimers.gLimReassocFailureTimer.sessionId;
+ }
+
+ if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+
+ /**
+ * Expected Re/Association Response frame
+ * not received within Re/Association Failure Timeout.
+ */
+
+
+
+
+ /* CR: vos packet memory is leaked when assoc rsp timeouted/failed. */
+ /* notify TL that association is failed so that TL can flush the cached frame */
+ WLANTL_AssocFailed (psessionEntry->staId);
+
+ // Log error
+ PELOG1(limLog(pMac, LOG1,
+ FL("Re/Association Response not received before timeout \n"));)
+
+ if (( (psessionEntry->limSystemRole == eLIM_AP_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )||
+ ( (psessionEntry->limMlmState != eLIM_MLM_WT_ASSOC_RSP_STATE) &&
+ (psessionEntry->limMlmState != eLIM_MLM_WT_REASSOC_RSP_STATE) &&
+ (psessionEntry->limMlmState != eLIM_MLM_WT_FT_REASSOC_RSP_STATE)))
+ {
+ /**
+ * Re/Assoc failure timer should not have timedout on AP
+ * or in a state other than wt_re/assoc_response.
+ */
+
+ // Log error
+ limLog(pMac, LOGW,
+ FL("received unexpected REASSOC failure timeout in state %X for role %d\n"),
+ psessionEntry->limMlmState, psessionEntry->limSystemRole);
+ limPrintMlmState(pMac, LOGW, psessionEntry->limMlmState);
+ }
+ else
+ {
+
+ if ((MsgType == LIM_ASSOC) ||
+ ((MsgType == LIM_REASSOC) && (psessionEntry->limMlmState == eLIM_MLM_WT_FT_REASSOC_RSP_STATE)))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("(Re)Assoc Failure Timeout occurred.\n"));)
+
+ psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, psessionEntry->limMlmState));
+
+ //Set the RXP mode to IDLE, so it starts filtering the frames.
+ if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
+ psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState\n"));)
+
+ // 'Change' timer for future activations
+ limDeactivateAndChangeTimer(pMac, eLIM_ASSOC_FAIL_TIMER);
+
+ // Free up buffer allocated for JoinReq held by
+ // MLM state machine
+ if (psessionEntry->pLimMlmJoinReq)
+ {
+ palFreeMemory( pMac->hHdd, psessionEntry->pLimMlmJoinReq);
+ psessionEntry->pLimMlmJoinReq = NULL;
+ }
+
+#if defined(ANI_PRODUCT_TYPE_CLIENT)
+ //To remove the preauth node in case of fail to associate
+ if (limSearchPreAuthList(pMac, psessionEntry->bssId))
+ {
+ PELOG1(limLog(pMac, LOG1, FL(" delete pre auth node for %02X-%02X-%02X-%02X-%02X-%02X\n"),
+ psessionEntry->bssId[0], psessionEntry->bssId[1], psessionEntry->bssId[2],
+ psessionEntry->bssId[3], psessionEntry->bssId[4], psessionEntry->bssId[5]);)
+ limDeletePreAuthNode(pMac, psessionEntry->bssId);
+ }
+#endif
+
+ mlmAssocCnf.resultCode =
+ eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE;
+ mlmAssocCnf.protStatusCode =
+ eSIR_MAC_UNSPEC_FAILURE_STATUS;
+
+ /* Update PE session Id*/
+ mlmAssocCnf.sessionId = psessionEntry->peSessionId;
+ if (MsgType == LIM_ASSOC)
+ limPostSmeMessage(pMac, LIM_MLM_ASSOC_CNF, (tANI_U32 *) &mlmAssocCnf);
+ else
+ {
+ /* Will come here only in case of 11r, CCx FT when reassoc rsp
+ is not received and we receive a reassoc - timesout */
+ mlmAssocCnf.resultCode = eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE;
+ limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmAssocCnf);
+ }
+ }
+ else
+ {
+ /**
+ * Restore pre-reassoc req state.
+ * Set BSSID to currently associated AP address.
+ */
+ psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+ limRestorePreReassocState(pMac,
+ eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry);
+ }
+ }
+} /*** limProcessAssocFailureTimeout() ***/
+
+
+
+/**
+ * limCompleteMlmScan()
+ *
+ *FUNCTION:
+ * This function is called to send MLM_SCAN_CNF message
+ * to SME state machine.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param retCode Result code to be sent
+ * @return None
+ */
+
+void
+limCompleteMlmScan(tpAniSirGlobal pMac, tSirResultCodes retCode)
+{
+ tLimMlmScanCnf mlmScanCnf;
+
+ /// Restore previous MLM state
+ pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+ limRestorePreScanState(pMac);
+
+ // Free up pMac->lim.gLimMlmScanReq
+ if( NULL != pMac->lim.gpLimMlmScanReq )
+ {
+ palFreeMemory( pMac->hHdd, pMac->lim.gpLimMlmScanReq);
+ pMac->lim.gpLimMlmScanReq = NULL;
+ }
+
+ mlmScanCnf.resultCode = retCode;
+ mlmScanCnf.scanResultLength = pMac->lim.gLimMlmScanResultLength;
+
+ limPostSmeMessage(pMac, LIM_MLM_SCAN_CNF, (tANI_U32 *) &mlmScanCnf);
+
+} /*** limCompleteMlmScan() ***/
+
+/**
+ * \brief Setup an A-MPDU/BA session
+ *
+ * \sa limProcessMlmAddBAReq
+ *
+ * \param pMac The global tpAniSirGlobal object
+ *
+ * \param pMsgBuf The MLME ADDBA Req message buffer
+ *
+ * \return none
+ */
+void limProcessMlmAddBAReq( tpAniSirGlobal pMac,
+ tANI_U32 *pMsgBuf )
+{
+tSirRetStatus status = eSIR_SUCCESS;
+tpLimMlmAddBAReq pMlmAddBAReq;
+tpLimMlmAddBACnf pMlmAddBACnf;
+ tpPESession psessionEntry;
+
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+
+ pMlmAddBAReq = (tpLimMlmAddBAReq) pMsgBuf;
+ if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBAReq->sessionId))== NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,
+ FL("session does not exist for given sessionId\n"));)
+ return;
+ }
+
+
+ // Send ADDBA Req over the air
+ status = limSendAddBAReq( pMac, pMlmAddBAReq,psessionEntry);
+
+ //
+ // Respond immediately to LIM, only if MLME has not been
+ // successfully able to send WDA_ADDBA_REQ to HAL.
+ // Else, LIM_MLM_ADDBA_CNF will be sent after receiving
+ // ADDBA Rsp from peer entity
+ //
+ if( eSIR_SUCCESS != status )
+ {
+ // Allocate for LIM_MLM_ADDBA_CNF
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pMlmAddBACnf,
+ sizeof( tLimMlmAddBACnf )))
+ {
+ limLog( pMac, LOGP,
+ FL("palAllocateMemory failed with error code %d\n"));
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf );
+ return;
+ }
+ else
+ {
+ palZeroMemory( pMac->hHdd, (void *) pMlmAddBACnf, sizeof( tLimMlmAddBACnf ));
+ palCopyMemory( pMac->hHdd,
+ (void *) pMlmAddBACnf->peerMacAddr,
+ (void *) pMlmAddBAReq->peerMacAddr,
+ sizeof( tSirMacAddr ));
+
+ pMlmAddBACnf->baDialogToken = pMlmAddBAReq->baDialogToken;
+ pMlmAddBACnf->baTID = pMlmAddBAReq->baTID;
+ pMlmAddBACnf->baPolicy = pMlmAddBAReq->baPolicy;
+ pMlmAddBACnf->baBufferSize = pMlmAddBAReq->baBufferSize;
+ pMlmAddBACnf->baTimeout = pMlmAddBAReq->baTimeout;
+ pMlmAddBACnf->sessionId = pMlmAddBAReq->sessionId;
+
+ // Update the result code
+ pMlmAddBACnf->addBAResultCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+
+ limPostSmeMessage( pMac,
+ LIM_MLM_ADDBA_CNF,
+ (tANI_U32 *) pMlmAddBACnf );
+ }
+
+ // Restore MLME state
+ psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+ }
+
+ // Free the buffer allocated for tLimMlmAddBAReq
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf );
+
+}
+
+/**
+ * \brief Send an ADDBA Rsp to peer STA in response
+ * to an ADDBA Req received earlier
+ *
+ * \sa limProcessMlmAddBARsp
+ *
+ * \param pMac The global tpAniSirGlobal object
+ *
+ * \param pMsgBuf The MLME ADDBA Rsp message buffer
+ *
+ * \return none
+ */
+void limProcessMlmAddBARsp( tpAniSirGlobal pMac,
+ tANI_U32 *pMsgBuf )
+{
+tpLimMlmAddBARsp pMlmAddBARsp;
+ tANI_U16 aid;
+ tpDphHashNode pSta;
+ tpPESession psessionEntry;
+
+
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+
+ pMlmAddBARsp = (tpLimMlmAddBARsp) pMsgBuf;
+
+ if(( psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBARsp->sessionId))== NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,
+ FL("session does not exist for given session ID\n"));)
+ return;
+ }
+
+
+ // Send ADDBA Rsp over the air
+ if( eSIR_SUCCESS != limSendAddBARsp( pMac,pMlmAddBARsp,psessionEntry))
+ {
+ limLog( pMac, LOGE,
+ FL("Failed to send ADDBA Rsp to peer \n"));
+ limPrintMacAddr( pMac, pMlmAddBARsp->peerMacAddr, LOGE );
+ /* Clean the BA context maintained by HAL and TL on failure */
+ pSta = dphLookupHashEntry( pMac, pMlmAddBARsp->peerMacAddr, &aid,
+ &psessionEntry->dph.dphHashTable);
+ if( NULL != pSta )
+ {
+ limPostMsgDelBAInd( pMac, pSta, pMlmAddBARsp->baTID, eBA_RECIPIENT,
+ psessionEntry);
+ }
+ }
+
+ // Time to post a WDA_DELBA_IND to HAL in order
+ // to cleanup the HAL and SoftMAC entries
+
+
+ // Free the buffer allocated for tLimMlmAddBARsp
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf );
+
+}
+
+/**
+ * \brief Setup an A-MPDU/BA session
+ *
+ * \sa limProcessMlmDelBAReq
+ *
+ * \param pMac The global tpAniSirGlobal object
+ *
+ * \param pMsgBuf The MLME DELBA Req message buffer
+ *
+ * \return none
+ */
+void limProcessMlmDelBAReq( tpAniSirGlobal pMac,
+ tANI_U32 *pMsgBuf )
+{
+ tSirRetStatus status = eSIR_SUCCESS;
+ tpLimMlmDelBAReq pMlmDelBAReq;
+ tpLimMlmDelBACnf pMlmDelBACnf;
+ tpPESession psessionEntry;
+
+
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+
+ // TODO - Need to validate MLME state
+ pMlmDelBAReq = (tpLimMlmDelBAReq) pMsgBuf;
+
+ if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDelBAReq->sessionId))== NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId\n"));)
+ return;
+ }
+
+ // Send DELBA Ind over the air
+ if( eSIR_SUCCESS !=
+ (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
+ status = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
+ else
+ {
+ tANI_U16 aid;
+ tpDphHashNode pSta;
+
+ // Time to post a WDA_DELBA_IND to HAL in order
+ // to cleanup the HAL and SoftMAC entries
+ pSta = dphLookupHashEntry( pMac, pMlmDelBAReq->peerMacAddr, &aid , &psessionEntry->dph.dphHashTable);
+ if( NULL != pSta )
+ {
+ status = limPostMsgDelBAInd( pMac,
+ pSta,
+ pMlmDelBAReq->baTID,
+ pMlmDelBAReq->baDirection,psessionEntry);
+
+ }
+ }
+
+ //
+ // Respond immediately to SME with DELBA CNF using
+ // LIM_MLM_DELBA_CNF with appropriate status
+ //
+
+ // Allocate for LIM_MLM_DELBA_CNF
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pMlmDelBACnf,
+ sizeof( tLimMlmDelBACnf )))
+ {
+ limLog( pMac, LOGP, FL("palAllocateMemory failed\n"));
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf );
+ return;
+ }
+ else
+ {
+ palZeroMemory( pMac->hHdd, (void *) pMlmDelBACnf, sizeof( tLimMlmDelBACnf ));
+
+ palCopyMemory( pMac->hHdd,
+ (void *) pMlmDelBACnf,
+ (void *) pMlmDelBAReq,
+ sizeof( tLimMlmDelBAReq ));
+
+ // Update DELBA result code
+ pMlmDelBACnf->delBAReasonCode = pMlmDelBAReq->delBAReasonCode;
+
+ /* Update PE session Id*/
+ pMlmDelBACnf->sessionId = pMlmDelBAReq->sessionId;
+
+ limPostSmeMessage( pMac,
+ LIM_MLM_DELBA_CNF,
+ (tANI_U32 *) pMlmDelBACnf );
+ }
+
+ // Free the buffer allocated for tLimMlmDelBAReq
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf );
+
+}
+
+/**
+ * @function : limSMPowerSaveStateInd( )
+ *
+ * @brief : This function is called upon receiving the PMC Indication to update the STA's MimoPs State.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * NA
+ *
+ * NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param limMsg - Lim Message structure object with the MimoPSparam in body
+ * @return None
+ */
+
+tSirRetStatus
+limSMPowerSaveStateInd(tpAniSirGlobal pMac, tSirMacHTMIMOPowerSaveState state)
+{
+#if 0
+ tSirRetStatus retStatus = eSIR_SUCCESS;
+#if 0
+ tANI_U32 cfgVal1;
+ tANI_U16 cfgVal2;
+ tSirMacHTCapabilityInfo *pHTCapabilityInfo;
+ tpDphHashNode pSta = NULL;
+
+ tpPESession psessionEntry = &pMac->lim.gpSession[0]; //TBD-RAJESH HOW TO GET sessionEntry?????
+ /** Verify the Mode of operation */
+ if (pMac->lim.gLimSystemRole != eSYSTEM_STA_ROLE) {
+ PELOGE(limLog(pMac, LOGE, FL("Got PMC indication when System not in the STA Role\n"));)
+ return eSIR_FAILURE;
+ }
+
+ if ((pMac->lim.gHTMIMOPSState == state) || (state == eSIR_HT_MIMO_PS_NA )) {
+ PELOGE(limLog(pMac, LOGE, FL("Got Indication when already in the same mode or State passed is NA:%d \n"), state);)
+ return eSIR_FAILURE;
+ }
+
+ if (!pMac->lim.htCapability){
+ PELOGW(limLog(pMac, LOGW, FL(" Not in 11n or HT capable mode\n"));)
+ return eSIR_FAILURE;
+ }
+
+ /** Update the CFG about the default MimoPS State */
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &cfgVal1) != eSIR_SUCCESS) {
+ limLog(pMac, LOGP, FL("could not retrieve HT Cap CFG \n"));
+ return eSIR_FAILURE;
+ }
+
+ cfgVal2 = (tANI_U16)cfgVal1;
+ pHTCapabilityInfo = (tSirMacHTCapabilityInfo *) &cfgVal2;
+ pHTCapabilityInfo->mimoPowerSave = state;
+
+ if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) != eSIR_SUCCESS) {
+ limLog(pMac, LOGP, FL("could not update HT Cap Info CFG\n"));
+ return eSIR_FAILURE;
+ }
+
+ PELOG2(limLog(pMac, LOG2, FL(" The HT Capability for Mimo Pwr is updated to State: %u \n"),state);)
+ if (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE) {
+ PELOG2(limLog(pMac, LOG2,FL(" The STA is not in the Connected/Link Est Sme_State: %d \n"), pMac->lim.gLimSmeState);)
+ /** Update in the LIM the MIMO PS state of the SELF */
+ pMac->lim.gHTMIMOPSState = state;
+ return eSIR_SUCCESS;
+ }
+
+ pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
+ if (!pSta->mlmStaContext.htCapability) {
+ limLog( pMac, LOGE,FL( "limSendSMPowerState: Peer is not HT Capable \n" ));
+ return eSIR_FAILURE;
+ }
+
+ if (isEnteringMimoPS(pMac->lim.gHTMIMOPSState, state)) {
+ tSirMacAddr macAddr;
+ /** Obtain the AP's Mac Address */
+ palCopyMemory(pMac ->hHdd, (tANI_U8 *)macAddr, psessionEntry->bssId, sizeof(tSirMacAddr));
+ /** Send Action Frame with the corresponding mode */
+ retStatus = limSendSMPowerStateFrame(pMac, macAddr, state);
+ if (retStatus != eSIR_SUCCESS) {
+ PELOGE(limLog(pMac, LOGE, "Update SM POWER: Sending Action Frame has failed\n");)
+ return retStatus;
+ }
+ }
+
+ /** Update MlmState about the SetMimoPS State */
+ pMac->lim.gLimPrevMlmState = pMac->lim.gLimMlmState;
+ pMac->lim.gLimMlmState = eLIM_MLM_WT_SET_MIMOPS_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+ /** Update the HAL and s/w mac about the mode to be set */
+ retStatus = limPostSMStateUpdate( pMac,psessionEntry->staId, state);
+
+ PELOG2(limLog(pMac, LOG2, " Updated the New SMPS State");)
+ /** Update in the LIM the MIMO PS state of the SELF */
+ pMac->lim.gHTMIMOPSState = state;
+#endif
+ return retStatus;
+#endif
+return eSIR_SUCCESS;
+}
+
+void
+limSetChannel(tpAniSirGlobal pMac, tANI_U32 titanHtcap, tANI_U8 channel, tPowerdBm maxTxPower, tANI_U8 peSessionId)
+{
+#if !defined WLAN_FEATURE_VOWIFI
+ tANI_U32 localPwrConstraint;
+#endif
+
+ // Setup the CB State appropriately, prior to
+ // issuing a dphChannelChange(). This is done
+ // so that if CB is enabled, the CB Secondary
+ // Channel is setup correctly
+
+ /* if local CB admin state is off or join req CB admin state is off, don't bother with CB channel setup */
+ PELOG1(limLog(pMac, LOG1, FL("Before : gCbState = 0x%x, gCbmode = %x\n"), pMac->lim.gCbState, pMac->lim.gCbMode);)
+ if(GET_CB_ADMIN_STATE(pMac->lim.gCbState) &&
+ SME_GET_CB_ADMIN_STATE(titanHtcap)) {
+ PELOG1(limLog(pMac, LOG1, FL("station doing channel bonding\n"));)
+ setupCBState( pMac, (tAniCBSecondaryMode)SME_GET_CB_OPER_STATE(titanHtcap));
+ }else {
+ PELOG1(limLog(pMac, LOG1, FL("station not doing channel bonding\n"));)
+ setupCBState(pMac, eANI_CB_SECONDARY_NONE);
+ }
+
+ PELOG1(limLog(pMac, LOG1, FL("After :gCbState = 0x%x, gCbmode = %x\n"), pMac->lim.gCbState, pMac->lim.gCbMode);)
+
+ #if 0
+ if (wlan_cfgSetInt(pMac, WNI_CFG_CURRENT_CHANNEL, channel) != eSIR_SUCCESS) {
+ limLog(pMac, LOGP, FL("could not set CURRENT_CHANNEL at CFG\n"));
+ return;
+ }
+ #endif // TO SUPPORT BT-AMP
+
+#if defined WLAN_FEATURE_VOWIFI
+ limSendSwitchChnlParams( pMac, channel, limGetPhyCBState( pMac ), maxTxPower, peSessionId);
+#else
+ if (wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
+ limLog(pMac, LOGP, FL("could not read WNI_CFG_LOCAL_POWER_CONSTRAINT from CFG\n"));
+ return;
+ }
+ // Send WDA_CHNL_SWITCH_IND to HAL
+ limSendSwitchChnlParams( pMac, channel, limGetPhyCBState( pMac ), (tPowerdBm)localPwrConstraint, peSessionId);
+#endif
+
+ }
+
+
diff --git a/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c b/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c
new file mode 100644
index 0000000..70d3b57
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c
@@ -0,0 +1,4991 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limProcessMlmRspMessages.cc contains the code
+ * for processing response messages from MLM state machine.
+ * Author: Chandra Modumudi
+ * Date: 02/11/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+#include "wniApi.h"
+#ifdef ANI_PRODUCT_TYPE_AP
+#include "wniCfgAp.h"
+#else
+#include "wniCfgSta.h"
+#endif
+#include "cfgApi.h"
+#include "sirApi.h"
+#include "schApi.h"
+#include "utilsApi.h"
+#include "limUtils.h"
+#include "limAssocUtils.h"
+#include "limSecurityUtils.h"
+#include "limSerDesUtils.h"
+#include "limTimerUtils.h"
+#include "limSendMessages.h"
+#include "limAdmitControl.h"
+#include "limSendMessages.h"
+#include "limIbssPeerMgmt.h"
+#include "limSession.h"
+#if defined WLAN_FEATURE_VOWIFI
+#include "rrmApi.h"
+#endif
+#if defined WLAN_FEATURE_VOWIFI_11R
+#include <limFT.h>
+#endif
+
+static void limHandleSmeJoinResult(tpAniSirGlobal, tSirResultCodes, tANI_U16,tpPESession);
+void limProcessMlmScanCnf(tpAniSirGlobal, tANI_U32 *);
+void limProcessMlmJoinCnf(tpAniSirGlobal, tANI_U32 *);
+void limProcessMlmAuthCnf(tpAniSirGlobal, tANI_U32 *);
+void limProcessMlmStartCnf(tpAniSirGlobal, tANI_U32 *);
+void limProcessMlmAuthInd(tpAniSirGlobal, tANI_U32 *);
+void limProcessMlmAssocInd(tpAniSirGlobal, tANI_U32 *);
+void limProcessMlmAssocCnf(tpAniSirGlobal, tANI_U32 *);
+void limProcessMlmReassocCnf(tpAniSirGlobal, tANI_U32 *);
+void limProcessMlmReassocInd(tpAniSirGlobal, tANI_U32 *);
+void limProcessMlmSetKeysCnf(tpAniSirGlobal, tANI_U32 *);
+void limProcessMlmDisassocInd(tpAniSirGlobal, tANI_U32 *);
+void limProcessMlmDisassocCnf(tpAniSirGlobal, tANI_U32 *);
+void limProcessMlmDeauthInd(tpAniSirGlobal, tANI_U32 *);
+void limProcessMlmDeauthCnf(tpAniSirGlobal, tANI_U32 *);
+void limProcessMlmPurgeStaInd(tpAniSirGlobal, tANI_U32 *);
+void limProcessMlmAddBACnf(tpAniSirGlobal, tANI_U32 *);
+void limProcessMlmDelBACnf(tpAniSirGlobal, tANI_U32 *);
+void limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 * pMsgBuf);
+static void limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry);
+void limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *, tANI_U8 *, tANI_U16 *);
+static void
+limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry);
+/**
+ * limProcessMlmRspMessages()
+ *
+ *FUNCTION:
+ * This function is called to processes various MLM response (CNF/IND
+ * messages from MLM State machine.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param msgType Indicates the MLM message type
+ * @param *pMsgBuf A pointer to the MLM message buffer
+ *
+ * @return None
+ */
+void
+limProcessMlmRspMessages(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
+{
+
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+ switch (msgType)
+ {
+ case LIM_MLM_SCAN_CNF:
+ limProcessMlmScanCnf(pMac, pMsgBuf);
+ break;
+
+
+ case LIM_MLM_AUTH_CNF:
+ limProcessMlmAuthCnf(pMac, pMsgBuf);
+ break;
+ case LIM_MLM_AUTH_IND:
+ limProcessMlmAuthInd(pMac, pMsgBuf);
+ break;
+ case LIM_MLM_ASSOC_CNF:
+ limProcessMlmAssocCnf(pMac, pMsgBuf);
+ break;
+ case LIM_MLM_START_CNF:
+ limProcessMlmStartCnf(pMac, pMsgBuf);
+ break;
+ case LIM_MLM_JOIN_CNF:
+ limProcessMlmJoinCnf(pMac, pMsgBuf);
+ break;
+ case LIM_MLM_ASSOC_IND:
+ limProcessMlmAssocInd(pMac, pMsgBuf);
+ break;
+ case LIM_MLM_REASSOC_CNF:
+ limProcessMlmReassocCnf(pMac, pMsgBuf);
+ break;
+ case LIM_MLM_REASSOC_IND:
+ limProcessMlmReassocInd(pMac, pMsgBuf);
+ break;
+ case LIM_MLM_DISASSOC_CNF:
+ limProcessMlmDisassocCnf(pMac, pMsgBuf);
+ break;
+ case LIM_MLM_DISASSOC_IND:
+ limProcessMlmDisassocInd(pMac, pMsgBuf);
+ break;
+ case LIM_MLM_PURGE_STA_IND:
+ limProcessMlmPurgeStaInd(pMac, pMsgBuf);
+ break;
+ case LIM_MLM_DEAUTH_CNF:
+ limProcessMlmDeauthCnf(pMac, pMsgBuf);
+ break;
+ case LIM_MLM_DEAUTH_IND:
+ limProcessMlmDeauthInd(pMac, pMsgBuf);
+ break;
+ case LIM_MLM_SETKEYS_CNF:
+ limProcessMlmSetKeysCnf(pMac, pMsgBuf);
+ break;
+ case LIM_MLM_REMOVEKEY_CNF:
+ limProcessMlmRemoveKeyCnf(pMac, pMsgBuf);
+ break;
+ case LIM_MLM_TSPEC_CNF:
+ break;
+ case LIM_MLM_ADDBA_CNF:
+ limProcessMlmAddBACnf( pMac, pMsgBuf );
+ break;
+ case LIM_MLM_DELBA_CNF:
+ limProcessMlmDelBACnf( pMac, pMsgBuf );
+ break;
+ default:
+ break;
+ } // switch (msgType)
+ return;
+} /*** end limProcessMlmRspMessages() ***/
+
+/**
+ * limProcessMlmScanCnf()
+ *
+ *FUNCTION:
+ * This function is called to processes MLM_SCAN_CNF
+ * message from MLM State machine.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pMsgBuf A pointer to the MLM message buffer
+ *
+ * @return None
+ */
+void
+limProcessMlmScanCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ switch(pMac->lim.gLimSmeState)
+ {
+ case eLIM_SME_WT_SCAN_STATE:
+ //case eLIM_SME_LINK_EST_WT_SCAN_STATE: //TO SUPPORT BT-AMP
+ //case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE: //TO SUPPORT BT-AMP
+ pMac->lim.gLimSmeState = pMac->lim.gLimPrevSmeState;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+ pMac->lim.gLimSystemInScanLearnMode = 0;
+ break;
+ default:
+ /**
+ * Should not have received scan confirm
+ * from MLM in other states.
+ * Log error
+ */
+ PELOGE(limLog(pMac, LOGE,
+ FL("received unexpected MLM_SCAN_CNF in state %X\n"),
+ pMac->lim.gLimSmeState);)
+ return;
+ }
+
+ /// Process received scan confirm
+ /// Increment length of cached scan results
+ pMac->lim.gLimSmeScanResultLength +=
+ ((tLimMlmScanCnf *) pMsgBuf)->scanResultLength;
+ if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
+ {
+ tANI_U16 scanRspLen = 0;
+ /// Need to send response to Host
+ pMac->lim.gLimRspReqd = false;
+ if ((((tLimMlmScanCnf *) pMsgBuf)->resultCode ==
+ eSIR_SME_SUCCESS) ||
+ pMac->lim.gLimSmeScanResultLength)
+ {
+ scanRspLen = sizeof(tSirSmeScanRsp) +
+ pMac->lim.gLimSmeScanResultLength -
+ sizeof(tSirBssDescription);
+ }
+ else
+ {
+ scanRspLen = sizeof(tSirSmeScanRsp);
+ }
+ if(pMac->lim.gLimReportBackgroundScanResults)
+ {
+ pMac->lim.gLimBackgroundScanTerminate = TRUE;
+ }
+ if (pMac->lim.gLimSmeScanResultLength == 0)
+ {
+ limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
+ }
+ else
+ {
+ limSendSmeScanRsp(pMac, scanRspLen,
+ eSIR_SME_SUCCESS,pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
+ }
+ } // if (pMac->lim.gLimRspReqd)
+ //check to see whether we need to run bgScan timer
+ if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
+ {
+ if (tx_timer_activate(
+ &pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
+ {
+ /// Could not activate background scan timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("could not activate background scan timer\n"));
+ pMac->lim.gLimBackgroundScanStarted = FALSE;
+ }
+ else
+ {
+ pMac->lim.gLimBackgroundScanStarted = TRUE;
+ }
+ }
+} /*** end limProcessMlmScanCnf() ***/
+
+
+/**
+ * limProcessMlmStartCnf()
+ *
+ *FUNCTION:
+ * This function is called to processes MLM_START_CNF
+ * message from MLM State machine.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pMsgBuf A pointer to the MLM message buffer
+ *
+ * @return None
+ */
+void
+limProcessMlmStartCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tpPESession psessionEntry = NULL;
+ tLimMlmStartCnf *pLimMlmStartCnf;
+ tANI_U8 smesessionId;
+ tANI_U16 smetransactionId;
+
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+ pLimMlmStartCnf = (tLimMlmStartCnf*)pMsgBuf;
+ if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmStartCnf->sessionId))==NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Session does Not exist with given sessionId \n"));)
+ return;
+ }
+ smesessionId = psessionEntry->smeSessionId;
+ smetransactionId = psessionEntry->transactionId;
+
+ if (psessionEntry->limSmeState != eLIM_SME_WT_START_BSS_STATE)
+ {
+ /**
+ * Should not have received Start confirm from MLM
+ * in other states.
+ * Log error
+ */
+ PELOGE(limLog(pMac, LOGE,
+ FL("received unexpected MLM_START_CNF in state %X\n"),
+ psessionEntry->limSmeState);)
+ return;
+ }
+ if (((tLimMlmStartCnf *) pMsgBuf)->resultCode ==
+ eSIR_SME_SUCCESS)
+ {
+
+ /**
+ * Update global SME state so that Beacon Generation
+ * module starts writing Beacon frames into TFP's
+ * Beacon file register.
+ */
+ psessionEntry->limSmeState = eLIM_SME_NORMAL_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+ if(psessionEntry->bssType == eSIR_BTAMP_STA_MODE)
+ {
+ limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP STA SIDE***\n"));
+ }
+ else if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
+ {
+ limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP AP SIDE***\n"));
+ }
+#ifdef WLAN_SOFTAP_FEATURE
+ else if(psessionEntry->bssType == eSIR_INFRA_AP_MODE)
+ {
+ limLog(pMac, LOG1, FL("*** Started BSS in INFRA AP SIDE***\n"));
+ }
+#endif
+ else
+ PELOG1(limLog(pMac, LOG1, FL("*** Started BSS ***\n"));)
+ }
+ else
+ {
+ /// Start BSS is a failure
+ peDeleteSession(pMac,psessionEntry);
+ psessionEntry = NULL;
+ }
+ /// Send response to Host
+ limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP,
+ ((tLimMlmStartCnf *) pMsgBuf)->resultCode,psessionEntry,
+ smesessionId,smetransactionId);
+#ifdef WLAN_SOFTAP_FEATURE
+ if (((tLimMlmStartCnf *) pMsgBuf)->resultCode == eSIR_SME_SUCCESS)
+ {
+ //Configure beacon and send beacons to HAL
+ limSendBeaconInd(pMac, psessionEntry);
+ }
+#endif
+}
+
+ /*** end limProcessMlmStartCnf() ***/
+
+/**
+ * limProcessMlmJoinCnf()
+ *
+ *FUNCTION:
+ * This function is called to processes MLM_JOIN_CNF
+ * message from MLM State machine.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pMsgBuf A pointer to the MLM message buffer
+ *
+ * @return None
+ */
+void
+limProcessMlmJoinCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tSirResultCodes resultCode;
+ tLimMlmJoinCnf *pLimMlmJoinCnf;
+ tpPESession psessionEntry;
+ pLimMlmJoinCnf = (tLimMlmJoinCnf*)pMsgBuf;
+ if( (psessionEntry = peFindSessionBySessionId(pMac,pLimMlmJoinCnf->sessionId))== NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Session does not exist for given sessionId\n"));)
+ return;
+ }
+
+ if (psessionEntry->limSmeState!= eLIM_SME_WT_JOIN_STATE)
+ {
+ PELOGE(limLog(pMac, LOGE,
+ FL("received unexpected MLM_JOIN_CNF in state %X\n"),
+ psessionEntry->limSmeState);)
+ return;
+ }
+
+ resultCode = ((tLimMlmJoinCnf *) pMsgBuf)->resultCode ;
+ /// Process Join confirm from MLM
+ if (resultCode == eSIR_SME_SUCCESS)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("*** Joined ESS ***\n"));)
+ //Setup hardware upfront
+ PELOGE(limLog(pMac, LOGE, FL("*** Starting to add BSS***\n"));) //remove me
+ //Done: 7-27-2009. JIM_FIX_ME sessionize the following function
+ if(limStaSendAddBssPreAssoc( pMac, false, psessionEntry) == eSIR_SUCCESS)
+ return;
+ else
+ resultCode = eSIR_SME_REFUSED;
+ }
+ {
+ /// Join failure
+ psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, psessionEntry->limSmeState));
+ /// Send Join response to Host
+ limHandleSmeJoinResult(pMac, resultCode, ((tLimMlmJoinCnf *) pMsgBuf)->protStatusCode, psessionEntry );
+ }
+} /*** end limProcessMlmJoinCnf() ***/
+
+/**
+ * limProcessMlmAuthCnf()
+ *
+ *FUNCTION:
+ * This function is called to processes MLM_AUTH_CNF
+ * message from MLM State machine.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pMsgBuf A pointer to the MLM message buffer
+ *
+ * @return None
+ */
+void
+limProcessMlmAuthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tANI_U16 caps;
+ tANI_U32 val;
+ tAniAuthType cfgAuthType, authMode;
+ tLimMlmAuthReq *pMlmAuthReq;
+ tLimMlmAssocReq *pMlmAssocReq;
+ tLimMlmAuthCnf *pMlmAuthCnf;
+ tpPESession psessionEntry;
+ tANI_U32 teleBcnEn = 0;
+// tANI_U8 sessionId;
+
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+ pMlmAuthCnf = (tLimMlmAuthCnf*)pMsgBuf;
+ if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAuthCnf->sessionId))== NULL)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("session does not exist for given sessionId\n"));)
+ return;
+ }
+
+ if (((psessionEntry->limSmeState != eLIM_SME_WT_AUTH_STATE) &&
+ (psessionEntry->limSmeState != eLIM_SME_WT_PRE_AUTH_STATE)) ||
+ (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
+ {
+ /**
+ * Should not have received AUTH confirm
+ * from MLM in other states or on AP.
+ * Log error
+ */
+ PELOGE(limLog(pMac, LOGE,
+ FL("received unexpected MLM_AUTH_CNF in state %X\n"),
+ psessionEntry->limSmeState);)
+ return;
+ }
+ /// Process AUTH confirm from MLM
+ if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
+ {
+ if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
+ {
+ if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
+ (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get AuthType value from CFG.
+ * Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve AuthType value\n"));
+ }
+ }
+ else
+ cfgAuthType = pMac->lim.gLimPreAuthType;
+
+ if ((cfgAuthType == eSIR_AUTO_SWITCH) &&
+ (((tLimMlmAuthCnf *) pMsgBuf)->authType == eSIR_OPEN_SYSTEM)
+ && (eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS == ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode))
+ {
+ /**
+ * When Open authentication fails with reason code "13" and
+ * authType set to 'auto switch', Try with Shared Authentication
+ */
+ authMode = eSIR_SHARED_KEY;
+ // Trigger MAC based Authentication
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmAuthReq, sizeof(tLimMlmAuthReq)))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for mlmAuthReq\n"));
+ return;
+ }
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pMlmAuthReq, sizeof(tLimMlmAuthReq));
+ val = sizeof(tSirMacAddr);
+ if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
+ {
+ sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
+ }
+ else
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmAuthReq->peerMacAddr,
+ (tANI_U8 *) &pMac->lim.gLimPreAuthPeerAddr,
+ sizeof(tSirMacAddr));
+ pMlmAuthReq->authType = authMode;
+ /* Update PE session Id*/
+ pMlmAuthReq->sessionId = pMlmAuthCnf->sessionId;
+ if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
+ (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
+ != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get AuthFailureTimeout value from CFG.
+ * Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve AuthFailureTimeout value\n"));
+ }
+ limPostMlmMessage(pMac,
+ LIM_MLM_AUTH_REQ,
+ (tANI_U32 *) pMlmAuthReq);
+ return;
+ }
+ else
+ {
+ // MAC based authentication failure
+ if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Auth Failure occurred.\n"));)
+ psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+ psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+ if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
+ psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState.\n"));)
+#if defined(ANI_AP_CLIENT_SDK)
+ if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
+ {
+ tSirMacAddr nullMacAddr = {0, 0, 0, 0, 0, 0};
+ PELOGE(limLog(pMac, LOGE, FL("Setting current BSSID as NULL in cfg\n"));)
+ palCopyMemory(pMac->hHdd, pMac->lim.gLimBssid, nullMacAddr, sizeof(tSirMacAddr));
+ if (cfgSetStr(pMac, WNI_CFG_BSSID, nullMacAddr, sizeof(tSirMacAddr)) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Could not update BSSID on CFG"));
+ }
+ }
+#endif
+ /**
+ * Need to send Join response with
+ * auth failure to Host.
+ */
+ limHandleSmeJoinResult(pMac,
+ ((tLimMlmAuthCnf *) pMsgBuf)->resultCode, ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry);
+ }
+ else
+ {
+ /**
+ * Pre-authentication failure.
+ * Send Pre-auth failure response to host
+ */
+ psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+ limSendSmeAuthRsp(
+ pMac,
+ ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
+ ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
+ ((tLimMlmAuthCnf *) pMsgBuf)->authType,
+ ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
+ }
+ } // end if (cfgAuthType == eAUTO_SWITCH)
+ } // if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
+ else
+ {
+ if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
+ {
+ /**
+ * Successful MAC based authentication
+ * Trigger Association with BSS
+ */
+ PELOG1(limLog(pMac, LOG1,
+ FL("*** Authenticated with BSS ***\n"));)
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmAssocReq, sizeof(tLimMlmAssocReq)))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for mlmAssocReq\n"));
+ return;
+ }
+ val = sizeof(tSirMacAddr);
+ #if 0
+ if (cfgGetStr(pMac, WNI_CFG_BSSID,
+ pMlmAssocReq->peerMacAddr,
+ &val) != eSIR_SUCCESS)
+ {
+ /// Could not get BSSID from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
+ }
+ #endif //SUPPORT BT-AMP
+ sirCopyMacAddr(pMlmAssocReq->peerMacAddr,psessionEntry->bssId);
+ if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
+ (tANI_U32 *) &pMlmAssocReq->assocFailureTimeout)
+ != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get AssocFailureTimeout value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve AssocFailureTimeout value\n"));
+ }
+ if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get Capabilities value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve Capabilities value\n"));
+ }
+ /*Clear spectrum management bit if AP doesn't support it*/
+ if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo & LIM_SPECTRUM_MANAGEMENT_BIT_MASK))
+ {
+ /*AP doesn't support spectrum management clear spectrum management bit*/
+ caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK);
+ }
+
+ pMlmAssocReq->capabilityInfo = caps;
+ PELOG3(limLog(pMac, LOG3,
+ FL("Capabilities to be used in AssocReq=0x%X, privacy bit=%x\n"),
+ caps,
+ ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->privacy);)
+
+ /* If telescopic beaconing is enabled, set listen interval to
+ WNI_CFG_TELE_BCN_MAX_LI */
+ if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
+ eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN\n"));
+
+ val = WNI_CFG_LISTEN_INTERVAL_STADEF;
+
+ if(teleBcnEn)
+ {
+ if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
+ eSIR_SUCCESS)
+ {
+ /**
+ * Could not get ListenInterval value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP, FL("could not retrieve ListenInterval\n"));
+ }
+ }
+ else
+ {
+ if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get ListenInterval value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP, FL("could not retrieve ListenInterval\n"));
+ }
+ }
+
+ pMlmAssocReq->listenInterval = (tANI_U16)val;
+ /* Update PE session ID*/
+ pMlmAssocReq->sessionId = psessionEntry->peSessionId;
+ psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
+ psessionEntry->limSmeState = eLIM_SME_WT_ASSOC_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+ limPostMlmMessage(pMac,
+ LIM_MLM_ASSOC_REQ,
+ (tANI_U32 *) pMlmAssocReq);
+ }
+ else
+ {
+ /**
+ * Successful Pre-authentication.
+ * Send Pre-auth response to host
+ */
+ psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+ limSendSmeAuthRsp(
+ pMac,
+ ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
+ ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
+ ((tLimMlmAuthCnf *) pMsgBuf)->authType,
+ ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
+ }
+ } // end if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
+} /*** end limProcessMlmAuthCnf() ***/
+
+/**
+ * limProcessMlmAssocCnf()
+ *
+ *FUNCTION:
+ * This function is called to processes MLM_ASSOC_CNF
+ * message from MLM State machine.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pMsgBuf A pointer to the MLM message buffer
+ *
+ * @return None
+ */
+void
+limProcessMlmAssocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tpPESession psessionEntry;
+ tLimMlmAssocCnf *pLimMlmAssocCnf;
+
+ if(pMsgBuf == NULL)
+ {
+ limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
+ return;
+ }
+ pLimMlmAssocCnf = (tLimMlmAssocCnf*)pMsgBuf;
+ if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmAssocCnf->sessionId)) == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Session does not exist for given sessionId\n"));)
+ return;
+ }
+ if (psessionEntry->limSmeState != eLIM_SME_WT_ASSOC_STATE ||
+ psessionEntry->limSystemRole == eLIM_AP_ROLE || psessionEntry ->limSystemRole == eLIM_BT_AMP_AP_ROLE)
+ {
+ /**
+ * Should not have received Assocication confirm
+ * from MLM in other states OR on AP.
+ * Log error
+ */
+ PELOGE(limLog(pMac, LOGE,
+ FL("received unexpected MLM_ASSOC_CNF in state %X\n"),
+ psessionEntry->limSmeState);)
+ return;
+ }
+ if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
+ {
+ // Association failure
+ PELOG1(limLog(pMac, LOG1, FL("*** Association failure ***\n"));)
+ psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+#if defined(ANI_AP_CLIENT_SDK)
+ if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
+ {
+ tSirMacAddr nullMacAddr = {0, 0, 0, 0, 0, 0};
+ palCopyMemory(pMac->hHdd, pMac->lim.gLimBssid, nullMacAddr, sizeof(tSirMacAddr));
+ if (cfgSetStr(pMac, WNI_CFG_BSSID, nullMacAddr, sizeof(tSirMacAddr)) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Could not update BSSID on CFG"));
+ }
+ }
+#endif
+ /**
+ * Need to send Join response with
+ * Association failure to Host.
+ */
+ limHandleSmeJoinResult(pMac,
+ ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
+ ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
+ } // if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ...
+ else
+ {
+ // Successful Association
+ PELOG1(limLog(pMac, LOG1, FL("*** Associated with BSS ***\n"));)
+ psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+ /**
+ * Need to send Join response with
+ * Association success to Host.
+ */
+ limHandleSmeJoinResult(pMac,
+ ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
+ ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
+ } // end if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ....
+} /*** end limProcessMlmAssocCnf() ***/
+
+/**
+ * limProcessMlmReassocCnf()
+ *
+ *FUNCTION:
+ * This function is called to processes MLM_REASSOC_CNF
+ * message from MLM State machine.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pMsgBuf A pointer to the MLM message buffer
+ *
+ * @return None
+ */
+void
+limProcessMlmReassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tpPESession psessionEntry;
+ tLimMlmReassocCnf *pLimMlmReassocCnf;
+
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+ pLimMlmReassocCnf = (tLimMlmReassocCnf*) pMsgBuf;
+ if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmReassocCnf->sessionId))==NULL)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("session Does not exist for given session Id\n"));)
+ return;
+ }
+ if ((psessionEntry->limSmeState != eLIM_SME_WT_REASSOC_STATE) ||
+ (psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
+ {
+ /**
+ * Should not have received Reassocication confirm
+ * from MLM in other states OR on AP.
+ * Log error
+ */
+ PELOGE(limLog(pMac, LOGE,
+ FL("Rcv unexpected MLM_REASSOC_CNF in role %d, sme state 0x%X\n"),
+ psessionEntry->limSystemRole, psessionEntry->limSmeState);)
+ return;
+ }
+ if (psessionEntry->pLimReAssocReq) {
+ palFreeMemory( pMac->hHdd, psessionEntry->pLimReAssocReq);
+ psessionEntry->pLimReAssocReq = NULL;
+ }
+
+ PELOGE(limLog(pMac, LOGE, FL("Rcv MLM_REASSOC_CNF with result code %d\n"), pLimMlmReassocCnf->resultCode);)
+ if (pLimMlmReassocCnf->resultCode == eSIR_SME_SUCCESS) {
+ // Successful Reassociation
+ PELOG1(limLog(pMac, LOG1, FL("*** Reassociated with new BSS ***\n"));)
+
+ psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+
+ /**
+ * Need to send Reassoc response with
+ * Reassociation success to Host.
+ */
+ limSendSmeJoinReassocRsp(
+ pMac, eWNI_SME_REASSOC_RSP,
+ pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
+ psessionEntry->smeSessionId,psessionEntry->transactionId);
+ }else if (pLimMlmReassocCnf->resultCode == eSIR_SME_REASSOC_REFUSED) {
+ /** Reassociation failure With the New AP
+ * but we still have the link with the Older AP
+ */
+ psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+
+ /**
+ * Need to send Reassoc response with
+ * Association failure to Host.
+ */
+ limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
+ pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
+ psessionEntry->smeSessionId,psessionEntry->transactionId);
+ }else {
+ // Reassociation failure
+ psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+ /**
+ * Need to send Reassoc response with
+ * Association failure to Host.
+ */
+ limSendSmeJoinReassocRsp(
+ pMac, eWNI_SME_REASSOC_RSP,
+ pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
+ psessionEntry->smeSessionId,psessionEntry->transactionId);
+ }
+} /*** end limProcessMlmReassocCnf() ***/
+
+/**
+ * limProcessMlmReassocInd()
+ *
+ *FUNCTION:
+ * This function is called to processes MLM_REASSOC_IND
+ * message from MLM State machine.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pMsgBuf A pointer to the MLM message buffer
+ *
+ * @return None
+ */
+void
+limProcessMlmReassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tANI_U32 len;
+ tSirMsgQ msgQ;
+ tSirSmeReassocInd *pSirSmeReassocInd;
+ tpDphHashNode pStaDs=0;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId;
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+ if((psessionEntry = peFindSessionByBssid(pMac,((tpLimMlmReassocInd)pMsgBuf)->peerMacAddr, &sessionId))== NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));)
+ return;
+ }
+ /// Inform Host of STA reassociation
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ len = sizeof(tSirSmeReassocInd) -
+ sizeof(tSirNeighborBssInfo) +
+ (((tpLimMlmReassocInd) pMsgBuf)->numBss *
+ sizeof(tSirNeighborBssInfo)) -
+ SIR_MAC_MAX_SSID_LENGTH +
+ ((tpLimMlmReassocInd) pMsgBuf)->ssId.length;
+#else
+ len = sizeof(tSirSmeReassocInd);
+#endif
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeReassocInd, len))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for eWNI_SME_REASSOC_IND\n"));
+ return;
+
+ }
+ sirStoreU16N((tANI_U8 *) &pSirSmeReassocInd->messageType,
+ eWNI_SME_REASSOC_IND);
+ limReassocIndSerDes(pMac, (tpLimMlmReassocInd) pMsgBuf,
+ (tANI_U8 *) &(pSirSmeReassocInd->length), psessionEntry);
+
+ // Required for indicating the frames to upper layer
+ pSirSmeReassocInd->assocReqLength = ((tpLimMlmReassocInd) pMsgBuf)->assocReqLength;
+ pSirSmeReassocInd->assocReqPtr = ((tpLimMlmReassocInd) pMsgBuf)->assocReqPtr;
+ pSirSmeReassocInd->beaconPtr = psessionEntry->beacon;
+ pSirSmeReassocInd->beaconLength = psessionEntry->bcnLen;
+
+ msgQ.type = eWNI_SME_REASSOC_IND;
+ msgQ.bodyptr = pSirSmeReassocInd;
+ msgQ.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_IND_EVENT, psessionEntry, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+ pStaDs = dphGetHashEntry(pMac, ((tpLimMlmReassocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
+ if (! pStaDs)
+ {
+ limLog( pMac, LOGP, FL("MLM ReAssocInd: Station context no longer valid (aid %d)\n"),
+ ((tpLimMlmReassocInd) pMsgBuf)->aid);
+ palFreeMemory(pMac->hHdd, pSirSmeReassocInd);
+ return;
+ }
+
+ limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
+ PELOG1(limLog(pMac, LOG1,
+ FL("Create CNF_WAIT_TIMER after received LIM_MLM_REASSOC_IND\n"));)
+ /*
+ ** turn on a timer to detect the loss of REASSOC CNF
+ **/
+ limActivateCnfTimer(pMac,
+ (tANI_U16) ((tpLimMlmReassocInd) pMsgBuf)->aid, psessionEntry);
+} /*** end limProcessMlmReassocInd() ***/
+
+/**
+ * limProcessMlmAuthInd()
+ *
+ *FUNCTION:
+ * This function is called to processes MLM_AUTH_IND
+ * message from MLM State machine.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pMsgBuf A pointer to the MLM message buffer
+ *
+ * @return None
+ */
+void
+limProcessMlmAuthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tSirMsgQ msgQ;
+ tSirSmeAuthInd *pSirSmeAuthInd;
+
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeAuthInd, sizeof(tSirSmeAuthInd)))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for eWNI_SME_AUTH_IND\n"));
+ }
+ limCopyU16((tANI_U8 *) &pSirSmeAuthInd->messageType, eWNI_SME_AUTH_IND);
+ limAuthIndSerDes(pMac, (tpLimMlmAuthInd) pMsgBuf,
+ (tANI_U8 *) &(pSirSmeAuthInd->length));
+ msgQ.type = eWNI_SME_AUTH_IND;
+ msgQ.bodyptr = pSirSmeAuthInd;
+ msgQ.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_IND_EVENT, NULL, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+ limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
+} /*** end limProcessMlmAuthInd() ***/
+
+
+
+
+void
+limFillAssocIndParams(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd,
+ tSirSmeAssocInd *pSirSmeAssocInd,
+ tpPESession psessionEntry)
+{
+ pSirSmeAssocInd->length = sizeof(tSirSmeAssocInd);
+ pSirSmeAssocInd->sessionId = psessionEntry->smeSessionId;
+
+ // Required for indicating the frames to upper layer
+ pSirSmeAssocInd->assocReqLength = pAssocInd->assocReqLength;
+ pSirSmeAssocInd->assocReqPtr = pAssocInd->assocReqPtr;
+
+ pSirSmeAssocInd->beaconPtr = psessionEntry->beacon;
+ pSirSmeAssocInd->beaconLength = psessionEntry->bcnLen;
+
+ // Fill in peerMacAddr
+ palCopyMemory( pMac->hHdd, pSirSmeAssocInd->peerMacAddr, pAssocInd->peerMacAddr, sizeof(tSirMacAddr));
+ // Fill in aid
+ pSirSmeAssocInd->aid = pAssocInd->aid;
+ // Fill in bssId
+ palCopyMemory( pMac->hHdd, pSirSmeAssocInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
+ // Fill in staId
+ //pSirSmeAssocInd->staId = psessionEntry->staId;
+ // Fill in authType
+ pSirSmeAssocInd->authType = pAssocInd->authType;
+ // Fill in ssId
+ palCopyMemory( pMac->hHdd, (tANI_U8*)&pSirSmeAssocInd->ssId,
+ (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
+ pSirSmeAssocInd->rsnIE.length = pAssocInd->rsnIE.length;
+ palCopyMemory( pMac->hHdd, (tANI_U8*) &pSirSmeAssocInd->rsnIE.rsnIEdata,
+ (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
+ pAssocInd->rsnIE.length);
+
+ pSirSmeAssocInd->addIE.length = pAssocInd->addIE.length;
+ palCopyMemory( pMac->hHdd, (tANI_U8*) &pSirSmeAssocInd->addIE.addIEdata,
+ (tANI_U8 *) &(pAssocInd->addIE.addIEdata),
+ pAssocInd->addIE.length);
+
+ // Copy the new TITAN capabilities
+ pSirSmeAssocInd->titanHtCaps = pAssocInd->titanHtCaps;
+ pSirSmeAssocInd->spectrumMgtIndicator = pAssocInd->spectrumMgtIndicator;
+ if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
+ {
+ pSirSmeAssocInd->powerCap.minTxPower = pAssocInd->powerCap.minTxPower;
+ pSirSmeAssocInd->powerCap.maxTxPower = pAssocInd->powerCap.maxTxPower;
+ pSirSmeAssocInd->supportedChannels.numChnl = pAssocInd->supportedChannels.numChnl;
+ palCopyMemory( pMac->hHdd, (tANI_U8*) &pSirSmeAssocInd->supportedChannels.channelList,
+ (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
+ pAssocInd->supportedChannels.numChnl);
+ }
+#ifdef WLAN_SOFTAP_FEATURE
+ // Fill in WmmInfo
+ pSirSmeAssocInd->wmmEnabledSta = pAssocInd->WmmStaInfoPresent;
+#endif
+} /*** end limAssocIndSerDes() ***/
+
+
+
+/**
+ * limProcessMlmAssocInd()
+ *
+ *FUNCTION:
+ * This function is called to processes MLM_ASSOC_IND
+ * message from MLM State machine.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pMsgBuf A pointer to the MLM message buffer
+ *
+ * @return None
+ */
+void
+limProcessMlmAssocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tANI_U32 len;
+ tSirMsgQ msgQ;
+ tSirSmeAssocInd *pSirSmeAssocInd;
+ tpDphHashNode pStaDs=0;
+ tpPESession psessionEntry;
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+ if((psessionEntry = peFindSessionBySessionId(pMac,((tpLimMlmAssocInd) pMsgBuf)->sessionId))== NULL)
+ {
+ limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId\n" ));
+ return;
+ }
+ /// Inform Host of STA association
+#if defined (ANI_PRODUCT_TYPE_AP)
+ len = sizeof(tSirSmeAssocInd) -
+ sizeof(tSirNeighborBssInfo) +
+ (((tpLimMlmAssocInd) pMsgBuf)->numBss *
+ sizeof(tSirNeighborBssInfo)) -
+ SIR_MAC_MAX_SSID_LENGTH +
+ ((tpLimMlmAssocInd) pMsgBuf)->ssId.length;
+#else
+ len = sizeof(tSirSmeAssocInd);
+#endif
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeAssocInd, len))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for eWNI_SME_ASSOC_IND\n"));
+ return;
+ }
+
+#if defined (ANI_PRODUCT_TYPE_AP)
+ sirStoreU16N((tANI_U8 *) &pSirSmeAssocInd->messageType,
+ eWNI_SME_ASSOC_IND);
+ limAssocIndSerDes(pMac, (tpLimMlmAssocInd) pMsgBuf,
+ (tANI_U8 *) &(pSirSmeAssocInd->length), psessionEntry);
+#else
+ pSirSmeAssocInd->messageType = eWNI_SME_ASSOC_IND;
+ limFillAssocIndParams(pMac, (tpLimMlmAssocInd) pMsgBuf, pSirSmeAssocInd, psessionEntry);
+#endif
+ msgQ.type = eWNI_SME_ASSOC_IND;
+ msgQ.bodyptr = pSirSmeAssocInd;
+ msgQ.bodyval = 0;
+ pStaDs = dphGetHashEntry(pMac,
+ ((tpLimMlmAssocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
+ if (! pStaDs)
+ { // good time to panic...
+ limLog(pMac, LOGE, FL("MLM AssocInd: Station context no longer valid (aid %d)\n"),
+ ((tpLimMlmAssocInd) pMsgBuf)->aid);
+ palFreeMemory(pMac->hHdd, pSirSmeAssocInd);
+
+ return;
+ }
+ pSirSmeAssocInd->staId = pStaDs->staIndex;
+#ifdef WLAN_SOFTAP_FEATURE
+ pSirSmeAssocInd->reassocReq = pStaDs->mlmStaContext.subType;
+#endif
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_IND_EVENT, psessionEntry, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+ limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
+
+ PELOG1(limLog(pMac, LOG1,
+ FL("Create CNF_WAIT_TIMER after received LIM_MLM_ASSOC_IND\n"));)
+ /*
+ ** turn on a timer to detect the loss of ASSOC CNF
+ **/
+ limActivateCnfTimer(pMac, (tANI_U16) ((tpLimMlmAssocInd) pMsgBuf)->aid, psessionEntry);
+
+// Enable this Compile flag to test the BT-AMP -AP assoc sequence
+#ifdef TEST_BTAMP_AP
+//tANI_U32 *pMsgBuf;
+{
+ tpSirSmeAssocCnf pSmeAssoccnf;
+ if(!palAllocateMemory(pMac->hHdd,(void **)&pSmeAssoccnf,sizeof(tSirSmeAssocCnf)))
+ PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory failed for pSmeAssoccnf \n"));)
+ pSmeAssoccnf->messageType = eWNI_SME_ASSOC_CNF;
+ pSmeAssoccnf->length = sizeof(tSirSmeAssocCnf);
+ palCopyMemory( pMac->hHdd,pSmeAssoccnf->peerMacAddr,((tpLimMlmAssocInd)pMsgBuf)->peerMacAddr,6);
+ pSmeAssoccnf->statusCode = eSIR_SME_SUCCESS;
+ pSmeAssoccnf->aid = ((tpLimMlmAssocInd)pMsgBuf)->aid;
+ palCopyMemory( pMac->hHdd, pSmeAssoccnf->alternateBssId,pSmeAssoccnf->peerMacAddr,sizeof(tSirMacAddr));
+ pSmeAssoccnf->alternateChannelId = 6;
+ palCopyMemory( pMac->hHdd,pSmeAssoccnf->bssId,psessionEntry->selfMacAddr,6);
+ pMsgBuf = (tANI_U32)pSmeAssoccnf;
+ __limProcessSmeAssocCnfNew(pMac, eWNI_SME_ASSOC_CNF, pMsgBuf);
+ palFreeMemory(pMac->hHdd,pSmeAssoccnf);
+}
+#endif
+
+
+} /*** end limProcessMlmAssocInd() ***/
+
+
+
+
+/**
+ * limProcessMlmDisassocInd()
+ *
+ *FUNCTION:
+ * This function is called to processes MLM_DISASSOC_IND
+ * message from MLM State machine.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pMsgBuf A pointer to the MLM message buffer
+ *
+ * @return None
+ */
+void
+limProcessMlmDisassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tLimMlmDisassocInd *pMlmDisassocInd;
+ tpPESession psessionEntry;
+ pMlmDisassocInd = (tLimMlmDisassocInd *) pMsgBuf;
+ if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocInd->sessionId) )== NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+ switch (psessionEntry->limSystemRole)
+ {
+ case eLIM_STA_IN_IBSS_ROLE:
+ break;
+ case eLIM_STA_ROLE:
+ case eLIM_BT_AMP_STA_ROLE:
+ psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+ break;
+ default: // eLIM_AP_ROLE //eLIM_BT_AMP_AP_ROLE
+ PELOG1(limLog(pMac, LOG1,
+ FL("*** Peer staId=%d Disassociated ***\n"),
+ pMlmDisassocInd->aid);)
+ // Send SME_DISASOC_IND after Polaris cleanup
+ // (after receiving LIM_MLM_PURGE_STA_IND)
+ break;
+ } // end switch (psessionEntry->limSystemRole)
+} /*** end limProcessMlmDisassocInd() ***/
+
+/**
+ * limProcessMlmDisassocCnf()
+ *
+ *FUNCTION:
+ * This function is called to processes MLM_DISASSOC_CNF
+ * message from MLM State machine.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pMsgBuf A pointer to the MLM message buffer
+ *
+ * @return None
+ */
+void
+limProcessMlmDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tSirResultCodes resultCode;
+ tLimMlmDisassocCnf *pMlmDisassocCnf;
+ tpPESession psessionEntry;
+ pMlmDisassocCnf = (tLimMlmDisassocCnf *) pMsgBuf;
+ if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocCnf->sessionId))== NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id\n"));)
+ return;
+ }
+ resultCode = (tSirResultCodes)
+ (pMlmDisassocCnf->disassocTrigger ==
+ eLIM_LINK_MONITORING_DISASSOC) ?
+ eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
+ pMlmDisassocCnf->resultCode;
+ if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
+ {
+#if defined(ANI_AP_CLIENT_SDK)
+ tSirMacAddr nullMacAddr = {0, 0, 0, 0, 0, 0};
+#endif
+ // Disassociate Confirm from MLM
+ if ( (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
+ (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) )
+ {
+ /**
+ * Should not have received
+ * Disassocate confirm
+ * from MLM in other states.
+ * Log error
+ */
+ PELOGE(limLog(pMac, LOGE,
+ FL("received unexpected MLM_DISASSOC_CNF in state %X\n"),psessionEntry->limSmeState);)
+ return;
+ }
+#if defined(ANI_AP_CLIENT_SDK)
+ // Whenever there is a disassoc notification, make sure the bssId is cleared so that
+ // if the station finds the same AP to which it was associated, it can try to associate
+ // with it again. If this is not done, the beacons/probe rsp from this AP will not be given
+ // up to WSM and it never see this is AP unless a cga/reboot is done.
+ palCopyMemory(pMac->hHdd, pMac->lim.gLimBssid, nullMacAddr, sizeof(tSirMacAddr));
+ if (cfgSetStr(pMac, WNI_CFG_BSSID, nullMacAddr, sizeof(tSirMacAddr)) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Could not update BSSID on CFG"));
+ }
+#endif
+ if (pMac->lim.gLimRspReqd)
+ pMac->lim.gLimRspReqd = false;
+ if (pMlmDisassocCnf->disassocTrigger ==
+ eLIM_PROMISCUOUS_MODE_DISASSOC)
+ {
+ if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
+ psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
+ else
+ psessionEntry->limSmeState = eLIM_SME_OFFLINE_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+ // Send Promiscuous mode response to host
+ limSendSmePromiscuousModeRsp(pMac);
+ }
+ else
+ {
+ if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
+ psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
+ else
+ psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+ limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
+ resultCode,
+ pMlmDisassocCnf->disassocTrigger,
+ pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
+ }
+ }
+ else if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
+ {
+ limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
+ resultCode,
+ pMlmDisassocCnf->disassocTrigger,
+ pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
+ }
+} /*** end limProcessMlmDisassocCnf() ***/
+
+/**
+ * limProcessMlmDeauthInd()
+ *
+ *FUNCTION:
+ * This function is called to processes MLM_DEAUTH_IND
+ * message from MLM State machine.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pMsgBuf A pointer to the MLM message buffer
+ *
+ * @return None
+ */
+void
+limProcessMlmDeauthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tLimMlmDeauthInd *pMlmDeauthInd;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId;
+ pMlmDeauthInd = (tLimMlmDeauthInd *) pMsgBuf;
+ if((psessionEntry = peFindSessionByBssid(pMac,pMlmDeauthInd->peerMacAddr,&sessionId))== NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));)
+ return;
+ }
+ switch (psessionEntry->limSystemRole)
+ {
+ case eLIM_STA_IN_IBSS_ROLE:
+ break;
+ case eLIM_STA_ROLE:
+ case eLIM_BT_AMP_STA_ROLE:
+ psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, psessionEntry->limSmeState));
+
+ default: // eLIM_AP_ROLE
+ {
+ PELOG1(limLog(pMac, LOG1,
+ FL("*** Received Deauthentication from staId=%d ***\n"),
+ pMlmDeauthInd->aid);)
+ }
+ // Send SME_DEAUTH_IND after Polaris cleanup
+ // (after receiving LIM_MLM_PURGE_STA_IND)
+ break;
+ } // end switch (psessionEntry->limSystemRole)
+} /*** end limProcessMlmDeauthInd() ***/
+
+/**
+ * limProcessMlmDeauthCnf()
+ *
+ *FUNCTION:
+ * This function is called to processes MLM_DEAUTH_CNF
+ * message from MLM State machine.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pMsgBuf A pointer to the MLM message buffer
+ *
+ * @return None
+ */
+void
+limProcessMlmDeauthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tANI_U16 aid;
+ tSirResultCodes resultCode;
+ tLimMlmDeauthCnf *pMlmDeauthCnf;
+ tpPESession psessionEntry;
+
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+ pMlmDeauthCnf = (tLimMlmDeauthCnf *) pMsgBuf;
+ if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthCnf->sessionId))==NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("session does not exist for given session Id \n"));)
+ return;
+ }
+
+ resultCode = (tSirResultCodes)
+ (pMlmDeauthCnf->deauthTrigger ==
+ eLIM_LINK_MONITORING_DEAUTH) ?
+ eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
+ pMlmDeauthCnf->resultCode;
+ aid = (psessionEntry->limSystemRole == eLIM_AP_ROLE) ?
+ pMlmDeauthCnf->aid : 1;
+ if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
+ {
+ #if defined(ANI_AP_CLIENT_SDK)
+ tSirMacAddr nullMacAddr = {0, 0, 0, 0, 0, 0};
+ #endif
+ // Deauth Confirm from MLM
+ if (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE)
+ {
+ /**
+ * Should not have received Deauth confirm
+ * from MLM in other states.
+ * Log error
+ */
+ PELOGE(limLog(pMac, LOGE,
+ FL("received unexpected MLM_DEAUTH_CNF in state %X\n"),
+ psessionEntry->limSmeState);)
+ return;
+ }
+#if defined(ANI_AP_CLIENT_SDK)
+ // Whenever there is a disassoc notification, make sure the bssId is cleared so that
+ // if the station finds the same AP to which it was associated, it can try to associate
+ // with it again. If this is not done, the beacons/probe rsp from this AP will not be given
+ // up to WSM and it never see this is AP unless a cga/reboot is done.
+ palCopyMemory(pMac->hHdd, pMac->lim.gLimBssid, nullMacAddr, sizeof(tSirMacAddr));
+ if (cfgSetStr(pMac, WNI_CFG_BSSID, nullMacAddr, sizeof(tSirMacAddr)) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Could not update BSSID on CFG"));
+ }
+#endif
+ if (pMlmDeauthCnf->resultCode == eSIR_SME_SUCCESS)
+ {
+ psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
+ PELOG1(limLog(pMac, LOG1,
+ FL("*** Deauthenticated with BSS ***\n"));)
+ }
+ else
+ psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+
+ if (pMac->lim.gLimRspReqd)
+ pMac->lim.gLimRspReqd = false;
+ }
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+ // BP deauthenticated by AP or vice versa
+ // Send SME_DISASSOC_RSP to host.
+ limSendSmeDisassocNtf(pMac, pMlmDeauthCnf->peerMacAddr,
+ resultCode,
+ pMlmDeauthCnf->deauthTrigger,
+ aid);
+#else
+ // On STA or on BASIC AP, send SME_DEAUTH_RSP to host
+ limSendSmeDeauthNtf(pMac, pMlmDeauthCnf->peerMacAddr,
+ resultCode,
+ pMlmDeauthCnf->deauthTrigger,
+ aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
+#endif
+} /*** end limProcessMlmDeauthCnf() ***/
+
+/**
+ * limProcessMlmPurgeStaInd()
+ *
+ *FUNCTION:
+ * This function is called to processes MLM_PURGE_STA_IND
+ * message from MLM State machine.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pMsgBuf A pointer to the MLM message buffer
+ *
+ * @return None
+ */
+void
+limProcessMlmPurgeStaInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tSirResultCodes resultCode;
+ tpLimMlmPurgeStaInd pMlmPurgeStaInd;
+ tpPESession psessionEntry;
+#if defined(ANI_AP_CLIENT_SDK)
+ tSirMacAddr nullMacAddr = {0, 0, 0, 0, 0, 0};
+#endif
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+ pMlmPurgeStaInd = (tpLimMlmPurgeStaInd) pMsgBuf;
+ if((psessionEntry = peFindSessionBySessionId(pMac,pMlmPurgeStaInd->sessionId))==NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId\n"));)
+ return;
+ }
+ // Purge STA indication from MLM
+ resultCode = (tSirResultCodes) pMlmPurgeStaInd->reasonCode;
+ switch (psessionEntry->limSystemRole)
+ {
+ case eLIM_STA_IN_IBSS_ROLE:
+ break;
+ case eLIM_STA_ROLE:
+ case eLIM_BT_AMP_STA_ROLE:
+ default: // eLIM_AP_ROLE
+ if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
+ (psessionEntry->limSmeState !=
+ eLIM_SME_WT_DISASSOC_STATE) &&
+ (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
+ {
+ /**
+ * Should not have received
+ * Purge STA indication
+ * from MLM in other states.
+ * Log error
+ */
+ PELOGE(limLog(pMac, LOGE,
+ FL("received unexpected MLM_PURGE_STA_IND in state %X\n"),
+ psessionEntry->limSmeState);)
+ break;
+ }
+ PELOG1(limLog(pMac, LOG1,
+ FL("*** Polaris cleanup completed for staId=%d ***\n"),
+ pMlmPurgeStaInd->aid);)
+ if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
+ {
+ psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+
+#if defined(ANI_AP_CLIENT_SDK)
+ // Whenever there is a disassoc notification, make sure the bssId is cleared so that
+ // if the station finds the same AP to which it was associated, it can try to associate
+ // with it again. If this is not done, the beacons/probe rsp from this AP will not be given
+ // up to WSM and it never see this is AP unless a cga/reboot is done.
+ palCopyMemory(pMac->hHdd, pMac->lim.gLimBssid, nullMacAddr, sizeof(tSirMacAddr));
+ if (cfgSetStr(pMac, WNI_CFG_BSSID, nullMacAddr, sizeof(tSirMacAddr)) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Could not update BSSID on CFG"));
+ }
+#endif
+ }
+ if (pMlmPurgeStaInd->purgeTrigger == eLIM_PEER_ENTITY_DEAUTH)
+ {
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+ // BP deauthenticated by AP or vice versa
+ // Send SME_DISASSOC_IND to host.
+ limSendSmeDisassocNtf(pMac,
+ pMlmPurgeStaInd->peerMacAddr,
+ resultCode,
+ pMlmPurgeStaInd->purgeTrigger,
+ pMlmPurgeStaInd->aid,psessionEntry);
+#else
+ limSendSmeDeauthNtf(pMac,
+ pMlmPurgeStaInd->peerMacAddr,
+ resultCode,
+ pMlmPurgeStaInd->purgeTrigger,
+ pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
+#endif
+ }
+ else
+ limSendSmeDisassocNtf(pMac,
+ pMlmPurgeStaInd->peerMacAddr,
+ resultCode,
+ pMlmPurgeStaInd->purgeTrigger,
+ pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
+ } // end switch (psessionEntry->limSystemRole)
+} /*** end limProcessMlmPurgeStaInd() ***/
+
+/**
+ * limProcessMlmSetKeysCnf()
+ *
+ *FUNCTION:
+ * This function is called to processes MLM_SETKEYS_CNF
+ * message from MLM State machine.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pMsgBuf A pointer to the MLM message buffer
+ *
+ * @return None
+ */
+void
+limProcessMlmSetKeysCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ // Prepare and send SME_SETCONTEXT_RSP message
+ tLimMlmSetKeysCnf *pMlmSetKeysCnf;
+ tpPESession psessionEntry;
+
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+ pMlmSetKeysCnf = (tLimMlmSetKeysCnf *) pMsgBuf;
+ if ((psessionEntry = peFindSessionBySessionId(pMac, pMlmSetKeysCnf->sessionId))== NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId \n"));)
+ return;
+ }
+ limLog( pMac, LOG1,
+ FL("Received MLM_SETKEYS_CNF with resultCode = %d\n"),
+ pMlmSetKeysCnf->resultCode );
+ limSendSmeSetContextRsp(pMac,
+ pMlmSetKeysCnf->peerMacAddr,
+#ifdef ANI_PRODUCT_TYPE_AP
+ pMlmSetKeysCnf->aid,
+#else
+ 1,
+#endif
+ (tSirResultCodes) pMlmSetKeysCnf->resultCode,psessionEntry,psessionEntry->smeSessionId,
+ psessionEntry->transactionId);
+} /*** end limProcessMlmSetKeysCnf() ***/
+/**
+ * limProcessMlmRemoveKeyCnf()
+ *
+ *FUNCTION:
+ * This function is called to processes MLM_REMOVEKEY_CNF
+ * message from MLM State machine.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pMsgBuf A pointer to the MLM message buffer
+ *
+ * @return None
+ */
+void
+limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ // Prepare and send SME_REMOVECONTEXT_RSP message
+ tLimMlmRemoveKeyCnf *pMlmRemoveKeyCnf;
+ tpPESession psessionEntry;
+
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+ pMlmRemoveKeyCnf = (tLimMlmRemoveKeyCnf *) pMsgBuf;
+ if((psessionEntry = peFindSessionBySessionId(pMac,pMlmRemoveKeyCnf->sessionId))== NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id\n"));)
+ return;
+ }
+ limLog( pMac, LOG1,
+ FL("Received MLM_REMOVEKEYS_CNF with resultCode = %d\n"),
+ pMlmRemoveKeyCnf->resultCode );
+ limSendSmeRemoveKeyRsp(pMac,
+ pMlmRemoveKeyCnf->peerMacAddr,
+ (tSirResultCodes) pMlmRemoveKeyCnf->resultCode,psessionEntry,
+ psessionEntry->smeSessionId,psessionEntry->transactionId);
+} /*** end limProcessMlmRemoveKeyCnf() ***/
+
+
+/**
+ * limHandleSmeJoinResult()
+ *
+ *FUNCTION:
+ * This function is called to process join/auth/assoc failures
+ * upon receiving MLM_JOIN/AUTH/ASSOC_CNF with a failure code or
+ * MLM_ASSOC_CNF with a success code in case of STA role and
+ * MLM_JOIN_CNF with success in case of STA in IBSS role.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param resultCode Failure code to be sent
+ *
+ *
+ * @return None
+ */
+static void
+limHandleSmeJoinResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
+{
+ tpDphHashNode pStaDs = NULL;
+ tANI_U8 smesessionId;
+ tANI_U16 smetransactionId;
+
+ /* Newly Added on oct 11 th*/
+ if(psessionEntry == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL \n"));)
+ return;
+ }
+ smesessionId = psessionEntry->smeSessionId;
+ smetransactionId = psessionEntry->transactionId;
+ /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
+ if(resultCode != eSIR_SME_SUCCESS)
+ {
+ pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
+ if (pStaDs != NULL)
+ {
+ pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
+ pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
+ pStaDs->mlmStaContext.resultCode = resultCode;
+ pStaDs->mlmStaContext.protStatusCode = protStatusCode;
+ //Done: 7-27-2009. JIM_FIX_ME: at the end of limCleanupRxPath, make sure PE is sending eWNI_SME_JOIN_RSP to SME
+ limCleanupRxPath(pMac, pStaDs, psessionEntry);
+ return;
+ }
+ }
+
+ palFreeMemory( pMac->hHdd, psessionEntry->pLimJoinReq);
+ psessionEntry->pLimJoinReq = NULL;
+ //Delete teh session if JOIN failure occurred.
+ if(resultCode != eSIR_SME_SUCCESS)
+ {
+ if(NULL != psessionEntry)
+ {
+ peDeleteSession(pMac,psessionEntry);
+ psessionEntry = NULL;
+ }
+ }
+ limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, resultCode, protStatusCode,psessionEntry,
+ smesessionId, smetransactionId);
+} /*** end limHandleSmeJoinResult() ***/
+
+/**
+ * limProcessMlmAddStaRsp()
+ *
+ *FUNCTION:
+ * This function is called to process a WDA_ADD_STA_RSP from HAL.
+ * Upon receipt of this message from HAL, MLME -
+ * > Determines the "state" in which this message was received
+ * > Forwards it to the appropriate callback
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param tSirMsgQ The MsgQ header, which contains the response buffer
+ *
+ * @return None
+ */
+void limProcessMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry )
+{
+ //we need to process the deferred message since the initiating req. there might be nested request.
+ //in the case of nested request the new request initiated from the response will take care of resetting
+ //the deffered flag.
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+#ifdef ANI_PRODUCT_TYPE_AP
+ if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ {
+ limProcessApMlmAddStaRsp(pMac, limMsgQ);
+ return;
+ }
+#endif
+ if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
+#ifdef WLAN_SOFTAP_FEATURE
+ || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
+#endif
+ )
+ {
+ limProcessBtAmpApMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
+ return;
+ }
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ limProcessStaMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
+#endif
+}
+void limProcessStaMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
+{
+ tLimMlmAssocCnf mlmAssocCnf;
+ tpDphHashNode pStaDs;
+ tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
+ tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
+
+ if(NULL == pAddStaParams )
+ {
+ limLog( pMac, LOGE, FL( "Encountered NULL Pointer\n" ));
+ return;
+ }
+ if( eHAL_STATUS_SUCCESS == pAddStaParams->status )
+ {
+ if( eLIM_MLM_WT_ADD_STA_RSP_STATE != psessionEntry->limMlmState)
+ {
+ //TODO: any response to be sent out here ?
+ limLog( pMac, LOGE,
+ FL( "Received unexpected WDA_ADD_STA_RSP in state %X\n" ),
+ psessionEntry->limMlmState);
+ mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
+ goto end;
+ }
+ if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
+ mesgType = LIM_MLM_REASSOC_CNF;
+ //
+ // Update the DPH Hash Entry for this STA
+ // with proper state info
+ //
+ pStaDs = dphGetHashEntry( pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
+ if( NULL != pStaDs)
+ pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
+ else
+ limLog( pMac, LOGW,
+ FL( "Unable to get the DPH Hash Entry for AID - %d\n" ),
+ DPH_STA_HASH_INDEX_PEER);
+ psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+ /*
+ * Storing the self StaIndex(Generated by HAL) in session context,
+ * instead of storing it in DPH Hash entry for Self STA.
+ * DPH entry for the self STA stores the sta index for the BSS entry
+ * to which the STA is associated.
+ */
+ psessionEntry->staId = pAddStaParams->staIdx;
+ //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
+ limReactivateHeartBeatTimer(pMac, psessionEntry);
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_KEEPALIVE_TIMER));
+
+ //assign the sessionId to the timer Object
+ pMac->lim.limTimers.gLimKeepaliveTimer.sessionId = psessionEntry->peSessionId;
+ if (tx_timer_activate(&pMac->lim.limTimers.gLimKeepaliveTimer) != TX_SUCCESS)
+ limLog(pMac, LOGP, FL("Cannot activate keepalive timer.\n"));
+#ifdef WLAN_DEBUG
+ pMac->lim.gLimNumLinkEsts++;
+#endif
+ // Return Assoc confirm to SME with success
+ // FIXME_GEN4 - Need the correct ASSOC RSP code to
+ // be passed in here....
+ //mlmAssocCnf.resultCode = (tSirResultCodes) assoc.statusCode;
+ mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_SUCCESS;
+ }
+ else
+ {
+ limLog( pMac, LOGW, FL( "ADD_STA failed!\n"));
+ mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
+ }
+end:
+ if( 0 != limMsgQ->bodyptr )
+ {
+ palFreeMemory( pMac->hHdd, (void *) pAddStaParams );
+ }
+ /* Updating PE session Id*/
+ mlmAssocCnf.sessionId = psessionEntry->peSessionId;
+ limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
+ return;
+}
+void limProcessMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
+{
+ //we need to process the deferred message since the initiating req. there might be nested request.
+ //in the case of nested request the new request initiated from the response will take care of resetting
+ //the deffered flag.
+ // tpPESession psessionEntry;
+ // tpDeleteBssParams pDeleteBssParams =( tpDeleteBssParams)limMsgQ->bodyptr;
+ // if((psessionEntry = peFindSessionBySessionId(pMac,pDeleteBssParams->sessionId)) == NULL)
+ // {
+ // limLog( pMac, LOGE, FL( "Session deos not exist with given sessionId\n" ));
+ // return;
+ // }
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+ #ifdef ANI_PRODUCT_TYPE_AP
+ if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ {
+ limProcessApMlmDelBssRsp(pMac, limMsgQ);
+ return;
+ }
+#endif
+
+ if (((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
+ (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
+#ifdef WLAN_SOFTAP_FEATURE
+ || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
+#endif
+ ) &&
+ (psessionEntry->statypeForBss == STA_ENTRY_SELF))
+ {
+ limProcessBtAmpApMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
+ return;
+ }
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ limProcessStaMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
+#endif
+}
+
+void limProcessStaMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
+{
+ tpDeleteBssParams pDelBssParams = (tpDeleteBssParams) limMsgQ->bodyptr;
+ tpDphHashNode pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
+ tSirResultCodes statusCode = eSIR_SME_SUCCESS;
+ if( eHAL_STATUS_SUCCESS == pDelBssParams->status )
+ {
+ PELOGW(limLog( pMac, LOGW,
+ FL( "STA received the DEL_BSS_RSP for BSSID: %X.\n"),pDelBssParams->bssIdx);)
+ if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId,
+ psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
+
+ {
+ PELOGE(limLog( pMac, LOGE, FL( "Failure in setting link state to IDLE\n"));)
+ statusCode = eSIR_SME_REFUSED;
+ goto end;
+ }
+ if(pStaDs == NULL)
+ {
+ limLog( pMac, LOGE, FL( "DPH Entry for STA 1 missing.\n"));
+ statusCode = eSIR_SME_REFUSED;
+ goto end;
+ }
+ if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != pStaDs->mlmStaContext.mlmState)
+ {
+ PELOGE(limLog( pMac, LOGE, FL( "Received unexpected WDA_DEL_BSS_RSP in state %X\n" ),
+ pStaDs->mlmStaContext.mlmState);)
+ statusCode = eSIR_SME_REFUSED;
+ goto end;
+ }
+ PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
+ limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
+ }
+ else
+ {
+ limLog( pMac, LOGP, FL( "DEL BSS failed!\n" ) );
+ return;
+ }
+ end:
+ if( 0 != limMsgQ->bodyptr )
+ {
+ palFreeMemory( pMac->hHdd, (void *) pDelBssParams );
+ }
+ if(pStaDs == NULL)
+ return;
+ if ( ((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
+ (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE &&
+ psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) &&
+ pStaDs->mlmStaContext.cleanupTrigger != eLIM_JOIN_FAILURE)
+ {
+ /** The Case where the DelBss is invoked from
+ * context of other than normal DisAssoc / Deauth OR
+ * as part of Join Failure.
+ */
+ limHandleDelBssInReAssocContext(pMac, pStaDs,psessionEntry);
+ return;
+ }
+ limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
+ return;
+}
+
+
+#ifdef ANI_PRODUCT_TYPE_AP
+void limProcessApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ)
+{
+ tSirResultCodes rc = eSIR_SME_SUCCESS;
+ tpDeleteBssParams pDelBss = (tpDeleteBssParams) limMsgQ->bodyptr;
+ if (pDelBss == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP with no body!\n"));)
+ rc = eSIR_SME_REFUSED;
+ goto end;
+ }
+ if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != pMac->lim.gLimMlmState)
+ {
+ limLog( pMac, LOGE,
+ FL( "Received unexpected WDA_DEL_BSS_RSP in state %X\n" ), pMac->lim.gLimMlmState);
+ rc = eSIR_SME_REFUSED;
+ goto end;
+ }
+ if (pDelBss->status != eHAL_STATUS_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("BSS: DEL_BSS_RSP error (%x) Bss %d "),
+ pDelBss->status, pDelBss->bssIdx);
+ rc = eSIR_SME_STOP_BSS_FAILURE;
+ goto end;
+ }
+ //Not used for station or softap.
+ rc = limSetLinkState(pMac, eSIR_LINK_IDLE_STATE);
+ if( rc != eSIR_SUCCESS )
+ goto end;
+ /** Softmac may send all the buffered packets right after resuming the transmission hence
+ * to occupy the medium during non channel occupancy period. So resume the transmission after
+ * HAL gives back the response.
+ */
+ if (LIM_IS_RADAR_DETECTED(pMac))
+ {
+ limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_RESUME_TX);
+ LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
+ }
+ dphHashTableClassInit(pMac);
+ limDeletePreAuthList(pMac);
+ //Is it ok to put LIM into IDLE state.
+ pMac->lim.gLimMlmState->limMlmState = eLIM_MLM_IDLE_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+ end:
+ limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, rc);
+ if(pDelBss != NULL)
+ palFreeMemory( pMac->hHdd, (void *) pDelBss );
+}
+#endif
+/* This code is same as limProcessApMlmDelBssRsp used for BT-AMP */
+void limProcessBtAmpApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
+{
+ tSirResultCodes rc = eSIR_SME_SUCCESS;
+ tpDeleteBssParams pDelBss = (tpDeleteBssParams) limMsgQ->bodyptr;
+ tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+ if(psessionEntry == NULL)
+ {
+ limLog(pMac, LOGE,FL("Session entry passed is NULL\n"));
+ return;
+ }
+
+ if (pDelBss == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP with no body!\n"));)
+ rc = eSIR_SME_REFUSED;
+ goto end;
+ }
+ pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
+ if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != psessionEntry->limMlmState)
+ {
+ limLog( pMac, LOGE,
+ FL( "Received unexpected WDA_DEL_BSS_RSP in state %X\n" ),psessionEntry->limMlmState);
+ rc = eSIR_SME_REFUSED;
+ goto end;
+ }
+ if (pDelBss->status != eHAL_STATUS_SUCCESS)
+ {
+ limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP error (%x) Bss %d "),
+ pDelBss->status, pDelBss->bssIdx);
+ rc = eSIR_SME_STOP_BSS_FAILURE;
+ goto end;
+ }
+ rc = limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid,
+ psessionEntry->selfMacAddr, NULL, NULL);
+ if( rc != eSIR_SUCCESS )
+ goto end;
+ /** Softmac may send all the buffered packets right after resuming the transmission hence
+ * to occupy the medium during non channel occupancy period. So resume the transmission after
+ * HAL gives back the response.
+ */
+ if (LIM_IS_RADAR_DETECTED(pMac))
+ {
+ limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_RESUME_TX);
+ LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
+ }
+ dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);//TBD-RAJESH is it needed ?
+ limDeletePreAuthList(pMac);
+#ifdef WLAN_SOFTAP_FEATURE
+ //Initialize number of associated stations during cleanup
+ pMac->lim.gLimNumOfCurrentSTAs = 0;
+#endif
+ end:
+ limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, rc, psessionEntry->smeSessionId, psessionEntry->transactionId);
+ peDeleteSession(pMac, psessionEntry);
+
+ if(pDelBss != NULL)
+ palFreeMemory( pMac->hHdd, (void *) pDelBss );
+}
+
+void limProcessMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
+{
+ //we need to process the deferred message since the initiating req. there might be nested request.
+ //in the case of nested request the new request initiated from the response will take care of resetting
+ //the deffered flag.
+
+ tpPESession psessionEntry;
+ tpDeleteStaParams pDeleteStaParams;
+ pDeleteStaParams = (tpDeleteStaParams)limMsgQ->bodyptr;
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+ if((psessionEntry = peFindSessionBySessionId(pMac,pDeleteStaParams->sessionId))==NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+
+#ifdef ANI_PRODUCT_TYPE_AP
+ if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ {
+ limProcessApMlmDelStaRsp(pMac, limMsgQ);
+ return;
+ }
+#endif
+ if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
+#ifdef WLAN_SOFTAP_FEATURE
+ || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
+#endif
+ )
+ {
+ limProcessBtAmpApMlmDelStaRsp(pMac,limMsgQ,psessionEntry);
+ return;
+ }
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ limProcessStaMlmDelStaRsp(pMac, limMsgQ,psessionEntry);
+#endif
+}
+
+#ifdef ANI_PRODUCT_TYPE_AP
+void limProcessApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
+{
+ tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
+ tpDphHashNode pStaDs = dphGetHashEntry(pMac, pDelStaParams->assocId);
+ tSirResultCodes statusCode = eSIR_SME_SUCCESS;
+ if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
+ {
+ limLog( pMac, LOGW,
+ FL( "AP received the DEL_STA_RSP for assocID: %X.\n"), pDelStaParams->assocId);
+ if(pStaDs == NULL)
+ {
+ limLog( pMac, LOGE,
+ FL( "DPH Entry for STA %X missing.\n"), pDelStaParams->assocId);
+ statusCode = eSIR_SME_REFUSED;
+ goto end;
+ }
+ if(( eLIM_MLM_WT_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) &&
+ ( eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState))
+ {
+ limLog( pMac, LOGE,
+ FL( "Received unexpected WDA_DEL_STA_RSP in state %s for staId %d assocId %d \n" ),
+ limMlmStateStr(pStaDs->mlmStaContext.mlmState), pStaDs->staIndex, pStaDs->assocId);
+ statusCode = eSIR_SME_REFUSED;
+ goto end;
+ }
+
+ PELOG1(limLog( pMac, LOG1,
+ FL("Deleted STA AssocID %d staId %d MAC "),
+ pStaDs->assocId, pStaDs->staIndex);
+ limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
+ if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE == pStaDs->mlmStaContext.mlmState)
+ {
+ if( 0 != limMsgQ->bodyptr )
+ {
+ palFreeMemory( pMac->hHdd, (void *) pDelStaParams );
+ }
+ if (limAddSta(pMac, pStaDs,psessionEntry) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE,
+ FL("could not Add STA with assocId=%d\n"),
+ pStaDs->assocId);)
+ // delete the TS if it has already been added.
+ // send the response with error status.
+ if(pStaDs->qos.addtsPresent)
+ {
+ tpLimTspecInfo pTspecInfo;
+ if(eSIR_SUCCESS == limTspecFindByAssocId(pMac, pStaDs->assocId,
+ &pStaDs->qos.addts.tspec, &pMac->lim.tspecInfo[0], &pTspecInfo))
+ {
+ limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo,
+ NULL, &pTspecInfo->idx);
+ }
+ }
+ limRejectAssociation(pMac,
+ pStaDs->staAddr,
+ pStaDs->mlmStaContext.subType,
+ true, pStaDs->mlmStaContext.authType,
+ pStaDs->assocId, true,
+ (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS);
+ }
+ return;
+ }
+ }
+ else
+ {
+ limLog( pMac, LOGW,
+ FL( "DEL STA failed!\n" ));
+ statusCode = eSIR_SME_REFUSED;
+ }
+ end:
+ if( 0 != limMsgQ->bodyptr )
+ {
+ palFreeMemory( pMac->hHdd, (void *) pDelStaParams );
+ }
+ if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
+ {
+ limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
+ }
+ return;
+}
+#endif
+/* This is the copy of limProcessApMlmDelStaRsp used for BT-AMP Support */
+void limProcessBtAmpApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
+{
+ tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
+ tpDphHashNode pStaDs;
+ tSirResultCodes statusCode = eSIR_SME_SUCCESS;
+ if(limMsgQ->bodyptr == NULL)
+ {
+ return;
+ }
+
+ pStaDs = dphGetHashEntry(pMac, pDelStaParams->assocId, &psessionEntry->dph.dphHashTable);
+ if(pStaDs == NULL)
+ {
+ limLog( pMac, LOGE,
+ FL( "DPH Entry for STA %X missing.\n"), pDelStaParams->assocId);
+ statusCode = eSIR_SME_REFUSED;
+ palFreeMemory( pMac->hHdd, (void *) pDelStaParams );
+
+ return;
+ }
+ if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
+ {
+ limLog( pMac, LOGW,
+ FL( "AP received the DEL_STA_RSP for assocID: %X.\n"), pDelStaParams->assocId);
+
+ if(( eLIM_MLM_WT_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) &&
+ ( eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState))
+ {
+ limLog( pMac, LOGE,
+ FL( "Received unexpected WDA_DEL_STA_RSP in state %s for staId %d assocId %d \n" ),
+ limMlmStateStr(pStaDs->mlmStaContext.mlmState), pStaDs->staIndex, pStaDs->assocId);
+ statusCode = eSIR_SME_REFUSED;
+ goto end;
+ }
+
+ limLog( pMac, LOG1,
+ FL("Deleted STA AssocID %d staId %d MAC "),
+ pStaDs->assocId, pStaDs->staIndex);
+ limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
+ if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE == pStaDs->mlmStaContext.mlmState)
+ {
+ palFreeMemory( pMac->hHdd, (void *) pDelStaParams );
+ if (limAddSta(pMac, pStaDs,psessionEntry) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE,
+ FL("could not Add STA with assocId=%d\n"),
+ pStaDs->assocId);)
+ // delete the TS if it has already been added.
+ // send the response with error status.
+ if(pStaDs->qos.addtsPresent)
+ {
+ tpLimTspecInfo pTspecInfo;
+ if(eSIR_SUCCESS == limTspecFindByAssocId(pMac, pStaDs->assocId,
+ &pStaDs->qos.addts.tspec, &pMac->lim.tspecInfo[0], &pTspecInfo))
+ {
+ limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo,
+ NULL, &pTspecInfo->idx);
+ }
+ }
+ limRejectAssociation(pMac,
+ pStaDs->staAddr,
+ pStaDs->mlmStaContext.subType,
+ true, pStaDs->mlmStaContext.authType,
+ pStaDs->assocId, true,
+ (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
+ psessionEntry);
+ }
+ return;
+ }
+ }
+ else
+ {
+ limLog( pMac, LOGW,
+ FL( "DEL STA failed!\n" ));
+ statusCode = eSIR_SME_REFUSED;
+ }
+ end:
+ palFreeMemory( pMac->hHdd, (void *) pDelStaParams );
+ if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
+ {
+ limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
+ }
+ return;
+}
+
+void limProcessStaMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
+{
+ tSirResultCodes statusCode = eSIR_SME_SUCCESS;
+ tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
+ tpDphHashNode pStaDs = NULL;
+ if(NULL == pDelStaParams )
+ {
+ limLog( pMac, LOGE, FL( "Encountered NULL Pointer\n" ));
+ goto end;
+ }
+ if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
+ {
+ pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
+ if (pStaDs == NULL)
+ {
+ //TODO: any response to be sent out here ?
+ limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing.\n"),
+ pDelStaParams->assocId);
+ statusCode = eSIR_SME_REFUSED;
+ goto end;
+ }
+ if( eLIM_MLM_WT_DEL_STA_RSP_STATE != psessionEntry->limMlmState)
+ {
+ //TODO: any response to be sent out here ?
+ limLog( pMac, LOGE, FL( "Received unexpected WDA_DELETE_STA_RSP in state %s\n" ),
+ limMlmStateStr(psessionEntry->limMlmState));
+ statusCode = eSIR_SME_REFUSED;
+ goto end;
+ }
+ PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
+ limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
+ limLog( pMac, LOGW, FL( "DEL_STA_RSP received for assocID: %X\n"), pDelStaParams->assocId);
+ //we must complete all cleanup related to delSta before calling limDelBSS.
+ if( 0 != limMsgQ->bodyptr )
+ {
+ palFreeMemory( pMac->hHdd, (void *) pDelStaParams );
+ }
+ statusCode = (tSirResultCodes) limDelBss(pMac, pStaDs, 0,psessionEntry);
+ return;
+ }
+ else
+ {
+ limLog( pMac, LOGW, FL( "DEL_STA failed!\n" ));
+ statusCode = eSIR_SME_REFUSED;
+ }
+end:
+ if( 0 != limMsgQ->bodyptr )
+ {
+ palFreeMemory( pMac->hHdd, (void *) pDelStaParams );
+ }
+ return;
+}
+
+#ifdef ANI_PRODUCT_TYPE_AP
+void limProcessApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
+{
+ tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
+ tpDphHashNode pStaDs = dphGetHashEntry(pMac, pAddStaParams->assocId);
+ if(pStaDs == NULL)
+ {
+ //TODO: any response to be sent out here ?
+ limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing.\n"), pAddStaParams->assocId);
+ goto end;
+ }
+ //
+ // TODO & FIXME_GEN4
+ // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
+ //
+ //TODO: any check for pMac->lim.gLimMlmState ?
+ if( eLIM_MLM_WT_ADD_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
+ {
+ //TODO: any response to be sent out here ?
+ limLog( pMac, LOGE,
+ FL( "Received unexpected WDA_ADD_STA_RSP in state %X\n" ),
+ pStaDs->mlmStaContext.mlmState);
+ goto end;
+ }
+ if(eHAL_STATUS_SUCCESS != pAddStaParams->status)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Error! rcvd delSta rsp from HAL with status %d\n"),pAddStaParams->status);)
+ limRejectAssociation(pMac, pStaDs->staAddr,
+ pStaDs->mlmStaContext.subType,
+ true, pStaDs->mlmStaContext.authType,
+ pStaDs->assocId, true,
+ (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS);
+ goto end;
+ }
+ pStaDs->bssId = pAddStaParams->bssIdx;
+ pStaDs->staIndex = pAddStaParams->staIdx;
+ pStaDs->ucUcastSig = pAddStaParams->ucUcastSig;
+ pStaDs->ucBcastSig = pAddStaParams->ucBcastSig;
+ if(pStaDs->qos.addtsPresent)
+ {
+ //need to send halMsg_AddTs to HAL.
+ tpLimTspecInfo pTspecInfo;
+ if(eSIR_SUCCESS ==
+ limTspecFindByAssocId(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec,
+ &pMac->lim.tspecInfo[0], &pTspecInfo))
+ {
+ if(eSIR_SUCCESS != limSendHalMsgAddTs(pMac, pStaDs->staIndex, pTspecInfo->idx, pStaDs->qos.addts.tspec))
+ {
+ // delete the TS that has already been added.
+ // send the response with error status.
+ limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo, NULL, &pTspecInfo->idx);
+ PELOGE(limLog(pMac, LOGE,
+ FL("limSendHalMsgAddTs failed for STA with assocId=%d\n"),
+ pStaDs->assocId);)
+ limRejectAssociation(pMac,
+ pStaDs->staAddr, pStaDs->mlmStaContext.subType,
+ true, pStaDs->mlmStaContext.authType,
+ pStaDs->assocId, false,
+ (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS);
+ if( 0 != limMsgQ->bodyptr )
+ {
+ palFreeMemory( pMac->hHdd, (void *) pAddStaParams );
+ }
+ limDelSta(pMac, pStaDs, true,psessionEntry);
+ return;
+ }
+ }
+ }
+ //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
+ pStaDs->valid = 1;
+ pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
+ PELOG1(limLog( pMac, LOG1,
+ FL("STA AssocID %d staId %d MAC "),
+ pStaDs->assocId,
+ pStaDs->staIndex);
+ limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
+ // Send Re/Association Response with
+ // status code to requesting STA.
+ limSendAssocRspMgmtFrame(pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
+ pStaDs->mlmStaContext.subType, pStaDs,psessionEntry);
+end:
+ if( 0 != limMsgQ->bodyptr )
+ {
+ palFreeMemory( pMac->hHdd, (void *) pAddStaParams );
+ }
+ return;
+}
+#endif
+/* This is the copy of limProcessApMlmAddStaRsp function .... used for BT-AMP AP Support */
+void limProcessBtAmpApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
+{
+ tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
+ tpDphHashNode pStaDs = dphGetHashEntry(pMac, pAddStaParams->assocId, &psessionEntry->dph.dphHashTable);
+ if(pStaDs == NULL)
+ {
+ //TODO: any response to be sent out here ?
+ limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing.\n"), pAddStaParams->assocId);
+ goto end;
+ }
+ //
+ // TODO & FIXME_GEN4
+ // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
+ //
+ //TODO: any check for pMac->lim.gLimMlmState ?
+ if( eLIM_MLM_WT_ADD_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
+ {
+ //TODO: any response to be sent out here ?
+ limLog( pMac, LOGE,
+ FL( "Received unexpected WDA_ADD_STA_RSP in state %X\n" ),
+ pStaDs->mlmStaContext.mlmState);
+ goto end;
+ }
+ if(eHAL_STATUS_SUCCESS != pAddStaParams->status)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Error! rcvd delSta rsp from HAL with status %d\n"),pAddStaParams->status);)
+ limRejectAssociation(pMac, pStaDs->staAddr,
+ pStaDs->mlmStaContext.subType,
+ true, pStaDs->mlmStaContext.authType,
+ pStaDs->assocId, true,
+ (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
+ psessionEntry);
+ goto end;
+ }
+ pStaDs->bssId = pAddStaParams->bssIdx;
+ pStaDs->staIndex = pAddStaParams->staIdx;
+ //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
+ pStaDs->valid = 1;
+ pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE;
+ limLog( pMac, LOG1,
+ FL("STA AssocID %d staId %d MAC "),
+ pStaDs->assocId,
+ pStaDs->staIndex);
+ limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
+
+ /* For BTAMP-AP, the flow sequence shall be:
+ * 1) PE sends eWNI_SME_ASSOC_IND to SME
+ * 2) PE receives eWNI_SME_ASSOC_CNF from SME
+ * 3) BTAMP-AP sends Re/Association Response to BTAMP-STA
+ */
+ limSendMlmAssocInd(pMac, pStaDs, psessionEntry);
+ // fall though to reclaim the original Add STA Response message
+end:
+ if( 0 != limMsgQ->bodyptr )
+ {
+ palFreeMemory( pMac->hHdd, (void *) pAddStaParams );
+ }
+ return;
+}
+
+/**
+ * limProcessApMlmAddBssRsp()
+ *
+ *FUNCTION:
+ * This function is called to process a WDA_ADD_BSS_RSP from HAL.
+ * Upon receipt of this message from HAL, MLME -
+ * > Validates the result of WDA_ADD_BSS_REQ
+ * > Init other remaining LIM variables
+ * > Init the AID pool, for that BSSID
+ * > Init the Pre-AUTH list, for that BSSID
+ * > Create LIM timers, specific to that BSSID
+ * > Init DPH related parameters that are specific to that BSSID
+ * > TODO - When do we do the actual change channel?
+ *
+ *LOGIC:
+ * SME sends eWNI_SME_START_BSS_REQ to LIM
+ * LIM sends LIM_MLM_START_REQ to MLME
+ * MLME sends WDA_ADD_BSS_REQ to HAL
+ * HAL responds with WDA_ADD_BSS_RSP to MLME
+ * MLME responds with LIM_MLM_START_CNF to LIM
+ * LIM responds with eWNI_SME_START_BSS_RSP to SME
+ *
+ *ASSUMPTIONS:
+ * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
+ * tSirMsgQ.body will now be freed by this routine
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param tSirMsgQ The MsgQ header, which contains the response buffer
+ *
+ * @return None
+ */
+static void
+limProcessApMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ)
+{
+ tLimMlmStartCnf mlmStartCnf;
+ tANI_U32 val;
+ tpPESession psessionEntry;
+// tANI_U8 sessionId;
+ tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
+ if(NULL == pAddBssParams )
+ {
+ limLog( pMac, LOGE, FL( "Encountered NULL Pointer\n" ));
+ goto end;
+ }
+ //TBD: free the memory before returning, do it for all places where lookup fails.
+ if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
+ return;
+ }
+ /* Update PE session Id*/
+ mlmStartCnf.sessionId = pAddBssParams->sessionId;
+ if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
+ {
+ PELOG2(limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS\n"));)
+ if (limSetLinkState(pMac, eSIR_LINK_AP_STATE,psessionEntry->bssId,
+ psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
+ goto end;
+ // Set MLME state
+ psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+ if( eSIR_IBSS_MODE == pAddBssParams->bssType )
+ {
+ /** IBSS is 'active' when we receive
+ * Beacon frames from other STAs that are part of same IBSS.
+ * Mark internal state as inactive until then.
+ */
+ psessionEntry->limIbssActive = false;
+ psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know session created for self/peer
+ limResetHBPktCount( psessionEntry );
+ limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
+ if (limActivateHearBeatTimer(pMac) != TX_SUCCESS)
+ limLog(pMac, LOGP, FL("could not activate Heartbeat timer\n"));
+ }
+ psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
+
+#ifdef ANI_PRODUCT_TYPE_AP
+ psessionEntry->limSystemRole = eLIM_AP_ROLE;
+#else
+ psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if ( eSIR_INFRA_AP_MODE == pAddBssParams->bssType )
+ psessionEntry->limSystemRole = eLIM_AP_ROLE;
+ else
+ psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
+#endif
+ schEdcaProfileUpdate(pMac, psessionEntry);
+ limInitPreAuthList(pMac);
+ limInitAIDpool(pMac,psessionEntry);
+ // Create timers used by LIM
+ if (!pMac->lim.gLimTimersCreated)
+ limCreateTimers(pMac);
+ /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
+ if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
+ limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!\n"));
+ pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
+ // Apply previously set configuration at HW
+ limApplyConfiguration(pMac,psessionEntry);
+ psessionEntry->staId = pAddBssParams->staContext.staIdx;
+ mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
+ }
+ else
+ {
+ limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d\n" ),pAddBssParams->status );
+ mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
+ }
+ limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
+ end:
+ if( 0 != limMsgQ->bodyptr )
+ palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
+}
+
+
+/**
+ * limProcessIbssMlmAddBssRsp()
+ *
+ *FUNCTION:
+ * This function is called to process a WDA_ADD_BSS_RSP from HAL.
+ * Upon receipt of this message from HAL, MLME -
+ * > Validates the result of WDA_ADD_BSS_REQ
+ * > Init other remaining LIM variables
+ * > Init the AID pool, for that BSSID
+ * > Init the Pre-AUTH list, for that BSSID
+ * > Create LIM timers, specific to that BSSID
+ * > Init DPH related parameters that are specific to that BSSID
+ * > TODO - When do we do the actual change channel?
+ *
+ *LOGIC:
+ * SME sends eWNI_SME_START_BSS_REQ to LIM
+ * LIM sends LIM_MLM_START_REQ to MLME
+ * MLME sends WDA_ADD_BSS_REQ to HAL
+ * HAL responds with WDA_ADD_BSS_RSP to MLME
+ * MLME responds with LIM_MLM_START_CNF to LIM
+ * LIM responds with eWNI_SME_START_BSS_RSP to SME
+ *
+ *ASSUMPTIONS:
+ * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
+ * tSirMsgQ.body will now be freed by this routine
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param tSirMsgQ The MsgQ header, which contains the response buffer
+ *
+ * @return None
+ */
+static void
+limProcessIbssMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
+{
+ tLimMlmStartCnf mlmStartCnf;
+ tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
+ tANI_U32 val;
+ if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
+ {
+ PELOG1(limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS\n"));)
+ if (limSetLinkState(pMac, eSIR_LINK_IBSS_STATE,psessionEntry->bssId,
+ psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
+ goto end;
+ // Set MLME state
+ psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+ /** IBSS is 'active' when we receive
+ * Beacon frames from other STAs that are part of same IBSS.
+ * Mark internal state as inactive until then.
+ */
+ psessionEntry->limIbssActive = false;
+ limResetHBPktCount( psessionEntry );
+ /* Timer related functions are not modified for BT-AMP : To be Done */
+ limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
+ if (limActivateHearBeatTimer(pMac) != TX_SUCCESS)
+ limLog(pMac, LOGP, FL("could not activate Heartbeat timer\n"));
+ psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
+ psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
+ psessionEntry->statypeForBss = STA_ENTRY_SELF;
+ schEdcaProfileUpdate(pMac, psessionEntry);
+ //TBD-RAJESH limInitPreauthList should re removed for IBSS also ?????
+ //limInitPreAuthList(pMac);
+ limInitAIDpool(pMac,psessionEntry);
+ // Create timers used by LIM
+#ifdef FIXME_GEN6 //following code may not be required, as limCreateTimers is now invoked from limInitialize (peStart)
+ if (!pMac->lim.gLimTimersCreated)
+ limCreateTimers(pMac);
+#endif
+ /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
+ if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
+ limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!\n"));
+ pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
+ // Apply previously set configuration at HW
+ limApplyConfiguration(pMac,psessionEntry);
+ psessionEntry->staId = pAddBssParams->staContext.staIdx;
+ mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
+ //If ADD BSS was issued as part of IBSS coalescing, don't send the message to SME, as that is internal to LIM
+ if(true == pMac->lim.gLimIbssCoalescingHappened)
+ {
+ limIbssAddBssRspWhenCoalescing(pMac, limMsgQ->bodyptr, psessionEntry);
+ goto end;
+ }
+ }
+ else
+ {
+ limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d\n" ),
+ pAddBssParams->status );
+ mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
+ }
+ //Send this message to SME, when ADD_BSS is initiated by SME
+ //If ADD_BSS is done as part of coalescing, this won't happen.
+ /* Update PE session Id*/
+ mlmStartCnf.sessionId =psessionEntry->peSessionId;
+ limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
+ end:
+ if( 0 != limMsgQ->bodyptr )
+ palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
+}
+
+static void
+limProcessStaMlmAddBssRspPreAssoc( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry )
+{
+ tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
+ tAniAuthType cfgAuthType, authMode;
+ tLimMlmAuthReq *pMlmAuthReq;
+ tpDphHashNode pStaDs = NULL;
+ if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
+ {
+ if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->staContext.staMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
+ {
+ // Could not add hash table entry
+ PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for \n"));)
+ limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
+ goto joinFailure;
+ }
+ psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
+ //Success, handle below
+ pStaDs->bssId = pAddBssParams->bssIdx;
+ //STA Index(genr by HAL) for the BSS entry is stored here
+ pStaDs->staIndex = pAddBssParams->staContext.staIdx;
+ // Trigger Authentication with AP
+ if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
+ (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get AuthType from CFG.
+ * Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve AuthType\n"));
+ }
+ if (cfgAuthType == eSIR_AUTO_SWITCH)
+ authMode = eSIR_OPEN_SYSTEM; // Try Open Authentication first
+ else
+ authMode = cfgAuthType;
+
+ // Trigger MAC based Authentication
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmAuthReq, sizeof(tLimMlmAuthReq)))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for mlmAuthReq\n"));
+ return;
+ }
+ #if 0
+ val = sizeof(tSirMacAddr);
+ if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID,
+ pMlmAuthReq->peerMacAddr,
+ &val) != eSIR_SUCCESS)
+ {
+ /// Could not get BSSID from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
+ }
+ #endif //TO SUPPORT BT-AMP
+ sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
+
+ pMlmAuthReq->authType = authMode;
+ if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
+ (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
+ != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get AuthFailureTimeout
+ * value from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve AuthFailureTimeout value\n"));
+ }
+ // SUNIT_FIX_ME: Set BOTH? Assume not. Please verify here and below.
+ //pMac->lim.gLimMlmState = eLIM_MLM_JOINED_STATE;
+ psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_JOINED_STATE));
+ pMlmAuthReq->sessionId = psessionEntry->peSessionId;
+ psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
+ psessionEntry->limSmeState = eLIM_SME_WT_AUTH_STATE;
+ // remember staId in case of assoc timeout/failure handling
+ psessionEntry->staId = pAddBssParams->staContext.staIdx;
+
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, psessionEntry->limSmeState));
+ limPostMlmMessage(pMac,
+ LIM_MLM_AUTH_REQ,
+ (tANI_U32 *) pMlmAuthReq);
+ return;
+ }
+
+joinFailure:
+ {
+ psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, psessionEntry->limSmeState));
+
+ /// Send Join response to Host
+ limHandleSmeJoinResult(pMac, eSIR_SME_REFUSED, eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
+
+ }
+
+}
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+/*------------------------------------------------------------------------------------------
+ *
+ * Function to handle WDA_ADD_BSS_RSP, in FT reassoc state.
+ *
+ *
+ *------------------------------------------------------------------------------------------
+ */
+static inline void
+limProcessStaMlmAddBssRspFT(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry)
+{
+ tpDphHashNode pStaDs = NULL;
+ tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
+ tpAddStaParams pAddStaParams = NULL;
+ tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
+ tLimMlmReassocReq *pMlmReassocReq;
+ tLimMlmReassocCnf mlmReassocCnf; // keep sme
+
+ pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
+
+ if ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE != psessionEntry->limMlmState )
+ {
+ goto end;
+ }
+
+ if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->bssId, DPH_STA_HASH_INDEX_PEER,
+ &psessionEntry->dph.dphHashTable)) == NULL)
+ {
+ // Could not add hash table entry
+ PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for \n"));)
+ limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
+ goto end;
+ }
+
+ // Set the filter state to post assoc
+ if (limSetLinkState(pMac, eSIR_LINK_POSTASSOC_STATE,
+ pAddBssParams->bssId, psessionEntry->selfMacAddr,
+ NULL, NULL) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState\n"));)
+ goto end;
+ }
+
+ // Prepare and send Reassociation request frame
+ // start reassoc timer.
+ pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
+ /// Start reassociation failure timer
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_REASSOC_FAIL_TIMER));
+ if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
+ != TX_SUCCESS)
+ {
+ /// Could not start reassoc failure timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("could not start Reassociation failure timer\n"));
+ // Return Reassoc confirm with
+ // Resources Unavailable
+ mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+ goto end;
+ }
+ limSendReassocReqWithFTIEsMgmtFrame(pMac, psessionEntry->pLimMlmReassocReq, psessionEntry);
+ psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
+ psessionEntry->limMlmState = eLIM_MLM_WT_FT_REASSOC_RSP_STATE;
+ PELOGE(limLog(pMac, LOGE, FL("Set the mlm state to %d session=%d\n"),
+ psessionEntry->limMlmState, psessionEntry->peSessionId);)
+
+ psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
+
+ //Success, handle below
+ pStaDs->bssId = pAddBssParams->bssIdx;
+ //STA Index(genr by HAL) for the BSS entry is stored here
+ pStaDs->staIndex = pAddBssParams->staContext.staIdx;
+ pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
+ pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
+
+ // Downgrade the EDCA parameters if needed
+ limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
+
+ // Send the active EDCA parameters to HAL
+ if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
+ {
+ limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
+ }
+ else
+ {
+ limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
+ }
+
+#if defined WLAN_FEATURE_VOWIFI
+ rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
+#endif
+
+ if( eHAL_STATUS_SUCCESS !=
+ palAllocateMemory( pMac->hHdd, (void **) &pAddStaParams, sizeof( tAddStaParams )))
+ {
+ limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during ADD_STA\n" ));
+ return;
+ }
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams, sizeof(tAddStaParams));
+
+ /// Add STA context at MAC HW (BMU, RHP & TFP)
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->staMac,
+ (tANI_U8 *) psessionEntry->selfMacAddr, sizeof(tSirMacAddr));
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->bssId,
+ psessionEntry->bssId, sizeof(tSirMacAddr));
+
+ // Update this when we get reassoc rsp , with success.
+ // pAddStaParams->assocId = psessionEntry->limAID;
+
+ pAddStaParams->staType = STA_ENTRY_SELF;
+ pAddStaParams->status = eHAL_STATUS_SUCCESS;
+ pAddStaParams->respReqd = 1;
+
+ /* Update PE session ID */
+ pAddStaParams->sessionId = psessionEntry->peSessionId;
+
+ // This will indicate HAL to "allocate" a new STA index
+ pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
+ pAddStaParams->updateSta = FALSE;
+
+ pAddStaParams->shortPreambleSupported = (tANI_U8)psessionEntry->beaconParams.fShortPreamble;
+ limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
+
+ if( psessionEntry->htCapabality)
+ {
+ pAddStaParams->htCapable = psessionEntry->htCapabality;
+#ifdef DISABLE_GF_FOR_INTEROP
+ /*
+ * To resolve the interop problem with Broadcom AP,
+ * where TQ STA could not pass traffic with GF enabled,
+ * TQ STA will do Greenfield only with TQ AP, for
+ * everybody else it will be turned off.
+ */
+ if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
+ {
+ limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
+ pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
+ }
+ else
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE
+ pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
+ pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
+ pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
+ pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
+ pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
+ pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
+ pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
+ pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
+ pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
+ pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
+ pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry);
+ pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry);
+#else
+ pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD );
+ pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET );
+ pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE );
+ pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE );
+ pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION );
+ pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA );
+ pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY );
+ pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR);
+ pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH );
+ pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ);
+ pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ);
+ pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ);
+#endif
+ }
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL\n"));
+ pAddStaParams->listenInterval = (tANI_U16)listenInterval;
+
+ limFillSupportedRatesInfo(pMac, NULL, &pAddStaParams->supportedRates,psessionEntry);
+
+ // Lets save this for when we receive the Reassoc Rsp
+ pMac->ft.ftPEContext.pAddStaReq = pAddStaParams;
+ return;
+
+end:
+ // Free up buffer allocated for reassocReq
+ if (pMlmReassocReq != NULL)
+ {
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmReassocReq);
+ }
+ mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
+ mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+ /* Update PE sessio Id*/
+ mlmReassocCnf.sessionId = psessionEntry->peSessionId;
+
+ limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
+}
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+
+/**
+ * limProcessStaMlmAddBssRsp()
+ *
+ *FUNCTION:
+ * This function is called to process a WDA_ADD_BSS_RSP from HAL.
+ * Upon receipt of this message from HAL, MLME -
+ * > Validates the result of WDA_ADD_BSS_REQ
+ * > Now, send an ADD_STA to HAL and ADD the "local" STA itself
+ *
+ *LOGIC:
+ * MLME had sent WDA_ADD_BSS_REQ to HAL
+ * HAL responded with WDA_ADD_BSS_RSP to MLME
+ * MLME now sends WDA_ADD_STA_REQ to HAL
+ *
+ *ASSUMPTIONS:
+ * tSirMsgQ.body is allocated by MLME during limProcessMlmJoinReq
+ * tSirMsgQ.body will now be freed by this routine
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param tSirMsgQ The MsgQ header, which contains the response buffer
+ *
+ * @return None
+ */
+static void
+limProcessStaMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
+{
+ tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
+ tLimMlmAssocCnf mlmAssocCnf;
+ tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
+ tANI_U32 subType = LIM_ASSOC;
+ tpDphHashNode pStaDs = NULL;
+ tANI_U16 staIdx = HAL_STA_INVALID_IDX;
+ tANI_U8 updateSta = false;
+ mlmAssocCnf.resultCode = eSIR_SME_SUCCESS;
+
+ if(eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE == psessionEntry->limMlmState)
+ {
+ //Done: 7-28-2009. JIM_FIX_ME: sessionize the following function
+ limProcessStaMlmAddBssRspPreAssoc(pMac, limMsgQ, psessionEntry);
+ goto end;
+ }
+ if( eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE == psessionEntry->limMlmState )
+ {
+ mesgType = LIM_MLM_REASSOC_CNF;
+ subType = LIM_REASSOC;
+ //If Reassoc is happening for the same BSS, then use the existing StaId and indicate to HAL
+ //to update the existing STA entry.
+ //If Reassoc is happening for the new BSS, then old BSS and STA entry would have been already deleted
+ //before PE tries to add BSS for the new BSS, so set the updateSta to false and pass INVALID STA Index.
+ if (sirCompareMacAddr( psessionEntry->bssId, psessionEntry->limReAssocbssId))
+ {
+ staIdx = psessionEntry->staId;
+ updateSta = true;
+ }
+ }
+ if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
+ {
+#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_CCX)
+ if( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState )
+ {
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog(pMac, LOGE, FL("Mlm=%d %d\n"),
+ psessionEntry->limMlmState,
+ eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE);)
+#endif
+ limProcessStaMlmAddBssRspFT( pMac, limMsgQ, psessionEntry);
+ goto end;
+ }
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+ // Set MLME state
+ psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+ psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know the session started for self or for peer oct6th
+ // Now, send WDA_ADD_STA_REQ
+ limLog( pMac, LOGW, FL( "On STA: ADD_BSS was successful\n" ));
+ pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
+ if (pStaDs == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not Add Self Entry for the station\n"));)
+ mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
+ }
+ else
+ {
+ psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
+ //Success, handle below
+ pStaDs->bssId = pAddBssParams->bssIdx;
+ //STA Index(genr by HAL) for the BSS entry is stored here
+ pStaDs->staIndex = pAddBssParams->staContext.staIdx;
+ pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
+ pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
+ // Downgrade the EDCA parameters if needed
+ limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
+ // Send the active EDCA parameters to HAL
+ if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE) {
+ limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
+ } else {
+ limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
+ }
+#if defined WLAN_FEATURE_VOWIFI
+ rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
+#endif
+
+ if (subType == LIM_REASSOC)
+ limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER);
+ if (limAddStaSelf(pMac,staIdx, updateSta, psessionEntry) != eSIR_SUCCESS)
+ {
+ // Add STA context at HW
+ PELOGE(limLog(pMac, LOGE, FL("could not Add Self Entry for the station\n"));)
+ mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
+ }
+ }
+ }
+ else
+ {
+ limLog( pMac, LOGP, FL( "ADD_BSS failed!\n" ));
+ // Return Assoc confirm to SME with failure
+ mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
+ }
+
+ if(mlmAssocCnf.resultCode != eSIR_SME_SUCCESS)
+ {
+ /* Update PE session Id*/
+ mlmAssocCnf.sessionId = psessionEntry->peSessionId;
+ limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
+ }
+ end:
+ if( 0 != limMsgQ->bodyptr )
+ palFreeMemory( pMac->hHdd,(void *) pAddBssParams );
+}
+
+
+
+/**
+ * limProcessMlmAddBssRsp()
+ *
+ *FUNCTION:
+ * This function is called to process a WDA_ADD_BSS_RSP from HAL.
+ * Upon receipt of this message from HAL, MLME -
+ * > Determines the "state" in which this message was received
+ * > Forwards it to the appropriate callback
+ *
+ *LOGIC:
+ * WDA_ADD_BSS_RSP can be received by MLME while the LIM is
+ * in the following two states:
+ * 1) As AP, LIM state = eLIM_SME_WT_START_BSS_STATE
+ * 2) As STA, LIM state = eLIM_SME_WT_JOIN_STATE
+ * Based on these two states, this API will determine where to
+ * route the message to
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param tSirMsgQ The MsgQ header, which contains the response buffer
+ *
+ * @return None
+ */
+void limProcessMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
+{
+ tLimMlmStartCnf mlmStartCnf;
+ tpPESession psessionEntry;
+ tpAddBssParams pAddBssParams = (tpAddBssParams) (limMsgQ->bodyptr);
+
+ if(NULL == pAddBssParams )
+ {
+ limLog( pMac, LOGE, FL( "Encountered NULL Pointer\n" ));
+ return;
+ }
+
+ //
+ // TODO & FIXME_GEN4
+ // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
+ //
+ //we need to process the deferred message since the initiating req. there might be nested request.
+ //in the case of nested request the new request initiated from the response will take care of resetting
+ //the deffered flag.
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+ // Validate SME/LIM state
+ // Validate MLME state
+ if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
+ {
+ limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId\n" ));
+ return;
+ }
+ /* update PE session Id*/
+ mlmStartCnf.sessionId = psessionEntry->peSessionId;
+ if( eSIR_IBSS_MODE == psessionEntry->bssType )
+ limProcessIbssMlmAddBssRsp( pMac, limMsgQ, psessionEntry );
+ else
+ {
+ if( eLIM_SME_WT_START_BSS_STATE == psessionEntry->limSmeState )
+ {
+ if( eLIM_MLM_WT_ADD_BSS_RSP_STATE != psessionEntry->limMlmState )
+ {
+ // Mesg received from HAL in Invalid state!
+ limLog( pMac, LOGE,
+ FL( "Received unexpected WDA_ADD_BSS_RSP in state %X\n" ),
+ psessionEntry->limMlmState );
+ mlmStartCnf.resultCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
+ if( 0 != limMsgQ->bodyptr )
+ palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
+ limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
+ }
+ else if ((psessionEntry->bssType == eSIR_BTAMP_AP_MODE)||(psessionEntry->bssType == eSIR_BTAMP_STA_MODE))
+ {
+ limProcessBtampAddBssRsp(pMac,limMsgQ,psessionEntry);
+ }
+ else
+ limProcessApMlmAddBssRsp( pMac,limMsgQ);
+ }
+ else
+ /* Called while processing assoc response */
+ limProcessStaMlmAddBssRsp( pMac, limMsgQ,psessionEntry);
+ }
+}
+/**
+ * limProcessMlmSetKeyRsp()
+ *
+ *FUNCTION:
+ * This function is called to process the following two
+ * messages from HAL:
+ * 1) WDA_SET_BSSKEY_RSP
+ * 2) WDA_SET_STAKEY_RSP
+ * 3) WDA_SET_STA_BCASTKEY_RSP
+ * Upon receipt of this message from HAL,
+ * MLME -
+ * > Determines the "state" in which this message was received
+ * > Forwards it to the appropriate callback
+ *
+ *LOGIC:
+ * WDA_SET_BSSKEY_RSP/WDA_SET_STAKEY_RSP can be
+ * received by MLME while in the following state:
+ * MLME state = eLIM_MLM_WT_SET_BSS_KEY_STATE --OR--
+ * MLME state = eLIM_MLM_WT_SET_STA_KEY_STATE --OR--
+ * MLME state = eLIM_MLM_WT_SET_STA_BCASTKEY_STATE
+ * Based on this state, this API will determine where to
+ * route the message to
+ *
+ *ASSUMPTIONS:
+ * ONLY the MLME state is being taken into account for now.
+ * This is because, it appears that the handling of the
+ * SETKEYS REQ is handled symmetrically on both the AP & STA
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param tSirMsgQ The MsgQ header, which contains the response buffer
+ *
+ * @return None
+ */
+void limProcessMlmSetStaKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
+{
+ tANI_U8 respReqd = 1;
+ tLimMlmSetKeysCnf mlmSetKeysCnf;
+ tANI_U8 sessionId = 0;
+ tpPESession psessionEntry;
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+ palZeroMemory( pMac->hHdd, (void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ));
+ //BTAMP
+ if(NULL == limMsgQ->bodyptr)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL\n"));)
+ return;
+ }
+ sessionId = ((tpSetStaKeyParams) limMsgQ->bodyptr)->sessionId;
+ if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
+ return;
+ }
+ if( eLIM_MLM_WT_SET_STA_KEY_STATE != psessionEntry->limMlmState )
+ {
+ // Mesg received from HAL in Invalid state!
+ limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X\n" ), limMsgQ->type, pMac->lim.gLimMlmState );
+ // There's not much that MLME can do at this stage...
+ respReqd = 0;
+ }
+ else
+ mlmSetKeysCnf.resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
+
+ palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
+ // Restore MLME state
+ //pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
+ psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+ if( respReqd )
+ {
+ tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
+ // Prepare and Send LIM_MLM_SETKEYS_CNF
+ if( NULL != lpLimMlmSetKeysReq )
+ {
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmSetKeysCnf.peerMacAddr, (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr, sizeof(tSirMacAddr) );
+#ifdef ANI_PRODUCT_TYPE_AP
+ mlmSetKeysCnf.aid = lpLimMlmSetKeysReq->aid;
+#endif
+ // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmSetKeysReq);
+ pMac->lim.gpLimMlmSetKeysReq = NULL;
+ }
+ mlmSetKeysCnf.sessionId = sessionId;
+ limPostSmeMessage( pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf );
+ }
+}
+void limProcessMlmSetBssKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
+{
+ tANI_U8 respReqd = 1;
+ tLimMlmSetKeysCnf mlmSetKeysCnf;
+ tANI_U16 resultCode;
+ tANI_U8 sessionId =0;
+ tpPESession psessionEntry;
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+ palZeroMemory( pMac->hHdd, (void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ));
+ //BTAMP
+ if(NULL == limMsgQ->bodyptr)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is null\n"));)
+ return;
+ }
+ sessionId = ((tpSetBssKeyParams) limMsgQ->bodyptr)->sessionId;
+ if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
+ return;
+ }
+ if( eLIM_MLM_WT_SET_BSS_KEY_STATE == psessionEntry->limMlmState )
+ resultCode = (tANI_U16) (((tpSetBssKeyParams) limMsgQ->bodyptr)->status);
+ else
+ resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status); //BCAST key also uses tpSetStaKeyParams. Done this way for readabilty.
+
+ //
+ // TODO & FIXME_GEN4
+ // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
+ //
+ // Validate SME/LIM state - Read the above "ASSUMPTIONS"
+ //if( eLIM_SME_LINK_EST_STATE == pMac->lim.gLimSmeState )
+ //{
+ // Validate MLME state
+ if( eLIM_MLM_WT_SET_BSS_KEY_STATE != psessionEntry->limMlmState &&
+ eLIM_MLM_WT_SET_STA_BCASTKEY_STATE != psessionEntry->limMlmState )
+ {
+ // Mesg received from HAL in Invalid state!
+ limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X\n" ), limMsgQ->type, pMac->lim.gLimMlmState );
+ // There's not much that MLME can do at this stage...
+ respReqd = 0;
+ }
+ else
+ mlmSetKeysCnf.resultCode = resultCode;
+
+ palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
+ // Restore MLME state
+ //pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
+ psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
+
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+ if( respReqd )
+ {
+ tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
+ mlmSetKeysCnf.sessionId = sessionId;
+
+ // Prepare and Send LIM_MLM_SETKEYS_CNF
+ if( NULL != lpLimMlmSetKeysReq )
+ {
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmSetKeysCnf.peerMacAddr, (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr, sizeof(tSirMacAddr) );
+#ifdef ANI_PRODUCT_TYPE_AP
+ mlmSetKeysCnf.aid = lpLimMlmSetKeysReq->aid;
+#endif
+ // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmSetKeysReq);
+ pMac->lim.gpLimMlmSetKeysReq = NULL;
+ }
+ limPostSmeMessage( pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf );
+ }
+}
+/**
+ * limProcessMlmRemoveKeyRsp()
+ *
+ *FUNCTION:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param tSirMsgQ The MsgQ header, which contains the response buffer
+ *
+ * @return None
+ */
+void limProcessMlmRemoveKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
+{
+tLimMlmRemoveKeyCnf mlmRemoveCnf;
+tANI_U16 resultCode;
+tpLimMlmRemoveKeyReq lpLimMlmRemoveKeyReq = (tpLimMlmRemoveKeyReq) pMac->lim.gpLimMlmRemoveKeyReq;
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+ palZeroMemory( pMac->hHdd,
+ (void *) &mlmRemoveCnf,
+ sizeof( tLimMlmRemoveKeyCnf ));
+ // Validate MLME state
+ if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE != pMac->lim.gLimMlmState &&
+ eLIM_MLM_WT_REMOVE_STA_KEY_STATE != pMac->lim.gLimMlmState )
+ {
+ // Mesg received from HAL in Invalid state!
+ limLog( pMac, LOGW,
+ FL( "Received unexpected [Mesg Id - %d] in state %X\n" ),
+ limMsgQ->type,
+ pMac->lim.gLimMlmState );
+ return; //ignore the response.
+ }
+
+ if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE == pMac->lim.gLimMlmState )
+ resultCode = (tANI_U16) (((tpRemoveBssKeyParams) limMsgQ->bodyptr)->status);
+ else
+ resultCode = (tANI_U16) (((tpRemoveStaKeyParams) limMsgQ->bodyptr)->status);
+ //
+ // TODO & FIXME_GEN4
+ // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
+ //
+
+ if( 0 != limMsgQ->bodyptr )
+ palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
+ // Restore MLME state
+ pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+ // Prepare and Send LIM_MLM_REMOVEKEY_CNF
+ if( NULL != lpLimMlmRemoveKeyReq )
+ {
+ palCopyMemory( pMac->hHdd,
+ (tANI_U8 *) &mlmRemoveCnf.peerMacAddr,
+ (tANI_U8 *) lpLimMlmRemoveKeyReq->peerMacAddr,
+ sizeof( tSirMacAddr ));
+ mlmRemoveCnf.resultCode = resultCode;
+ // Free the buffer cached for the global pMac->lim.gpLimMlmRemoveKeyReq
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmRemoveKeyReq);
+ pMac->lim.gpLimMlmRemoveKeyReq = NULL;
+ }
+ limPostSmeMessage( pMac,
+ LIM_MLM_REMOVEKEY_CNF,
+ (tANI_U32 *) &mlmRemoveCnf );
+}
+
+#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+/**----------------------------------------------------
+\fn __limProcessFinishLearnRsp
+\brief Handle finish learn rsp state, only for AP.
+\param pMac
+\return NONE
+-----------------------------------------------------*/
+static void __limProcessFinishLearnRsp(tpAniSirGlobal pMac)
+{
+ PELOG2(limLog(pMac, LOG2, FL("System Role: %d\n"), pMac->lim.gLimSystemRole);)
+ if (pMac->lim.gpLimMeasReq == NULL)
+ {
+ limRestorePreLearnState(pMac);
+ return;
+ }
+ /**
+ * Initial measurement -> periodic measurement should keep enabled, so that
+ * if system Role is UNKNOWN LIM can send indication to WSM. Overloading
+ * periodic measurement to distinguish initial measurement and radar
+ * detect park basically to avoid sending measurement indication after
+ * radar detect park.
+ * Radar detect park -> periodic measurement should be disabled, so that
+ * LIM wont send indication even when role is UNKNOWN.
+ * Final measurement -> periodic measurement should be enabled, so that
+ * LIM could start measurement indication timer.
+ */
+ if (pMac->lim.gpLimMeasReq->measControl.periodicMeasEnabled &&
+ !pMac->lim.gLimMeasParams.isMeasIndTimerActive)
+ {
+#if 0 /* Will we be ever in UNKNOWN ROLE: Veerendra */
+ if (pMac->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE)
+ {
+ limSendSmeMeasurementInd(pMac);
+ limCleanupMeasResources(pMac);
+ limRestorePreLearnState(pMac);
+ return;
+ }
+ else
+#endif
+ {
+#ifdef GEN6_TODO
+ /* revisit this piece of code to assign the appropriate sessionId below
+ * priority - MEDIUM
+ */
+ pMac->lim.gLimMeasParams.measurementIndTimer.sessionId = sessionId;
+#endif
+ // Activate periodic measurement indication timer
+ if (tx_timer_activate(
+ &pMac->lim.gLimMeasParams.measurementIndTimer)
+ != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("could not start Meas IND timer\n"));
+ return;
+ }
+ pMac->lim.gLimMeasParams.isMeasIndTimerActive = 1;
+ }
+ }
+ if (pMac->lim.gLimMeasParams.nextLearnChannelId >=
+ pMac->lim.gpLimMeasReq->channelList.numChannels - 1)
+ {
+ // All channels in the channel set are learned.
+ pMac->lim.gLimMeasParams.nextLearnChannelId = 0;
+ }
+ // Go back to previous state.
+ limRestorePreLearnState(pMac);
+ // Restart the learn interval timer.
+ if (pMac->lim.gpLimMeasReq->measControl.periodicMeasEnabled)
+ limReEnableLearnMode(pMac);
+ return;
+}
+#endif
+
+/** ---------------------------------------------------------------------
+\fn limProcessInitScanRsp
+\brief This function is called when LIM receives WDA_INIT_SCAN_RSP
+\ message from HAL. If status code is failure, then
+\ update the gLimNumOfConsecutiveBkgndScanFailure count.
+\param tpAniSirGlobal pMac
+\param tANI_U32 body
+\return none
+\ ----------------------------------------------------------------------- */
+void limProcessInitScanRsp(tpAniSirGlobal pMac, void *body)
+{
+ tpInitScanParams pInitScanParam;
+ eHalStatus status;
+#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ tANI_U8 channelNum;
+#endif
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+ pInitScanParam = (tpInitScanParams) body;
+ status = pInitScanParam->status;
+ palFreeMemory( pMac->hHdd, (char *)body);
+
+ //Only abort scan if the we are scanning.
+ if( pMac->lim.abortScan &&
+ (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
+ {
+ limLog( pMac, LOGW, FL(" finish scan\n") );
+ pMac->lim.abortScan = 0;
+ limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
+ limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
+ //Set the resume channel to Any valid channel (invalid).
+ //This will instruct HAL to set it to any previous valid channel.
+ peSetResumeChannel(pMac, 0, 0);
+ limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
+ }
+ switch(pMac->lim.gLimHalScanState)
+ {
+ case eLIM_HAL_INIT_SCAN_WAIT_STATE:
+ if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("InitScanRsp with failed status= %d\n"), status);)
+ pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
+ pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
+ /*
+ * On Windows eSIR_SME_HAL_SCAN_INIT_FAILED message to CSR may trigger
+ * another Scan request in the same context (happens when 11d is enabled
+ * and first scan request with 11d channels fails for whatever reason, then CSR issues next init
+ * scan in the same context but with bigger channel list), so the state needs to be
+ * changed before this response message is sent.
+ */
+ limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
+#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ /* For handling the measurement request from WSM as scan request in LIM*/
+#if 0
+ if (pMac->lim.gLimSystemRole == eLIM_STA_ROLE && pMac->lim.gpLimMeasReq != NULL)
+ {
+ limRestorePreLearnState(pMac);
+ pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
+ limReEnableLearnMode(pMac);
+ }
+#endif
+#endif
+ return;
+ }
+ else if (status == eHAL_STATUS_SUCCESS)
+ {
+ /* since we have successfully triggered a background scan,
+ * reset the "consecutive bkgnd scan failure" count to 0
+ */
+ pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
+ pMac->lim.gLimNumOfBackgroundScanSuccess += 1;
+ }
+ limContinueChannelScan(pMac);
+ break;
+#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ case eLIM_HAL_INIT_LEARN_WAIT_STATE:
+// if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
+ {
+ if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
+ {
+ limRestorePreLearnState(pMac);
+ pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
+ limReEnableLearnMode(pMac);
+ return;
+ }
+ channelNum = limGetCurrentLearnChannel(pMac);
+ limSendHalStartScanReq(pMac, channelNum, eLIM_HAL_START_LEARN_WAIT_STATE);
+ }
+ break;
+#endif
+//WLAN_SUSPEND_LINK Related
+ case eLIM_HAL_SUSPEND_LINK_WAIT_STATE:
+ if( pMac->lim.gpLimSuspendCallback )
+ {
+ if( status == eHAL_STATUS_SUCCESS )
+ pMac->lim.gLimHalScanState = eLIM_HAL_SUSPEND_LINK_STATE;
+ else
+ pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
+
+ pMac->lim.gpLimSuspendCallback( pMac, status, pMac->lim.gpLimSuspendData );
+ pMac->lim.gpLimSuspendCallback = NULL;
+ pMac->lim.gpLimSuspendData = NULL;
+ }
+ else
+ {
+ limLog( pMac, LOGP, "No suspend link callback set but station is in suspend state\n");
+ return;
+ }
+ break;
+//end WLAN_SUSPEND_LINK Related
+ default:
+ limLog(pMac, LOGW, FL("limProcessInitScanRsp: Rcvd InitScanRsp not in WAIT State, state %d\n"),
+ pMac->lim.gLimHalScanState);
+ break;
+ }
+ return;
+}
+/**
+ * limProcessSwitchChannelReAssocReq()
+ *
+ *FUNCTION:
+ * This function is called to send the reassoc req mgmt frame after the
+ * switchChannelRsp message is received from HAL.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure.
+ * @param psessionEntry - session related information.
+ * @param status - channel switch success/failure.
+ *
+ * @return None
+ */
+static void limProcessSwitchChannelReAssocReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
+{
+ tLimMlmReassocCnf mlmReassocCnf;
+ tLimMlmReassocReq *pMlmReassocReq;
+ pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
+ if(pMlmReassocReq == NULL)
+ {
+ limLog(pMac, LOGP, FL("pLimMlmReassocReq does not exist for given switchChanSession\n"));
+ mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ goto end;
+ }
+
+ if(status != eHAL_STATUS_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!\n"));)
+ mlmReassocCnf.resultCode = eSIR_SME_CHANNEL_SWITCH_FAIL;
+ goto end;
+ }
+ /// Start reassociation failure timer
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_REASSOC_FAIL_TIMER));
+ if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
+ != TX_SUCCESS)
+ {
+ /// Could not start reassoc failure timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("could not start Reassociation failure timer\n"));
+ // Return Reassoc confirm with
+ // Resources Unavailable
+ mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ goto end;
+ }
+ /// Prepare and send Reassociation request frame
+ limSendReassocReqMgmtFrame(pMac, pMlmReassocReq, psessionEntry);
+ return;
+end:
+ // Free up buffer allocated for reassocReq
+ if(pMlmReassocReq != NULL)
+ {
+ /* Update PE session Id*/
+ mlmReassocCnf.sessionId = pMlmReassocReq->sessionId;
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmReassocReq);
+ }
+ else
+ {
+ mlmReassocCnf.sessionId = 0;
+ }
+
+ mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+ /* Update PE sessio Id*/
+ mlmReassocCnf.sessionId = psessionEntry->peSessionId;
+
+ limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
+}
+/**
+ * limProcessSwitchChannelJoinReq()
+ *
+ *FUNCTION:
+ * This function is called to send the probe req mgmt frame after the
+ * switchChannelRsp message is received from HAL.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure.
+ * @param psessionEntry - session related information.
+ * @param status - channel switch success/failure.
+ *
+ * @return None
+ */
+static void limProcessSwitchChannelJoinReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
+{
+ tANI_U32 val;
+ tSirMacSSid ssId;
+ tLimMlmJoinCnf mlmJoinCnf;
+ if(status != eHAL_STATUS_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!\n"));)
+ goto error;
+ }
+
+ if ( (NULL == psessionEntry ) || (NULL == psessionEntry->pLimMlmJoinReq) )
+ {
+ PELOGE(limLog(pMac, LOGE, FL("invalid pointer!!\n"));)
+ goto error;
+ }
+
+ // Activate Join failure timer
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_JOIN_FAIL_TIMER));
+ if (tx_timer_activate(&pMac->lim.limTimers.gLimJoinFailureTimer) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("could not activate Join failure timer\n"));
+ psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+ //memory is freed up below.
+ psessionEntry->pLimMlmJoinReq = NULL;
+ goto error;
+ }
+ /* eSIR_BTAMP_AP_MODE stroed as bss type in session Table when join req is received, is to be veified */
+ if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
+ {
+ if (limSetLinkState(pMac, eSIR_LINK_BTAMP_PREASSOC_STATE, psessionEntry->bssId,
+ psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
+ goto error;
+ }
+ else
+ {
+ if(limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
+ psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
+ goto error;
+ }
+ // Update BSSID at CFG database
+#if 0
+ if (cfgSetStr(pMac, WNI_CFG_BSSID, pMac->lim.gpLimMlmJoinReq->bssDescription.bssId,
+ sizeof(tSirMacAddr))
+ != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("could not update BSSID at CFG\n"));
+#endif //TO SUPPORT BT-AMP
+ //sirCopyMacAddr(psessionEntry->pLimMlmJoinReq->bssDescription.bssId,psessionEntry->bssId);
+
+ /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
+ if(wlan_cfgGetInt(pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("failed to get WNI_CFG_TRIG_STA_BK_SCAN cfg value!\n"));
+ pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
+ // Apply previously set configuration at HW
+ limApplyConfiguration(pMac, psessionEntry);
+ /// Wait for Beacon to announce join success
+#if 0
+ if (cfgGetStr(pMac, WNI_CFG_SSID, ssId.ssId, &cfgLen) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("could not retrive SSID\n"));
+#endif //To SUPPORT BT-AMP
+ palCopyMemory( pMac->hHdd, ssId.ssId,
+ psessionEntry->ssId.ssId,
+ psessionEntry->ssId.length);
+ ssId.length = psessionEntry->ssId.length;
+ // include additional IE if there is
+ limSendProbeReqMgmtFrame( pMac, &ssId,
+ psessionEntry->pLimMlmJoinReq->bssDescription.bssId, psessionEntry->currentOperChannel/*chanNum*/,
+ psessionEntry->selfMacAddr, psessionEntry->dot11mode,
+ psessionEntry->pLimJoinReq->addIEScan.length, psessionEntry->pLimJoinReq->addIEScan.addIEdata);
+ return;
+error:
+ if(NULL != psessionEntry)
+ {
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) (psessionEntry->pLimMlmJoinReq));
+ psessionEntry->pLimMlmJoinReq = NULL;
+ mlmJoinCnf.sessionId = psessionEntry->peSessionId;
+ }
+ else
+ {
+ mlmJoinCnf.sessionId = 0;
+ }
+ mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+ limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
+}
+
+/**
+ * limProcessSwitchChannelRsp()
+ *
+ *FUNCTION:
+ * This function is called to process switchChannelRsp message from HAL.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param body - message body.
+ *
+ * @return None
+ */
+void limProcessSwitchChannelRsp(tpAniSirGlobal pMac, void *body)
+{
+ tpSwitchChannelParams pChnlParams = NULL;
+ eHalStatus status;
+ tANI_U16 channelChangeReasonCode;
+ tANI_U8 peSessionId;
+ tpPESession psessionEntry;
+ //we need to process the deferred message since the initiating req. there might be nested request.
+ //in the case of nested request the new request initiated from the response will take care of resetting
+ //the deffered flag.
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+ pChnlParams = (tpSwitchChannelParams) body;
+ status = pChnlParams->status;
+ peSessionId = pChnlParams->peSessionId;
+ if((psessionEntry = peFindSessionBySessionId(pMac, peSessionId))== NULL)
+ {
+ palFreeMemory( pMac->hHdd, (tANI_U8 *)body);
+ limLog(pMac, LOGP, FL("session does not exist for given sessionId\n"));
+ return;
+ }
+#if defined WLAN_FEATURE_VOWIFI
+ //HAL fills in the tx power used for mgmt frames in this field.
+ //Store this value to use in TPC report IE.
+ rrmCacheMgmtTxPower( pMac, pChnlParams->txMgmtPower, psessionEntry );
+#endif
+ palFreeMemory( pMac->hHdd, (tANI_U8 *)body);
+ channelChangeReasonCode = psessionEntry->channelChangeReasonCode;
+ // initialize it back to invalid id
+ psessionEntry->channelChangeReasonCode = 0xBAD;
+ switch(channelChangeReasonCode)
+ {
+ case LIM_SWITCH_CHANNEL_REASSOC:
+ limProcessSwitchChannelReAssocReq(pMac, psessionEntry, status);
+ break;
+ case LIM_SWITCH_CHANNEL_JOIN:
+ limProcessSwitchChannelJoinReq(pMac, psessionEntry, status);
+ break;
+
+ case LIM_SWITCH_CHANNEL_OPERATION:
+ /*
+ * The above code should also use the callback.
+ * mechanism below, there is scope for cleanup here.
+ * THat way all this response handler does is call the call back
+ * We can get rid of the reason code here.
+ */
+ if (pMac->lim.gpchangeChannelCallback)
+ {
+ PELOG1(limLog( pMac, LOG1, "Channel changed hence invoke registered call back\n");)
+ pMac->lim.gpchangeChannelCallback(pMac, status, pMac->lim.gpchangeChannelData, psessionEntry);
+ }
+ break;
+ default:
+ break;
+ }
+}
+/**
+ * limProcessStartScanRsp()
+ *
+ *FUNCTION:
+ * This function is called to process startScanRsp message from HAL. If scan/learn was successful
+ * then it will start scan/learn on the next channel.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param body - message body.
+ *
+ * @return None
+ */
+
+void limProcessStartScanRsp(tpAniSirGlobal pMac, void *body)
+{
+ tpStartScanParams pStartScanParam;
+ eHalStatus status;
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+ pStartScanParam = (tpStartScanParams) body;
+ status = pStartScanParam->status;
+#if defined WLAN_FEATURE_VOWIFI
+ //HAL fills in the tx power used for mgmt frames in this field.
+ //Store this value to use in TPC report IE.
+ rrmCacheMgmtTxPower( pMac, pStartScanParam->txMgmtPower, NULL );
+ //Store start TSF of scan start. This will be stored in BSS params.
+ rrmUpdateStartTSF( pMac, pStartScanParam->startTSF );
+#endif
+ palFreeMemory( pMac->hHdd, (tANI_U8 *)body);
+ if( pMac->lim.abortScan )
+ {
+ limLog( pMac, LOGW, FL(" finish scan\n") );
+ pMac->lim.abortScan = 0;
+ limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
+ limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
+ //Set the resume channel to Any valid channel (invalid).
+ //This will instruct HAL to set it to any previous valid channel.
+ peSetResumeChannel(pMac, 0, 0);
+ limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
+ }
+ switch(pMac->lim.gLimHalScanState)
+ {
+ case eLIM_HAL_START_SCAN_WAIT_STATE:
+ if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("StartScanRsp with failed status= %d\n"), status);)
+ //
+ // FIXME - With this, LIM will try and recover state, but
+ // eWNI_SME_SCAN_CNF maybe reporting an incorrect
+ // status back to the SME
+ //
+ //Set the resume channel to Any valid channel (invalid).
+ //This will instruct HAL to set it to any previous valid channel.
+ peSetResumeChannel(pMac, 0, 0);
+ limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE );
+ //limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
+ }
+ else
+ {
+ pMac->lim.gLimHalScanState = eLIM_HAL_SCANNING_STATE;
+ limContinuePostChannelScan(pMac);
+ }
+ break;
+#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ case eLIM_HAL_START_LEARN_WAIT_STATE:
+ // if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
+ {
+ if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
+ {
+ //Set the resume channel to Any valid channel (invalid).
+ //This will instruct HAL to set it to any previous valid channel.
+ peSetResumeChannel(pMac, 0, 0);
+ limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
+ }
+ else
+ {
+ limContinueChannelLearn(pMac);
+ }
+ }
+ break;
+#endif
+ default:
+ limLog(pMac, LOGW, FL("Rcvd StartScanRsp not in WAIT State, state %d\n"),
+ pMac->lim.gLimHalScanState);
+ break;
+ }
+ return;
+}
+void limProcessEndScanRsp(tpAniSirGlobal pMac, void *body)
+{
+ tpEndScanParams pEndScanParam;
+ eHalStatus status;
+#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ tANI_U8 channelNum;
+#endif
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+ pEndScanParam = (tpEndScanParams) body;
+ status = pEndScanParam->status;
+ palFreeMemory( pMac->hHdd, (char *)body);
+ switch(pMac->lim.gLimHalScanState)
+ {
+ case eLIM_HAL_END_SCAN_WAIT_STATE:
+ if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d\n"), status);)
+ pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
+ limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
+ }
+ else
+ {
+ pMac->lim.gLimCurrentScanChannelId++;
+ limContinueChannelScan(pMac);
+ }
+ break;
+#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ case eLIM_HAL_END_LEARN_WAIT_STATE:
+ if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
+ {
+ //Set the resume channel to Any valid channel (invalid).
+ //This will instruct HAL to set it to any previous valid channel.
+ peSetResumeChannel(pMac, 0, 0);
+ limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
+ }
+#if 0 /* Will we be in UNKNOWN ROLE ever in this context: Veerendra */
+ else if (pMac->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE)
+ {
+ /** Before starting BSS, we do complete set of measurement before putting
+ * softmac back into normal mode.
+ */
+ channelNum = limGetCurrentLearnChannel(pMac);
+ limSendHalStartScanReq(pMac, channelNum, eLIM_HAL_START_LEARN_WAIT_STATE);
+ }
+ else
+#endif
+ {
+ limLog(pMac, LOGW, FL("ERROR! This state is set only when AP in UNKNOWN_ROLE\n"),
+ pMac->lim.gLimHalScanState);
+ limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
+ }
+ break;
+#endif
+ default:
+ limLog(pMac, LOGW, FL("Rcvd endScanRsp not in WAIT State, state %d\n"),
+ pMac->lim.gLimHalScanState);
+ break;
+ }
+ return;
+}
+void limProcessFinishScanRsp(tpAniSirGlobal pMac, void *body)
+{
+ tpFinishScanParams pFinishScanParam;
+ tANI_U8 dummySessionId = 0;
+ eHalStatus status;
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+ pFinishScanParam = (tpFinishScanParams) body;
+ status = pFinishScanParam->status;
+ palFreeMemory( pMac->hHdd, (char *)body);
+ switch(pMac->lim.gLimHalScanState)
+ {
+ case eLIM_HAL_FINISH_SCAN_WAIT_STATE:
+ pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
+ limCompleteMlmScan(pMac, eSIR_SME_SUCCESS);
+ if (pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
+ {
+ /** Right time to stop tx and start the timer for channel switch */
+ /* Sending Session ID 0, may not be correct, since SCAN is global there should not
+ * be any associated session id
+ */
+ limStopTxAndSwitchChannel(pMac, dummySessionId);
+ }
+ else if (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
+ {
+ /** Start the quieting */
+ /* Sending Session ID 0, may not be correct, since SCAN is global there should not
+ * be any associated session id
+ */
+ limStartQuietTimer(pMac, dummySessionId);
+ }
+#ifdef ANI_PRODUCT_TYPE_AP
+ /* For handling the measurement request from WSM as scan request in LIM*/
+#if 0
+ if (pMac->lim.gLimSystemRole == eLIM_STA_ROLE && pMac->lim.gpLimMeasReq != NULL)
+ {
+ limSendSmeMeasurementInd(pMac);
+ limCleanupMeasResources(pMac);
+ limRestorePreLearnState(pMac);
+ }
+#endif
+#endif
+ if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d\n"), status);)
+ }
+ break;
+#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+ case eLIM_HAL_FINISH_LEARN_WAIT_STATE:
+ pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
+ __limProcessFinishLearnRsp(pMac);
+ break;
+#endif //#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+//WLAN_SUSPEND_LINK Related
+ case eLIM_HAL_RESUME_LINK_WAIT_STATE:
+ if( pMac->lim.gpLimResumeCallback )
+ {
+ pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
+ pMac->lim.gpLimResumeCallback( pMac, status, pMac->lim.gpLimResumeData );
+ pMac->lim.gpLimResumeCallback = NULL;
+ pMac->lim.gpLimResumeData = NULL;
+ pMac->lim.gLimSystemInScanLearnMode = 0;
+ }
+ else
+ {
+ limLog( pMac, LOGP, "No Resume link callback set but station is in suspend state\n");
+ return;
+ }
+ break;
+//end WLAN_SUSPEND_LINK Related
+
+ default:
+ limLog(pMac, LOGW, FL("Rcvd FinishScanRsp not in WAIT State, state %d\n"),
+ pMac->lim.gLimHalScanState);
+ break;
+ }
+ return;
+}
+/**
+ * @function : limProcessMlmHalAddBARsp
+ *
+ * @brief: Process WDA_ADDBA_RSP coming from HAL
+ *
+ *
+ * @param pMac The global tpAniSirGlobal object
+ *
+ * @param tSirMsgQ The MsgQ header containing the response buffer
+ *
+ * @return none
+ */
+void limProcessMlmHalAddBARsp( tpAniSirGlobal pMac,
+ tpSirMsgQ limMsgQ )
+{
+ // Send LIM_MLM_ADDBA_CNF to LIM
+ tpLimMlmAddBACnf pMlmAddBACnf;
+ tpPESession psessionEntry;
+ tpAddBAParams pAddBAParams = (tpAddBAParams) limMsgQ->bodyptr;
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+ //now LIM can process any defer message.
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+ if (pAddBAParams == NULL) {
+ PELOGE(limLog(pMac, LOGE,FL("NULL ADD BA Response from HAL\n"));)
+ return;
+ }
+ if((psessionEntry = peFindSessionBySessionId(pMac, pAddBAParams->sessionId))==NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionID: %d\n"),pAddBAParams->sessionId );)
+ palFreeMemory(pMac->hHdd, (void*)limMsgQ->bodyptr);
+ return;
+ }
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ // Allocate for LIM_MLM_ADDBA_CNF
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pMlmAddBACnf, sizeof( tLimMlmAddBACnf ))) {
+ limLog( pMac, LOGP, FL(" palAllocateMemory failed with error code %d\n"));
+ palFreeMemory(pMac->hHdd, (void*)limMsgQ->bodyptr);
+ return;
+ }
+ palZeroMemory( pMac->hHdd, (void *) pMlmAddBACnf, sizeof( tLimMlmAddBACnf ));
+ // Copy the peer MAC
+ palCopyMemory( pMac->hHdd, pMlmAddBACnf->peerMacAddr, pAddBAParams->peerMacAddr,
+ sizeof( tSirMacAddr ));
+ // Copy other ADDBA Rsp parameters
+ pMlmAddBACnf->baDialogToken = pAddBAParams->baDialogToken;
+ pMlmAddBACnf->baTID = pAddBAParams->baTID;
+ pMlmAddBACnf->baPolicy = pAddBAParams->baPolicy;
+ pMlmAddBACnf->baBufferSize = pAddBAParams->baBufferSize;
+ pMlmAddBACnf->baTimeout = pAddBAParams->baTimeout;
+ pMlmAddBACnf->baDirection = pAddBAParams->baDirection;
+ pMlmAddBACnf->sessionId = psessionEntry->peSessionId;
+ if(eHAL_STATUS_SUCCESS == pAddBAParams->status)
+ pMlmAddBACnf->addBAResultCode = eSIR_MAC_SUCCESS_STATUS;
+ else
+ pMlmAddBACnf->addBAResultCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+ palFreeMemory(pMac->hHdd, (void*)limMsgQ->bodyptr);
+ // Send ADDBA CNF to LIM
+ limPostSmeMessage( pMac, LIM_MLM_ADDBA_CNF, (tANI_U32 *) pMlmAddBACnf );
+}
+/**
+ * \brief Process LIM_MLM_ADDBA_CNF
+ *
+ * \sa limProcessMlmAddBACnf
+ *
+ * \param pMac The global tpAniSirGlobal object
+ *
+ * \param tSirMsgQ The MsgQ header containing the response buffer
+ *
+ * \return none
+ */
+void limProcessMlmAddBACnf( tpAniSirGlobal pMac,
+ tANI_U32 *pMsgBuf )
+{
+tpLimMlmAddBACnf pMlmAddBACnf;
+tpDphHashNode pSta;
+tANI_U16 aid;
+tLimBAState curBaState;
+tpPESession psessionEntry = NULL;
+if(pMsgBuf == NULL)
+{
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+}
+pMlmAddBACnf = (tpLimMlmAddBACnf) pMsgBuf;
+ if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBACnf->sessionId))== NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));)
+ return;
+ }
+ // First, extract the DPH entry
+ pSta = dphLookupHashEntry( pMac, pMlmAddBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
+ if( NULL == pSta )
+ {
+ PELOGE(limLog( pMac, LOGE,
+ FL( "STA context not found - ignoring ADDBA CNF from HAL\n" ));)
+ palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
+ return;
+ }
+ LIM_GET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, &curBaState);
+ // Need to validate SME state
+ if( eLIM_BA_STATE_WT_ADD_RSP != curBaState)
+ {
+ PELOGE(limLog( pMac, LOGE,
+ FL( "Received unexpected ADDBA CNF when STA BA state is %d\n" ),
+ curBaState );)
+ palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
+ return;
+ }
+ // Restore STA BA state
+ LIM_SET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, eLIM_BA_STATE_IDLE);
+ if( eSIR_SUCCESS == pMlmAddBACnf->addBAResultCode )
+ {
+ // Update LIM internal cache...
+ if( eBA_RECIPIENT == pMlmAddBACnf->baDirection )
+ {
+ pSta->tcCfg[pMlmAddBACnf->baTID].fUseBARx = 1;
+ pSta->tcCfg[pMlmAddBACnf->baTID].fRxCompBA = 1;
+ pSta->tcCfg[pMlmAddBACnf->baTID].fRxBApolicy = pMlmAddBACnf->baPolicy;
+ pSta->tcCfg[pMlmAddBACnf->baTID].rxBufSize = pMlmAddBACnf->baBufferSize;
+ pSta->tcCfg[pMlmAddBACnf->baTID].tuRxBAWaitTimeout = pMlmAddBACnf->baTimeout;
+ }
+ else
+ {
+ pSta->tcCfg[pMlmAddBACnf->baTID].fUseBATx = 1;
+ pSta->tcCfg[pMlmAddBACnf->baTID].fTxCompBA = 1;
+ pSta->tcCfg[pMlmAddBACnf->baTID].fTxBApolicy = pMlmAddBACnf->baPolicy;
+ pSta->tcCfg[pMlmAddBACnf->baTID].txBufSize = pMlmAddBACnf->baBufferSize;
+ pSta->tcCfg[pMlmAddBACnf->baTID].tuTxBAWaitTimeout = pMlmAddBACnf->baTimeout;
+ }
+ }
+ if( eBA_RECIPIENT == pMlmAddBACnf->baDirection )
+ {
+ //
+ // Package LIM_MLM_ADDBA_RSP to MLME, with proper
+ // status code. MLME will then send an ADDBA RSP
+ // over the air to the peer MAC entity
+ //
+ if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
+ pMlmAddBACnf->peerMacAddr,
+ pMlmAddBACnf->addBAResultCode,
+ pMlmAddBACnf->baDialogToken,
+ (tANI_U8) pMlmAddBACnf->baTID,
+ (tANI_U8) pMlmAddBACnf->baPolicy,
+ pMlmAddBACnf->baBufferSize,
+ pMlmAddBACnf->baTimeout,psessionEntry))
+ {
+ PELOGW(limLog( pMac, LOGW,
+ FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
+ limPrintMacAddr( pMac, pMlmAddBACnf->peerMacAddr, LOGW );)
+ }
+ }
+ // Free the memory allocated for LIM_MLM_ADDBA_CNF
+ palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
+}
+/**
+ * \brief Process LIM_MLM_DELBA_CNF
+ *
+ * \sa limProcessMlmDelBACnf
+ *
+ * \param pMac The global tpAniSirGlobal object
+ *
+ * \param tSirMsgQ The MsgQ header containing the response buffer
+ *
+ * \return none
+ */
+void limProcessMlmDelBACnf( tpAniSirGlobal pMac,
+ tANI_U32 *pMsgBuf )
+{
+ tpLimMlmDelBACnf pMlmDelBACnf;
+ tpDphHashNode pSta;
+ tANI_U16 aid;
+// tANI_U8 sessionId;
+ tLimBAState curBaState;
+ tpPESession psessionEntry;
+
+ if(pMsgBuf == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+ return;
+ }
+ pMlmDelBACnf = (tpLimMlmDelBACnf) pMsgBuf;
+ if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDelBACnf->sessionId))== NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+ // First, extract the DPH entry
+ pSta = dphLookupHashEntry( pMac, pMlmDelBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
+ if( NULL == pSta )
+ {
+ limLog( pMac, LOGE,
+ FL( "STA context not found - ignoring DELBA CNF from HAL\n" ));
+ return;
+ }
+ if(NULL == pMlmDelBACnf)
+ {
+ limLog( pMac, LOGE,
+ FL( "pMlmDelBACnf is NULL - ignoring DELBA CNF from HAL\n" ));
+ return;
+ }
+ // Need to validate baState
+ LIM_GET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, &curBaState);
+ if( eLIM_BA_STATE_WT_DEL_RSP != curBaState )
+ {
+ limLog( pMac, LOGE,
+ FL( "Received unexpected DELBA CNF when STA BA state is %d\n" ),
+ curBaState );
+ return;
+ }
+ // Restore STA BA state
+ LIM_SET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, eLIM_BA_STATE_IDLE);
+ // Free the memory allocated for LIM_MLM_DELBA_CNF
+ palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
+}
+/**
+ * \brief Process SIR_LIM_DEL_BA_IND
+ *
+ * \sa limProcessMlmHalBADeleteInd
+ *
+ * \param pMac The global tpAniSirGlobal object
+ *
+ * \param tSirMsgQ The MsgQ header containing the indication buffer
+ *
+ * \return none
+ */
+void limProcessMlmHalBADeleteInd( tpAniSirGlobal pMac,
+ tpSirMsgQ limMsgQ )
+{
+ tSirRetStatus status = eSIR_SUCCESS;
+ tpBADeleteParams pBADeleteParams;
+ tpDphHashNode pSta;
+ tANI_U16 aid;
+ tLimBAState curBaState;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId;
+
+ pBADeleteParams = (tpBADeleteParams) limMsgQ->bodyptr;
+
+ if((psessionEntry = peFindSessionByBssid(pMac,pBADeleteParams->bssId,&sessionId))== NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));)
+ return;
+ }
+ // First, extract the DPH entry
+ pSta = dphLookupHashEntry( pMac, pBADeleteParams->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
+ if( NULL == pSta )
+ {
+ limLog( pMac, LOGE,
+ FL( "STA context not found - ignoring BA Delete IND from HAL\n" ));
+ goto returnAfterCleanup;
+ }
+
+ // Need to validate BA state
+ LIM_GET_STA_BA_STATE(pSta, pBADeleteParams->baTID, &curBaState);
+ if( eLIM_BA_STATE_IDLE != curBaState )
+ {
+ limLog( pMac, LOGE,
+ FL( "Received unexpected BA Delete IND when STA BA state is %d\n" ),
+ curBaState );
+ goto returnAfterCleanup;
+ }
+
+ // Validate if a BA is active for the requested TID
+ // AND in that desired direction
+ if( eBA_INITIATOR == pBADeleteParams->baDirection )
+ {
+ if( 0 == pSta->tcCfg[pBADeleteParams->baTID].fUseBATx )
+ status = eSIR_FAILURE;
+ }
+ else
+ {
+ if( 0 == pSta->tcCfg[pBADeleteParams->baTID].fUseBARx )
+ status = eSIR_FAILURE;
+ }
+ if( eSIR_FAILURE == status )
+ {
+ limLog( pMac, LOGW,
+ FL("Received an INVALID DELBA Delete Ind for TID %d...\n"),
+ pBADeleteParams->baTID );
+ }
+ else
+ {
+ // Post DELBA REQ to MLME...
+ if( eSIR_SUCCESS !=
+ (status = limPostMlmDelBAReq( pMac,
+ pSta,
+ pBADeleteParams->baDirection,
+ pBADeleteParams->baTID,
+ eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry )))
+ {
+ limLog( pMac, LOGE,
+ FL( "Attempt to post LIM_MLM_DELBA_REQ failed with status %d\n" ), status);
+ }
+ else
+ {
+ limLog( pMac, LOGE,
+ FL( "BA Delete - Reason 0x%08x. Attempting to delete BA session for TID %d with peer STA " ),
+ pBADeleteParams->reasonCode, pBADeleteParams->baTID );
+ limPrintMacAddr( pMac, pSta->staAddr, LOGE );
+ }
+ }
+returnAfterCleanup:
+ // Free the memory allocated for SIR_LIM_DEL_BA_IND
+ palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
+}
+/**
+ * @function : limProcessSetMimoRsp()
+ *
+ * @brief : This function is called upon receiving the WDA_SET_MIMOPS_RSP from the HAL
+ * after Processing the Req from the SME (PMC)
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * NA
+ *
+ * NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param limMsg - Lim Message structure object with the MimoPSparam in body
+ * @return None
+ */
+
+void
+limProcessSetMimoRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
+{
+#if 0
+ tSirRetStatus retStatus;
+ tpSetMIMOPS pMIMO_PSParams;
+
+
+ do {
+
+ pMIMO_PSParams = (tpSetMIMOPS)limMsg->bodyptr;
+ if( NULL == pMIMO_PSParams ) {
+ PELOGE(limLog(pMac, LOGE, "Received the WDA_SET_MIMOPS_RSP with NULL as the PS param");)
+ return;
+ }
+
+ /** If Updation of the HAL Fail's*/
+ if (pMIMO_PSParams->status != eSIR_SUCCESS) {
+ limLog(pMac, LOGP, FL("Update HAL / SW Mac for MIMO State has Failed\n"));
+ break;
+ }
+
+ if ((pMac->lim.gLimSystemRole != eSYSTEM_STA_ROLE) ||
+ (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE) )
+ break;
+
+ pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+ /** In the Case of Exiting out of the Powersave (changing from Dynamic/Static mode to SM Enabled)
+ * send the action Frame to Peer to update the PS State of the STA , for the case of Entering PowerSave
+ * the Action Frame is being sent at first before setting the internal structures
+ */
+ if (!isEnteringMimoPS(pMac->lim.gHTMIMOPSState, pMIMO_PSParams->htMIMOPSState)) {
+ tSirMacAddr macAddr;
+
+ /** Obtain the AP's Mac Address */
+ palCopyMemory(pMac -> hHdd, (tANI_U8 *)macAddr, pMac->lim.gLimBssid, sizeof(tSirMacAddr));
+
+ /** Send Action Frame with the corresponding mode */
+ retStatus = limSendSMPowerStateFrame(pMac, macAddr, pMIMO_PSParams->htMIMOPSState);
+ if (retStatus != eSIR_SUCCESS) {
+ PELOGE(limLog(pMac, LOGE, FL("Sending Action Frame has failed\n"));)
+ break;
+ }
+ }
+ PELOG1(limLog(pMac, LOG1, FL("The Setting up of LimGlobals is successful for MIMOPS"));)
+ }while(0);
+
+ palFreeMemory( pMac->hHdd, (void *) pMIMO_PSParams );
+#endif
+}
+/**
+ * @function : limHandleDelBssInReAssocContext
+ * @brief : While Processing the ReAssociation Response Frame in STA,
+ * a. immediately after receiving the Reassoc Response the RxCleanUp is
+ * being issued and the end of DelBSS the new BSS is being added.
+ *
+ * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
+ * change, We need to update CSR with ReAssocCNF Response with the
+ * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
+ * context only
+ *
+ * @param : pMac - tpAniSirGlobal
+ * pStaDs - Station Descriptor
+ *
+ * @return : none
+ */
+static void
+limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
+{
+ tLimMlmReassocCnf mlmReassocCnf;
+ /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
+ /** Set the MlmState to IDLE*/
+ psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+ /* Update PE session Id*/
+ mlmReassocCnf.sessionId = psessionEntry->peSessionId;
+ switch (psessionEntry->limMlmState) {
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ case eLIM_SME_WT_REASSOC_STATE :
+ {
+ tpSirAssocRsp assocRsp;
+ tpDphHashNode pStaDs;
+ tSirRetStatus retStatus = eSIR_SUCCESS;
+#ifdef ANI_PRODUCT_TYPE_CLIENT
+ tSchBeaconStruct beaconStruct;
+#endif
+ /** Delete the older STA Table entry */
+ limDeleteDphHashEntry(pMac, psessionEntry->bssId, DPH_STA_HASH_INDEX_PEER, psessionEntry);
+ /**
+ * Add an entry for AP to hash table
+ * maintained by DPH module
+ */
+ if ((pStaDs = dphAddHashEntry(pMac, psessionEntry->limReAssocbssId, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
+ {
+ // Could not add hash table entry
+ PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for \n"));)
+ limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
+ mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
+ goto Error;
+ }
+ /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
+ * is being stored to be used here for sending ADDBSS
+ */
+ assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
+ limUpdateAssocStaDatas(pMac, pStaDs, assocRsp,psessionEntry);
+ limUpdateReAssocGlobals(pMac, assocRsp,psessionEntry);
+#ifdef ANI_PRODUCT_TYPE_CLIENT
+ limExtractApCapabilities( pMac,
+ (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
+ limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
+ &beaconStruct );
+ if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
+ limDecideStaProtectionOnAssoc(pMac, &beaconStruct, psessionEntry);
+ if(beaconStruct.erpPresent) {
+ if (beaconStruct.erpIEInfo.barkerPreambleMode)
+ psessionEntry->beaconParams.fShortPreamble = 0;
+ else
+ psessionEntry->beaconParams.fShortPreamble = 1;
+ }
+ //updateBss flag is false, as in this case, PE is first deleting the existing BSS and then adding a new one.
+ if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, &beaconStruct,
+ &psessionEntry->pLimReAssocReq->bssDescription, false, psessionEntry)) {
+ limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed \n"));
+ retStatus = eSIR_FAILURE;
+ }
+#elif defined(ANI_AP_CLIENT_SDK)
+ if (eSIR_SUCCESS != limStaSendAddBss( pMac, (*assocRsp), &psessionEntry->pLimReAssocReq->neighborBssList.bssList[0],
+ false, psessionEntry)) {
+ limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed \n"));
+ retStatus = eSIR_FAILURE;
+ }
+#endif
+ if (retStatus != eSIR_SUCCESS)
+ {
+ mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+ palFreeMemory(pMac->hHdd, assocRsp);
+ pMac->lim.gLimAssocResponseData = NULL;
+ goto Error;
+ }
+ palFreeMemory(pMac->hHdd, assocRsp);
+ psessionEntry->limAssocResponseData = NULL;
+ }
+ break;
+ case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
+ {
+ /** Case wherein the DisAssoc / Deauth
+ * being sent as response to ReAssoc Req*/
+ /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
+ mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
+ mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
+ /** Set the SME State back to WT_Reassoc State*/
+ psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+ limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
+ if((psessionEntry->limSystemRole == eLIM_STA_ROLE)||
+ (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
+ {
+ psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+ }
+ limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
+ }
+ break;
+#endif
+ default:
+ PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State\n"));)
+ mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
+ mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
+ goto Error;
+ }
+return;
+Error:
+ limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
+}
+
+/* Added For BT -AMP Support */
+static void
+limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
+{
+ tLimMlmStartCnf mlmStartCnf;
+ tANI_U32 val;
+ tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
+
+ if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
+ {
+ limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS\n"));
+ if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
+ {
+ if (limSetLinkState(pMac, eSIR_LINK_BTAMP_AP_STATE, psessionEntry->bssId,
+ psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
+ goto end;
+ } else if (psessionEntry->bssType == eSIR_BTAMP_STA_MODE) {
+ if (limSetLinkState(pMac, eSIR_LINK_SCAN_STATE, psessionEntry->bssId,
+ psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
+ goto end;
+ }
+
+ // Set MLME state
+ psessionEntry->limMlmState= eLIM_MLM_BSS_STARTED_STATE;
+ psessionEntry->statypeForBss = STA_ENTRY_SELF; // to know session started for peer or for self
+ psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
+ schEdcaProfileUpdate(pMac, psessionEntry);
+ limInitAIDpool(pMac,psessionEntry);
+ // Create timers used by LIM
+ if (!pMac->lim.gLimTimersCreated)
+ limCreateTimers(pMac);
+ /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
+ if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
+ limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!\n"));
+ pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
+ // Apply previously set configuration at HW
+ limApplyConfiguration(pMac,psessionEntry);
+ psessionEntry->staId = pAddBssParams->staContext.staIdx;
+ mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
+ }
+ else
+ {
+ limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d\n" ),pAddBssParams->status );
+ mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
+ }
+ mlmStartCnf.sessionId = psessionEntry->peSessionId;
+ limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
+ end:
+ if( 0 != limMsgQ->bodyptr )
+ palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
+}
+
+/**
+ * @function : limHandleAddBssInReAssocContext
+ * @brief : While Processing the ReAssociation Response Frame in STA,
+ * a. immediately after receiving the Reassoc Response the RxCleanUp is
+ * being issued and the end of DelBSS the new BSS is being added.
+ *
+ * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
+ * change, We need to update CSR with ReAssocCNF Response with the
+ * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
+ * context only
+ *
+ * @param : pMac - tpAniSirGlobal
+ * pStaDs - Station Descriptor
+ *
+ * @return : none
+ */
+void
+limHandleAddBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
+{
+ tLimMlmReassocCnf mlmReassocCnf;
+ /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
+ /** Set the MlmState to IDLE*/
+ pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
+ switch (psessionEntry->limSmeState) {
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ case eLIM_SME_WT_REASSOC_STATE : {
+ tpSirAssocRsp assocRsp;
+ tpDphHashNode pStaDs;
+ tSirRetStatus retStatus = eSIR_SUCCESS;
+#ifdef ANI_PRODUCT_TYPE_CLIENT
+ tSchBeaconStruct beaconStruct;
+#endif
+ // Get the AP entry from DPH hash table
+ pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
+ if (pStaDs == NULL )
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Fail to get STA PEER entry from hash\n"));)
+ mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
+ goto Error;
+ }
+ /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
+ * is being stored to be used here for sending ADDBSS
+ */
+ assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
+ limUpdateAssocStaDatas(pMac, pStaDs, assocRsp, psessionEntry);
+ limUpdateReAssocGlobals(pMac, assocRsp, psessionEntry);
+#ifdef ANI_PRODUCT_TYPE_CLIENT
+ limExtractApCapabilities( pMac,
+ (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
+ limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
+ &beaconStruct );
+ if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
+ limDecideStaProtectionOnAssoc(pMac, &beaconStruct, psessionEntry);
+ if(beaconStruct.erpPresent) {
+ if (beaconStruct.erpIEInfo.barkerPreambleMode)
+ psessionEntry->beaconParams.fShortPreamble = 0;
+ else
+ psessionEntry->beaconParams.fShortPreamble = 1;
+ }
+
+ if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, &beaconStruct,
+ &psessionEntry->pLimReAssocReq->bssDescription, true, psessionEntry)) {
+ limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed \n"));
+ retStatus = eSIR_FAILURE;
+ }
+#elif defined(ANI_AP_CLIENT_SDK)
+ if (eSIR_SUCCESS != limStaSendAddBss( pMac, (*assocRsp), &pMac->lim.gpLimReassocReq->neighborBssList.bssList[0], true)) {
+ limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed \n"));
+ retStatus = eSIR_FAILURE;
+ }
+#endif
+ if (retStatus != eSIR_SUCCESS)
+ {
+ mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+ palFreeMemory(pMac->hHdd, assocRsp);
+ pMac->lim.gLimAssocResponseData = NULL;
+ goto Error;
+ }
+ palFreeMemory(pMac->hHdd, assocRsp);
+ psessionEntry->limAssocResponseData = NULL;
+ }
+ break;
+ case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: { /** Case wherein the DisAssoc / Deauth
+ * being sent as response to ReAssoc Req*/
+ /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
+ mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
+ mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
+ /** Set the SME State back to WT_Reassoc State*/
+ psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
+ limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry);
+ if(psessionEntry->limSystemRole == eLIM_STA_ROLE)
+ psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
+
+ limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
+ }
+ break;
+#endif
+ default:
+ PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State\n"));)
+ mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
+ mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
+ goto Error;
+ }
+return;
+Error:
+ limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
+}
+
+#if 0
+ static void
+limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
+{
+ tSirSmeAssocCnf assocCnf;
+ tpDphHashNode pStaDs;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId;
+
+ if(pMsgBuf == NULL)
+ {
+ limLog(pMac, LOGE, FL("pMsgBuf is NULL \n"));
+ goto end;
+ }
+ if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
+ !__limIsSmeAssocCnfValid(&assocCnf))
+ {
+ limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message \n"));
+ goto end;
+ }
+ if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
+ {
+ limLog(pMac, LOGE, FL("session does not exist for given bssId\n"));
+ goto end;
+ }
+ if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
+ ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
+ {
+ limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X\n"),
+ msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
+ goto end;
+ }
+ pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
+ if (pStaDs == NULL)
+ {
+ limLog(pMac, LOG1,
+ FL("Received invalid message %X due to no STA context, for aid %d, peer "),
+ msgType, assocCnf.aid);
+ limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
+ /*
+ ** send a DISASSOC_IND message to WSM to make sure
+ ** the state in WSM and LIM is the same
+ **/
+ limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
+ eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
+ goto end;
+ }
+ if ((pStaDs &&
+ (( !palEqualMemory( pMac->hHdd,(tANI_U8 *) pStaDs->staAddr,
+ (tANI_U8 *) assocCnf.peerMacAddr,
+ sizeof(tSirMacAddr)) ) ||
+ (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
+ ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
+ (msgType != eWNI_SME_ASSOC_CNF)) ||
+ ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
+ (msgType != eWNI_SME_REASSOC_CNF)))))
+ {
+ limLog(pMac, LOG1,
+ FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
+ msgType, assocCnf.aid);
+ limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
+ goto end;
+ }
+ /*
+ ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
+ ** has been received
+ **/
+ limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer\n"));
+ limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
+ if (assocCnf.statusCode == eSIR_SME_SUCCESS)
+ {
+ /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
+ * when it had received Assoc Request frame. Now, PE just needs to send
+ * Association Response frame to the requesting BTAMP-STA.
+ */
+ pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
+ limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) \n"), pStaDs->assocId);
+ limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
+ pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
+ goto end;
+ } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
+ else
+ {
+ // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
+ limRejectAssociation(pMac, pStaDs->staAddr,
+ pStaDs->mlmStaContext.subType,
+ true, pStaDs->mlmStaContext.authType,
+ pStaDs->assocId, true,
+ assocCnf.statusCode, psessionEntry);
+ return;
+ }
+end:
+ if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
+ {
+ if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
+ {
+ palFreeMemory(pMac->hHdd,((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
+ ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
+ }
+
+ palFreeMemory(pMac->hHdd, psessionEntry->parsedAssocReq[pStaDs->assocId]);
+ psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
+ }
+} /*** end __limProcessSmeAssocCnfNew() ***/
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE
+void
+limSendBeaconInd(tpAniSirGlobal pMac, tpPESession psessionEntry){
+ tBeaconGenParams *pBeaconGenParams = NULL;
+ tSirMsgQ limMsg;
+ /** Allocate the Memory for Beacon Pre Message and for Stations in PoweSave*/
+ if(psessionEntry == NULL ){
+ PELOGE( limLog( pMac, LOGE,
+ FL( "Error:Unable to get the PESessionEntry\n" ));)
+ return;
+ }
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pBeaconGenParams, (sizeof(*pBeaconGenParams))))
+ {
+ PELOGE( limLog( pMac, LOGP,
+ FL( "Unable to PAL allocate memory during sending beaconPreMessage\n" ));)
+ return;
+ }
+ palZeroMemory( pMac->hHdd, pBeaconGenParams, sizeof(*pBeaconGenParams));
+ palCopyMemory( pMac->hHdd, (void *) pBeaconGenParams->bssId,
+ (void *)psessionEntry->bssId,
+ SIR_MAC_ADDR_LENGTH );
+ limMsg.bodyptr = pBeaconGenParams;
+ schProcessPreBeaconInd(pMac, &limMsg);
+ return;
+}
+#endif
diff --git a/CORE/MAC/src/pe/lim/limProcessProbeReqFrame.c b/CORE/MAC/src/pe/lim/limProcessProbeReqFrame.c
new file mode 100644
index 0000000..ecb7719
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limProcessProbeReqFrame.c
@@ -0,0 +1,918 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limProcessProbeReqFrame.cc contains the code
+ * for processing Probe Request Frame.
+ * Author: Chandra Modumudi
+ * Date: 02/28/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+#include "wniCfgAp.h"
+#else
+#include "wniCfgSta.h"
+#endif
+#include "aniGlobal.h"
+#include "cfgApi.h"
+
+#include "utilsApi.h"
+#include "limTypes.h"
+#include "limUtils.h"
+#include "limAssocUtils.h"
+#include "limSerDesUtils.h"
+#include "parserApi.h"
+#include "limSession.h"
+
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+void limSendP2PProbeResponse(tpAniSirGlobal pMac, tANI_U8 *pBd,
+ tpPESession psessionEntry);
+#endif
+#ifdef WLAN_SOFTAP_FEATURE
+void
+
+limSendSmeProbeReqInd(tpAniSirGlobal pMac,
+ tSirMacAddr peerMacAddr,
+ tANI_U8 *pProbeReqIE,
+ tANI_U32 ProbeReqIELen,
+ tpPESession psessionEntry);
+
+/**
+ * limGetWPSPBCSessions
+ *
+ *FUNCTION:
+ * This function is called to query the WPS PBC overlap
+ *
+ *LOGIC:
+ * This function check WPS PBC probe request link list for PBC overlap
+ *
+ *ASSUMPTIONS:
+ *
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param addr A pointer to probe request source MAC addresss
+ * @param uuid_e A pointer to UUIDE element of WPS IE in WPS PBC probe request
+ * @param psessionEntry A pointer to station PE session
+ *
+ * @return None
+ */
+
+void limGetWPSPBCSessions(tpAniSirGlobal pMac, tANI_U8 *addr,
+ tANI_U8 *uuid_e, eWPSPBCOverlap *overlap,
+ tpPESession psessionEntry)
+{
+ int count = 0;
+ tSirWPSPBCSession *pbc;
+ tANI_TIMESTAMP curTime;
+
+ curTime = (tANI_TIMESTAMP)(palGetTickCount(pMac->hHdd) / PAL_TICKS_PER_SECOND);
+
+ palFillMemory( pMac->hHdd, (tANI_U8 *)addr, sizeof(tSirMacAddr), 0);
+ palFillMemory( pMac->hHdd, (tANI_U8 *)uuid_e, SIR_WPS_UUID_LEN, 0);
+
+ for (pbc = psessionEntry->pAPWPSPBCSession; pbc; pbc = pbc->next) {
+
+ if (curTime > pbc->timestamp + SIR_WPS_PBC_WALK_TIME)
+ break;
+
+ count++;
+ if(count > 1)
+ break;
+
+ palCopyMemory(pMac->hHdd, (tANI_U8 *)addr, (tANI_U8 *)pbc->addr, sizeof(tSirMacAddr));
+ palCopyMemory(pMac->hHdd, (tANI_U8 *)uuid_e, (tANI_U8 *)pbc->uuid_e, SIR_WPS_UUID_LEN);
+ }
+
+ if (count > 1)
+ {
+ *overlap = eSAP_WPSPBC_OVERLAP_IN120S; // Overlap
+ }
+ else if(count == 0)
+ {
+ *overlap = eSAP_WPSPBC_NO_WPSPBC_PROBE_REQ_IN120S; // no WPS probe request in 120 second
+ } else
+ {
+ *overlap = eSAP_WPSPBC_ONE_WPSPBC_PROBE_REQ_IN120S; // One WPS probe request in 120 second
+ }
+
+ PELOGE(limLog(pMac, LOGE, FL("overlap = %d\n"), *overlap);)
+ PELOGE(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOGE, addr, sizeof(tSirMacAddr));)
+ PELOGE(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOGE, uuid_e, SIR_WPS_UUID_LEN);)
+
+ return;
+}
+
+/**
+ * limRemoveTimeoutPBCsessions
+ *
+ *FUNCTION:
+ * This function is called to remove the WPS PBC probe request entires from specific entry to end.
+ *
+ *LOGIC:
+ *
+ *
+ *ASSUMPTIONS:
+ *
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pbc The beginning entry in WPS PBC probe request link list
+ *
+ * @return None
+ */
+static void limRemoveTimeoutPBCsessions(tpAniSirGlobal pMac, tSirWPSPBCSession *pbc)
+{
+ tSirWPSPBCSession *prev;
+
+ while (pbc) {
+ prev = pbc;
+ pbc = pbc->next;
+
+ PELOG4(limLog(pMac, LOG4, FL("WPS PBC sessions remove\n"));)
+ PELOG4(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG4, prev->addr, sizeof(tSirMacAddr));)
+ PELOG4(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG4, prev->uuid_e, SIR_WPS_UUID_LEN);)
+
+ palFreeMemory(pMac->hHdd, prev);
+ }
+}
+
+void limRemovePBCSessions(tpAniSirGlobal pMac, tSirMacAddr pRemoveMac,tpPESession psessionEntry)
+{
+ tSirWPSPBCSession *pbc, *prev = NULL;
+ prev = pbc = psessionEntry->pAPWPSPBCSession;
+
+ while (pbc) {
+ if (palEqualMemory(pMac->hHdd, (tANI_U8 *)pbc->addr,
+ (tANI_U8 *)pRemoveMac, sizeof(tSirMacAddr))) {
+ prev->next = pbc->next;
+ if (pbc == psessionEntry->pAPWPSPBCSession)
+ psessionEntry->pAPWPSPBCSession = pbc->next;
+ palFreeMemory(pMac->hHdd, pbc);
+ return;
+ }
+ prev = pbc;
+ pbc = pbc->next;
+ }
+
+}
+
+/**
+ * limUpdatePBCSessionEntry
+ *
+ *FUNCTION:
+ * This function is called when probe request with WPS PBC IE is received
+ *
+ *LOGIC:
+ * This function add the WPS PBC probe request in the WPS PBC probe request link list
+ * The link list is in decreased time order of probe request that is received.
+ * The entry that is more than 120 second is removed.
+ *
+ *ASSUMPTIONS:
+ *
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param addr A pointer to probe request source MAC addresss
+ * @param uuid_e A pointer to UUIDE element of WPS IE
+ * @param psessionEntry A pointer to station PE session
+ *
+ * @return None
+ */
+
+static void limUpdatePBCSessionEntry(tpAniSirGlobal pMac,
+ tANI_U8 *addr, tANI_U8 *uuid_e,
+ tpPESession psessionEntry)
+{
+ tSirWPSPBCSession *pbc, *prev = NULL;
+
+ tANI_TIMESTAMP curTime;
+
+ curTime = (tANI_TIMESTAMP)(palGetTickCount(pMac->hHdd) / PAL_TICKS_PER_SECOND);
+
+ PELOG4(limLog(pMac, LOG4, FL("Receive WPS probe reques curTime=%d\n"), curTime);)
+ PELOG4(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG4, addr, sizeof(tSirMacAddr));)
+ PELOG4(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG4, uuid_e, SIR_WPS_UUID_LEN);)
+
+ pbc = psessionEntry->pAPWPSPBCSession;
+
+ while (pbc) {
+ if (palEqualMemory(pMac->hHdd, (tANI_U8 *)pbc->addr, (tANI_U8 *)addr, sizeof(tSirMacAddr)) &&
+ palEqualMemory(pMac->hHdd, (tANI_U8 *)pbc->uuid_e, (tANI_U8 *)uuid_e, SIR_WPS_UUID_LEN)) {
+ if (prev)
+ prev->next = pbc->next;
+ else
+ psessionEntry->pAPWPSPBCSession = pbc->next;
+ break;
+ }
+ prev = pbc;
+ pbc = pbc->next;
+ }
+
+ if (!pbc) {
+ if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
+ (void **) &pbc, sizeof(tSirWPSPBCSession)))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
+ return;
+ }
+ palCopyMemory(pMac->hHdd, (tANI_U8 *)pbc->addr, (tANI_U8 *)addr, sizeof(tSirMacAddr));
+
+ if (uuid_e)
+ palCopyMemory(pMac->hHdd, (tANI_U8 *)pbc->uuid_e, (tANI_U8 *)uuid_e, SIR_WPS_UUID_LEN);
+ }
+
+ pbc->next = psessionEntry->pAPWPSPBCSession;
+ psessionEntry->pAPWPSPBCSession = pbc;
+ pbc->timestamp = curTime;
+
+ /* remove entries that have timed out */
+ prev = pbc;
+ pbc = pbc->next;
+
+ while (pbc) {
+ if (curTime > pbc->timestamp + SIR_WPS_PBC_WALK_TIME) {
+ prev->next = NULL;
+ limRemoveTimeoutPBCsessions(pMac, pbc);
+ break;
+ }
+ prev = pbc;
+ pbc = pbc->next;
+ }
+}
+#if 0
+/**
+ * limWPSPBCTimeout
+ *
+ *FUNCTION:
+ * This function is called when WPS PBC enrtries clean up timer is expired
+ *
+ *LOGIC:
+ * This function remove all the entryies that more than 120 second old
+ *
+ *ASSUMPTIONS:
+ *
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param psessionEntry A pointer to station PE session
+ *
+ * @return None
+ */
+
+void limWPSPBCTimeout(tpAniSirGlobal pMac, tpPESession psessionEntry)
+{
+ tANI_TIMESTAMP curTime;
+ tSirWPSPBCSession *pbc, *prev = NULL;
+
+ curTime = (tANI_TIMESTAMP)(palGetTickCount(pMac->hHdd) / PAL_TICKS_PER_SECOND);
+
+ PELOG3(limLog(pMac, LOG3, FL("WPS PBC cleanup timeout curTime=%d\n"), curTime);)
+
+ prev = psessionEntry->pAPWPSPBCSession;
+ if(prev)
+ pbc = prev->next;
+ else
+ return;
+
+ while (pbc) {
+ if (curTime > pbc->timestamp + SIR_WPS_PBC_WALK_TIME) {
+ prev->next = NULL;
+ limRemoveTimeoutPBCsessions(pMac, pbc);
+ break;
+ }
+ prev = pbc;
+ pbc = pbc->next;
+ }
+
+ if(prev)
+ {
+ if (curTime > prev->timestamp + SIR_WPS_PBC_WALK_TIME) {
+ psessionEntry->pAPWPSPBCSession = NULL;
+ limRemoveTimeoutPBCsessions(pMac, prev);
+ }
+ }
+
+}
+#endif
+/**
+ * limWPSPBCClose
+ *
+ *FUNCTION:
+ * This function is called when BSS is closed
+ *
+ *LOGIC:
+ * This function remove all the WPS PBC entries
+ *
+ *ASSUMPTIONS:
+ *
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param psessionEntry A pointer to station PE session
+ *
+ * @return None
+ */
+
+void limWPSPBCClose(tpAniSirGlobal pMac, tpPESession psessionEntry)
+{
+
+ limRemoveTimeoutPBCsessions(pMac, psessionEntry->pAPWPSPBCSession);
+
+}
+#endif
+
+/**
+ * limCheck11bRates
+ *
+ *FUNCTION:
+ * This function is called by limProcessProbeReqFrame() upon
+ * Probe Request frame reception.
+ *
+ *LOGIC:
+ * This function check 11b rates in supportedRates and extendedRates rates
+ *
+ *NOTE:
+ *
+ * @param rate
+ *
+ * @return BOOLEAN
+ */
+
+tANI_BOOLEAN limCheck11bRates(tANI_U8 rate)
+{
+ if ( ( 0x02 == (rate))
+ || ( 0x04 == (rate))
+ || ( 0x0b == (rate))
+ || ( 0x16 == (rate))
+ )
+ {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/**
+ * limProcessProbeReqFrame
+ *
+ *FUNCTION:
+ * This function is called by limProcessMessageQueue() upon
+ * Probe Request frame reception.
+ *
+ *LOGIC:
+ * This function processes received Probe Request frame and responds
+ * with Probe Response.
+ * Only AP or STA in IBSS mode that sent last Beacon will respond to
+ * Probe Request.
+ *
+ *ASSUMPTIONS:
+ * 1. AP or STA in IBSS mode that sent last Beacon will always respond
+ * to Probe Request received with broadcast SSID.
+ *
+ *NOTE:
+ * 1. Dunno what to do with Rates received in Probe Request frame
+ * 2. Frames with out-of-order fields/IEs are dropped.
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pRxPacketInfo A pointer to Buffer descriptor + associated PDUs
+ *
+ * @return None
+ */
+
+void
+limProcessProbeReqFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
+{
+ tANI_U8 *pBody;
+ tpSirMacMgmtHdr pHdr;
+ tANI_U32 frameLen;
+ tSirProbeReq probeReq;
+ tAniSSID ssId;
+ tSirMsgQ msgQ;
+ tSirSmeProbeReq *pSirSmeProbeReq;
+ tANI_U32 wpsApEnable=0, tmp;
+
+ do{
+ // Don't send probe responses if disabled
+ if (pMac->lim.gLimProbeRespDisableFlag)
+ break;
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+
+ if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
+ (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)||
+ (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)||
+ ( (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) &&
+ (WDA_GET_RX_BEACON_SENT(pRxPacketInfo)) ) )
+ {
+ frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
+
+ PELOG3(limLog(pMac, LOG3, FL("Received Probe Request %d bytes from "), frameLen);
+ limPrintMacAddr(pMac, pHdr->sa, LOG3);)
+
+ // Get pointer to Probe Request frame body
+ pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
+
+ // Parse Probe Request frame
+ if (sirConvertProbeReqFrame2Struct(pMac, pBody, frameLen, &probeReq)==eSIR_FAILURE)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Parse error ProbeRequest, length=%d, SA is:"), frameLen);)
+ limPrintMacAddr(pMac, pHdr->sa, LOGW);
+ pMac->sys.probeError++;
+ break;
+ }
+ else
+ {
+#ifdef WLAN_FEATURE_P2P
+ if (psessionEntry->pePersona == VOS_P2P_GO_MODE)
+ {
+ tANI_U8 i = 0, rate_11b = 0, other_rates = 0;
+ // Check 11b rates in supported rates
+ for ( i = 0 ; i < probeReq.supportedRates.numRates;
+ i++ )
+ {
+ if (limCheck11bRates(probeReq.supportedRates.rate[i] & 0x7f))
+ {
+ rate_11b++;
+ }
+ else
+ {
+ other_rates++;
+ }
+ }
+
+ // Check 11b rates in extended rates
+ for ( i = 0 ; i < probeReq.extendedRates.numRates; i++ )
+ {
+ if (limCheck11bRates(probeReq.extendedRates.rate[i] & 0x7f))
+ {
+ rate_11b++;
+ }
+ else
+ {
+ other_rates++;
+ }
+ }
+
+ if ( (rate_11b > 0) && (other_rates == 0) )
+ {
+ PELOG3(limLog(pMac, LOG3,
+ FL("Received a probe request frame with only 11b rates, SA is: "));
+ limPrintMacAddr(pMac, pHdr->sa, LOG3);)
+ return;
+ }
+ }
+#endif
+#ifdef WLAN_SOFTAP_FEATURE
+ if ((psessionEntry->limSystemRole == eLIM_AP_ROLE))
+ {
+
+ if ( (psessionEntry->APWPSIEs.SirWPSProbeRspIE.FieldPresent &
+ SIR_WPS_PROBRSP_VER_PRESENT) &&
+ (probeReq.wscIePresent == 1) &&
+ (probeReq.probeReqWscIeInfo.DevicePasswordID.id ==
+ WSC_PASSWD_ID_PUSH_BUTTON) &&
+ (probeReq.probeReqWscIeInfo.UUID_E.present == 1))
+ {
+ if(psessionEntry->fwdWPSPBCProbeReq)
+ {
+ PELOG4(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG4,
+ pHdr->sa, sizeof(tSirMacAddr));)
+ PELOG4(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG4, pBody, frameLen);)
+ limSendSmeProbeReqInd(pMac, pHdr->sa, pBody, frameLen, psessionEntry);
+ }
+ else
+ {
+ limUpdatePBCSessionEntry(pMac,
+ pHdr->sa, probeReq.probeReqWscIeInfo.UUID_E.uuid, psessionEntry);
+ }
+ }
+ }
+ else
+ {
+#endif
+ if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_ENABLE, &tmp) != eSIR_SUCCESS)
+ limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_ENABLE );
+
+ wpsApEnable = tmp & WNI_CFG_WPS_ENABLE_AP;
+ if ((wpsApEnable) &&
+ (probeReq.wscIePresent == 1) &&
+ (probeReq.probeReqWscIeInfo.DevicePasswordID.id == WSC_PASSWD_ID_PUSH_BUTTON))
+ {
+ // send the probe req to WSM when it is from a PBC station
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **)&pSirSmeProbeReq, sizeof(tSirSmeProbeReq)))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for eWNI_SME_PROBE_REQ\n"));
+ return;
+ }
+ msgQ.type = eWNI_SME_PROBE_REQ;
+ msgQ.bodyval = 0;
+ msgQ.bodyptr = pSirSmeProbeReq;
+#if defined(ANI_PRODUCT_TYPE_AP) && defined(ANI_LITTLE_BYTE_ENDIAN)
+ sirStoreU16N((tANI_U8*)&pSirSmeProbeReq->messageType, eWNI_SME_PROBE_REQ);
+ sirStoreU16N((tANI_U8*)&pSirSmeProbeReq->length, sizeof(tSirSmeProbeReq));
+#else
+
+ pSirSmeProbeReq->messageType = eWNI_SME_PROBE_REQ;
+ pSirSmeProbeReq->length = sizeof(tSirSmeProbeReq);
+#endif
+ pSirSmeProbeReq->sessionId = psessionEntry->smeSessionId;
+ palCopyMemory( pMac->hHdd, pSirSmeProbeReq->peerMacAddr, pHdr->sa, sizeof(tSirMacAddr));
+ pSirSmeProbeReq->devicePasswdId = probeReq.probeReqWscIeInfo.DevicePasswordID.id;
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ if (limSysProcessMmhMsgApi(pMac, &msgQ, ePROT) != eSIR_SUCCESS){
+ PELOG3(limLog(pMac, LOG3, FL("couldnt send the probe req to wsm "));)
+ }
+ }
+#ifdef WLAN_SOFTAP_FEATURE
+ }
+#endif
+ }
+
+ ssId.length = psessionEntry->ssId.length;
+ /* Copy the SSID from sessio entry to local variable */
+ palCopyMemory( pMac->hHdd, ssId.ssId,
+ psessionEntry->ssId.ssId,
+ psessionEntry->ssId.length);
+
+ // Compare received SSID with current SSID. If they
+ // match, reply with Probe Response.
+ if (probeReq.ssId.length)
+ {
+ if (!ssId.length)
+ goto multipleSSIDcheck;
+
+ if (palEqualMemory( pMac->hHdd,(tANI_U8 *) &ssId,
+ (tANI_U8 *) &(probeReq.ssId), (tANI_U8) (ssId.length + 1)) )
+ {
+ limSendProbeRspMgmtFrame(pMac, pHdr->sa, &ssId, DPH_USE_MGMT_STAID,
+ DPH_NON_KEEPALIVE_FRAME, psessionEntry,
+ probeReq.p2pIePresent);
+ break;
+ }
+#ifdef WLAN_FEATURE_P2P
+ else if (psessionEntry->pePersona == VOS_P2P_GO_MODE)
+ {
+ tANI_U8 direct_ssid[7] = "DIRECT-";
+ tANI_U8 direct_ssid_len = 7;
+ if (palEqualMemory( pMac->hHdd, (tANI_U8 *) &direct_ssid,
+ (tANI_U8 *) &(probeReq.ssId.ssId), (tANI_U8) (direct_ssid_len)) )
+ {
+ limSendProbeRspMgmtFrame(pMac, pHdr->sa, &ssId, DPH_USE_MGMT_STAID,
+ DPH_NON_KEEPALIVE_FRAME, psessionEntry,
+ probeReq.p2pIePresent);
+ break;
+ }
+ }
+#endif
+ else
+ {
+ PELOG3(limLog(pMac, LOG3,
+ FL("Ignoring ProbeReq frame with unmatched SSID received from "));
+ limPrintMacAddr(pMac, pHdr->sa, LOG3);)
+ pMac->sys.probeBadSsid++;
+ }
+ }
+ else
+ {
+#if (WNI_POLARIS_FW_PRODUCT == AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ tANI_U32 cfg;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_SEND_SINGLE_SSID_ALWAYS, &cfg)
+ != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("could not retrieve SEND_SSID_IN_PR\n"));
+
+ if (!ssId.length &&
+ (psessionEntry->pLimStartBssReq->numSSID == 1) &&
+ cfg)
+ {
+ PELOG2(limLog(pMac, LOG2, FL("Sending ProbeRsp with suppressed SSID to"));
+ limPrintMacAddr(pMac, pHdr->sa, LOG2);)
+
+ limSendProbeRspMgmtFrame( pMac, pHdr->sa,
+ (tAniSSID *) psessionEntry->pLimStartBssReq->ssIdList,
+ DPH_USE_MGMT_STAID, DPH_NON_KEEPALIVE_FRAME, psessionEntry,
+ probeReq.p2pIePresent);
+ }
+ else
+#endif
+ {
+ // Broadcast SSID in the Probe Request.
+ // Reply with SSID we're configured with.
+#ifdef WLAN_SOFTAP_FEATURE
+ //Turn off the SSID length to 0 if hidden SSID feature is present
+ if(psessionEntry->ssidHidden)
+ /*We are returning from here as probe request contains the broadcast SSID.
+ So no need to send the probe resp*/
+ //ssId.length = 0;
+ return;
+#endif
+ limSendProbeRspMgmtFrame(pMac, pHdr->sa, &ssId, DPH_USE_MGMT_STAID,
+ DPH_NON_KEEPALIVE_FRAME, psessionEntry,
+ probeReq.p2pIePresent);
+ }
+ break;
+ }
+multipleSSIDcheck:
+#if (WNI_POLARIS_FW_PRODUCT == AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ if (!psessionEntry->pLimStartBssReq->ssId.length)
+ {
+ tANI_U8 i;
+
+ // Multiple SSIDs/Suppressed SSID is enabled.
+ for (i = 0; i < psessionEntry->pLimStartBssReq->numSSID; i++)
+ {
+ if (palEqualMemory( pMac->hHdd,
+ (tANI_U8 *) &psessionEntry->pLimStartBssReq->ssIdList[i],
+ (tANI_U8 *) &probeReq.ssId,
+ (tANI_U8) psessionEntry->pLimStartBssReq->ssIdList[i].length + 1))
+ {
+ limSendProbeRspMgmtFrame( pMac, pHdr->sa,
+ (tAniSSID *) &psessionEntry->pLimStartBssReq->ssIdList[i],
+ DPH_USE_MGMT_STAID, DPH_NON_KEEPALIVE_FRAME, psessionEntry,
+ probeReq.p2pIePresent);
+ break;
+ }
+ }
+
+ if (i == psessionEntry->pLimStartBssReq->numSSID)
+ {
+ // Local SSID does not match with received one
+ // Ignore received Probe Request frame
+ PELOG3(limLog(pMac, LOG3,
+ FL("Ignoring ProbeReq frame with unmatched SSID received from "));
+ limPrintMacAddr(pMac, pHdr->sa, LOG3);)
+ pMac->sys.probeBadSsid++;
+ }
+ }
+ else
+#endif
+ {
+ PELOG3(limLog(pMac, LOG3,
+ FL("Ignoring ProbeReq frame with unmatched SSID received from "));
+ limPrintMacAddr(pMac, pHdr->sa, LOG3);)
+ pMac->sys.probeBadSsid++;
+ }
+ }
+ else
+ {
+ // Ignore received Probe Request frame
+ PELOG3(limLog(pMac, LOG3, FL("Ignoring Probe Request frame received from "));
+ limPrintMacAddr(pMac, pHdr->sa, LOG3);)
+ pMac->sys.probeIgnore++;
+ break;
+ }
+ }while(0);
+
+ return;
+} /*** end limProcessProbeReqFrame() ***/
+
+/**
+ * limIndicateProbeReqToHDD
+ *
+ *FUNCTION:
+ * This function is called by limProcessProbeReqFrame_multiple_BSS() upon
+ * Probe Request frame reception.
+ *
+ *LOGIC:
+ * This function processes received Probe Request frame and Pass
+ * Probe Request Frame to HDD.
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pBd A pointer to Buffer descriptor + associated PDUs
+ * @param psessionEntry A pointer to PE session
+ *
+ * @return None
+ */
+
+#if defined WLAN_FEATURE_P2P
+static void
+limIndicateProbeReqToHDD(tpAniSirGlobal pMac, tANI_U8 *pBd,
+ tpPESession psessionEntry)
+{
+ tpSirMacMgmtHdr pHdr;
+ tANI_U32 frameLen;
+
+ limLog( pMac, LOG1, "Received a probe request frame");
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pBd);
+ frameLen = WDA_GET_RX_PAYLOAD_LEN(pBd);
+
+ //send the probe req to SME.
+ limSendSmeMgmtFrameInd( pMac, pHdr->fc.subType,
+ (tANI_U8*)pHdr, (frameLen + sizeof(tSirMacMgmtHdr)),
+ psessionEntry->smeSessionId, WDA_GET_RX_CH(pBd) );
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+ limSendP2PProbeResponse(pMac, pBd, psessionEntry);
+#endif
+} /*** end limIndicateProbeReqToHDD() ***/
+#endif
+
+/**
+ * limProcessProbeReqFrame_multiple_BSS
+ *
+ *FUNCTION:
+ * This function is called by limProcessMessageQueue() upon
+ * Probe Request frame reception.
+ *
+ *LOGIC:
+ * This function call limIndicateProbeReqToHDD function to indicate
+ * Probe Request frame to HDD. It also call limProcessProbeReqFrame
+ * function which process received Probe Request frame and responds
+ * with Probe Response.
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pBd A pointer to Buffer descriptor + associated PDUs
+ * @param psessionEntry A pointer to PE session
+ *
+ * @return None
+ */
+
+void
+limProcessProbeReqFrame_multiple_BSS(tpAniSirGlobal pMac, tANI_U8 *pBd, tpPESession psessionEntry)
+{
+ tANI_U8 i;
+
+ if (psessionEntry != NULL)
+ {
+#ifdef WLAN_FEATURE_P2P
+ if ((eLIM_AP_ROLE == psessionEntry->limSystemRole)
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+ || (psessionEntry->limSystemRole == eLIM_P2P_DEVICE_ROLE)
+#endif
+ )
+ {
+ limIndicateProbeReqToHDD(pMac, pBd, psessionEntry);
+ }
+#endif
+ limProcessProbeReqFrame(pMac,pBd,psessionEntry);
+ return;
+ }
+
+ for(i =0; i < pMac->lim.maxBssId;i++)
+ {
+ psessionEntry = peFindSessionBySessionId(pMac,i);
+ if ( (psessionEntry != NULL) )
+ {
+#ifdef WLAN_FEATURE_P2P
+ if ((eLIM_AP_ROLE == psessionEntry->limSystemRole)
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+ || (psessionEntry->limSystemRole == eLIM_P2P_DEVICE_ROLE)
+#endif
+ )
+ {
+ limIndicateProbeReqToHDD(pMac, pBd, psessionEntry);
+ }
+#endif
+ if ( (eLIM_AP_ROLE == psessionEntry->limSystemRole) ||
+ (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole) ||
+ (eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) ||
+ (eLIM_BT_AMP_STA_ROLE == psessionEntry->limSystemRole)
+ )
+ {
+ limProcessProbeReqFrame(pMac,pBd,psessionEntry);
+ }
+ }
+ }
+
+} /*** end limProcessProbeReqFrame_multiple_BSS() ***/
+
+#ifdef WLAN_SOFTAP_FEATURE
+/**
+ * limSendSmeProbeReqInd()
+ *
+ *FUNCTION:
+ * This function is to send
+ * eWNI_SME_WPS_PBC_PROBE_REQ_IND message to host
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * This function is used for sending eWNI_SME_WPS_PBC_PROBE_REQ_IND
+ * to host.
+ *
+ * @param peerMacAddr Indicates the peer MAC addr that the probe request
+ * is generated.
+ * @param pProbeReqIE pointer to RAW probe request IE
+ * @param ProbeReqIELen The length of probe request IE.
+ * @param psessionEntry A pointer to PE session
+ *
+ * @return None
+ */
+void
+limSendSmeProbeReqInd(tpAniSirGlobal pMac,
+ tSirMacAddr peerMacAddr,
+ tANI_U8 *pProbeReqIE,
+ tANI_U32 ProbeReqIELen,
+ tpPESession psessionEntry)
+{
+ tSirSmeProbeReqInd *pSirSmeProbeReqInd;
+ tSirMsgQ msgQ;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeProbeReqInd, sizeof(tSirSmeProbeReqInd)))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for eWNI_SME_PROBE_REQ\n"));
+ return;
+ }
+
+ msgQ.type = eWNI_SME_WPS_PBC_PROBE_REQ_IND;
+ msgQ.bodyval = 0;
+ msgQ.bodyptr = pSirSmeProbeReqInd;
+
+ pSirSmeProbeReqInd->messageType = eWNI_SME_WPS_PBC_PROBE_REQ_IND;
+ pSirSmeProbeReqInd->length = sizeof(tSirSmeProbeReq);
+ pSirSmeProbeReqInd->sessionId = psessionEntry->smeSessionId;
+
+ palCopyMemory( pMac->hHdd, pSirSmeProbeReqInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
+ palCopyMemory( pMac->hHdd, pSirSmeProbeReqInd->WPSPBCProbeReq.peerMacAddr, peerMacAddr, sizeof(tSirMacAddr));
+
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ pSirSmeProbeReqInd->WPSPBCProbeReq.probeReqIELen = (tANI_U16)ProbeReqIELen;
+ palCopyMemory( pMac->hHdd, pSirSmeProbeReqInd->WPSPBCProbeReq.probeReqIE, pProbeReqIE, ProbeReqIELen);
+
+ if (limSysProcessMmhMsgApi(pMac, &msgQ, ePROT) != eSIR_SUCCESS){
+ PELOGE(limLog(pMac, LOGE, FL("couldnt send the probe req to hdd"));)
+ }
+
+} /*** end limSendSmeProbeReqInd() ***/
+#endif
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+void limSendP2PProbeResponse(tpAniSirGlobal pMac, tANI_U8 *pBd,
+ tpPESession psessionEntry)
+{
+ tAniSSID ssId = { P2P_WILDCARD_SSID_LEN, P2P_WILDCARD_SSID };
+ tANI_U8 *pBody;
+ tpSirMacMgmtHdr pHdr;
+ tANI_U32 frameLen;
+ tSirProbeReq probeReq;
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pBd);
+ // Get pointer to Probe Request frame body
+ pBody = WDA_GET_RX_MPDU_DATA(pBd);
+
+ if( (pBody[0] == 0) && (pBody[1] == ssId.length) &&
+ (palEqualMemory( pMac->hHdd, ssId.ssId, pBody + 2,
+ ssId.length)))
+ {
+ // Parse Probe Request frame
+ frameLen = WDA_GET_RX_PAYLOAD_LEN(pBd);
+ if (eSIR_FAILURE == sirConvertProbeReqFrame2Struct(pMac, pBody, frameLen, &probeReq))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Parse error ProbeRequest, length=%d, SA is:"), frameLen);)
+ limPrintMacAddr(pMac, pHdr->sa, LOGW);
+ pMac->sys.probeError++;
+ return;
+ }
+
+ if (psessionEntry->pePersona == VOS_P2P_GO_MODE)
+ {
+ ssId.length = psessionEntry->ssId.length;
+ palCopyMemory(pMac->hHdd, ssId.ssId, psessionEntry->ssId.ssId,psessionEntry->ssId.length);
+ limSendProbeRspMgmtFrame(pMac, pHdr->sa, &ssId, DPH_USE_MGMT_STAID, DPH_NON_KEEPALIVE_FRAME,
+ psessionEntry, probeReq.p2pIePresent );
+ }
+ else
+ {
+ limSendProbeRspMgmtFrame(pMac, pHdr->sa, &ssId, DPH_USE_MGMT_STAID, DPH_NON_KEEPALIVE_FRAME,
+ psessionEntry, probeReq.p2pIePresent );
+ }
+ }
+}
+#endif //#ifdef WLAN_FEATURE_P2P_INTERNAL
diff --git a/CORE/MAC/src/pe/lim/limProcessProbeRspFrame.c b/CORE/MAC/src/pe/lim/limProcessProbeRspFrame.c
new file mode 100644
index 0000000..f7949ea
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limProcessProbeRspFrame.c
@@ -0,0 +1,375 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limProcessProbeRspFrame.cc contains the code
+ * for processing Probe Response Frame.
+ * Author: Chandra Modumudi
+ * Date: 03/01/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#include "wniApi.h"
+#ifdef ANI_PRODUCT_TYPE_AP
+#include "wniCfgAp.h"
+#else
+#include "wniCfgSta.h"
+#endif
+#include "aniGlobal.h"
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halCommonApi.h"
+#endif
+#include "schApi.h"
+#include "utilsApi.h"
+#include "limApi.h"
+#include "limTypes.h"
+#include "limUtils.h"
+#include "limAssocUtils.h"
+#include "limPropExtsUtils.h"
+#include "limSerDesUtils.h"
+#include "limSendMessages.h"
+
+#include "parserApi.h"
+
+/**
+ * limProcessProbeRspFrame
+ *
+ *FUNCTION:
+ * This function is called by limProcessMessageQueue() upon
+ * Probe Response frame reception.
+ *
+ *LOGIC:
+ * This function processes received Probe Response frame.
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ * 1. Frames with out-of-order IEs are dropped.
+ * 2. In case of IBSS, join 'success' makes MLM state machine
+ * transition into 'BSS started' state. This may have to change
+ * depending on supporting what kinda Authentication in IBSS.
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pRxPacketInfo A pointer to Buffer descriptor + associated PDUs
+ * @return None
+ */
+
+
+void
+limProcessProbeRspFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
+{
+ tANI_U8 *pBody;
+ tANI_U32 frameLen = 0;
+ tSirMacAddr currentBssId;
+ tpSirMacMgmtHdr pHdr;
+ tSirProbeRespBeacon probeRsp;
+ tANI_U8 qosEnabled = false;
+ tANI_U8 wmeEnabled = false;
+
+ probeRsp.ssId.length = 0;
+ probeRsp.wpa.length = 0;
+ probeRsp.propIEinfo.apName.length = 0;
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ probeRsp.propIEinfo.aniIndicator = 0;
+ probeRsp.propIEinfo.wdsLength = 0;
+#endif
+
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+
+
+ PELOG2(limLog(pMac, LOG2,
+ FL("Received Probe Response frame with length=%d from "),
+ WDA_GET_RX_MPDU_LEN(pRxPacketInfo));
+ limPrintMacAddr(pMac, pHdr->sa, LOG2);)
+
+ if (limDeactivateMinChannelTimerDuringScan(pMac) != eSIR_SUCCESS)
+ return;
+
+
+ /**
+ * Expect Probe Response only when
+ * 1. STA is in scan mode waiting for Beacon/Probe response or
+ * 2. STA is waiting for Beacon/Probe Response to announce
+ * join success or
+ * 3. STA is in IBSS mode in BSS started state or
+ * 4. STA/AP is in learn mode
+ * 5. STA in link established state. In this state, the probe response is
+ * expected for two scenarios:
+ * -- As part of heart beat mechanism, probe req is sent out
+ * -- If QoS Info IE in beacon has a different count for EDCA Params,
+ * and EDCA IE is not present in beacon,
+ * then probe req is sent out to get the EDCA params.
+ *
+ * Ignore Probe Response frame in all other states
+ */
+ // TO SUPPORT BT-AMP
+ if (((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) || //mlm state check should be global - 18th oct
+ (pMac->lim.gLimMlmState == eLIM_MLM_PASSIVE_SCAN_STATE) || //mlm state check should be global - 18th oct
+ (pMac->lim.gLimMlmState == eLIM_MLM_LEARN_STATE) || //mlm state check should be global - 18th oct
+ (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE) ||
+ (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE) )||
+ ((GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_STA_IN_IBSS_ROLE) &&
+ (psessionEntry->limMlmState == eLIM_MLM_BSS_STARTED_STATE)))
+ {
+ frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
+
+ // Get pointer to Probe Response frame body
+ pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
+
+ if (sirConvertProbeFrame2Struct(pMac, pBody, frameLen, &probeRsp)
+ ==eSIR_FAILURE)
+ {
+ PELOG1(limLog(pMac, LOG1,
+ FL("PArse error ProbeResponse, length=%d\n"),
+ frameLen);)
+ return;
+ }
+ //To Support BT-AMP
+ if ((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) || //mlm state check should be global - 18th oct
+ (pMac->lim.gLimMlmState == eLIM_MLM_PASSIVE_SCAN_STATE))
+ limCheckAndAddBssDescription(pMac, &probeRsp, pRxPacketInfo,
+ ((pMac->lim.gLimHalScanState == eLIM_HAL_SCANNING_STATE) ? eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE), eANI_BOOLEAN_TRUE);
+ else if (pMac->lim.gLimMlmState == eLIM_MLM_LEARN_STATE) //mlm state check should be global - 18th oct
+ {
+#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ // STA/AP is in learn mode
+ /* Not sure whether the below 2 lines are needed for the station. TODO If yes, this should be
+ * uncommented. Also when we tested enabling this, there is a crash as soon as the station
+ * comes up which needs to be fixed*/
+ //if (pMac->lim.gLimSystemRole == eLIM_STA_ROLE)
+ // limCheckAndAddBssDescription(pMac, &probeRsp, pRxPacketInfo, eANI_BOOLEAN_TRUE);
+ limCollectMeasurementData(pMac, pRxPacketInfo, &probeRsp);
+ PELOG3(limLog(pMac, LOG3,
+ FL("Parsed WDS info in ProbeRsp frames: wdsLength=%d\n"),
+ probeRsp.propIEinfo.wdsLength);)
+#endif
+ }
+ else if (psessionEntry->limMlmState ==
+ eLIM_MLM_WT_JOIN_BEACON_STATE)
+ {
+ if( psessionEntry->beacon != NULL ) //Either Beacon/probe response is required. Hence store it in same buffer.
+ {
+ palFreeMemory(pMac->hHdd, psessionEntry->beacon);
+ psessionEntry->beacon = NULL;
+ }
+ psessionEntry->bcnLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
+ if( (palAllocateMemory(pMac->hHdd, (void**)&psessionEntry->beacon, psessionEntry->bcnLen)) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store beacon"));)
+ }
+ else
+ {
+ //Store the Beacon/ProbeRsp. This is sent to csr/hdd in join cnf response.
+ palCopyMemory(pMac->hHdd, psessionEntry->beacon, WDA_GET_RX_MPDU_DATA(pRxPacketInfo), psessionEntry->bcnLen);
+ }
+
+
+ // STA in WT_JOIN_BEACON_STATE
+ limCheckAndAnnounceJoinSuccess(pMac, &probeRsp, pHdr,psessionEntry);
+ }
+ else if(psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
+ {
+ tpDphHashNode pStaDs = NULL;
+ /**
+ * Check if this Probe Response is for
+ * our Probe Request sent upon reaching
+ * heart beat threshold
+ */
+ #if 0
+ if (wlan_cfgGetStr(pMac,
+ WNI_CFG_BSSID,
+ currentBssId,
+ &cfg) != eSIR_SUCCESS)
+ {
+ /// Could not get BSSID from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
+ }
+ #endif //TO SUPPORT BT-AMP
+ sirCopyMacAddr(currentBssId,psessionEntry->bssId);
+
+ if ( !palEqualMemory( pMac->hHdd,currentBssId, pHdr->bssId, sizeof(tSirMacAddr)) )
+ return;
+
+ if (!LIM_IS_CONNECTION_ACTIVE(psessionEntry))
+ {
+ limLog(pMac, LOGW,
+ FL("Received Probe Resp from AP. So it is alive!!\n"));
+
+ if (probeRsp.HTInfo.present)
+ limReceivedHBHandler(pMac, (tANI_U8)probeRsp.HTInfo.primaryChannel, psessionEntry);
+ else
+ limReceivedHBHandler(pMac, (tANI_U8)probeRsp.channelNumber, psessionEntry);
+ }
+
+#if defined ANI_PRODUCT_TYPE_CLIENT || defined (ANI_AP_CLIENT_SDK)
+
+ if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
+ {
+ if (probeRsp.quietIEPresent)
+ {
+ limUpdateQuietIEFromBeacon(pMac, &(probeRsp.quietIE), psessionEntry);
+ }
+ else if ((pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN) ||
+ (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING))
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Received a probe rsp without Quiet IE\n"));)
+ limCancelDot11hQuiet(pMac, psessionEntry);
+ }
+
+ if (probeRsp.channelSwitchPresent ||
+ probeRsp.propIEinfo.propChannelSwitchPresent)
+ {
+ limUpdateChannelSwitch(pMac, &probeRsp, psessionEntry);
+ }
+ else if (pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
+ {
+ limCancelDot11hChannelSwitch(pMac, psessionEntry);
+ }
+ }
+
+#endif
+
+ /**
+ * Now Process EDCA Parameters, if EDCAParamSet count is different.
+ * -- While processing beacons in link established state if it is determined that
+ * QoS Info IE has a different count for EDCA Params,
+ * and EDCA IE is not present in beacon,
+ * then probe req is sent out to get the EDCA params.
+ */
+
+ pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
+
+ limGetQosMode(psessionEntry, &qosEnabled);
+ limGetWmeMode(psessionEntry, &wmeEnabled);
+ PELOG2(limLog(pMac, LOG2,
+ FL("wmeEdcaPresent: %d wmeEnabled: %d, edcaPresent: %d, qosEnabled: %d, edcaParams.qosInfo.count: %d schObject.gLimEdcaParamSetCount: %d\n"),
+ probeRsp.wmeEdcaPresent, wmeEnabled, probeRsp.edcaPresent, qosEnabled,
+ probeRsp.edcaParams.qosInfo.count, psessionEntry->gLimEdcaParamSetCount);)
+ if (((probeRsp.wmeEdcaPresent && wmeEnabled) ||
+ (probeRsp.edcaPresent && qosEnabled)) &&
+ (probeRsp.edcaParams.qosInfo.count != psessionEntry->gLimEdcaParamSetCount))
+ {
+ if (schBeaconEdcaProcess(pMac, &probeRsp.edcaParams, psessionEntry) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("EDCA parameter processing error\n"));)
+ else if (pStaDs != NULL)
+ {
+ // If needed, downgrade the EDCA parameters
+ limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
+
+ if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
+ limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
+ else
+ limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
+ }
+ else
+ PELOGE(limLog(pMac, LOGE, FL("Self Entry missing in Hash Table\n"));)
+
+ }
+ }
+ else if ((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) &&
+ (psessionEntry->limMlmState == eLIM_MLM_BSS_STARTED_STATE))
+ limHandleIBSScoalescing(pMac, &probeRsp, pRxPacketInfo,psessionEntry);
+ } // if ((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) || ...
+
+ // Ignore Probe Response frame in all other states
+ return;
+} /*** end limProcessProbeRspFrame() ***/
+
+
+void
+limProcessProbeRspFrameNoSession(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo)
+{
+ tANI_U8 *pBody;
+ tANI_U32 frameLen = 0;
+ tpSirMacMgmtHdr pHdr;
+ tSirProbeRespBeacon probeRsp;
+
+ probeRsp.ssId.length = 0;
+ probeRsp.wpa.length = 0;
+ probeRsp.propIEinfo.apName.length = 0;
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ probeRsp.propIEinfo.aniIndicator = 0;
+ probeRsp.propIEinfo.wdsLength = 0;
+#endif
+
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+
+
+ limLog(pMac, LOG2,
+ FL("Received Probe Response frame with length=%d from "),
+ WDA_GET_RX_MPDU_LEN(pRxPacketInfo));
+ limPrintMacAddr(pMac, pHdr->sa, LOG2);
+
+ if (limDeactivateMinChannelTimerDuringScan(pMac) != eSIR_SUCCESS)
+ return;
+
+ /* Since there is no psessionEntry, PE cannot be in the following states:
+ * - eLIM_MLM_WT_JOIN_BEACON_STATE
+ * - eLIM_MLM_LINK_ESTABLISHED_STATE
+ * - eLIM_MLM_BSS_STARTED_STATE
+ * Hence, expect Probe Response only when
+ * 1. STA is in scan mode waiting for Beacon/Probe response
+ *
+ * Ignore Probe Response frame in all other states
+ */
+ if( (pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) ||
+ (pMac->lim.gLimMlmState == eLIM_MLM_PASSIVE_SCAN_STATE) || //mlm state check should be global - 18th oct
+ (pMac->lim.gLimMlmState == eLIM_MLM_LEARN_STATE) )
+ {
+ frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
+
+ // Get pointer to Probe Response frame body
+ pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
+
+ if (sirConvertProbeFrame2Struct(pMac, pBody, frameLen, &probeRsp) == eSIR_FAILURE)
+ {
+ limLog(pMac, LOG1, FL("Parse error ProbeResponse, length=%d\n"), frameLen);
+ return;
+ }
+
+ if( (pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) ||
+ (pMac->lim.gLimMlmState == eLIM_MLM_PASSIVE_SCAN_STATE) )
+ limCheckAndAddBssDescription(pMac, &probeRsp, pRxPacketInfo, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
+ else if (pMac->lim.gLimMlmState == eLIM_MLM_LEARN_STATE)
+ {
+#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ // STA/AP is in learn mode
+ /* Not sure whether the below 2 lines are needed for the station. TODO If yes, this should be
+ * uncommented. Also when we tested enabling this, there is a crash as soon as the station
+ * comes up which needs to be fixed*/
+ //if (pMac->lim.gLimSystemRole == eLIM_STA_ROLE)
+ // limCheckAndAddBssDescription(pMac, &probeRsp, pRxPacketInfo, eANI_BOOLEAN_TRUE);
+ limCollectMeasurementData(pMac, pRxPacketInfo, &probeRsp);
+ limLog(pMac, LOG3,
+ FL("Parsed WDS info in ProbeRsp frames: wdsLength=%d\n"),
+ probeRsp.propIEinfo.wdsLength);
+#endif
+ }
+ }
+ return;
+} /*** end limProcessProbeRspFrameNew() ***/
diff --git a/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c b/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c
new file mode 100644
index 0000000..4523e68
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c
@@ -0,0 +1,5263 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limProcessSmeReqMessages.cc contains the code
+ * for processing SME request messages.
+ * Author: Chandra Modumudi
+ * Date: 02/11/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#include "palTypes.h"
+#include "wniApi.h"
+#ifdef ANI_PRODUCT_TYPE_AP
+#include "wniCfgAp.h"
+#else
+#include "wniCfgSta.h"
+#endif
+#include "cfgApi.h"
+#include "sirApi.h"
+#include "schApi.h"
+#include "utilsApi.h"
+#include "limTypes.h"
+#include "limUtils.h"
+#include "limAssocUtils.h"
+#include "limSecurityUtils.h"
+#include "limSerDesUtils.h"
+#include "limSmeReqUtils.h"
+#include "limIbssPeerMgmt.h"
+#include "limAdmitControl.h"
+#include "dphHashTable.h"
+#include "limSendMessages.h"
+#include "limApi.h"
+#include "wmmApsd.h"
+
+#ifdef WLAN_SOFTAP_FEATURE
+#include "sapApi.h"
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI
+#include "rrmApi.h"
+#endif
+#if defined FEATURE_WLAN_CCX
+#include "ccxApi.h"
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+#include <limFT.h>
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+/* These are the min/max tx power (non virtual rates) range
+ supported by prima hardware */
+#define MIN_TX_PWR_CAP 12
+#define MAX_TX_PWR_CAP 19
+
+#endif
+
+
+// SME REQ processing function templates
+static void __limProcessSmeStartReq(tpAniSirGlobal, tANI_U32 *);
+static tANI_BOOLEAN __limProcessSmeSysReadyInd(tpAniSirGlobal, tANI_U32 *);
+static tANI_BOOLEAN __limProcessSmeStartBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
+static void __limProcessSmeScanReq(tpAniSirGlobal, tANI_U32 *);
+static void __limProcessSmeJoinReq(tpAniSirGlobal, tANI_U32 *);
+static void __limProcessSmeReassocReq(tpAniSirGlobal, tANI_U32 *);
+static void __limProcessSmeDisassocReq(tpAniSirGlobal, tANI_U32 *);
+static void __limProcessSmeDisassocCnf(tpAniSirGlobal, tANI_U32 *);
+static void __limProcessSmeDeauthReq(tpAniSirGlobal, tANI_U32 *);
+static void __limProcessSmeSetContextReq(tpAniSirGlobal, tANI_U32 *);
+static tANI_BOOLEAN __limProcessSmeStopBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
+
+#if 0
+ static void __limProcessSmeAuthReq(tpAniSirGlobal, tANI_U32 *);
+ static void __limProcessSmePromiscuousReq(tpAniSirGlobal, tANI_U32 *);
+#endif
+
+#ifdef ANI_PRODUCT_TYPE_AP
+static void __limProcessSmeAssocCnf(tpAniSirGlobal, tANI_U32, tANI_U32 *);
+#endif
+void __limProcessSmeAssocCnfNew(tpAniSirGlobal, tANI_U32, tANI_U32 *);
+
+#ifdef VOSS_ENABLED
+extern void peRegisterTLHandle(tpAniSirGlobal pMac);
+#endif
+
+#ifdef WLAN_FEATURE_P2P
+extern int limProcessRemainOnChnlReq(tpAniSirGlobal pMac, tANI_U32 *pMsg);
+#endif
+
+#ifdef ANI_PRODUCT_TYPE_CLIENT
+#ifdef BACKGROUND_SCAN_ENABLED
+
+// start the background scan timers if it hasn't already started
+static void
+__limBackgroundScanInitiate(tpAniSirGlobal pMac)
+{
+ if (pMac->lim.gLimBackgroundScanStarted)
+ return;
+
+ //make sure timer is created first
+ if (TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
+ {
+ limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_BACKGROUND_SCAN_TIMER));
+ if (tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
+ limLog(pMac, LOGP, FL("could not activate background scan timer\n"));
+ pMac->lim.gLimBackgroundScanStarted = true;
+ pMac->lim.gLimBackgroundScanChannelId = 0;
+ }
+}
+
+#endif // BACKGROUND_SCAN_ENABLED
+#endif
+
+// determine if a fresh scan request must be issued or not
+/*
+* PE will do fresh scan, if all of the active sessions are in good state (Link Est or BSS Started)
+* If one of the sessions is not in one of the above states, then PE does not do fresh scan
+* If no session exists (scanning very first time), then PE will always do fresh scan if SME
+* asks it to do that.
+*/
+static tANI_U8
+__limFreshScanReqd(tpAniSirGlobal pMac, tANI_U8 returnFreshResults)
+{
+
+ tANI_U8 validState = TRUE;
+ int i;
+
+ if(pMac->lim.gLimSmeState != eLIM_SME_IDLE_STATE)
+ {
+ return FALSE;
+ }
+ for(i =0; i < pMac->lim.maxBssId; i++)
+ {
+
+ if(pMac->lim.gpSession[i].valid == TRUE)
+ {
+ if(!( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) ||
+ (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
+ (pMac->lim.gpSession[i].limSmeState == eLIM_SME_LINK_EST_STATE) )||
+
+ ( ( (pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)||
+ (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
+ (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE) )&&
+ (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
+#ifdef WLAN_FEATURE_P2P
+ || ( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRA_AP_MODE)
+ && ( pMac->lim.gpSession[i].pePersona == VOS_P2P_GO_MODE) )
+ || (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) )
+ && (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
+#endif
+ ))
+ {
+ validState = FALSE;
+ break;
+ }
+
+ }
+ }
+ PELOG1(limLog(pMac, LOG1, FL("FreshScanReqd: %d \n"), validState);)
+
+ if( (validState) && (returnFreshResults & SIR_BG_SCAN_RETURN_FRESH_RESULTS))
+ return TRUE;
+
+ return FALSE;
+}
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+static tANI_BOOLEAN __limProcessSmeSwitchChlReq(tpAniSirGlobal, tpSirMsgQ pMsg);
+#endif
+
+
+/**
+ * __limIsSmeAssocCnfValid()
+ *
+ *FUNCTION:
+ * This function is called by limProcessLmmMessages() upon
+ * receiving SME_ASSOC_CNF.
+ *
+ *LOGIC:
+ * Message validity checks are performed in this function
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMeasReq Pointer to Received ASSOC_CNF message
+ * @return true When received SME_ASSOC_CNF is formatted
+ * correctly
+ * false otherwise
+ */
+
+inline static tANI_U8
+__limIsSmeAssocCnfValid(tpSirSmeAssocCnf pAssocCnf)
+{
+ if (limIsGroupAddr(pAssocCnf->peerMacAddr))
+ return false;
+ else
+ return true;
+} /*** end __limIsSmeAssocCnfValid() ***/
+
+
+/**
+ * __limGetSmeJoinReqSizeForAlloc()
+ *
+ *FUNCTION:
+ * This function is called in various places to get IE length
+ * from tSirBssDescription structure
+ * number being scanned.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pBssDescr
+ * @return Total IE length
+ */
+
+static tANI_U16
+__limGetSmeJoinReqSizeForAlloc(tANI_U8 *pBuf)
+{
+ tANI_U16 len = 0;
+
+ if (!pBuf)
+ return len;
+
+ pBuf += sizeof(tANI_U16);
+ len = limGetU16( pBuf );
+ return (len + sizeof( tANI_U16 ));
+} /*** end __limGetSmeJoinReqSizeForAlloc() ***/
+
+
+/**----------------------------------------------------------------
+\fn __limIsDeferedMsgForLearn
+
+\brief Has role only if 11h is enabled. Not used on STA side.
+ Defers the message if SME is in learn state and brings
+ the LIM back to normal mode.
+
+\param pMac
+\param pMsg - Pointer to message posted from SME to LIM.
+\return TRUE - If defered
+ FALSE - Otherwise
+------------------------------------------------------------------*/
+static tANI_BOOLEAN
+__limIsDeferedMsgForLearn(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
+{
+ if (limIsSystemInScanState(pMac))
+ {
+ if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d\n"), pMsg->type);)
+ return eANI_BOOLEAN_FALSE;
+ }
+ PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d\n"),
+ pMsg->type);)
+
+ /** Send finish scan req to HAL only if LIM is not waiting for any response
+ * from HAL like init scan rsp, start scan rsp etc.
+ */
+ if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
+ {
+ //Set the resume channel to Any valid channel (invalid).
+ //This will instruct HAL to set it to any previous valid channel.
+ peSetResumeChannel(pMac, 0, 0);
+ limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
+ }
+
+ return eANI_BOOLEAN_TRUE;
+ }
+ return eANI_BOOLEAN_FALSE;
+}
+
+/**----------------------------------------------------------------
+\fn __limIsDeferedMsgForRadar
+
+\brief Has role only if 11h is enabled. Not used on STA side.
+ Defers the message if radar is detected.
+
+\param pMac
+\param pMsg - Pointer to message posted from SME to LIM.
+\return TRUE - If defered
+ FALSE - Otherwise
+------------------------------------------------------------------*/
+static tANI_BOOLEAN
+__limIsDeferedMsgForRadar(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
+{
+ /** fRadarDetCurOperChan will be set only if we detect radar in current
+ * operating channel and System Role == AP ROLE */
+ if (LIM_IS_RADAR_DETECTED(pMac))
+ {
+ if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d\n"), pMsg->type);)
+ return eANI_BOOLEAN_FALSE;
+ }
+ PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d\n"),
+ pMsg->type);)
+ return eANI_BOOLEAN_TRUE;
+ }
+ return eANI_BOOLEAN_FALSE;
+}
+
+
+/**
+ * __limProcessSmeStartReq()
+ *
+ *FUNCTION:
+ * This function is called to process SME_START_REQ message
+ * from HDD or upper layer application.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the SME message buffer
+ * @return None
+ */
+
+static void
+__limProcessSmeStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tSirResultCodes retCode = eSIR_SME_SUCCESS;
+ tANI_U8 smesessionId;
+ tANI_U16 smetransactionId;
+
+
+ PELOG1(limLog(pMac, LOG1, FL("Received START_REQ\n"));)
+
+ limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
+
+ if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
+ {
+ pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
+
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+
+ /// By default do not return after first scan match
+ pMac->lim.gLimReturnAfterFirstMatch = 0;
+
+ /// Initialize MLM state machine
+ limInitMlm(pMac);
+
+ /// By default return unique scan results
+ pMac->lim.gLimReturnUniqueResults = true;
+ pMac->lim.gLimSmeScanResultLength = 0;
+
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ if (((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
+ {
+ /*
+ * Need to indicate new BSSs found during background scanning to
+ * host. Update this parameter at CFG
+ */
+ if (cfgSetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, ((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
+ != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("could not set NEIGHBOR_BSS_IND at CFG\n"));
+ retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
+ }
+ }
+#endif
+ }
+ else
+ {
+ /**
+ * Should not have received eWNI_SME_START_REQ in states
+ * other than OFFLINE. Return response to host and
+ * log error
+ */
+ limLog(pMac, LOGE, FL("Invalid SME_START_REQ received in SME state %X\n"),pMac->lim.gLimSmeState );
+ limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
+ retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
+ }
+ limSendSmeRsp(pMac, eWNI_SME_START_RSP, retCode,smesessionId,smetransactionId);
+} /*** end __limProcessSmeStartReq() ***/
+
+
+/** -------------------------------------------------------------
+\fn __limProcessSmeSysReadyInd
+\brief handles the notification from HDD. PE just forwards this message to HAL.
+\param tpAniSirGlobal pMac
+\param tANI_U32* pMsgBuf
+\return TRUE-Posting to HAL failed, so PE will consume the buffer.
+\ FALSE-Posting to HAL successful, so HAL will consume the buffer.
+ -------------------------------------------------------------*/
+static tANI_BOOLEAN
+__limProcessSmeSysReadyInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tSirMsgQ msg;
+
+ msg.type = WDA_SYS_READY_IND;
+ msg.reserved = 0;
+ msg.bodyptr = pMsgBuf;
+ msg.bodyval = 0;
+
+#ifdef VOSS_ENABLED
+ if(pMac->gDriverType != eDRIVER_TYPE_MFG)
+ {
+ peRegisterTLHandle(pMac);
+ }
+#endif
+ PELOGW(limLog(pMac, LOGW, FL("sending WDA_SYS_READY_IND msg to HAL\n"));)
+ MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+
+ if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
+ {
+ limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed\n"));
+ return eANI_BOOLEAN_TRUE;
+ }
+ return eANI_BOOLEAN_FALSE;
+}
+
+
+/**
+ * __limHandleSmeStartBssRequest()
+ *
+ *FUNCTION:
+ * This function is called to process SME_START_BSS_REQ message
+ * from HDD or upper layer application.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the SME message buffer
+ * @return None
+ */
+
+static void
+__limHandleSmeStartBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tANI_U16 size;
+ tANI_U32 val = 0;
+ tSirRetStatus retStatus;
+ tSirMacChanNum channelNumber;
+ tLimMlmStartReq *pMlmStartReq;
+ tpSirSmeStartBssReq pSmeStartBssReq; //Local variable for Start BSS Req.. Added For BT-AMP Support
+ tSirResultCodes retCode = eSIR_SME_SUCCESS;
+ tANI_U32 autoGenBssId = FALSE; //Flag Used in case of IBSS to Auto generate BSSID.
+ tSirMacHTChannelWidth txWidthSet;
+ tANI_U8 sessionId;
+ tpPESession psessionEntry = NULL;
+ tANI_U8 smesessionId;
+ tANI_U16 smetransactionId;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ //Since the session is not created yet, sending NULL. The response should have the correct state.
+ limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_REQ_EVENT, NULL, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ PELOG1(limLog(pMac, LOG1, FL("Received START_BSS_REQ\n"));)
+
+ /* Global Sme state and mlm states are not defined yet , for BT-AMP Suppoprt . TO BE DONE */
+ if ( (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) ||
+ (pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE))
+ {
+ size = sizeof(tSirSmeStartBssReq) + SIR_MAC_MAX_IE_LENGTH;
+
+#ifdef ANI_PRODUCT_TYPE_AP
+ size + = ANI_WDS_INFO_MAX_LENGTH;
+#endif
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSmeStartBssReq, size))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory failed for pMac->lim.gpLimStartBssReq\n"));)
+ /// Send failure response to host
+ retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ goto end;
+ }
+
+ (void) palZeroMemory(pMac->hHdd, (void *)pSmeStartBssReq, size);
+
+ if ((limStartBssReqSerDes(pMac, pSmeStartBssReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
+ (!limIsSmeStartBssReqValid(pMac, pSmeStartBssReq)))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ\n"));)
+ retCode = eSIR_SME_INVALID_PARAMETERS;
+ goto free;
+ }
+#if 0
+ PELOG3(limLog(pMac, LOG3,
+ FL("Parsed START_BSS_REQ fields are bssType=%d, channelId=%d\n"),
+ pMac->lim.gpLimStartBssReq->bssType, pMac->lim.gpLimStartBssReq->channelId);)
+#endif
+
+ /* This is the place where PE is going to create a session.
+ * If session is not existed , then create a new session */
+ if((psessionEntry = peFindSessionByBssid(pMac,pSmeStartBssReq->bssId,&sessionId)) != NULL)
+ {
+ limLog(pMac, LOGW, FL("Session Already exists for given BSSID\n"));
+ retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
+ psessionEntry = NULL;
+ goto free;
+ }
+ else
+ {
+ if((psessionEntry = peCreateSession(pMac,pSmeStartBssReq->bssId,&sessionId, pMac->lim.maxStation)) == NULL)
+ {
+ limLog(pMac, LOGW, FL("Session Can not be created \n"));
+ retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ goto free;
+ }
+
+ }
+
+ /* Store the session related parameters in newly created session */
+ psessionEntry->pLimStartBssReq = pSmeStartBssReq;
+
+ /* Store PE sessionId in session Table */
+ psessionEntry->peSessionId = sessionId;
+
+ /* Store SME session Id in sessionTable */
+ psessionEntry->smeSessionId = pSmeStartBssReq->sessionId;
+
+ psessionEntry->transactionId = pSmeStartBssReq->transactionId;
+
+ sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeStartBssReq->selfMacAddr);
+
+ /* Copy SSID to session table */
+ palCopyMemory( pMac->hHdd, (tANI_U8 *)&psessionEntry->ssId,
+ (tANI_U8 *)&pSmeStartBssReq->ssId,
+ (pSmeStartBssReq->ssId.length + 1));
+
+
+
+ psessionEntry->bssType = pSmeStartBssReq->bssType;
+
+ psessionEntry->nwType = pSmeStartBssReq->nwType;
+
+ psessionEntry->beaconParams.beaconInterval = pSmeStartBssReq->beaconInterval;
+
+ /* Store the channel number in session Table */
+ psessionEntry->currentOperChannel = pSmeStartBssReq->channelId;
+
+ /*Store Persona */
+ psessionEntry->pePersona = pSmeStartBssReq->bssPersona;
+ VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,FL("PE PERSONA=%d\n"),
+ psessionEntry->pePersona);
+
+ /*Update the phymode*/
+ psessionEntry->gLimPhyMode = pSmeStartBssReq->nwType;
+
+ psessionEntry->maxTxPower = cfgGetRegulatoryMaxTransmitPower( pMac,
+ psessionEntry->currentOperChannel );
+ /* Store the dot 11 mode in to the session Table*/
+
+ psessionEntry->dot11mode = pSmeStartBssReq->dot11mode;
+ psessionEntry->htCapabality = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
+
+ palCopyMemory(pMac->hHdd, (void*)&psessionEntry->rateSet,
+ (void*)&pSmeStartBssReq->operationalRateSet,
+ sizeof(tSirMacRateSet));
+ palCopyMemory(pMac->hHdd, (void*)&psessionEntry->extRateSet,
+ (void*)&pSmeStartBssReq->extendedRateSet,
+ sizeof(tSirMacRateSet));
+
+ switch(pSmeStartBssReq->bssType)
+ {
+#ifdef WLAN_SOFTAP_FEATURE
+ case eSIR_INFRA_AP_MODE:
+ psessionEntry->limSystemRole = eLIM_AP_ROLE;
+ psessionEntry->privacy = pSmeStartBssReq->privacy;
+ psessionEntry->fwdWPSPBCProbeReq = pSmeStartBssReq->fwdWPSPBCProbeReq;
+ psessionEntry->authType = pSmeStartBssReq->authType;
+ /* Store the DTIM period */
+ psessionEntry->dtimPeriod = (tANI_U8)pSmeStartBssReq->dtimPeriod;
+ /*Enable/disable UAPSD*/
+ psessionEntry->apUapsdEnable = pSmeStartBssReq->apUapsdEnable;
+ if (psessionEntry->pePersona == VOS_P2P_GO_MODE)
+ {
+ psessionEntry->proxyProbeRspEn = 0;
+ }
+ else
+ {
+ /* To detect PBC overlap in SAP WPS mode, Host handles
+ * Probe Requests.
+ */
+ if(SAP_WPS_DISABLED == pSmeStartBssReq->wps_state)
+ {
+ psessionEntry->proxyProbeRspEn = 1;
+ }
+ else
+ {
+ psessionEntry->proxyProbeRspEn = 0;
+ }
+ }
+ psessionEntry->ssidHidden = pSmeStartBssReq->ssidHidden;
+ psessionEntry->wps_state = pSmeStartBssReq->wps_state;
+ break;
+#endif
+ case eSIR_IBSS_MODE:
+ psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
+ break;
+
+ case eSIR_BTAMP_AP_MODE:
+ psessionEntry->limSystemRole = eLIM_BT_AMP_AP_ROLE;
+ break;
+
+ case eSIR_BTAMP_STA_MODE:
+ psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
+ break;
+
+ /* There is one more mode called auto mode. which is used no where */
+
+ //FORBUILD -TEMPFIX.. HOW TO use AUTO MODE?????
+
+
+ default:
+ //not used anywhere...used in scan function
+ break;
+ }
+
+ // BT-AMP: Allocate memory for the array of parsed (Re)Assoc request structure
+ if ( (pSmeStartBssReq->bssType == eSIR_BTAMP_AP_MODE)
+#ifdef WLAN_SOFTAP_FEATURE
+ || (pSmeStartBssReq->bssType == eSIR_INFRA_AP_MODE)
+#endif
+ )
+ {
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&psessionEntry->parsedAssocReq,
+ (psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq)) ))
+ {
+ limLog(pMac, LOGW, FL("palAllocateMemory() failed\n"));
+ retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ goto free;
+ }
+ palZeroMemory(pMac->hHdd, psessionEntry->parsedAssocReq, (psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq)) );
+ }
+
+ /* Channel Bonding is not addressd yet for BT-AMP Support.. sunit will address channel bonding */
+ if (pSmeStartBssReq->channelId)
+ {
+ channelNumber = pSmeStartBssReq->channelId;
+ /*Update cbMode received from sme with LIM's updated cbMode*/
+ pSmeStartBssReq->cbMode = (tAniCBSecondaryMode)pMac->lim.gCbMode;
+
+ setupCBState( pMac, pSmeStartBssReq->cbMode );
+ pMac->lim.gHTSecondaryChannelOffset = limGetHTCBState(pSmeStartBssReq->cbMode);
+#ifdef WLAN_SOFTAP_FEATURE
+ txWidthSet = (tSirMacHTChannelWidth)limGetHTCapability(pMac, eHT_RECOMMENDED_TX_WIDTH_SET, psessionEntry);
+#else
+ txWidthSet = (tSirMacHTChannelWidth)limGetHTCapability(pMac, eHT_RECOMMENDED_TX_WIDTH_SET);
+#endif
+
+ /*
+ * If there is a mismatch in secondaryChannelOffset being passed in the START_BSS request and
+ * ChannelBonding CFG, then MAC will override the 'ChannelBonding' CFG with what is being passed
+ * in StartBss Request.
+ * HAL RA and PHY will go out of sync, if both these values are not consistent and will result in TXP Errors
+ * when HAL RA tries to use 40Mhz rates when CB is turned off in PHY.
+ */
+ if(((pMac->lim.gHTSecondaryChannelOffset == eHT_SECONDARY_CHANNEL_OFFSET_NONE) &&
+ (txWidthSet == eHT_CHANNEL_WIDTH_40MHZ)) ||
+ ((pMac->lim.gHTSecondaryChannelOffset != eHT_SECONDARY_CHANNEL_OFFSET_NONE) &&
+ (txWidthSet == eHT_CHANNEL_WIDTH_20MHZ)))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("secondaryChannelOffset and txWidthSet don't match, resetting txWidthSet CFG\n"));)
+ txWidthSet = (txWidthSet == eHT_CHANNEL_WIDTH_20MHZ) ? eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ;
+ if (cfgSetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, txWidthSet)
+ != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("could not set WNI_CFG_CHANNEL_BONDING_MODE at CFG\n"));
+ retCode = eSIR_LOGP_EXCEPTION;
+ goto free;
+ }
+ }
+ }
+
+ else
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ\n"));)
+ retCode = eSIR_SME_INVALID_PARAMETERS;
+ goto free;
+ }
+
+ // Delete pre-auth list if any
+ limDeletePreAuthList(pMac);
+
+ // Delete IBSS peer BSSdescription list if any
+ //limIbssDelete(pMac); sep 26 review
+
+
+
+#ifdef FIXME_GEN6 //following code may not be required. limInitMlm is now being invoked during peStart
+ /// Initialize MLM state machine
+#ifdef ANI_PRODUCT_TYPE_AP
+ /* The Role is not set yet. Currently assuming the AddBss in Linux will be called by AP only.
+ * This should be handled when IBSS functionality is implemented in the Linux
+ * TODO */
+ pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+#else
+ limInitMlm(pMac);
+#endif
+#endif
+
+ psessionEntry->htCapabality = IS_DOT11_MODE_HT(pSmeStartBssReq->dot11mode);
+
+#ifdef WLAN_SOFTAP_FEATURE
+ /* keep the RSN/WPA IE information in PE Session Entry
+ * later will be using this to check when received (Re)Assoc req
+ * */
+ limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac,&pSmeStartBssReq->rsnIE,psessionEntry);
+
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE
+ //Taken care for only softAP case rest need to be done
+ if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
+ psessionEntry->gLimProtectionControl = pSmeStartBssReq->protEnabled;
+ /*each byte will have the following info
+ *bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
+ *reserved reserved RIFS Lsig n-GF ht20 11g 11b*/
+ palCopyMemory( pMac->hHdd, (void *) &psessionEntry->cfgProtection,
+ (void *) &pSmeStartBssReq->ht_capab,
+ sizeof( tCfgProtection ));
+ psessionEntry->pAPWPSPBCSession = NULL; // Initialize WPS PBC session link list
+ }
+#endif
+
+ // Prepare and Issue LIM_MLM_START_REQ to MLM
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmStartReq, sizeof(tLimMlmStartReq)))
+ {
+ limLog(pMac, LOGP, FL("call to palAllocateMemory failed for mlmStartReq\n"));
+ retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ goto free;
+ }
+
+ (void)palZeroMemory(pMac->hHdd, (void *) pMlmStartReq, sizeof(tLimMlmStartReq));
+
+ /* Copy SSID to the MLM start structure */
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmStartReq->ssId,
+ (tANI_U8 *) &pSmeStartBssReq->ssId,
+ pSmeStartBssReq->ssId.length + 1);
+#ifdef WLAN_SOFTAP_FEATURE
+ pMlmStartReq->ssidHidden = pSmeStartBssReq->ssidHidden;
+ pMlmStartReq->obssProtEnabled = pSmeStartBssReq->obssProtEnabled;
+#endif
+
+
+ pMlmStartReq->bssType = psessionEntry->bssType;
+
+ /* Fill PE session Id from the session Table */
+ pMlmStartReq->sessionId = psessionEntry->peSessionId;
+
+ if( (pMlmStartReq->bssType == eSIR_BTAMP_STA_MODE) || (pMlmStartReq->bssType == eSIR_BTAMP_AP_MODE )
+#ifdef WLAN_SOFTAP_FEATURE
+ || (pMlmStartReq->bssType == eSIR_INFRA_AP_MODE)
+#endif
+ )
+ {
+ //len = sizeof(tSirMacAddr);
+ //retStatus = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, (tANI_U8 *) pMlmStartReq->bssId, &len);
+ //if (retStatus != eSIR_SUCCESS)
+ //limLog(pMac, LOGP, FL("could not retrive BSSID, retStatus=%d\n"), retStatus);
+
+ /* Copy the BSSId from sessionTable to mlmStartReq struct */
+ sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
+ }
+
+ else // ibss mode
+ {
+ pMac->lim.gLimIbssCoalescingHappened = false;
+
+ if((retStatus = wlan_cfgGetInt(pMac, WNI_CFG_IBSS_AUTO_BSSID, &autoGenBssId)) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Could not retrieve Auto Gen BSSID, retStatus=%d\n"), retStatus);
+ retCode = eSIR_LOGP_EXCEPTION;
+ goto free;
+ }
+
+ if(!autoGenBssId)
+ {
+ // We're not auto generating BSSID. Instead, get it from session entry
+ sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
+
+ if(pMlmStartReq->bssId[0] & 0x01)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Request to start IBSS with group BSSID\n Autogenerating the BSSID\n"));)
+ autoGenBssId = TRUE;
+ }
+ }
+
+ if( autoGenBssId )
+ { //if BSSID is not any uc id. then use locally generated BSSID.
+ //Autogenerate the BSSID
+ limGetRandomBssid( pMac, pMlmStartReq->bssId);
+ pMlmStartReq->bssId[0]= 0x02;
+
+ /* Copy randomly generated BSSID to the session Table */
+ sirCopyMacAddr(psessionEntry->bssId,pMlmStartReq->bssId);
+ }
+ }
+ /* store the channel num in mlmstart req structure */
+ pMlmStartReq->channelNumber = psessionEntry->currentOperChannel;
+ pMlmStartReq->cbMode = pSmeStartBssReq->cbMode;
+ pMlmStartReq->beaconPeriod = psessionEntry->beaconParams.beaconInterval;
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
+ pMlmStartReq->dtimPeriod = psessionEntry->dtimPeriod;
+ pMlmStartReq->wps_state = psessionEntry->wps_state;
+
+ }else
+#endif
+ {
+ if (wlan_cfgGetInt(pMac, WNI_CFG_DTIM_PERIOD, &val) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("could not retrieve DTIM Period\n"));
+ pMlmStartReq->dtimPeriod = (tANI_U8)val;
+ }
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_PERIOD, &val) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("could not retrieve Beacon interval\n"));
+ pMlmStartReq->cfParamSet.cfpPeriod = (tANI_U8)val;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_MAX_DURATION, &val) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("could not retrieve CFPMaxDuration\n"));
+ pMlmStartReq->cfParamSet.cfpMaxDuration = (tANI_U16) val;
+
+ //this may not be needed anymore now, as rateSet is now included in the session entry and MLM has session context.
+ palCopyMemory(pMac->hHdd, (void*)&pMlmStartReq->rateSet, (void*)&psessionEntry->rateSet,
+ sizeof(tSirMacRateSet));
+
+
+ // Now populate the 11n related parameters
+ pMlmStartReq->nwType = psessionEntry->nwType;
+ pMlmStartReq->htCapable = psessionEntry->htCapabality;
+ //
+ // FIXME_GEN4 - Determine the appropriate defaults...
+ //
+ pMlmStartReq->htOperMode = pMac->lim.gHTOperMode;
+ pMlmStartReq->dualCTSProtection = pMac->lim.gHTDualCTSProtection; // Unused
+ pMlmStartReq->txChannelWidthSet = pMac->lim.gHTRecommendedTxWidthSet;
+
+ //Update the global LIM parameter, which is used to populate HT Info IEs in beacons/probe responses.
+ pMac->lim.gHTSecondaryChannelOffset = limGetHTCBState(pMlmStartReq->cbMode);
+
+ /* sep26 review */
+ psessionEntry->limRFBand = limGetRFBand(channelNumber);
+
+ // Initialize 11h Enable Flag
+ psessionEntry->lim11hEnable = 0;
+ if((pMlmStartReq->bssType != eSIR_IBSS_MODE) &&
+ (SIR_BAND_5_GHZ == psessionEntry->limRFBand) )
+ {
+ if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED \n"));
+ psessionEntry->lim11hEnable = val;
+ }
+
+ if (!psessionEntry->lim11hEnable)
+ {
+ if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, 0) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED \n"));
+ }
+
+#ifdef ANI_PRODUCT_TYPE_AP
+ PELOGE(limLog(pMac, LOGE, FL("Dot 11h is %s\n"), pMac->lim.gLim11hEnable?"Enabled":"Disabled");)
+ if (pMac->lim.gLim11hEnable)
+ {
+ PELOG2(limLog(pMac, LOG2, FL("Cb state = %d, SecChanOffset = %d\n"),
+ pMac->lim.gCbState, pMac->lim.gHTSecondaryChannelOffset);)
+ limRadarInit(pMac);
+ }
+#endif
+ psessionEntry ->limPrevSmeState = psessionEntry->limSmeState;
+ psessionEntry ->limSmeState = eLIM_SME_WT_START_BSS_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+
+ limPostMlmMessage(pMac, LIM_MLM_START_REQ, (tANI_U32 *) pMlmStartReq);
+ return;
+ }
+ else
+ {
+
+ limLog(pMac, LOGE, FL("Received unexpected START_BSS_REQ, in state %X\n"),pMac->lim.gLimSmeState);
+ retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
+ goto end;
+ } // if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
+
+free:
+ palFreeMemory( pMac->hHdd, pSmeStartBssReq);
+ pSmeStartBssReq = NULL;
+
+end:
+
+ /* This routine should return the sme sessionId and SME transaction Id */
+ limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
+
+ if(NULL != psessionEntry)
+ {
+ peDeleteSession(pMac,psessionEntry);
+ psessionEntry = NULL;
+ }
+ limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP, retCode,psessionEntry,smesessionId,smetransactionId);
+} /*** end __limHandleSmeStartBssRequest() ***/
+
+
+/**--------------------------------------------------------------
+\fn __limProcessSmeStartBssReq
+
+\brief Wrapper for the function __limHandleSmeStartBssRequest
+ This message will be defered until softmac come out of
+ scan mode or if we have detected radar on the current
+ operating channel.
+\param pMac
+\param pMsg
+
+\return TRUE - If we consumed the buffer
+ FALSE - If have defered the message.
+ ---------------------------------------------------------------*/
+static tANI_BOOLEAN
+__limProcessSmeStartBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
+{
+ if (__limIsDeferedMsgForLearn(pMac, pMsg) ||
+ __limIsDeferedMsgForRadar(pMac, pMsg))
+ {
+ /**
+ * If message defered, buffer is not consumed yet.
+ * So return false
+ */
+ return eANI_BOOLEAN_FALSE;
+ }
+
+ __limHandleSmeStartBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
+ return eANI_BOOLEAN_TRUE;
+}
+
+
+/**
+ * limGetRandomBssid()
+ *
+ * FUNCTION:This function is called to process generate the random number for bssid
+ * This function is called to process SME_SCAN_REQ message
+ * from HDD or upper layer application.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ * 1. geneartes the unique random number for bssid in ibss
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *data Pointer to bssid buffer
+ * @return None
+ */
+void limGetRandomBssid(tpAniSirGlobal pMac, tANI_U8 *data)
+{
+ tANI_U32 random[2] ;
+ random[0] = tx_time_get();
+ random[0] |= (random[0] << 15) ;
+ random[1] = random[0] >> 1;
+ palCopyMemory(pMac->hHdd, data, (tANI_U8*)random, sizeof(tSirMacAddr));
+}
+
+
+/**
+ * __limProcessSmeScanReq()
+ *
+ *FUNCTION:
+ * This function is called to process SME_SCAN_REQ message
+ * from HDD or upper layer application.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ * 1. Periodic scanning should be requesting to return unique
+ * scan results.
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the SME message buffer
+ * @return None
+ */
+
+static void
+__limProcessSmeScanReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tANI_U32 len;
+ tLimMlmScanReq *pMlmScanReq;
+ tpSirSmeScanReq pScanReq;
+ tANI_U8 i = 0;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_REQ_EVENT, NULL, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ pScanReq = (tpSirSmeScanReq) pMsgBuf;
+ PELOG1(limLog(pMac, LOG1, FL("SME SCAN REQ numChan %d min %d max %d IELen %d first %d fresh %d unique %d type %d rsp %d\n"),
+ pScanReq->channelList.numChannels,
+ pScanReq->minChannelTime,
+ pScanReq->maxChannelTime,
+ pScanReq->uIEFieldLen,
+ pScanReq->returnAfterFirstMatch,
+ pScanReq->returnFreshResults,
+ pScanReq->returnUniqueResults,
+ pScanReq->scanType, pMac->lim.gLimRspReqd ? 1 : 0);)
+
+ /*copy the Self MAC address from SmeReq to the globalplace , used for sending probe req.discussed on code review sep18*/
+ sirCopyMacAddr(pMac->lim.gSelfMacAddr, pScanReq->selfMacAddr);
+
+ /* This routine should return the sme sessionId and SME transaction Id */
+
+ if (!limIsSmeScanReqValid(pMac, pScanReq))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Received SME_SCAN_REQ with invalid parameters\n"));)
+
+ if (pMac->lim.gLimRspReqd)
+ {
+ pMac->lim.gLimRspReqd = false;
+
+ limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
+
+ } // if (pMac->lim.gLimRspReqd)
+
+ return;
+ }
+
+ //if scan is disabled then return as invalid scan request.
+ //if scan in power save is disabled, and system is in power save mode, then ignore scan request.
+ if( (pMac->lim.fScanDisabled) || (!pMac->lim.gScanInPowersave && !limIsSystemInActiveState(pMac)) )
+ {
+ limSendSmeScanRsp(pMac, 8, eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
+ return;
+ }
+
+
+ /**
+ * If scan request is received in idle, joinFailed
+ * states or in link established state (in STA role)
+ * or in normal state (in STA-in-IBSS/AP role) with
+ * 'return fresh scan results' request from HDD or
+ * it is periodic background scanning request,
+ * trigger fresh scan request to MLM
+ */
+ if (__limFreshScanReqd(pMac, pScanReq->returnFreshResults))
+ {
+ #if 0
+ // Update global SME state
+ pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
+ if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) ||
+ (pMac->lim.gLimSmeState == eLIM_SME_JOIN_FAILURE_STATE))
+ pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
+ else if (pMac->lim.gLimSmeState == eLIM_SME_NORMAL_STATE)
+ pMac->lim.gLimSmeState = eLIM_SME_NORMAL_CHANNEL_SCAN_STATE;
+ else
+
+ #endif //TO SUPPORT BT-AMP
+
+ /*Change Global SME state */
+
+ /* Store the previous SME state */
+
+ pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
+
+ pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+
+ if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
+ {
+ // Discard previously cached scan results
+ limReInitScanResults(pMac);
+ }
+
+ pMac->lim.gLim24Band11dScanDone = 0;
+ pMac->lim.gLim50Band11dScanDone = 0;
+ pMac->lim.gLimReturnAfterFirstMatch =
+ pScanReq->returnAfterFirstMatch;
+
+ pMac->lim.gLimReturnUniqueResults =
+ ((pScanReq->returnUniqueResults) > 0 ? true : false);
+ /* De-activate Heartbeat timers for connected sessions while
+ * scan is in progress if the system is in Active mode */
+ if((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
+ (ePMM_STATE_READY == pMac->pmm.gPmmState))
+ {
+ for(i=0;i<pMac->lim.maxBssId;i++)
+ {
+ if((pMac->lim.gpSession[i].valid == TRUE) &&
+ (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
+ {
+ limHeartBeatDeactivateAndChangeTimer(pMac, peFindSessionBySessionId(pMac,i));
+ }
+ }
+ }
+
+ if (pScanReq->channelList.numChannels == 0)
+ {
+ tANI_U32 cfg_len;
+ // Scan all channels
+ len = sizeof(tLimMlmScanReq) +
+ (sizeof( pScanReq->channelList.channelNumber ) * (WNI_CFG_VALID_CHANNEL_LIST_LEN - 1)) +
+ pScanReq->uIEFieldLen;
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmScanReq, len) )
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for mlmScanReq (%d)\n"), len);
+
+ return;
+ }
+
+ // Initialize this buffer
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pMlmScanReq, len );
+
+ cfg_len = WNI_CFG_VALID_CHANNEL_LIST_LEN;
+ if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
+ pMlmScanReq->channelList.channelNumber,
+ &cfg_len) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get Valid channel list from CFG.
+ * Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve Valid channel list\n"));
+ }
+ pMlmScanReq->channelList.numChannels = (tANI_U8) cfg_len;
+ }
+ else
+ {
+ len = sizeof( tLimMlmScanReq ) - sizeof( pScanReq->channelList.channelNumber ) +
+ (sizeof( pScanReq->channelList.channelNumber ) * pScanReq->channelList.numChannels ) +
+ pScanReq->uIEFieldLen;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmScanReq, len) )
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for mlmScanReq(%d)\n"), len);
+
+ return;
+ }
+
+ // Initialize this buffer
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pMlmScanReq, len);
+ pMlmScanReq->channelList.numChannels =
+ pScanReq->channelList.numChannels;
+
+ palCopyMemory( pMac->hHdd, pMlmScanReq->channelList.channelNumber,
+ pScanReq->channelList.channelNumber,
+ pScanReq->channelList.numChannels);
+ }
+
+ pMlmScanReq->uIEFieldLen = pScanReq->uIEFieldLen;
+ pMlmScanReq->uIEFieldOffset = len - pScanReq->uIEFieldLen;
+
+ if(pScanReq->uIEFieldLen)
+ {
+ palCopyMemory( pMac->hHdd, (tANI_U8 *)pMlmScanReq+ pMlmScanReq->uIEFieldOffset,
+ (tANI_U8 *)pScanReq+(pScanReq->uIEFieldOffset),
+ pScanReq->uIEFieldLen);
+ }
+
+ pMlmScanReq->bssType = pScanReq->bssType;
+ palCopyMemory( pMac->hHdd, pMlmScanReq->bssId,
+ pScanReq->bssId,
+ sizeof(tSirMacAddr));
+ pMlmScanReq->numSsid = pScanReq->numSsid;
+
+ i = 0;
+ while (i < pMlmScanReq->numSsid)
+ {
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmScanReq->ssId[i],
+ (tANI_U8 *) &pScanReq->ssId[i],
+ pScanReq->ssId[i].length + 1);
+
+ i++;
+ }
+
+
+ pMlmScanReq->scanType = pScanReq->scanType;
+ pMlmScanReq->backgroundScanMode = pScanReq->backgroundScanMode;
+ pMlmScanReq->minChannelTime = pScanReq->minChannelTime;
+ pMlmScanReq->maxChannelTime = pScanReq->maxChannelTime;
+ pMlmScanReq->dot11mode = pScanReq->dot11mode;
+#ifdef WLAN_FEATURE_P2P
+ pMlmScanReq->p2pSearch = pScanReq->p2pSearch;
+#endif
+
+ //Store the smeSessionID and transaction ID for later use.
+ pMac->lim.gSmeSessionId = pScanReq->sessionId;
+ pMac->lim.gTransactionId = pScanReq->transactionId;
+
+ // Issue LIM_MLM_SCAN_REQ to MLM
+ limPostMlmMessage(pMac, LIM_MLM_SCAN_REQ, (tANI_U32 *) pMlmScanReq);
+
+ } // if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
+
+ else
+ {
+ /// In all other cases return 'cached' scan results
+ if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
+ {
+ tANI_U16 scanRspLen = sizeof(tSirSmeScanRsp);
+
+ pMac->lim.gLimRspReqd = false;
+
+ if (pMac->lim.gLimSmeScanResultLength == 0)
+ {
+ limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS, pScanReq->sessionId, pScanReq->transactionId);
+ }
+ else
+ {
+ scanRspLen = sizeof(tSirSmeScanRsp) +
+ pMac->lim.gLimSmeScanResultLength -
+ sizeof(tSirBssDescription);
+ limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS, pScanReq->sessionId, pScanReq->transactionId);
+ }
+
+ if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
+ {
+ // Discard previously cached scan results
+ limReInitScanResults(pMac);
+ }
+
+ } // if (pMac->lim.gLimRspReqd)
+ } // else ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
+
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+#ifdef BACKGROUND_SCAN_ENABLED
+ // start background scans if needed
+ // There is a bug opened against softmac. Need to enable when the bug is fixed.
+ __limBackgroundScanInitiate(pMac);
+#endif
+#endif
+
+} /*** end __limProcessSmeScanReq() ***/
+
+
+
+
+/**
+ * __limProcessSmeJoinReq()
+ *
+ *FUNCTION:
+ * This function is called to process SME_JOIN_REQ message
+ * from HDD or upper layer application.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the SME message buffer
+ * @return None
+ */
+
+static void
+__limProcessSmeJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ // tANI_U8 *pBuf;
+ //tANI_U32 len;
+// tSirMacAddr currentBssId;
+ tpSirSmeJoinReq pSmeJoinReq = NULL;
+ tLimMlmJoinReq *pMlmJoinReq;
+ tSirResultCodes retCode = eSIR_SME_SUCCESS;
+ tANI_U32 val = 0;
+ tANI_U16 nSize;
+ tANI_U8 sessionId;
+ tpPESession psessionEntry = NULL;
+ tANI_U8 smesessionId;
+ tANI_U16 smetransactionId;
+ tPowerdBm localPowerConstraint = 0, regMax = 0;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ //Not sending any session, since it is not created yet. The response whould have correct state.
+ limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_REQ_EVENT, NULL, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ PELOG1(limLog(pMac, LOG1, FL("Received SME_JOIN_REQ\n"));)
+
+#ifdef WLAN_FEATURE_VOWIFI
+ /* Need to read the CFG here itself as this is used in limExtractAPCapability() below.
+ * This CFG is actually read in rrmUpdateConfig() which is called later. Because this is not
+ * read, RRM related path before calling rrmUpdateConfig() is not getting executed causing issues
+ * like not honoring power constraint on 1st association after driver loading. */
+ if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("cfg get rrm enabled failed\n"));
+ pMac->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0;
+ val = 0;
+#endif /* WLAN_FEATURE_VOWIFI */
+
+ /**
+ * Expect Join request in idle state.
+ * Reassociate request is expected in link established state.
+ */
+
+ /* Global SME and LIM states are not defined yet for BT-AMP Support */
+ if(pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE)
+ {
+ nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8*) pMsgBuf);
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSmeJoinReq, nSize))
+ {
+ limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pSmeJoinReq\n"));
+ retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ goto end;
+ }
+ (void) palZeroMemory(pMac->hHdd, (void *) pSmeJoinReq, nSize);
+
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ handleHTCapabilityandHTInfo(pMac);
+#endif
+ if ((limJoinReqSerDes(pMac, pSmeJoinReq, (tANI_U8 *)pMsgBuf) == eSIR_FAILURE) ||
+ (!limIsSmeJoinReqValid(pMac, pSmeJoinReq)))
+ {
+ /// Received invalid eWNI_SME_JOIN_REQ
+ // Log the event
+ limLog(pMac, LOGW, FL("received SME_JOIN_REQ with invalid data\n"));
+ retCode = eSIR_SME_INVALID_PARAMETERS;
+ goto end;
+ }
+
+ //pMac->lim.gpLimJoinReq = pSmeJoinReq; TO SUPPORT BT-AMP ,review os sep 23
+
+ /* check for the existence of start BSS session */
+#ifdef FIXME_GEN6
+ if(pSmeJoinReq->bsstype == eSIR_BTAMP_AP_MODE)
+ {
+ if(peValidateBtJoinRequest(pMac)!= TRUE)
+ {
+ limLog(pMac, LOGW, FL("Start Bss session not present::SME_JOIN_REQ in unexpected state\n"));
+ retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
+ psessionEntry = NULL;
+ goto end;
+ }
+ }
+
+#endif
+
+
+ if((psessionEntry = peFindSessionByBssid(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId)) != NULL)
+ {
+ limLog(pMac, LOGE, FL("Session Already exists for given BSSID\n"));
+
+ if(psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)
+ {
+ // Received eWNI_SME_JOIN_REQ for same
+ // BSS as currently associated.
+ // Log the event and send success
+ PELOGW(limLog(pMac, LOGW, FL("Received SME_JOIN_REQ for currently joined BSS\n"));)
+ /// Send Join success response to host
+ retCode = eSIR_SME_SUCCESS;
+ goto end;
+ }
+ else
+ {
+ retCode = eSIR_SME_REFUSED;
+ psessionEntry = NULL;
+ goto end;
+ }
+ }
+ else /* Session Entry does not exist for given BSSId */
+ {
+ /* Try to Create a new session */
+ if((psessionEntry = peCreateSession(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId, pMac->lim.maxStation)) == NULL)
+ {
+ limLog(pMac, LOGE, FL("Session Can not be created \n"));
+ retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ goto end;
+ }
+ }
+
+ /* Store Session related parameters */
+ /* Store PE session Id in session Table */
+ psessionEntry->peSessionId = sessionId;
+
+ /* store the smejoin req handle in session table */
+ psessionEntry->pLimJoinReq = pSmeJoinReq;
+
+ /* Store SME session Id in sessionTable */
+ psessionEntry->smeSessionId = pSmeJoinReq->sessionId;
+
+ /* Store SME transaction Id in session Table */
+ psessionEntry->transactionId = pSmeJoinReq->transactionId;
+
+ /* Store beaconInterval */
+ psessionEntry->beaconParams.beaconInterval = pSmeJoinReq->bssDescription.beaconInterval;
+
+ /* Copying of bssId is already done, while creating session */
+ //sirCopyMacAddr(psessionEntry->bssId,pSmeJoinReq->bssId);
+ sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeJoinReq->selfMacAddr);
+ psessionEntry->bssType = pSmeJoinReq->bsstype;
+
+ psessionEntry->statypeForBss = STA_ENTRY_PEER;
+
+ /* Copy the dot 11 mode in to the session table */
+
+ psessionEntry->dot11mode = pSmeJoinReq->dot11mode;
+ psessionEntry->nwType = pSmeJoinReq->bssDescription.nwType;
+
+ /*Phy mode*/
+ psessionEntry->gLimPhyMode = pSmeJoinReq->bssDescription.nwType;
+
+ /* Copy The channel Id to the session Table */
+ psessionEntry->currentOperChannel = pSmeJoinReq->bssDescription.channelId;
+
+
+ /*Store Persona */
+ psessionEntry->pePersona = pSmeJoinReq->staPersona;
+ VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+ FL("PE PERSONA=%d"), psessionEntry->pePersona);
+
+ /* Copy the SSID from smejoinreq to session entry */
+ psessionEntry->ssId.length = pSmeJoinReq->ssId.length;
+ palCopyMemory( pMac->hHdd,psessionEntry->ssId.ssId,pSmeJoinReq->ssId.ssId,psessionEntry->ssId.length);
+
+ /* Copy the SSID from smejoinreq to session entry */
+ psessionEntry->ssId.length = pSmeJoinReq->ssId.length;
+ palCopyMemory( pMac->hHdd,psessionEntry->ssId.ssId,pSmeJoinReq->ssId.ssId,psessionEntry->ssId.length);
+
+ // Determin 11r or CCX connection based on input from SME
+ // which inturn is dependent on the profile the user wants to connect
+ // to, So input is coming from supplicant
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ psessionEntry->is11Rconnection = pSmeJoinReq->is11Rconnection;
+#endif
+#ifdef FEATURE_WLAN_CCX
+ psessionEntry->isCCXconnection = pSmeJoinReq->isCCXconnection;
+#endif
+#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX
+ psessionEntry->isFastTransitionEnabled = pSmeJoinReq->isFastTransitionEnabled;
+#endif
+
+ if(psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
+ {
+ psessionEntry->limSystemRole = eLIM_STA_ROLE;
+ }
+ else if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
+ {
+ psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
+ }
+ else
+ {
+ /* Throw an error and return and make sure to delete the session.*/
+ limLog(pMac, LOGW, FL("received SME_JOIN_REQ with invalid bss type\n"));
+ retCode = eSIR_SME_INVALID_PARAMETERS;
+ goto end;
+ }
+
+ if(pSmeJoinReq->addIEScan.length)
+ {
+ palCopyMemory(pMac->hHdd, &psessionEntry->pLimJoinReq->addIEScan,
+ &pSmeJoinReq->addIEScan, sizeof(tSirAddie));
+ }
+
+ if(pSmeJoinReq->addIEAssoc.length)
+ {
+ palCopyMemory(pMac->hHdd, &psessionEntry->pLimJoinReq->addIEAssoc,
+ &pSmeJoinReq->addIEAssoc, sizeof(tSirAddie));
+ }
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+
+ val = sizeof(tLimMlmJoinReq) + sizeof(tSirMacSSidIE) +
+ sizeof(tSirMacRateSetIE) + sizeof(tSirMacDsParamSetIE);
+#else
+ val = sizeof(tLimMlmJoinReq) + psessionEntry->pLimJoinReq->bssDescription.length + 2;
+#endif
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmJoinReq, val))
+ {
+ limLog(pMac, LOGP, FL("call to palAllocateMemory failed for mlmJoinReq\n"));
+ return;
+ }
+ (void) palZeroMemory(pMac->hHdd, (void *) pMlmJoinReq, val);
+
+ /* PE SessionId is stored as a part of JoinReq*/
+ pMlmJoinReq->sessionId = psessionEntry->peSessionId;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, (tANI_U32 *) &pMlmJoinReq->joinFailureTimeout)
+ != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("could not retrieve JoinFailureTimer value\n"));
+
+ /* copy operational rate from psessionEntry*/
+ palCopyMemory(pMac->hHdd, (void*)&psessionEntry->rateSet, (void*)&pSmeJoinReq->operationalRateSet,
+ sizeof(tSirMacRateSet));
+ palCopyMemory(pMac->hHdd, (void*)&psessionEntry->extRateSet, (void*)&pSmeJoinReq->extendedRateSet,
+ sizeof(tSirMacRateSet));
+ //this may not be needed anymore now, as rateSet is now included in the session entry and MLM has session context.
+ palCopyMemory(pMac->hHdd, (void*)&pMlmJoinReq->operationalRateSet, (void*)&psessionEntry->rateSet,
+ sizeof(tSirMacRateSet));
+
+ psessionEntry->encryptType = pSmeJoinReq->UCEncryptionType;
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+ palCopyMemory( pMac->hHdd, pMlmJoinReq->bssDescription.bssId,
+ pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].bssId,
+ sizeof(tSirMacAddr));
+
+ pMlmJoinReq->bssDescription.capabilityInfo = 1;
+
+ pMlmJoinReq->bssDescription.aniIndicator =
+ (tANI_U8) pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].wniIndicator;
+
+ pMlmJoinReq->bssDescription.nwType =
+ pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].nwType;
+
+ pMlmJoinReq->bssDescription.channelId =
+ pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].channelId;
+
+ limCopyNeighborInfoToCfg(pMac,
+ pMac->lim.gpLimJoinReq->neighborBssList.bssList[0], psessionEntry);
+
+ palCopyMemory( pMac->hHdd, pMac->lim.gLimCurrentBssId,
+ pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].bssId,
+ sizeof(tSirMacAddr));
+
+ pMac->lim.gLimCurrentChannelId =
+ pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].channelId;
+
+ pMac->lim.gLimCurrentBssCaps =
+ pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].capabilityInfo;
+
+ pMac->lim.gLimCurrentTitanHtCaps =
+ pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].titanHtCaps;
+
+ palCopyMemory( pMac->hHdd,
+ (tANI_U8 *) &pMac->lim.gLimCurrentSSID,
+ (tANI_U8 *) &pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].ssId,
+ pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].ssId.length+1);
+#else
+ pMlmJoinReq->bssDescription.length = psessionEntry->pLimJoinReq->bssDescription.length;
+
+ palCopyMemory( pMac->hHdd,
+ (tANI_U8 *) &pMlmJoinReq->bssDescription.bssId,
+ (tANI_U8 *) &psessionEntry->pLimJoinReq->bssDescription.bssId,
+ psessionEntry->pLimJoinReq->bssDescription.length + 2);
+
+#if 0
+
+ pMac->lim.gLimCurrentChannelId =
+ psessionEntry->pLimJoinReq->bssDescription.channelId;
+#endif //oct 9th review remove globals
+
+
+ psessionEntry->limCurrentBssCaps =
+ psessionEntry->pLimJoinReq->bssDescription.capabilityInfo;
+
+
+ psessionEntry->limCurrentTitanHtCaps=
+ psessionEntry->pLimJoinReq->bssDescription.titanHtCaps;
+
+ regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
+ localPowerConstraint = regMax;
+ limExtractApCapability( pMac,
+ (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
+ limGetIElenFromBssDescription(&psessionEntry->pLimJoinReq->bssDescription),
+ &psessionEntry->limCurrentBssQosCaps,
+ &psessionEntry->limCurrentBssPropCap,
+ &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimCurrentBssUapsd this session specific
+ , &localPowerConstraint
+ );
+#ifdef FEATURE_WLAN_CCX
+ psessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint);
+#else
+ psessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
+#endif
+#if defined WLAN_VOWIFI_DEBUG
+ limLog( pMac, LOGE, "Regulatory max = %d, local power constraint = %d, max tx = %d", regMax, localPowerConstraint, psessionEntry->maxTxPower );
+#endif
+
+ if (pMac->lim.gLimCurrentBssUapsd)
+ {
+ pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimJoinReq->uapsdPerAcBitmask;
+ limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x\n"), pMac->lim.gUapsdPerAcBitmask);
+
+ // resetting the dynamic uapsd mask
+ pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
+ pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
+ }
+#endif
+
+ psessionEntry->limRFBand = limGetRFBand(psessionEntry->currentOperChannel);
+
+ // Initialize 11h Enable Flag
+ if(SIR_BAND_5_GHZ == psessionEntry->limRFBand)
+ {
+ if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED \n"));
+ psessionEntry->lim11hEnable = val;
+ }
+ else
+ psessionEntry->lim11hEnable = 0;
+
+ //To care of the scenario when STA transitions from IBSS to Infrastructure mode.
+ pMac->lim.gLimIbssCoalescingHappened = false;
+
+ psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
+ psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+
+ PELOG1(limLog(pMac, LOG1, FL("SME JoinReq: SSID %d.%c%c%c%c%c%c\n"),
+ psessionEntry->ssId.length,
+ psessionEntry->ssId.ssId[0],
+ psessionEntry->ssId.ssId[1],
+ psessionEntry->ssId.ssId[2],
+ psessionEntry->ssId.ssId[3],
+ psessionEntry->ssId.ssId[4],
+ psessionEntry->ssId.ssId[5]);
+ limLog(pMac, LOG1, FL("Channel %d, BSSID %x:%x:%x:%x:%x:%x\n"),
+ psessionEntry->currentOperChannel,
+ psessionEntry->bssId[0],
+ psessionEntry->bssId[1],
+ psessionEntry->bssId[2],
+ psessionEntry->bssId[3],
+ psessionEntry->bssId[4],
+ psessionEntry->bssId[5]);)
+
+ /* Indicate whether spectrum management is enabled*/
+ psessionEntry->spectrumMgtEnabled =
+ pSmeJoinReq->spectrumMgtIndicator;
+ /* Issue LIM_MLM_JOIN_REQ to MLM */
+ limPostMlmMessage(pMac, LIM_MLM_JOIN_REQ, (tANI_U32 *) pMlmJoinReq);
+ return;
+
+ }
+ else
+ {
+ /* Received eWNI_SME_JOIN_REQ un expected state */
+ limLog(pMac, LOGE, FL("received unexpected SME_JOIN_REQ in state %X\n"), pMac->lim.gLimSmeState);
+ limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
+ retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
+ psessionEntry = NULL;
+ goto end;
+
+ }
+
+end:
+ limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
+
+ if(pSmeJoinReq)
+ {
+ palFreeMemory( pMac->hHdd, pSmeJoinReq);
+ pSmeJoinReq = NULL;
+ if (NULL != psessionEntry)
+ {
+ psessionEntry->pLimJoinReq = NULL;
+ }
+ }
+
+ if(retCode != eSIR_SME_SUCCESS)
+ {
+ if(NULL != psessionEntry)
+ {
+ peDeleteSession(pMac,psessionEntry);
+ psessionEntry = NULL;
+ }
+ }
+
+ limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry,smesessionId,smetransactionId);
+} /*** end __limProcessSmeJoinReq() ***/
+
+
+#ifdef FEATURE_WLAN_CCX
+tANI_U8 limGetMaxTxPower(tPowerdBm regMax, tPowerdBm apTxPower)
+{
+ tANI_U8 maxTxPower = 0;
+ tANI_U8 txPower = VOS_MIN( regMax , (apTxPower) );
+ if((txPower >= MIN_TX_PWR_CAP) && (txPower <= MAX_TX_PWR_CAP))
+ maxTxPower = txPower;
+ else if (txPower < MIN_TX_PWR_CAP)
+ maxTxPower = MIN_TX_PWR_CAP;
+ else
+ maxTxPower = MAX_TX_PWR_CAP;
+
+ return (maxTxPower);
+}
+#endif
+
+
+#if 0
+/**
+ * __limProcessSmeAuthReq()
+ *
+ *FUNCTION:
+ * This function is called to process SME_AUTH_REQ message
+ * from HDD or upper layer application.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the SME message buffer
+ * @return None
+ */
+
+static void
+__limProcessSmeAuthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+
+ tAniAuthType authMode;
+ tLimMlmAuthReq *pMlmAuthReq;
+ tpSirSmeAuthReq pSirSmeAuthReq;
+ tSirResultCodes retCode = eSIR_SME_SUCCESS;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId;
+
+
+ if(pMsgBuf == NULL)
+ {
+ limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
+ return;
+ }
+
+ pSirSmeAuthReq = (tpSirSmeAuthReq) pMsgBuf;
+
+ if((psessionEntry = peFindSessionByBssid(pMac,pSirSmeAuthReq->bssId,&sessionId))== NULL)
+ {
+ limLog(pMac, LOGE,FL("Session Does not exist for given BssId\n"));
+ return;
+ }
+
+ if (!limIsSmeAuthReqValid(pSirSmeAuthReq))
+ {
+ limLog(pMac, LOGW,
+ FL("received invalid SME_AUTH_REQ message\n"));
+
+ /// Send AUTH failure response to host
+ retCode = eSIR_SME_INVALID_PARAMETERS;
+ goto end;
+ }
+
+ PELOG1(limLog(pMac, LOG1,
+ FL("RECEIVED AUTH_REQ\n"));)
+
+ /**
+ * Expect Auth request for STA in link established state
+ * or STA in IBSS mode in normal state.
+ */
+
+ if ((psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE) ||
+ (psessionEntry->limSmeState == eLIM_SME_JOIN_FAILURE_STATE) ||
+ ((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) &&
+ (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
+ {
+ if (pSirSmeAuthReq->authType == eSIR_AUTO_SWITCH)
+ authMode = eSIR_SHARED_KEY; // Try Shared Key first
+ else
+ authMode = pSirSmeAuthReq->authType;
+
+ // Trigger MAC based Authentication
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmAuthReq, sizeof(tLimMlmAuthReq)))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for mlmAuthReq\n"));
+ return;
+ }
+
+ pMac->lim.gLimPreAuthType = pSirSmeAuthReq->authType;
+
+ psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
+ psessionEntry->limSmeState = eLIM_SME_WT_PRE_AUTH_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+
+ // Store channel specified in auth request.
+ // This will be programmed later by MLM.
+ pMac->lim.gLimPreAuthChannelNumber =
+ (tSirMacChanNum)
+ pSirSmeAuthReq->channelNumber;
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMac->lim.gLimPreAuthPeerAddr,
+ (tANI_U8 *) &pSirSmeAuthReq->peerMacAddr,
+ sizeof(tSirMacAddr));
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmAuthReq->peerMacAddr,
+ (tANI_U8 *) &pSirSmeAuthReq->peerMacAddr,
+ sizeof(tSirMacAddr));
+
+ pMlmAuthReq->authType = authMode;
+
+ /* Update PE session Id */
+ pMlmAuthReq->sessionId = sessionId;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
+ (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
+ != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get AuthFailureTimeout value from CFG.
+ * Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve AuthFailureTimeout value\n"));
+ }
+
+ limPostMlmMessage(pMac, LIM_MLM_AUTH_REQ, (tANI_U32 *) pMlmAuthReq);
+ return;
+ }
+ else
+ {
+ /// Should not have received eWNI_SME_AUTH_REQ
+ // Log the event
+ limLog(pMac, LOGE,
+ FL("received unexpected SME_AUTH_REQ in state %X\n"),psessionEntry->limSmeState);
+ limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
+
+ /// Send AUTH failure response to host
+ retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
+ goto end;
+ }
+
+end:
+ limSendSmeAuthRsp(pMac, retCode,
+ pSirSmeAuthReq->peerMacAddr,
+ pSirSmeAuthReq->authType,
+ eSIR_MAC_UNSPEC_FAILURE_STATUS );
+
+} /*** end __limProcessSmeAuthReq() ***/
+#endif
+
+
+/**
+ * __limProcessSmeReassocReq()
+ *
+ *FUNCTION:
+ * This function is called to process SME_REASSOC_REQ message
+ * from HDD or upper layer application.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the SME message buffer
+ * @return None
+ */
+
+static void
+__limProcessSmeReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tANI_U16 caps;
+ tANI_U32 val;
+ tpSirSmeReassocReq pReassocReq = NULL;
+ tLimMlmReassocReq *pMlmReassocReq;
+ tSirResultCodes retCode = eSIR_SME_SUCCESS;
+ tpPESession psessionEntry = NULL;
+ tANI_U8 sessionId;
+ tANI_U8 smeSessionId;
+ tANI_U16 transactionId;
+ tPowerdBm localPowerConstraint = 0, regMax = 0;
+ tANI_U32 teleBcnEn = 0;
+
+
+ PELOG3(limLog(pMac, LOG3, FL("Received REASSOC_REQ\n"));)
+
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pReassocReq, __limGetSmeJoinReqSizeForAlloc((tANI_U8 *) pMsgBuf)))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for pReassocReq\n"));
+
+ retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ goto end;
+ }
+
+
+ if ((limJoinReqSerDes(pMac, (tpSirSmeJoinReq) pReassocReq,
+ (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
+ (!limIsSmeJoinReqValid(pMac,
+ (tpSirSmeJoinReq) pReassocReq)))
+ {
+ /// Received invalid eWNI_SME_REASSOC_REQ
+ // Log the event
+ limLog(pMac, LOGW,
+ FL("received SME_REASSOC_REQ with invalid data\n"));
+
+ retCode = eSIR_SME_INVALID_PARAMETERS;
+ goto end;
+ }
+
+ if((psessionEntry = peFindSessionByBssid(pMac,pReassocReq->bssDescription.bssId,&sessionId))==NULL)
+ {
+ limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
+ limLog(pMac, LOGP, FL("Session does not exist for given bssId\n"));
+ retCode = eSIR_SME_INVALID_PARAMETERS;
+ goto end;
+ }
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_REQ_EVENT, psessionEntry, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+ //pMac->lim.gpLimReassocReq = pReassocReq;//TO SUPPORT BT-AMP
+
+ /* Store the reassoc handle in the session Table.. 23rd sep review */
+ psessionEntry->pLimReAssocReq = pReassocReq;
+
+ /**
+ * Reassociate request is expected
+ * in link established state only.
+ */
+
+ if (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)
+ {
+#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_CCX)
+ if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
+ {
+ // May be from 11r FT pre-auth. So lets check it before we bail out
+ limLog(pMac, LOGE, FL("Session in reassoc state is %d\n"),
+ psessionEntry->peSessionId);
+
+ // Make sure its our preauth bssid
+ if (!palEqualMemory( pMac->hHdd, pReassocReq->bssDescription.bssId,
+ pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, 6))
+ {
+ limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
+ limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOGE);
+ limLog(pMac, LOGP, FL("Unknown bssId in reassoc state\n"));
+ retCode = eSIR_SME_INVALID_PARAMETERS;
+ goto end;
+ }
+
+ limProcessMlmFTReassocReq(pMac, pMsgBuf, psessionEntry);
+ return;
+ }
+#endif
+ /// Should not have received eWNI_SME_REASSOC_REQ
+ // Log the event
+ limLog(pMac, LOGE,
+ FL("received unexpected SME_REASSOC_REQ in state %X\n"),
+ psessionEntry->limSmeState);
+ limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
+
+ retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
+ goto end;
+ }
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+ limCopyNeighborInfoToCfg(pMac,
+ psessionEntry->pLimReAssocReq->neighborBssList.bssList[0],
+ psessionEntry);
+
+ palCopyMemory( pMac->hHdd,
+ pMac->lim.gLimReassocBssId,
+ psessionEntry->pLimReAssocReq->neighborBssList.bssList[0].bssId,
+ sizeof(tSirMacAddr));
+
+ pMac->lim.gLimReassocChannelId =
+ psessionEntry->pLimReAssocReq->neighborBssList.bssList[0].channelId;
+
+ pMac->lim.gLimReassocBssCaps =
+ psessionEntry->pLimReAssocReq->neighborBssList.bssList[0].capabilityInfo;
+
+ pMac->lim.gLimReassocTitanHtCaps =
+ psessionEntry->pLimReAssocReq->neighborBssList.bssList[0].titanHtCaps;
+
+ palCopyMemory( pMac->hHdd,
+ (tANI_U8 *) &pMac->lim.gLimReassocSSID,
+ (tANI_U8 *) &psessionEntry->pLimReAssocReq->neighborBssList.bssList[0].ssId,
+ psessionEntry->pLimReAssocReq->neighborBssList.bssList[0].ssId.length+1);
+#else
+ palCopyMemory( pMac->hHdd,
+ psessionEntry->limReAssocbssId,
+ psessionEntry->pLimReAssocReq->bssDescription.bssId,
+ sizeof(tSirMacAddr));
+
+ psessionEntry->limReassocChannelId =
+ psessionEntry->pLimReAssocReq->bssDescription.channelId;
+
+ psessionEntry->limReassocBssCaps =
+ psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo;
+
+ psessionEntry->limReassocTitanHtCaps =
+ psessionEntry->pLimReAssocReq->bssDescription.titanHtCaps;
+
+ regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
+ localPowerConstraint = regMax;
+ limExtractApCapability( pMac,
+ (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
+ limGetIElenFromBssDescription(
+ &psessionEntry->pLimReAssocReq->bssDescription),
+ &psessionEntry->limReassocBssQosCaps,
+ &psessionEntry->limReassocBssPropCap,
+ &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimReassocBssUapsd session specific
+ , &localPowerConstraint
+ );
+
+ psessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
+#if defined WLAN_VOWIFI_DEBUG
+ limLog( pMac, LOGE, "Regulatory max = %d, local power constraint = %d, max tx = %d", regMax, localPowerConstraint, psessionEntry->maxTxPower );
+#endif
+ {
+ #if 0
+ if (wlan_cfgGetStr(pMac, WNI_CFG_SSID, pMac->lim.gLimReassocSSID.ssId,
+ &cfgLen) != eSIR_SUCCESS)
+ {
+ /// Could not get SSID from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrive SSID\n"));
+ }
+ #endif//TO SUPPORT BT-AMP
+
+ /* Copy the SSID from sessio entry to local variable */
+ #if 0
+ palCopyMemory( pMac->hHdd, pMac->lim.gLimReassocSSID.ssId,
+ psessionEntry->ssId.ssId,
+ psessionEntry->ssId.length);
+ #endif
+ psessionEntry->limReassocSSID.length = pReassocReq->ssId.length;
+ palCopyMemory( pMac->hHdd, psessionEntry->limReassocSSID.ssId,
+ pReassocReq->ssId.ssId, psessionEntry->limReassocSSID.length);
+
+ }
+
+ if (pMac->lim.gLimCurrentBssUapsd)
+ {
+ pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimReAssocReq->uapsdPerAcBitmask;
+ limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x\n"), pMac->lim.gUapsdPerAcBitmask);
+ }
+
+#endif
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmReassocReq, sizeof(tLimMlmReassocReq)))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for mlmReassocReq\n"));
+
+ retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ goto end;
+ }
+
+ palCopyMemory( pMac->hHdd, pMlmReassocReq->peerMacAddr,
+ psessionEntry->limReAssocbssId,
+ sizeof(tSirMacAddr));
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
+ (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
+ != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get ReassocFailureTimeout value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve ReassocFailureTimeout value\n"));
+ }
+
+ if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get Capabilities value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve Capabilities value\n"));
+ }
+ pMlmReassocReq->capabilityInfo = caps;
+
+ /* Update PE sessionId*/
+ pMlmReassocReq->sessionId = sessionId;
+
+ /* If telescopic beaconing is enabled, set listen interval to
+ WNI_CFG_TELE_BCN_MAX_LI */
+ if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
+ eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN\n"));
+
+ val = WNI_CFG_LISTEN_INTERVAL_STADEF;
+
+ if(teleBcnEn)
+ {
+ if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
+ eSIR_SUCCESS)
+ {
+ /**
+ * Could not get ListenInterval value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP, FL("could not retrieve ListenInterval\n"));
+ }
+ }
+ else
+ {
+ if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get ListenInterval value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP, FL("could not retrieve ListenInterval\n"));
+ }
+ }
+
+ /* Delete all BA sessions before Re-Assoc.
+ * BA frames are class 3 frames and the session
+ * is lost upon disassociation and reassociation.
+ */
+
+ limDelAllBASessions(pMac);
+
+ pMlmReassocReq->listenInterval = (tANI_U16) val;
+
+ /* Indicate whether spectrum management is enabled*/
+ psessionEntry->spectrumMgtEnabled = pReassocReq->spectrumMgtIndicator;
+
+ psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
+ psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
+
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+
+ limPostMlmMessage(pMac,
+ LIM_MLM_REASSOC_REQ,
+ (tANI_U32 *) pMlmReassocReq);
+ return;
+
+end:
+ if (pReassocReq)
+ palFreeMemory( pMac->hHdd, pReassocReq);
+
+ if (psessionEntry)
+ {
+ // error occurred after we determined the session so extract
+ // session and transaction info from there
+ smeSessionId = psessionEntry->smeSessionId;
+ transactionId = psessionEntry->transactionId;
+ }
+ else
+ {
+ // error occurred before or during the time we determined the session
+ // so extract the session and transaction info from the message
+ limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
+ }
+
+ /// Send Reassoc failure response to host
+ /// (note psessionEntry may be NULL, but that's OK)
+ limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
+ retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,
+ psessionEntry, smeSessionId, transactionId);
+
+} /*** end __limProcessSmeReassocReq() ***/
+
+
+tANI_BOOLEAN sendDisassocFrame = 1;
+/**
+ * __limProcessSmeDisassocReq()
+ *
+ *FUNCTION:
+ * This function is called to process SME_DISASSOC_REQ message
+ * from HDD or upper layer application.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the SME message buffer
+ * @return None
+ */
+
+static void
+__limProcessSmeDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tANI_U16 disassocTrigger, reasonCode;
+ tLimMlmDisassocReq *pMlmDisassocReq;
+ tSirResultCodes retCode = eSIR_SME_SUCCESS;
+ tSirSmeDisassocReq smeDisassocReq;
+ tpPESession psessionEntry = NULL;
+ tANI_U8 sessionId;
+ tANI_U8 smesessionId;
+ tANI_U16 smetransactionId;
+
+ PELOG1(limLog(pMac, LOG1,FL("received DISASSOC_REQ message\n"));)
+
+ if(pMsgBuf == NULL)
+ {
+ limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
+ return;
+ }
+
+ limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
+
+ retCode = limDisassocReqSerDes(pMac, &smeDisassocReq, (tANI_U8 *) pMsgBuf);
+
+ if ( (retCode == eSIR_FAILURE) ||(!limIsSmeDisassocReqValid(pMac, &smeDisassocReq, psessionEntry)) )
+ {
+ PELOGE(limLog(pMac, LOGE,
+ FL("received invalid SME_DISASSOC_REQ message\n"));)
+
+ if (pMac->lim.gLimRspReqd)
+ {
+ pMac->lim.gLimRspReqd = false;
+
+ retCode = eSIR_SME_INVALID_PARAMETERS;
+ disassocTrigger = eLIM_HOST_DISASSOC;
+ goto sendDisassoc;
+ }
+
+ return;
+ }
+
+
+ PELOGE(limLog(pMac, LOGE, FL("received DISASSOC_REQ message. Reason: %d SmeState: %d\n"),
+ smeDisassocReq.reasonCode, pMac->lim.gLimSmeState);)
+
+
+ if((psessionEntry = peFindSessionByBssid(pMac,smeDisassocReq.bssId,&sessionId))== NULL)
+ {
+ limLog(pMac, LOGE,FL("session does not exist for given bssId\n"));
+ retCode = eSIR_SME_INVALID_PARAMETERS;
+ disassocTrigger = eLIM_HOST_DISASSOC;
+ goto sendDisassoc;
+
+ }
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_REQ_EVENT, psessionEntry, 0, smeDisassocReq.reasonCode);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ /* Update SME session Id and SME transaction ID*/
+
+ psessionEntry->smeSessionId = smesessionId;
+ psessionEntry->transactionId = smetransactionId;
+
+ switch (psessionEntry->limSystemRole)
+ {
+ case eLIM_STA_ROLE:
+ case eLIM_BT_AMP_STA_ROLE:
+ switch (psessionEntry->limSmeState)
+ {
+ case eLIM_SME_ASSOCIATED_STATE:
+ case eLIM_SME_LINK_EST_STATE:
+ psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
+ psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+ break;
+
+ case eLIM_SME_WT_DEAUTH_STATE:
+ /* PE shall still process the DISASSOC_REQ and proceed with
+ * link tear down even if it had already sent a DEAUTH_IND to
+ * to SME. pMac->lim.gLimPrevSmeState shall remain the same as
+ * its been set when PE entered WT_DEAUTH_STATE.
+ */
+ psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+ limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in SME_WT_DEAUTH_STATE. \n"));
+ break;
+
+ case eLIM_SME_WT_DISASSOC_STATE:
+ /* PE Recieved a Disassoc frame. Normally it gets DISASSOC_CNF but it
+ * received DISASSOC_REQ. Which means host is also trying to disconnect.
+ * PE can continue processing DISASSOC_REQ and send the response instead
+ * of failing the request. SME will anyway ignore DEAUTH_IND that was sent
+ * for disassoc frame.
+ *
+ * It will send a disassoc, which is ok. However, we can use the global flag
+ * sendDisassoc to not send disassoc frame.
+ */
+ limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in SME_WT_DISASSOC_STATE. \n"));
+ break;
+
+ case eLIM_SME_JOIN_FAILURE_STATE: {
+ /** Return Success as we are already in Disconnected State*/
+ if (pMac->lim.gLimRspReqd) {
+ retCode = eSIR_SME_SUCCESS;
+ disassocTrigger = eLIM_HOST_DISASSOC;
+ goto sendDisassoc;
+ }
+ }break;
+ default:
+ /**
+ * STA is not currently associated.
+ * Log error and send response to host
+ */
+ limLog(pMac, LOGE,
+ FL("received unexpected SME_DISASSOC_REQ in state %X\n"),
+ psessionEntry->limSmeState);
+ limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
+
+ if (pMac->lim.gLimRspReqd)
+ {
+ if (psessionEntry->limSmeState !=
+ eLIM_SME_WT_ASSOC_STATE)
+ pMac->lim.gLimRspReqd = false;
+
+ retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
+ disassocTrigger = eLIM_HOST_DISASSOC;
+ goto sendDisassoc;
+ }
+
+ return;
+ }
+
+ break;
+
+ case eLIM_AP_ROLE:
+ case eLIM_BT_AMP_AP_ROLE:
+ // Fall through
+ break;
+
+ case eLIM_STA_IN_IBSS_ROLE:
+ default: // eLIM_UNKNOWN_ROLE
+ limLog(pMac, LOGE,
+ FL("received unexpected SME_DISASSOC_REQ for role %d\n"),
+ psessionEntry->limSystemRole);
+
+ retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
+ disassocTrigger = eLIM_HOST_DISASSOC;
+ goto sendDisassoc;
+ } // end switch (pMac->lim.gLimSystemRole)
+
+ if (smeDisassocReq.reasonCode == eLIM_LINK_MONITORING_DISASSOC)
+ {
+ /// Disassociation is triggered by Link Monitoring
+ disassocTrigger = eLIM_LINK_MONITORING_DISASSOC;
+ reasonCode = eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON;
+ }
+ else
+ {
+ disassocTrigger = eLIM_HOST_DISASSOC;
+ reasonCode = smeDisassocReq.reasonCode;
+ }
+
+ if (smeDisassocReq.doNotSendOverTheAir)
+ {
+ sendDisassocFrame = 0;
+ }
+ // Trigger Disassociation frame to peer MAC entity
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmDisassocReq, sizeof(tLimMlmDisassocReq)))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for mlmDisassocReq\n"));
+
+ return;
+ }
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmDisassocReq->peerMacAddr,
+ (tANI_U8 *) &smeDisassocReq.peerMacAddr,
+ sizeof(tSirMacAddr));
+
+ pMlmDisassocReq->reasonCode = reasonCode;
+ pMlmDisassocReq->disassocTrigger = disassocTrigger;
+
+ /* Update PE session ID*/
+ pMlmDisassocReq->sessionId = sessionId;
+#ifdef ANI_PRODUCT_TYPE_AP
+ pMlmDisassocReq->aid = smeDisassocReq.aid;
+#endif
+
+ limPostMlmMessage(pMac,
+ LIM_MLM_DISASSOC_REQ,
+ (tANI_U32 *) pMlmDisassocReq);
+ return;
+
+sendDisassoc:
+ if (psessionEntry)
+ limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
+ retCode,
+ disassocTrigger,
+#ifdef ANI_PRODUCT_TYPE_AP
+ smeDisassocReq.aid);
+#else
+ 1,smesessionId,smetransactionId,psessionEntry);
+#endif
+ else
+ limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
+ retCode,
+ disassocTrigger,
+#ifdef ANI_PRODUCT_TYPE_AP
+ smeDisassocReq.aid);
+#else
+ 1, 0, 0, NULL);
+#endif
+
+
+} /*** end __limProcessSmeDisassocReq() ***/
+
+
+/** -----------------------------------------------------------------
+ \brief __limProcessSmeDisassocCnf() - Process SME_DISASSOC_CNF
+
+ This function is called to process SME_DISASSOC_CNF message
+ from HDD or upper layer application.
+
+ \param pMac - global mac structure
+ \param pStaDs - station dph hash node
+ \return none
+ \sa
+ ----------------------------------------------------------------- */
+static void
+__limProcessSmeDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tSirSmeDisassocCnf smeDisassocCnf;
+ tANI_U16 aid;
+ tpDphHashNode pStaDs;
+ tSirRetStatus status = eSIR_SUCCESS;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId;
+
+
+ PELOG1(limLog(pMac, LOG1, FL("received DISASSOC_CNF message\n"));)
+
+ status = limDisassocCnfSerDes(pMac, &smeDisassocCnf,(tANI_U8 *) pMsgBuf);
+
+ if (status == eSIR_FAILURE)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("invalid SME_DISASSOC_CNF message\n"));)
+ return;
+ }
+
+ if((psessionEntry = peFindSessionByBssid(pMac, smeDisassocCnf.bssId, &sessionId))== NULL)
+ {
+ limLog(pMac, LOGE,FL("session does not exist for given bssId\n"));
+ return;
+ }
+
+ if (!limIsSmeDisassocCnfValid(pMac, &smeDisassocCnf, psessionEntry))
+ {
+ limLog(pMac, LOGW, FL("received invalid SME_DISASSOC_CNF message\n"));
+ return;
+ }
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ if (smeDisassocCnf.messageType == eWNI_SME_DISASSOC_CNF)
+ limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
+ else if (smeDisassocCnf.messageType == eWNI_SME_DEAUTH_CNF)
+ limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ switch (psessionEntry->limSystemRole)
+ {
+ case eLIM_STA_ROLE:
+ case eLIM_BT_AMP_STA_ROLE: //To test reconn
+ if ((psessionEntry->limSmeState != eLIM_SME_IDLE_STATE) &&
+ (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
+ (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
+ {
+ limLog(pMac, LOGE,
+ FL("received unexp SME_DISASSOC_CNF in state %X\n"),
+ psessionEntry->limSmeState);
+ limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
+ return;
+ }
+ break;
+
+ case eLIM_AP_ROLE:
+ // Fall through
+#ifdef WLAN_SOFTAP_FEATURE
+ break;
+#else
+ return;
+#endif
+
+ case eLIM_STA_IN_IBSS_ROLE:
+ default: // eLIM_UNKNOWN_ROLE
+ limLog(pMac, LOGE,
+ FL("received unexpected SME_DISASSOC_CNF role %d\n"),
+ psessionEntry->limSystemRole);
+
+ return;
+ }
+
+
+ if ( (psessionEntry->limSmeState == eLIM_SME_WT_DISASSOC_STATE) ||
+ (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE)
+#ifdef WLAN_SOFTAP_FEATURE
+ || (psessionEntry->limSystemRole == eLIM_AP_ROLE )
+#endif
+ )
+ {
+ pStaDs = dphLookupHashEntry(pMac, smeDisassocCnf.peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
+ if (pStaDs == NULL)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("received DISASSOC_CNF for a STA that does not have context, addr= "));
+ limPrintMacAddr(pMac, smeDisassocCnf.peerMacAddr, LOGW);)
+ return;
+ }
+ limCleanupRxPath(pMac, pStaDs, psessionEntry);
+ }
+
+ return;
+}
+
+
+/**
+ * __limProcessSmeDeauthReq()
+ *
+ *FUNCTION:
+ * This function is called to process SME_DEAUTH_REQ message
+ * from HDD or upper layer application.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the SME message buffer
+ * @return None
+ */
+
+static void
+__limProcessSmeDeauthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tANI_U16 deauthTrigger, reasonCode;
+ tLimMlmDeauthReq *pMlmDeauthReq;
+ tSirSmeDeauthReq smeDeauthReq;
+ tSirResultCodes retCode = eSIR_SME_SUCCESS;
+ tSirRetStatus status = eSIR_SUCCESS;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId; //PE sessionId
+ tANI_U8 smesessionId;
+ tANI_U16 smetransactionId;
+
+ PELOG1(limLog(pMac, LOG1,FL("received DEAUTH_REQ message\n"));)
+
+ status = limDeauthReqSerDes(pMac, &smeDeauthReq,(tANI_U8 *) pMsgBuf);
+
+ limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
+
+ //We need to get a session first but we don't even know if the message is correct.
+ if((psessionEntry = peFindSessionByBssid(pMac, smeDeauthReq.bssId, &sessionId)) == NULL)
+ {
+ limLog(pMac, LOGE,FL("session does not exist for given bssId\n"));
+ retCode = eSIR_SME_INVALID_PARAMETERS;
+ deauthTrigger = eLIM_HOST_DEAUTH;
+ goto sendDeauth;
+
+ }
+
+ if ((status == eSIR_FAILURE) || (!limIsSmeDeauthReqValid(pMac, &smeDeauthReq, psessionEntry)))
+ {
+ PELOGE(limLog(pMac, LOGW,FL("received invalid SME_DEAUTH_REQ message\n"));)
+ if (pMac->lim.gLimRspReqd)
+ {
+ pMac->lim.gLimRspReqd = false;
+
+ retCode = eSIR_SME_INVALID_PARAMETERS;
+ deauthTrigger = eLIM_HOST_DEAUTH;
+ goto sendDeauth;
+ }
+
+ return;
+ }
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_REQ_EVENT, psessionEntry, 0, smeDeauthReq.reasonCode);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ /* Update SME session ID and Transaction ID */
+ psessionEntry->smeSessionId = smesessionId;
+ psessionEntry->transactionId = smetransactionId;
+
+
+ switch (psessionEntry->limSystemRole)
+ {
+ case eLIM_STA_ROLE:
+ case eLIM_BT_AMP_STA_ROLE:
+
+ switch (psessionEntry->limSmeState)
+ {
+ case eLIM_SME_ASSOCIATED_STATE:
+ case eLIM_SME_LINK_EST_STATE:
+ case eLIM_SME_WT_ASSOC_STATE:
+ case eLIM_SME_JOIN_FAILURE_STATE:
+ case eLIM_SME_IDLE_STATE:
+ psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
+ psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+
+ // Send Deauthentication request to MLM below
+
+ break;
+
+ default:
+ /**
+ * STA is not in a state to deauthenticate with
+ * peer. Log error and send response to host.
+ */
+ limLog(pMac, LOGE,
+ FL("received unexp SME_DEAUTH_REQ in state %X\n"),psessionEntry->limSmeState);
+ limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
+
+ if (pMac->lim.gLimRspReqd)
+ {
+ pMac->lim.gLimRspReqd = false;
+
+ retCode = eSIR_SME_STA_NOT_AUTHENTICATED;
+ deauthTrigger = eLIM_HOST_DEAUTH;
+ goto sendDeauth;
+ }
+
+ return;
+ }
+
+ break;
+
+ case eLIM_STA_IN_IBSS_ROLE:
+
+ return;
+
+ case eLIM_AP_ROLE:
+ // Fall through
+
+ break;
+
+ default:
+ limLog(pMac, LOGE,
+ FL("received unexpected SME_DEAUTH_REQ for role %X\n"),psessionEntry->limSystemRole);
+
+ return;
+ } // end switch (pMac->lim.gLimSystemRole)
+
+ if (smeDeauthReq.reasonCode == eLIM_LINK_MONITORING_DEAUTH)
+ {
+ /// Deauthentication is triggered by Link Monitoring
+ PELOG1(limLog(pMac, LOG1, FL("**** Lost link with AP ****\n"));)
+ deauthTrigger = eLIM_LINK_MONITORING_DEAUTH;
+ reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
+ }
+ else
+ {
+ deauthTrigger = eLIM_HOST_DEAUTH;
+ reasonCode = smeDeauthReq.reasonCode;
+ }
+
+ // Trigger Deauthentication frame to peer MAC entity
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmDeauthReq, sizeof(tLimMlmDeauthReq)))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for mlmDeauthReq\n"));
+
+ return;
+ }
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmDeauthReq->peerMacAddr,
+ (tANI_U8 *) &smeDeauthReq.peerMacAddr,
+ sizeof(tSirMacAddr));
+
+ pMlmDeauthReq->reasonCode = reasonCode;
+ pMlmDeauthReq->deauthTrigger = deauthTrigger;
+#ifdef ANI_PRODUCT_TYPE_AP
+ pMlmDeauthReq->aid = smeDeauthReq.aid;
+#endif
+
+ /* Update PE session Id*/
+ pMlmDeauthReq->sessionId = sessionId;
+
+ limPostMlmMessage(pMac,
+ LIM_MLM_DEAUTH_REQ,
+ (tANI_U32 *) pMlmDeauthReq);
+ return;
+
+sendDeauth:
+ limSendSmeDeauthNtf(pMac, smeDeauthReq.peerMacAddr,
+ retCode,
+ deauthTrigger,
+#ifdef ANI_PRODUCT_TYPE_AP
+ smeDeauthReq.aid,
+#else
+ 1,
+#endif
+ smesessionId, smetransactionId);
+} /*** end __limProcessSmeDeauthReq() ***/
+
+
+
+/**
+ * __limProcessSmeSetContextReq()
+ *
+ *FUNCTION:
+ * This function is called to process SME_SETCONTEXT_REQ message
+ * from HDD or upper layer application.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the SME message buffer
+ * @return None
+ */
+
+static void
+__limProcessSmeSetContextReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tpSirSmeSetContextReq pSetContextReq;
+ tLimMlmSetKeysReq *pMlmSetKeysReq;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId; //PE sessionID
+ tANI_U8 smesessionId;
+ tANI_U16 smetransactionId;
+
+
+ PELOG1(limLog(pMac, LOG1,
+ FL("received SETCONTEXT_REQ message\n")););
+
+
+ if(pMsgBuf == NULL)
+ {
+ limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
+ return;
+ }
+
+ limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSetContextReq,
+ (sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)))
+ {
+ limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pSetContextReq\n"));
+ return;
+ }
+
+ if ((limSetContextReqSerDes(pMac, pSetContextReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
+ (!limIsSmeSetContextReqValid(pMac, pSetContextReq)))
+ {
+ limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message\n"));
+ goto end;
+ }
+
+ if(pSetContextReq->keyMaterial.numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("numKeys:%d is more than SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS\n"), pSetContextReq->keyMaterial.numKeys);)
+ limSendSmeSetContextRsp(pMac,
+ pSetContextReq->peerMacAddr,
+#ifdef ANI_PRODUCT_TYPE_AP
+ pSetContextReq->aid,
+#else
+ 1,
+#endif
+ eSIR_SME_INVALID_PARAMETERS,NULL,
+ smesessionId,smetransactionId);
+
+ goto end;
+ }
+
+
+ if((psessionEntry = peFindSessionByBssid(pMac, pSetContextReq->bssId, &sessionId)) == NULL)
+ {
+ limLog(pMac, LOGW, FL("Session does not exist for given BSSID\n"));
+ limSendSmeSetContextRsp(pMac,
+ pSetContextReq->peerMacAddr,
+#ifdef ANI_PRODUCT_TYPE_AP
+ pSetContextReq->aid,
+#else
+ 1,
+#endif
+ eSIR_SME_INVALID_PARAMETERS,NULL,
+ smesessionId,smetransactionId);
+
+ goto end;
+ }
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, psessionEntry, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+
+ if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
+ (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
+ (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
+ (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
+ (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
+ {
+ // Trigger MLM_SETKEYS_REQ
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmSetKeysReq, sizeof(tLimMlmSetKeysReq)))
+ {
+ // Log error
+ limLog(pMac, LOGP, FL("call to palAllocateMemory failed for mlmSetKeysReq\n"));
+ goto end;
+ }
+
+ pMlmSetKeysReq->edType = pSetContextReq->keyMaterial.edType;
+ pMlmSetKeysReq->numKeys = pSetContextReq->keyMaterial.numKeys;
+ if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
+ {
+ limLog(pMac, LOGP, FL("Num of keys exceeded max num of default keys limit\n"));
+ goto end;
+ }
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmSetKeysReq->peerMacAddr,
+ (tANI_U8 *) &pSetContextReq->peerMacAddr,
+ sizeof(tSirMacAddr));
+
+#ifdef ANI_PRODUCT_TYPE_AP
+ pMlmSetKeysReq->aid = pSetContextReq->aid;
+#endif
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmSetKeysReq->key,
+ (tANI_U8 *) &pSetContextReq->keyMaterial.key,
+ sizeof(tSirKeys) * (pMlmSetKeysReq->numKeys ? pMlmSetKeysReq->numKeys : 1));
+
+ pMlmSetKeysReq->sessionId = sessionId;
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOG1(limLog(pMac, LOG1,
+ FL("received SETCONTEXT_REQ message sessionId=%d\n"), pMlmSetKeysReq->sessionId););
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if(((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) || (pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104))
+ && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
+ {
+ if(pSetContextReq->keyMaterial.key[0].keyLength)
+ {
+ tANI_U8 keyId;
+ keyId = pSetContextReq->keyMaterial.key[0].keyId;
+ palCopyMemory(pMac, (tANI_U8 *)&psessionEntry->WEPKeyMaterial[keyId],
+ (tANI_U8 *) &pSetContextReq->keyMaterial, sizeof(tSirKeyMaterial));
+ }
+ else {
+ tANI_U32 i;
+ for( i = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++)
+ {
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmSetKeysReq->key[i],
+ (tANI_U8 *)psessionEntry->WEPKeyMaterial[i].key, sizeof(tSirKeys));
+ }
+ }
+ }
+#endif
+
+ limPostMlmMessage(pMac, LIM_MLM_SETKEYS_REQ, (tANI_U32 *) pMlmSetKeysReq);
+
+#ifdef ANI_AP_SDK
+ /* For SDK acting as STA under Linux, need to consider the AP as *
+ * as authenticatated. */
+ if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
+ (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE))
+ {
+ tpDphHashNode pSta;
+ pSta = dphGetHashEntry(pMac, 0, &psessionEntry->dph.dphHashTable);
+ if (pSta)
+ pSta->staAuthenticated = 1;
+ }
+#endif
+ }
+ else
+ {
+ limLog(pMac, LOGE,
+ FL("received unexpected SME_SETCONTEXT_REQ for role %d, state=%X\n"),
+ psessionEntry->limSystemRole,
+ psessionEntry->limSmeState);
+ limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
+
+ limSendSmeSetContextRsp(pMac, pSetContextReq->peerMacAddr,
+#ifdef ANI_PRODUCT_TYPE_AP
+ pSetContextReq->aid,
+#else
+ 1,
+#endif
+ eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
+ smesessionId,
+ smetransactionId);
+ }
+
+end:
+ palFreeMemory( pMac->hHdd, pSetContextReq);
+ return;
+} /*** end __limProcessSmeSetContextReq() ***/
+
+/**
+ * __limProcessSmeRemoveKeyReq()
+ *
+ *FUNCTION:
+ * This function is called to process SME_REMOVEKEY_REQ message
+ * from HDD or upper layer application.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the SME message buffer
+ * @return None
+ */
+
+static void
+__limProcessSmeRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tpSirSmeRemoveKeyReq pRemoveKeyReq;
+ tLimMlmRemoveKeyReq *pMlmRemoveKeyReq;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId; //PE sessionID
+ tANI_U8 smesessionId;
+ tANI_U16 smetransactionId;
+
+ PELOG1(limLog(pMac, LOG1,
+ FL("received REMOVEKEY_REQ message\n"));)
+
+ if(pMsgBuf == NULL)
+ {
+ limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
+ return;
+ }
+
+
+ limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pRemoveKeyReq,
+ (sizeof(*pRemoveKeyReq))))
+ {
+ //Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for pRemoveKeyReq\n"));
+
+ return;
+ }
+
+ if ((limRemoveKeyReqSerDes(pMac,
+ pRemoveKeyReq,
+ (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
+ {
+ limLog(pMac, LOGW,
+ FL("received invalid SME_REMOVECONTEXT_REQ message\n"));
+
+ /* extra look up is needed since, session entry to be passed il limsendremovekey response */
+
+ if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId,&sessionId))== NULL)
+ {
+ limLog(pMac, LOGE,FL("session does not exist for given bssId\n"));
+ //goto end;
+ }
+
+ limSendSmeRemoveKeyRsp(pMac,
+ pRemoveKeyReq->peerMacAddr,
+ eSIR_SME_INVALID_PARAMETERS,psessionEntry,
+ smesessionId,smetransactionId);
+
+ goto end;
+ }
+
+ if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId, &sessionId))== NULL)
+ {
+ limLog(pMac, LOGE,
+ FL("session does not exist for given bssId\n"));
+ limSendSmeRemoveKeyRsp(pMac,
+ pRemoveKeyReq->peerMacAddr,
+ eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, NULL,
+ smesessionId, smetransactionId);
+ goto end;
+ }
+
+
+ if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
+ (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
+ (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
+ (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
+ (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
+ {
+ // Trigger MLM_REMOVEKEYS_REQ
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmRemoveKeyReq, sizeof(tLimMlmRemoveKeyReq)))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for mlmRemoveKeysReq\n"));
+
+ goto end;
+ }
+
+ pMlmRemoveKeyReq->edType = (tAniEdType)pRemoveKeyReq->edType;
+ pMlmRemoveKeyReq->keyId = pRemoveKeyReq->keyId;
+ pMlmRemoveKeyReq->wepType = pRemoveKeyReq->wepType;
+ pMlmRemoveKeyReq->unicast = pRemoveKeyReq->unicast;
+
+ /* Update PE session Id */
+ pMlmRemoveKeyReq->sessionId = sessionId;
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmRemoveKeyReq->peerMacAddr,
+ (tANI_U8 *) &pRemoveKeyReq->peerMacAddr,
+ sizeof(tSirMacAddr));
+
+
+ limPostMlmMessage(pMac,
+ LIM_MLM_REMOVEKEY_REQ,
+ (tANI_U32 *) pMlmRemoveKeyReq);
+ }
+ else
+ {
+ limLog(pMac, LOGE,
+ FL("received unexpected SME_REMOVEKEY_REQ for role %d, state=%X\n"),
+ psessionEntry->limSystemRole,
+ psessionEntry->limSmeState);
+ limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
+
+ limSendSmeRemoveKeyRsp(pMac,
+ pRemoveKeyReq->peerMacAddr,
+ eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
+ smesessionId,smetransactionId);
+ }
+
+end:
+ palFreeMemory( pMac->hHdd, pRemoveKeyReq);
+} /*** end __limProcessSmeRemoveKeyReq() ***/
+
+
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+/**
+ * __limHandleSmeSwitchChlRequest()
+ *
+ *FUNCTION:
+ * This function is called to process the following SME messages
+ * received from HDD or WSM:
+ * - eWNI_SME_SWITCH_CHL_REQ
+ * - eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ
+ * - eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ
+ *
+ *ASSUMPTIONS:
+ *
+ * eWNI_SME_SWITCH_CHL_REQ is issued only when 11h is enabled,
+ * and WSM wishes to switch its primary channel. AP shall
+ * populate the 802.11h channel switch IE in its Beacons/Probe Rsp.
+ *
+ * eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ is issued only when 11h is enabled,
+ * and WSM wishes to switch both its primary channel and secondary channel.
+ * (In the case of if 11h is disabled, and WSM wants to change both
+ * primary & secondary channel, then WSM should issue a restart-BSS). AP
+ * shall populate the 802.11h channel switch IE in its Beacons/Probe Rsp.
+ *
+ * eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ is issued when WSM wishes to
+ * switch/disable only its secondary channel. This can occur when 11h
+ * is enabled or disabled. AP shall populate the airgo proprietary
+ * channel switch IE in its Beacons/Probe Rsp.
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the SME message buffer
+ * @return None
+ */
+
+static void
+__limHandleSmeSwitchChlRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tpSirSmeSwitchChannelReq pSmeMsg;
+ eHalStatus status;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_SWITCH_CHL_REQ_EVENT, NULL, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ if(pMsgBuf == NULL)
+ {
+ limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
+ return;
+ }
+
+ if (pMac->lim.gLimSmeState != eLIM_SME_NORMAL_STATE ||
+ pMac->lim.gLimSystemRole != eLIM_AP_ROLE ||
+ pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
+ {
+ PELOGE(limLog(pMac, LOGE, "Rcvd Switch Chl Req in wrong state\n");)
+ limSendSmeRsp(pMac, eWNI_SME_SWITCH_CHL_RSP, eSIR_SME_CHANNEL_SWITCH_FAIL);
+ return;
+ }
+
+ status = palAllocateMemory( pMac->hHdd, (void **)&pSmeMsg, sizeof(tSirSmeSwitchChannelReq));
+ if( eHAL_STATUS_SUCCESS != status)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory failed, status = %d\n"), status);)
+ return;
+ }
+
+ if (!limIsSmeSwitchChannelReqValid(pMac, (tANI_U8 *)pMsgBuf, pSmeMsg))
+ {
+ limLog(pMac, LOGE,
+ FL("invalid sme message received\n"));
+ palFreeMemory( pMac->hHdd, pSmeMsg);
+ limSendSmeRsp(pMac, eWNI_SME_SWITCH_CHL_RSP, eSIR_SME_INVALID_PARAMETERS);
+ return;
+ }
+
+
+ /* If we're already doing channel switching and we're in the
+ * middle of counting down, then reject this channel switch msg.
+ */
+ if (pMac->lim.gLimChannelSwitch.state != eLIM_CHANNEL_SWITCH_IDLE)
+ {
+ limLog(pMac, LOGE,
+ FL("channel switching is already in progress.\n"));
+ palFreeMemory( pMac->hHdd, pSmeMsg);
+ limSendSmeRsp(pMac, eWNI_SME_SWITCH_CHL_RSP, eSIR_SME_CHANNEL_SWITCH_DISABLED);
+ return;
+ }
+
+ PELOG1(limLog(pMac, LOG1, FL("rcvd eWNI_SME_SWITCH_CHL_REQ, message type = %d\n"), pSmeMsg->messageType);)
+ switch(pSmeMsg->messageType)
+ {
+ case eWNI_SME_SWITCH_CHL_REQ:
+ pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
+ break;
+
+ case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
+
+ pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
+ break;
+
+ case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
+ pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_SECONDARY_ONLY;
+ break;
+
+ default:
+ PELOGE(limLog(pMac, LOGE, FL("unknown message\n"));)
+ palFreeMemory( pMac->hHdd, pSmeMsg);
+ limSendSmeRsp(pMac, eWNI_SME_SWITCH_CHL_RSP, eSIR_SME_INVALID_PARAMETERS);
+ return;
+ }
+
+ pMac->lim.gLimChannelSwitch.primaryChannel = pSmeMsg->channelId;
+ pMac->lim.gLimChannelSwitch.secondarySubBand = pSmeMsg->cbMode;
+ pMac->lim.gLimChannelSwitch.switchCount = computeChannelSwitchCount(pMac, pSmeMsg->dtimFactor);
+ if (LIM_IS_RADAR_DETECTED(pMac))
+ {
+ /** Measurement timers not running */
+ pMac->lim.gLimChannelSwitch.switchMode = eSIR_CHANSW_MODE_SILENT;
+ }
+ else
+ {
+ /** Stop measurement timers till channel switch */
+ limStopMeasTimers(pMac);
+ pMac->lim.gLimChannelSwitch.switchMode = eSIR_CHANSW_MODE_NORMAL;
+ }
+
+ PELOG1(limLog(pMac, LOG1, FL("state %d, primary %d, subband %d, count %d \n"),
+ pMac->lim.gLimChannelSwitch.state,
+ pMac->lim.gLimChannelSwitch.primaryChannel,
+ pMac->lim.gLimChannelSwitch.secondarySubBand,
+ pMac->lim.gLimChannelSwitch.switchCount);)
+ palFreeMemory( pMac->hHdd, pSmeMsg);
+
+ pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_END;
+ pMac->lim.gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
+
+ return;
+} /*** end __limHandleSmeSwitchChlRequest() ***/
+
+
+/**--------------------------------------------------------------
+\fn __limProcessSmeSwitchChlReq
+
+\brief Wrapper for the function __limHandleSmeSwitchChlRequest
+ This message will be defered until softmac come out of
+ scan mode.
+\param pMac
+\param pMsg
+
+\return TRUE - If we consumed the buffer
+ FALSE - If have defered the message.
+ ---------------------------------------------------------------*/
+static tANI_BOOLEAN
+__limProcessSmeSwitchChlReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
+{
+ if (__limIsDeferedMsgForLearn(pMac, pMsg))
+ {
+ /**
+ * If message defered, buffer is not consumed yet.
+ * So return false
+ */
+ return eANI_BOOLEAN_FALSE;
+ }
+ __limHandleSmeSwitchChlRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
+ return eANI_BOOLEAN_TRUE;
+}
+#endif
+
+
+void limProcessSmeGetScanChannelInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tSirMsgQ mmhMsg;
+ tpSmeGetScanChnRsp pSirSmeRsp;
+ tANI_U16 len = 0;
+
+ if(pMac->lim.scanChnInfo.numChnInfo > SIR_MAX_SUPPORTED_CHANNEL_LIST)
+ {
+ limLog(pMac, LOGW, FL("numChn is out of bounds %d\n"),
+ pMac->lim.scanChnInfo.numChnInfo);
+ pMac->lim.scanChnInfo.numChnInfo = SIR_MAX_SUPPORTED_CHANNEL_LIST;
+ }
+
+ PELOG2(limLog(pMac, LOG2,
+ FL("Sending message %s with number of channels %d\n"),
+ limMsgStr(eWNI_SME_GET_SCANNED_CHANNEL_RSP), pMac->lim.scanChnInfo.numChnInfo);)
+
+ len = sizeof(tSmeGetScanChnRsp) + (pMac->lim.scanChnInfo.numChnInfo - 1) * sizeof(tLimScanChn);
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeRsp, len ))
+ {
+ /// Buffer not available. Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for JOIN/REASSOC_RSP\n"));
+
+ return;
+ }
+ palZeroMemory(pMac->hHdd, pSirSmeRsp, len);
+
+#if defined(ANI_PRODUCT_TYPE_AP) && defined(ANI_LITTLE_BYTE_ENDIAN)
+ sirStoreU16N((tANI_U8*)&pSirSmeRsp->mesgType, eWNI_SME_GET_SCANNED_CHANNEL_RSP);
+ sirStoreU16N((tANI_U8*)&pSirSmeRsp->mesgLen, len);
+#else
+ pSirSmeRsp->mesgType = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
+ pSirSmeRsp->mesgLen = len;
+#endif
+ pSirSmeRsp->sessionId = 0;
+
+ if(pMac->lim.scanChnInfo.numChnInfo)
+ {
+ pSirSmeRsp->numChn = pMac->lim.scanChnInfo.numChnInfo;
+ palCopyMemory(pMac->hHdd, pSirSmeRsp->scanChn, pMac->lim.scanChnInfo.scanChn, sizeof(tLimScanChn) * pSirSmeRsp->numChn);
+ }
+ //Clear the list
+ limRessetScanChannelInfo(pMac);
+
+ mmhMsg.type = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
+ mmhMsg.bodyptr = pSirSmeRsp;
+ mmhMsg.bodyval = 0;
+
+ pMac->lim.gLimRspReqd = false;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+}
+
+
+#ifdef WLAN_SOFTAP_FEATURE
+void limProcessSmeGetAssocSTAsInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tSirSmeGetAssocSTAsReq getAssocSTAsReq;
+ tpDphHashNode pStaDs = NULL;
+ tpPESession psessionEntry = NULL;
+ tSap_Event sapEvent;
+ tpWLAN_SAPEventCB pSapEventCallback = NULL;
+ tpSap_AssocMacAddr pAssocStasTemp = NULL;// #include "sapApi.h"
+ tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
+ tANI_U8 assocId = 0;
+ tANI_U8 staCount = 0;
+
+ if (!limIsSmeGetAssocSTAsReqValid(pMac, &getAssocSTAsReq, (tANI_U8 *) pMsgBuf))
+ {
+ limLog(pMac, LOGE,
+ FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message\n"));
+ goto limAssocStaEnd;
+ }
+
+ switch (getAssocSTAsReq.modId)
+ {
+/**
+ case VOS_MODULE_ID_HAL:
+ wdaPostCtrlMsg( pMac, &msgQ );
+ return;
+
+ case VOS_MODULE_ID_TL:
+ Post msg TL
+ return;
+*/
+ case VOS_MODULE_ID_PE:
+ default:
+ break;
+ }
+
+ // Get Assoctiated stations from PE
+ // Find PE session Entry
+ if ((psessionEntry = peFindSessionByBssid(pMac, getAssocSTAsReq.bssId, &sessionId)) == NULL)
+ {
+ limLog(pMac, LOGE,
+ FL("session does not exist for given bssId\n"));
+ goto limAssocStaEnd;
+ }
+
+ if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
+ {
+ limLog(pMac, LOGE,
+ FL("Received unexpected message in state %X, in role %X\n"),
+ psessionEntry->limSmeState , psessionEntry->limSystemRole);
+ goto limAssocStaEnd;
+ }
+
+ // Retrieve values obtained in the request message
+ pSapEventCallback = (tpWLAN_SAPEventCB)getAssocSTAsReq.pSapEventCallback;
+ pAssocStasTemp = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
+
+ for (assocId = 0; assocId < psessionEntry->dph.dphHashTable.size; assocId++)// Softap dphHashTable.size = 8
+ {
+ pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
+
+ if (NULL == pStaDs)
+ continue;
+
+ if (pStaDs->valid)
+ {
+ palCopyMemory(pMac->hHdd, (tANI_U8 *)&pAssocStasTemp->staMac,
+ (tANI_U8 *)&pStaDs->staAddr,
+ sizeof(v_MACADDR_t)); // Mac address
+ pAssocStasTemp->assocId = (v_U8_t)pStaDs->assocId; // Association Id
+ pAssocStasTemp->staId = (v_U8_t)pStaDs->staIndex; // Station Id
+
+ limLog(pMac, LOG1, FL("dph Station Number = %d"), staCount+1);
+ limLog(pMac, LOG1, FL("MAC = %02x:%02x:%02x:%02x:%02x:%02x"),
+ pStaDs->staAddr[0],
+ pStaDs->staAddr[1],
+ pStaDs->staAddr[2],
+ pStaDs->staAddr[3],
+ pStaDs->staAddr[4],
+ pStaDs->staAddr[5]);
+ limLog(pMac, LOG1, FL("Association Id = %d"),pStaDs->assocId);
+ limLog(pMac, LOG1, FL("Station Index = %d"),pStaDs->staIndex);
+
+ pAssocStasTemp++;
+ staCount++;
+ }
+ }
+
+limAssocStaEnd:
+ // Call hdd callback with sap event to send the list of associated stations from PE
+ if (pSapEventCallback != NULL)
+ {
+ sapEvent.sapHddEventCode = eSAP_ASSOC_STA_CALLBACK_EVENT;
+ sapEvent.sapevt.sapAssocStaListEvent.module = VOS_MODULE_ID_PE;
+ sapEvent.sapevt.sapAssocStaListEvent.noOfAssocSta = staCount;
+ sapEvent.sapevt.sapAssocStaListEvent.pAssocStas = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
+ pSapEventCallback(&sapEvent, getAssocSTAsReq.pUsrContext);
+ }
+}
+
+
+/**
+ * limProcessSmeGetWPSPBCSessions
+ *
+ *FUNCTION:
+ * This function is called when query the WPS PBC overlap message is received
+ *
+ *LOGIC:
+ * This function parses get WPS PBC overlap information message and call callback to pass
+ * WPS PBC overlap information back to hdd.
+ *ASSUMPTIONS:
+ *
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pMsgBuf A pointer to WPS PBC overlap query message
+*
+ * @return None
+ */
+void limProcessSmeGetWPSPBCSessions(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tSirSmeGetWPSPBCSessionsReq GetWPSPBCSessionsReq;
+ tpPESession psessionEntry = NULL;
+ tSap_Event sapEvent;
+ tpWLAN_SAPEventCB pSapEventCallback = NULL;
+ tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
+ tSirMacAddr zeroMac = {0,0,0,0,0,0};
+
+ sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_E_FAULT;
+
+ if (limIsSmeGetWPSPBCSessionsReqValid(pMac, &GetWPSPBCSessionsReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGE,
+ FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message\n"));
+ goto limGetWPSPBCSessionsEnd;
+ }
+
+ // Get Assoctiated stations from PE
+ // Find PE session Entry
+ if ((psessionEntry = peFindSessionByBssid(pMac, GetWPSPBCSessionsReq.bssId, &sessionId)) == NULL)
+ {
+ limLog(pMac, LOGE,
+ FL("session does not exist for given bssId\n"));
+ goto limGetWPSPBCSessionsEnd;
+ }
+
+ if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
+ {
+ limLog(pMac, LOGE,
+ FL("Received unexpected message in role %X\n"),
+ psessionEntry->limSystemRole);
+ goto limGetWPSPBCSessionsEnd;
+ }
+
+ // Call hdd callback with sap event to send the WPS PBC overlap infromation
+ sapEvent.sapHddEventCode = eSAP_GET_WPSPBC_SESSION_EVENT;
+ sapEvent.sapevt.sapGetWPSPBCSessionEvent.module = VOS_MODULE_ID_PE;
+
+ if (palEqualMemory(pMac->hHdd, zeroMac, GetWPSPBCSessionsReq.pRemoveMac, sizeof(tSirMacAddr)))
+ { //This is GetWpsSession call
+
+ limGetWPSPBCSessions(pMac,
+ sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, sapEvent.sapevt.sapGetWPSPBCSessionEvent.UUID_E,
+ &sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap, psessionEntry);
+ }
+ else
+ {
+ limRemovePBCSessions(pMac, GetWPSPBCSessionsReq.pRemoveMac,psessionEntry);
+ /* don't have to inform the HDD/Host */
+ return;
+ }
+
+ PELOG4(limLog(pMac, LOGE, FL("wpsPBCOverlap %d\n"), sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap);)
+ PELOG4(limPrintMacAddr(pMac, sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, LOG4);)
+
+ sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_SUCCESS;
+
+limGetWPSPBCSessionsEnd:
+ pSapEventCallback = (tpWLAN_SAPEventCB)GetWPSPBCSessionsReq.pSapEventCallback;
+ pSapEventCallback(&sapEvent, GetWPSPBCSessionsReq.pUsrContext);
+}
+
+#endif
+
+
+/**
+ * __limCounterMeasures()
+ *
+ * FUNCTION:
+ * This function is called to "implement" MIC counter measure
+ * and is *temporary* only
+ *
+ * LOGIC: on AP, disassoc all STA associated thru TKIP,
+ * we don't do the proper STA disassoc sequence since the
+ * BSS will be stoped anyway
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return None
+ */
+
+static void
+__limCounterMeasures(tpAniSirGlobal pMac, tpPESession psessionEntry)
+{
+ tSirMacAddr mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+ if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
+ || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) )
+
+ limSendDisassocMgmtFrame(pMac, eSIR_MAC_MIC_FAILURE_REASON, mac, psessionEntry);
+
+ tx_thread_sleep(10);
+};
+
+
+#ifdef WLAN_SOFTAP_FEATURE
+void
+limProcessTkipCounterMeasures(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tSirSmeTkipCntrMeasReq tkipCntrMeasReq;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId; //PE sessionId
+
+ if ( limTkipCntrMeasReqSerDes( pMac, &tkipCntrMeasReq, (tANI_U8 *) pMsgBuf ) != eSIR_SUCCESS )
+ {
+ limLog(pMac, LOGE,
+ FL("received invalid eWNI_SME_TKIP_CNTR_MEAS_REQ message\n"));
+ return;
+ }
+
+ if ( NULL == (psessionEntry = peFindSessionByBssid( pMac, tkipCntrMeasReq.bssId, &sessionId )) )
+ {
+ limLog(pMac, LOGE, FL("session does not exist for given BSSID \n"));
+ return;
+ }
+
+ if ( tkipCntrMeasReq.bEnable )
+ {
+ __limCounterMeasures( pMac, psessionEntry );
+ }
+
+ psessionEntry->bTkipCntrMeasActive = tkipCntrMeasReq.bEnable;
+}
+#endif
+
+
+static void
+__limHandleSmeStopBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tSirSmeStopBssReq stopBssReq;
+ tSirRetStatus status;
+ tLimSmeStates prevState;
+ tANI_U8 sessionId; //PE sessionId
+ tpPESession psessionEntry;
+ tANI_U8 smesessionId;
+ tANI_U16 smetransactionId;
+
+ limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
+
+
+
+ if ((limStopBssReqSerDes(pMac, &stopBssReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS) ||
+ !limIsSmeStopBssReqValid(pMsgBuf))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("received invalid SME_STOP_BSS_REQ message\n"));)
+ /// Send Stop BSS response to host
+ limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
+ return;
+ }
+
+
+ if((psessionEntry = peFindSessionByBssid(pMac,stopBssReq.bssId,&sessionId)) == NULL)
+ {
+ limLog(pMac, LOGW, FL("session does not exist for given BSSID \n"));
+ limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
+ return;
+ }
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, psessionEntry, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+
+ if ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) || /* Added For BT -AMP Support */
+ (psessionEntry->limSystemRole == eLIM_STA_ROLE ))
+ {
+ /**
+ * Should not have received STOP_BSS_REQ in states
+ * other than 'normal' state or on STA in Infrastructure
+ * mode. Log error and return response to host.
+ */
+ limLog(pMac, LOGE,
+ FL("received unexpected SME_STOP_BSS_REQ in state %X, for role %d\n"),
+ psessionEntry->limSmeState, psessionEntry->limSystemRole);
+ limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
+ /// Send Stop BSS response to host
+ limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,smesessionId,smetransactionId);
+ return;
+ }
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if (psessionEntry->limSystemRole == eLIM_AP_ROLE )
+ {
+ limWPSPBCClose(pMac, psessionEntry);
+ }
+#endif
+ PELOGW(limLog(pMac, LOGW, FL("RECEIVED STOP_BSS_REQ with reason code=%d\n"), stopBssReq.reasonCode);)
+
+ prevState = psessionEntry->limSmeState;
+
+ psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+
+ /* Update SME session Id and Transaction Id */
+ psessionEntry->smeSessionId = smesessionId;
+ psessionEntry->transactionId = smetransactionId;
+
+ /* BTAMP_STA and STA_IN_IBSS should NOT send Disassoc frame */
+ if ( (eLIM_STA_IN_IBSS_ROLE != psessionEntry->limSystemRole) && (eLIM_BT_AMP_STA_ROLE != psessionEntry->limSystemRole) )
+ {
+ tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+ if ((stopBssReq.reasonCode == eSIR_SME_MIC_COUNTER_MEASURES))
+ // Send disassoc all stations associated thru TKIP
+ __limCounterMeasures(pMac,psessionEntry);
+ else
+ limSendDisassocMgmtFrame(pMac, eSIR_MAC_DISASSOC_LEAVING_BSS_REASON, bcAddr,psessionEntry);
+ }
+
+ //limDelBss is also called as part of coalescing, when we send DEL BSS followed by Add Bss msg.
+ pMac->lim.gLimIbssCoalescingHappened = false;
+
+ /* send a delBss to HAL and wait for a response */
+ status = limDelBss(pMac, NULL,psessionEntry->bssIdx,psessionEntry);
+
+ if (status != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d\n"), psessionEntry->bssIdx);)
+ psessionEntry->limSmeState= prevState;
+
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+
+ limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_STOP_BSS_FAILURE,smesessionId,smetransactionId);
+ }
+}
+
+
+/**--------------------------------------------------------------
+\fn __limProcessSmeStopBssReq
+
+\brief Wrapper for the function __limHandleSmeStopBssRequest
+ This message will be defered until softmac come out of
+ scan mode. Message should be handled even if we have
+ detected radar in the current operating channel.
+\param pMac
+\param pMsg
+
+\return TRUE - If we consumed the buffer
+ FALSE - If have defered the message.
+ ---------------------------------------------------------------*/
+static tANI_BOOLEAN
+__limProcessSmeStopBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
+{
+ if (__limIsDeferedMsgForLearn(pMac, pMsg))
+ {
+ /**
+ * If message defered, buffer is not consumed yet.
+ * So return false
+ */
+ return eANI_BOOLEAN_FALSE;
+ }
+ __limHandleSmeStopBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
+ return eANI_BOOLEAN_TRUE;
+} /*** end __limProcessSmeStopBssReq() ***/
+
+
+void limProcessSmeDelBssRsp(
+ tpAniSirGlobal pMac,
+ tANI_U32 body,tpPESession psessionEntry)
+{
+
+ (void) body;
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+ //TBD: get the sessionEntry
+ dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);
+ limDeletePreAuthList(pMac);
+ limIbssDelete(pMac,psessionEntry);
+ limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_SUCCESS,psessionEntry->smeSessionId,psessionEntry->transactionId);
+ return;
+}
+
+
+#if 0
+/**
+ * __limProcessSmePromiscuousReq()
+ *
+ *FUNCTION:
+ * This function is called to process SME_PROMISCUOUS_REQ message
+ * from HDD or upper layer application.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the SME message buffer
+ * @return None
+ */
+
+static void
+__limProcessSmePromiscuousReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+
+ tANI_U32 cfg = sizeof(tSirMacAddr);
+ tSirMacAddr currentBssId;
+ tLimMlmDisassocReq *pMlmDisassocReq;
+ tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+
+
+ if(pMsgBuf == NULL)
+ {
+ limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
+ return;
+ }
+
+ PELOG1(limLog(pMac, LOG1,
+ FL("received PROMISCUOUS_REQ message\n"));)
+
+ if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) !=
+ eSIR_SUCCESS)
+ {
+ /// Could not get BSSID from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
+ }
+
+ if ((((pMac->lim.gLimSystemRole == eLIM_STA_ROLE) ||
+ (pMac->lim.gLimSystemRole == eLIM_STA_IN_IBSS_ROLE)) &&
+ ((pMac->lim.gLimSmeState == eLIM_SME_ASSOCIATED_STATE) ||
+ (pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_STATE))) ||
+ ((pMac->lim.gLimSystemRole == eLIM_AP_ROLE) &&
+ (pMac->lim.gLimSmeState == eLIM_SME_NORMAL_STATE)))
+ {
+ // Trigger Disassociation frame to peer MAC entity
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmDisassocReq, sizeof(tLimMlmDisassocReq)))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for mlmDisassocReq\n"));
+
+ return;
+ }
+
+ if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmDisassocReq->peerMacAddr,
+ (tANI_U8 *) &bcAddr,
+ sizeof(tSirMacAddr));
+ else
+ palCopyMemory( pMac->hHdd, pMlmDisassocReq->peerMacAddr,
+ currentBssId,
+ sizeof(tSirMacAddr));
+
+ pMlmDisassocReq->reasonCode =
+ eSIR_MAC_DISASSOC_LEAVING_BSS_REASON;
+ pMlmDisassocReq->disassocTrigger =
+ eLIM_PROMISCUOUS_MODE_DISASSOC;
+
+ pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
+ pMac->lim.gLimSmeState = eLIM_SME_WT_DISASSOC_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+
+ limPostMlmMessage(pMac,
+ LIM_MLM_DISASSOC_REQ,
+ (tANI_U32 *) pMlmDisassocReq);
+ }
+ else
+ {
+ // Send Promiscuous mode response to host
+ limSendSmePromiscuousModeRsp(pMac);
+
+ pMac->lim.gLimSmeState = eLIM_SME_OFFLINE_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+ }
+
+} /*** end __limProcessSmePromiscuousReq() ***/
+#endif
+
+
+/**---------------------------------------------------------------
+\fn __limProcessSmeAssocCnfNew
+\brief This function handles SME_ASSOC_CNF/SME_REASSOC_CNF
+\ in BTAMP AP.
+\
+\param pMac
+\param msgType - message type
+\param pMsgBuf - a pointer to the SME message buffer
+\return None
+------------------------------------------------------------------*/
+
+ void
+__limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
+{
+ tSirSmeAssocCnf assocCnf;
+ tpDphHashNode pStaDs = NULL;
+ tpPESession psessionEntry= NULL;
+ tANI_U8 sessionId;
+
+
+ if(pMsgBuf == NULL)
+ {
+ limLog(pMac, LOGE, FL("pMsgBuf is NULL \n"));
+ goto end;
+ }
+
+ if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
+ !__limIsSmeAssocCnfValid(&assocCnf))
+ {
+ limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message \n"));
+ goto end;
+ }
+
+ if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
+ {
+ limLog(pMac, LOGE, FL("session does not exist for given bssId\n"));
+ goto end;
+ }
+
+ if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
+ ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
+ {
+ limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X\n"),
+ msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
+ goto end;
+ }
+
+ pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
+
+ if (pStaDs == NULL)
+ {
+ limLog(pMac, LOG1,
+ FL("Received invalid message %X due to no STA context, for aid %d, peer "),
+ msgType, assocCnf.aid);
+ limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
+
+ /*
+ ** send a DISASSOC_IND message to WSM to make sure
+ ** the state in WSM and LIM is the same
+ **/
+ limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
+ eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
+ goto end;
+ }
+ if ((pStaDs &&
+ (( !palEqualMemory( pMac->hHdd,(tANI_U8 *) pStaDs->staAddr,
+ (tANI_U8 *) assocCnf.peerMacAddr,
+ sizeof(tSirMacAddr)) ) ||
+ (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
+ ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
+ (msgType != eWNI_SME_ASSOC_CNF)) ||
+ ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
+#ifdef WLAN_SOFTAP_FEATURE
+ (msgType != eWNI_SME_ASSOC_CNF))))) // since softap is passing this as ASSOC_CNF and subtype differs
+#else
+ (msgType != eWNI_SME_REASSOC_CNF)))))
+#endif
+ {
+ limLog(pMac, LOG1,
+ FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
+ msgType, assocCnf.aid);
+ limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
+ goto end;
+ }
+
+ /*
+ ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
+ ** has been received
+ **/
+ limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer\n"));
+ limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
+
+ if (assocCnf.statusCode == eSIR_SME_SUCCESS)
+ {
+ /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
+ * when it had received Assoc Request frame. Now, PE just needs to send
+ * Association Response frame to the requesting BTAMP-STA.
+ */
+ pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
+ limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) \n"), pStaDs->assocId);
+ limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
+ pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
+ goto end;
+ } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
+ else
+ {
+ // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
+ /*Since the HAL sta entry is created for denied STA we need to remove this HAL entry.So to do that set updateContext to 1*/
+ if(!pStaDs->mlmStaContext.updateContext)
+ pStaDs->mlmStaContext.updateContext = 1;
+ limRejectAssociation(pMac, pStaDs->staAddr,
+ pStaDs->mlmStaContext.subType,
+ true, pStaDs->mlmStaContext.authType,
+ pStaDs->assocId, true,
+ eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
+ return;
+ }
+
+end:
+ if((psessionEntry != NULL) && (pStaDs != NULL))
+ {
+ if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
+ {
+ if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
+ {
+ palFreeMemory(pMac->hHdd,((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
+ ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
+ }
+
+ palFreeMemory(pMac->hHdd, psessionEntry->parsedAssocReq[pStaDs->assocId]);
+ psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
+ }
+ }
+
+} /*** end __limProcessSmeAssocCnfNew() ***/
+
+
+#ifdef ANI_PRODUCT_TYPE_AP
+/**
+ * __limProcessSmeAssocCnf()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeMessages() upon
+ * receiving SME_ASSOC_CNF/SME_REASSOC_CNF from WSM.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the SME message buffer
+ *
+ * @return None
+ */
+
+static void
+__limProcessSmeAssocCnf(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
+{
+ tSirSmeAssocCnf assocCnf;
+ tpDphHashNode pStaDs;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId;
+ tHalBitVal cbBitVal;
+ tANI_U8 tspecIdx = 0; //index in the lim tspec table.
+
+ if(pMsgBuf == NULL)
+ {
+ limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
+ return;
+ }
+
+ if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) ==
+ eSIR_FAILURE) ||
+ !__limIsSmeAssocCnfValid(&assocCnf))
+ {
+ limLog(pMac, LOGW,
+ FL("Received re/assocCnf message with invalid parameters\n"));
+
+ return;
+ }
+
+ if((psessionEntry = peFindSessionByBssid(pMac,assocCnf->bssId,&sessionId))== NULL)
+ {
+
+ limLog(pMac, LOGE,
+ FL("session does not exist for given bssId\n"));
+ return;
+ }
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_CNF_EVENT, psessionEntry, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
+ ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
+ {
+ limLog(pMac, LOGE,
+ FL("Received unexpected message %X in state %X, in role %X\n"),
+ msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
+
+ return;
+ }
+
+ pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
+
+
+ if (pStaDs == NULL)
+ {
+
+ PELOG1(limLog(pMac, LOG1,
+ FL("Received invalid message %X due to no STA context, for aid %d, peer "),
+ msgType, assocCnf.aid);
+ limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);)
+
+ /*
+ ** send a DISASSOC_IND message to WSM to make sure
+ ** the state in WSM and LIM is the same
+ **/
+
+ limSendSmeDisassocNtf(pMac,
+ assocCnf.peerMacAddr,
+ eSIR_SME_STA_NOT_ASSOCIATED,
+ eLIM_PEER_ENTITY_DISASSOC,
+ assocCnf.aid,psessionEntry);
+
+ return;
+ }
+ if ((pStaDs &&
+ (( !palEqualMemory( pMac->hHdd,(tANI_U8 *) pStaDs->staAddr,
+ (tANI_U8 *) assocCnf.peerMacAddr,
+ sizeof(tSirMacAddr)) ) ||
+ (pStaDs->mlmStaContext.mlmState !=
+ eLIM_MLM_WT_ASSOC_CNF_STATE) ||
+ ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
+ (msgType != eWNI_SME_ASSOC_CNF)) ||
+ ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
+ (msgType != eWNI_SME_REASSOC_CNF)))))
+ {
+ PELOG1(limLog(pMac, LOG1,
+ FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
+ msgType, assocCnf.aid);
+ limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);)
+
+ return;
+ }
+
+ /*
+ ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
+ ** has been received
+ **/
+
+ PELOG1(limLog(pMac, LOG1, FL("Received Cnf. Delete Timer\n"));)
+ limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER,
+ pStaDs->assocId);
+
+ if (assocCnf.statusCode == eSIR_SME_SUCCESS)
+ {
+ tSirMacScheduleIE schedule;
+
+ // If STA is a TITAN-compatible device, then setup
+ // the TITAN proprietary capabilities appropriately
+ // in the per STA DS, as per the local TITAN Prop
+ // capabilities of this AP
+
+ // STA is allowed to be associated
+ if (pStaDs->mlmStaContext.updateContext)
+ {
+
+ tLimMlmStates mlmPrevState = pStaDs->mlmStaContext.mlmState;
+ //we need to set the mlmState here in order differentiate in limDelSta.
+ pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE;
+ if(limDelSta(pMac, pStaDs, true,psessionEntry) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGE,
+ FL("could not DEL STA with assocId=%d staId %d\n"),
+ pStaDs->assocId, pStaDs->staIndex);
+
+ limRejectAssociation(pMac,
+ pStaDs->staAddr,
+ pStaDs->mlmStaContext.subType,
+ true, pStaDs->mlmStaContext.authType,
+ pStaDs->assocId, true,
+ (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
+ psessionEntry);
+
+ //Restoring the state back.
+ pStaDs->mlmStaContext.mlmState = mlmPrevState;
+ return;
+ }
+ return;
+ }
+ else
+ {
+ // Add STA context at HW
+ if (limAddSta(pMac, pStaDs,psessionEntry) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGE,
+ FL("could not Add STA with assocId=%d\n"),
+ pStaDs->assocId);
+
+ // delete the TS if it has already been added.
+ // send the response with error status.
+ if(pStaDs->qos.addtsPresent)
+ {
+ limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo, NULL, &tspecIdx);
+ }
+
+ limRejectAssociation(pMac,
+ pStaDs->staAddr,
+ pStaDs->mlmStaContext.subType,
+ true, pStaDs->mlmStaContext.authType,
+ pStaDs->assocId, true,
+ (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
+ psessionEntry);
+
+ }
+ return;
+ }
+
+ } // if (assocCnf.statusCode == eSIR_SME_SUCCESS)
+ else
+ {
+ // STA is not allowed to be associated
+ limRejectAssociation(pMac, pStaDs->staAddr,
+ pStaDs->mlmStaContext.subType,
+ true, pStaDs->mlmStaContext.authType,
+ pStaDs->assocId, true,
+ assocCnf.statusCode, psessionEntry);
+ }
+} /*** end __limProcessSmeAssocCnf() ***/
+#endif
+
+
+static void
+__limProcessSmeAddtsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tpDphHashNode pStaDs;
+ tSirMacAddr peerMac;
+ tpSirAddtsReq pSirAddts;
+ tANI_U32 timeout;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId; //PE sessionId
+ tANI_U8 smesessionId;
+ tANI_U16 smetransactionId;
+
+
+ if(pMsgBuf == NULL)
+ {
+ limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
+ return;
+ }
+
+ limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
+
+ pSirAddts = (tpSirAddtsReq) pMsgBuf;
+
+ if((psessionEntry = peFindSessionByBssid(pMac, pSirAddts->bssId,&sessionId))== NULL)
+ {
+ limLog(pMac, LOGE, "Session Does not exist for given bssId\n");
+ return;
+ }
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_REQ_EVENT, psessionEntry, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+
+
+ /* if sta
+ * - verify assoc state
+ * - send addts request to ap
+ * - wait for addts response from ap
+ * if ap, just ignore with error log
+ */
+ PELOG1(limLog(pMac, LOG1,
+ FL("Received SME_ADDTS_REQ (TSid %d, UP %d)\n"),
+ pSirAddts->req.tspec.tsinfo.traffic.tsid,
+ pSirAddts->req.tspec.tsinfo.traffic.userPrio);)
+
+ if ((psessionEntry->limSystemRole != eLIM_STA_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE))
+ {
+ PELOGE(limLog(pMac, LOGE, "AddTs received on AP - ignoring\n");)
+ limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
+ smesessionId,smetransactionId);
+ return;
+ }
+
+ //Ignore the request if STA is in 11B mode.
+ if(psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11B)
+ {
+ PELOGE(limLog(pMac, LOGE, "AddTS received while Dot11Mode is 11B - ignoring\n");)
+ limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
+ smesessionId,smetransactionId);
+ return;
+ }
+
+
+ pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
+
+ if(pStaDs == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE, "Cannot find AP context for addts req\n");)
+ limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
+ smesessionId,smetransactionId);
+ return;
+ }
+
+ if ((! pStaDs->valid) ||
+ (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
+ {
+ PELOGE(limLog(pMac, LOGE, "AddTs received in invalid MLM state\n");)
+ limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
+ smesessionId,smetransactionId);
+ return;
+ }
+
+ pSirAddts->req.wsmTspecPresent = 0;
+ pSirAddts->req.wmeTspecPresent = 0;
+ pSirAddts->req.lleTspecPresent = 0;
+
+ if ((pStaDs->wsmEnabled) &&
+ (pSirAddts->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
+ pSirAddts->req.wsmTspecPresent = 1;
+ else if (pStaDs->wmeEnabled)
+ pSirAddts->req.wmeTspecPresent = 1;
+ else if (pStaDs->lleEnabled)
+ pSirAddts->req.lleTspecPresent = 1;
+ else
+ {
+ PELOGW(limLog(pMac, LOGW, FL("ADDTS_REQ ignore - qos is disabled\n"));)
+ limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
+ smesessionId,smetransactionId);
+ return;
+ }
+
+ if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
+ (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
+ {
+ limLog(pMac, LOGE, "AddTs received in invalid LIMsme state (%d)\n",
+ psessionEntry->limSmeState);
+ limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
+ smesessionId,smetransactionId);
+ return;
+ }
+
+ if (pMac->lim.gLimAddtsSent)
+ {
+ limLog(pMac, LOGE, "Addts (token %d, tsid %d, up %d) is still pending\n",
+ pMac->lim.gLimAddtsReq.req.dialogToken,
+ pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.tsid,
+ pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.userPrio);
+ limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
+ smesessionId,smetransactionId);
+ return;
+ }
+
+ #if 0
+ val = sizeof(tSirMacAddr);
+ if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMac, &val) != eSIR_SUCCESS)
+ {
+ /// Could not get BSSID from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
+ return;
+ }
+ #endif
+ sirCopyMacAddr(peerMac,psessionEntry->bssId);
+
+ // save the addts request
+ pMac->lim.gLimAddtsSent = true;
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMac->lim.gLimAddtsReq, (tANI_U8 *) pSirAddts, sizeof(tSirAddtsReq));
+
+ // ship out the message now
+ limSendAddtsReqActionFrame(pMac, peerMac, &pSirAddts->req,
+ psessionEntry);
+ PELOG1(limLog(pMac, LOG1, "Sent ADDTS request\n");)
+
+ // start a timer to wait for the response
+ if (pSirAddts->timeout)
+ timeout = pSirAddts->timeout;
+ else if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &timeout) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Unable to get Cfg param %d (Addts Rsp Timeout)\n"),
+ WNI_CFG_ADDTS_RSP_TIMEOUT);
+ return;
+ }
+
+ timeout = SYS_MS_TO_TICKS(timeout);
+ if (tx_timer_change(&pMac->lim.limTimers.gLimAddtsRspTimer, timeout, 0) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("AddtsRsp timer change failed!\n"));
+ return;
+ }
+ pMac->lim.gLimAddtsRspTimerCount++;
+ if (tx_timer_change_context(&pMac->lim.limTimers.gLimAddtsRspTimer,
+ pMac->lim.gLimAddtsRspTimerCount) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("AddtsRsp timer change failed!\n"));
+ return;
+ }
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_ADDTS_RSP_TIMER));
+
+ //add the sessionId to the timer object
+ pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId;
+ if (tx_timer_activate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("AddtsRsp timer activation failed!\n"));
+ return;
+ }
+ return;
+}
+
+
+static void
+__limProcessSmeDeltsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tSirMacAddr peerMacAddr;
+ tANI_U8 ac;
+ tSirMacTSInfo *pTsinfo;
+ tpSirDeltsReq pDeltsReq = (tpSirDeltsReq) pMsgBuf;
+ tpDphHashNode pStaDs = NULL;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId;
+ tANI_U32 status = eSIR_SUCCESS;
+ tANI_U8 smesessionId;
+ tANI_U16 smetransactionId;
+
+ limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
+
+ if((psessionEntry = peFindSessionByBssid(pMac, pDeltsReq->bssId, &sessionId))== NULL)
+ {
+ limLog(pMac, LOGE, "Session Does not exist for given bssId\n");
+ status = eSIR_FAILURE;
+ goto end;
+ }
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_REQ_EVENT, psessionEntry, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+
+ if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDeltsReq, peerMacAddr,psessionEntry))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed\n"));)
+ status = eSIR_FAILURE;
+ limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_FAILURE,psessionEntry,smesessionId,smetransactionId);
+ return;
+ }
+
+ PELOG1(limLog(pMac, LOG1, FL("Sent DELTS request to station with assocId = %d MacAddr = %x:%x:%x:%x:%x:%x\n"),
+ pDeltsReq->aid, peerMacAddr[0], peerMacAddr[1], peerMacAddr[2],
+ peerMacAddr[3], peerMacAddr[4], peerMacAddr[5]);)
+
+ limSendDeltsReqActionFrame(pMac, peerMacAddr, pDeltsReq->req.wmeTspecPresent, &pDeltsReq->req.tsinfo, &pDeltsReq->req.tspec,
+ psessionEntry);
+
+ pTsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo : &pDeltsReq->req.tsinfo;
+
+ /* We've successfully send DELTS frame to AP. Update the
+ * dynamic UAPSD mask. The AC for this TSPEC to be deleted
+ * is no longer trigger enabled or delivery enabled
+ */
+ limSetTspecUapsdMask(pMac, pTsinfo, CLEAR_UAPSD_MASK);
+
+ /* We're deleting the TSPEC, so this particular AC is no longer
+ * admitted. PE needs to downgrade the EDCA
+ * parameters(for the AC for which TS is being deleted) to the
+ * next best AC for which ACM is not enabled, and send the
+ * updated values to HAL.
+ */
+ ac = upToAc(pTsinfo->traffic.userPrio);
+
+ if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
+ {
+ pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
+ }
+ else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
+ {
+ pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
+ }
+ else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
+ {
+ pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
+ pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
+ }
+
+ limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
+
+ pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
+ if (pStaDs != NULL)
+ {
+ if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
+ limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
+ else
+ limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
+ status = eSIR_SUCCESS;
+ }
+ else
+ {
+ limLog(pMac, LOGE, FL("Self entry missing in Hash Table \n"));
+ status = eSIR_FAILURE;
+ }
+#ifdef FEATURE_WLAN_CCX
+ limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
+#endif
+
+ // send an sme response back
+ end:
+ limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_SUCCESS,psessionEntry,smesessionId,smetransactionId);
+}
+
+
+void
+limProcessSmeAddtsRspTimeout(tpAniSirGlobal pMac, tANI_U32 param)
+{
+ //fetch the sessionEntry based on the sessionId
+ tpPESession psessionEntry;
+ if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAddtsRspTimer.sessionId))== NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+
+ if ( (psessionEntry->limSystemRole != eLIM_STA_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE) )
+ {
+ limLog(pMac, LOGW, "AddtsRspTimeout in non-Sta role (%d)\n", psessionEntry->limSystemRole);
+ pMac->lim.gLimAddtsSent = false;
+ return;
+ }
+
+ if (! pMac->lim.gLimAddtsSent)
+ {
+ PELOGW(limLog(pMac, LOGW, "AddtsRspTimeout but no AddtsSent\n");)
+ return;
+ }
+
+ if (param != pMac->lim.gLimAddtsRspTimerCount)
+ {
+ limLog(pMac, LOGE, FL("Invalid AddtsRsp Timer count %d (exp %d)\n"),
+ param, pMac->lim.gLimAddtsRspTimerCount);
+ return;
+ }
+
+ // this a real response timeout
+ pMac->lim.gLimAddtsSent = false;
+ pMac->lim.gLimAddtsRspTimerCount++;
+
+ limSendSmeAddtsRsp(pMac, true, eSIR_SME_ADDTS_RSP_TIMEOUT, psessionEntry, pMac->lim.gLimAddtsReq.req.tspec,
+ psessionEntry->smeSessionId, psessionEntry->transactionId);
+}
+
+
+/**
+ * __limProcessSmeStatsRequest()
+ *
+ *FUNCTION:
+ *
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the SME message buffer
+ * @return None
+ */
+static void
+__limProcessSmeStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tpAniGetStatsReq pStatsReq;
+ tSirMsgQ msgQ;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId;
+
+
+ if(pMsgBuf == NULL)
+ {
+ limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
+ return;
+ }
+
+ pStatsReq = (tpAniGetStatsReq) pMsgBuf;
+
+ if((psessionEntry = peFindSessionByBssid(pMac,pStatsReq->bssId,&sessionId))== NULL)
+ {
+ limLog(pMac, LOGE, FL("session does not exist for given bssId\n"));
+ return;
+ }
+
+
+
+ switch(pStatsReq->msgType)
+ {
+ //Add Lim stats here. and send reqsponse.
+
+ //HAL maintained Stats.
+ case eWNI_SME_STA_STAT_REQ:
+ msgQ.type = WDA_STA_STAT_REQ;
+ break;
+ case eWNI_SME_AGGR_STAT_REQ:
+ msgQ.type = WDA_AGGR_STAT_REQ;
+ break;
+ case eWNI_SME_GLOBAL_STAT_REQ:
+ msgQ.type = WDA_GLOBAL_STAT_REQ;
+ break;
+ case eWNI_SME_STAT_SUMM_REQ:
+ msgQ.type = WDA_STAT_SUMM_REQ;
+ break;
+ default: //Unknown request.
+ PELOGE(limLog(pMac, LOGE, "Unknown Statistics request\n");)
+ palFreeMemory( pMac, pMsgBuf );
+ return;
+ }
+
+ if ( !pMac->lim.gLimRspReqd )
+ {
+ palFreeMemory( pMac, pMsgBuf );
+ return;
+ }
+ else
+ {
+ pMac->lim.gLimRspReqd = FALSE;
+ }
+
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pMsgBuf;
+ msgQ.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+
+ if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
+ limLog(pMac, LOGP, "Unable to forward request\n");
+ return;
+ }
+
+ return;
+}
+
+
+/**
+ * __limProcessSmeGetStatisticsRequest()
+ *
+ *FUNCTION:
+ *
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the SME message buffer
+ * @return None
+ */
+static void
+__limProcessSmeGetStatisticsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tpAniGetPEStatsReq pPEStatsReq;
+ tSirMsgQ msgQ;
+
+ pPEStatsReq = (tpAniGetPEStatsReq) pMsgBuf;
+
+ //pPEStatsReq->msgType should be eWNI_SME_GET_STATISTICS_REQ
+
+ msgQ.type = WDA_GET_STATISTICS_REQ;
+
+ if ( !pMac->lim.gLimRspReqd )
+ {
+ palFreeMemory( pMac, pMsgBuf );
+ return;
+ }
+ else
+ {
+ pMac->lim.gLimRspReqd = FALSE;
+ }
+
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pMsgBuf;
+ msgQ.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+
+ if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
+ palFreeMemory( pMac, pMsgBuf );
+ limLog(pMac, LOGP, "Unable to forward request\n");
+ return;
+ }
+
+ return;
+}
+
+
+#ifdef WLAN_SOFTAP_FEATURE
+static void
+__limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId; //PE sessionID
+
+ PELOG1(limLog(pMac, LOG1,
+ FL("received UPDATE_APWPSIEs_REQ message\n")););
+
+ if(pMsgBuf == NULL)
+ {
+ limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
+ return;
+ }
+
+ if( palAllocateMemory( pMac->hHdd, (void **)&pUpdateAPWPSIEsReq, sizeof(tSirUpdateAPWPSIEsReq)))
+ {
+ limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pUpdateAPWPSIEsReq\n"));
+ return;
+ }
+
+ if ((limUpdateAPWPSIEsReqSerDes(pMac, pUpdateAPWPSIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
+ {
+ limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message\n"));
+ goto end;
+ }
+
+ if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPSIEsReq->bssId, &sessionId)) == NULL)
+ {
+ limLog(pMac, LOGW, FL("Session does not exist for given BSSID\n"));
+ goto end;
+ }
+
+ palCopyMemory(pMac->hHdd, &psessionEntry->APWPSIEs, &pUpdateAPWPSIEsReq->APWPSIEs, sizeof(tSirAPWPSIEs));
+
+ schSetFixedBeaconFields(pMac, psessionEntry);
+ limSendBeaconInd(pMac, psessionEntry);
+
+end:
+ palFreeMemory( pMac->hHdd, pUpdateAPWPSIEsReq);
+ return;
+} /*** end __limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
+
+static void
+__limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tpSirUpdateParams pUpdateParams;
+ tpPESession psessionEntry;
+
+ PELOG1(limLog(pMac, LOG1,
+ FL("received HIDE_SSID message\n")););
+
+ if(pMsgBuf == NULL)
+ {
+ limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
+ return;
+ }
+
+ pUpdateParams = (tpSirUpdateParams)pMsgBuf;
+
+ if((psessionEntry = peFindSessionBySessionId(pMac, pUpdateParams->sessionId)) == NULL)
+ {
+ limLog(pMac, LOGW, "Session does not exist for given sessionId %d\n",
+ pUpdateParams->sessionId);
+ return;
+ }
+
+ /* Update the session entry */
+ psessionEntry->ssidHidden = pUpdateParams->ssidHidden;
+
+ /* Update beacon */
+ schSetFixedBeaconFields(pMac, psessionEntry);
+ limSendBeaconInd(pMac, psessionEntry);
+
+ return;
+} /*** end __limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
+
+static void
+__limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId; //PE sessionID
+
+ if(pMsgBuf == NULL)
+ {
+ limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
+ return;
+ }
+
+ if( palAllocateMemory( pMac->hHdd, (void **)&pUpdateAPWPARSNIEsReq, sizeof(tSirUpdateAPWPSIEsReq)))
+ {
+ limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pUpdateAPWPARSNIEsReq\n"));
+ return;
+ }
+
+ if ((limUpdateAPWPARSNIEsReqSerDes(pMac, pUpdateAPWPARSNIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
+ {
+ limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message\n"));
+ goto end;
+ }
+
+ if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPARSNIEsReq->bssId, &sessionId)) == NULL)
+ {
+ limLog(pMac, LOGW, FL("Session does not exist for given BSSID\n"));
+ goto end;
+ }
+
+ palCopyMemory(pMac->hHdd, &psessionEntry->pLimStartBssReq->rsnIE, &pUpdateAPWPARSNIEsReq->APWPARSNIEs, sizeof(tSirRSNie));
+
+ limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac, &psessionEntry->pLimStartBssReq->rsnIE, psessionEntry);
+
+ psessionEntry->pLimStartBssReq->privacy = 1;
+ psessionEntry->privacy = 1;
+
+ schSetFixedBeaconFields(pMac, psessionEntry);
+ limSendBeaconInd(pMac, psessionEntry);
+
+end:
+ palFreeMemory( pMac->hHdd, pUpdateAPWPARSNIEsReq);
+ return;
+} /*** end __limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
+
+#endif
+
+
+/** -------------------------------------------------------------
+\fn limProcessSmeDelBaPeerInd
+\brief handles indication message from HDD to send delete BA request
+\param tpAniSirGlobal pMac
+\param tANI_U32 pMsgBuf
+\return None
+-------------------------------------------------------------*/
+void
+limProcessSmeDelBaPeerInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tANI_U16 assocId =0;
+ tpSmeDelBAPeerInd pSmeDelBAPeerInd = (tpSmeDelBAPeerInd)pMsgBuf;
+ tpDphHashNode pSta;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId;
+
+
+
+ if(NULL == pSmeDelBAPeerInd)
+ return;
+
+ if ((psessionEntry = peFindSessionByBssid(pMac,pSmeDelBAPeerInd->bssId,&sessionId))==NULL)
+ {
+ limLog(pMac, LOGE,FL("session does not exist for given bssId\n"));
+ return;
+ }
+ limLog(pMac, LOGW, FL("called with staId = %d, tid = %d, baDirection = %d\n"),
+ pSmeDelBAPeerInd->staIdx, pSmeDelBAPeerInd->baTID, pSmeDelBAPeerInd->baDirection);
+
+ pSta = dphLookupAssocId(pMac, pSmeDelBAPeerInd->staIdx, &assocId, &psessionEntry->dph.dphHashTable);
+ if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
+ pSta,
+ pSmeDelBAPeerInd->baDirection,
+ pSmeDelBAPeerInd->baTID,
+ eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry))
+ {
+ limLog( pMac, LOGW,
+ FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
+ if (pSta)
+ limPrintMacAddr(pMac, pSta->staAddr, LOGW);
+ }
+}
+
+// --------------------------------------------------------------------
+/**
+ * __limProcessReportMessage
+ *
+ * FUNCTION: Processes the next received Radio Resource Management message
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param None
+ * @return None
+ */
+
+void __limProcessReportMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
+{
+#ifdef WLAN_FEATURE_VOWIFI
+ switch (pMsg->type)
+ {
+ case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
+ rrmProcessNeighborReportReq( pMac, pMsg->bodyptr );
+ break;
+ case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
+ {
+#if defined FEATURE_WLAN_CCX
+ tpSirBeaconReportXmitInd pBcnReport=NULL;
+ tpPESession psessionEntry=NULL;
+ tANI_U8 sessionId;
+
+ if(pMsg->bodyptr == NULL)
+ {
+ limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
+ return;
+ }
+ pBcnReport = (tpSirBeaconReportXmitInd )pMsg->bodyptr;
+ if((psessionEntry = peFindSessionByBssid(pMac, pBcnReport->bssId,&sessionId))== NULL)
+ {
+ limLog(pMac, LOGE, "Session Does not exist for given bssId\n");
+ return;
+ }
+ if (psessionEntry->isCCXconnection)
+ ccxProcessBeaconReportXmit( pMac, pMsg->bodyptr);
+ else
+#endif
+ rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr );
+ }
+ break;
+ }
+#endif
+}
+
+#if defined(FEATURE_WLAN_CCX) || defined(WLAN_FEATURE_VOWIFI)
+// --------------------------------------------------------------------
+/**
+ * limSendSetMaxTxPowerReq
+ *
+ * FUNCTION: Send SIR_HAL_SET_MAX_TX_POWER_REQ message to change the max tx power.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param txPower txPower to be set.
+ * @param pSessionEntry session entry.
+ * @return None
+ */
+tSirRetStatus
+limSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry )
+{
+ tpMaxTxPowerParams pMaxTxParams = NULL;
+ tSirRetStatus retCode = eSIR_SUCCESS;
+ tSirMsgQ msgQ;
+
+ if( pSessionEntry == NULL )
+ {
+ PELOGE(limLog(pMac, LOGE, "%s:%d: Inavalid parameters\n", __func__, __LINE__ );)
+ return eSIR_FAILURE;
+ }
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pMaxTxParams, sizeof(tMaxTxPowerParams) ) )
+ {
+ limLog( pMac, LOGP, "%s:%d:Unable to allocate memory for pMaxTxParams \n", __func__, __LINE__);
+ return eSIR_MEM_ALLOC_FAILED;
+
+ }
+#if defined(WLAN_VOWIFI_DEBUG) || defined(FEATURE_WLAN_CCX)
+ PELOG1(limLog( pMac, LOG1, "%s:%d: Allocated memory for pMaxTxParams...will be freed in other module\n", __func__, __LINE__ );)
+#endif
+ pMaxTxParams->power = txPower;
+ palCopyMemory( pMac->hHdd, pMaxTxParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
+ palCopyMemory( pMac->hHdd, pMaxTxParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
+
+ msgQ.type = WDA_SET_MAX_TX_POWER_REQ;
+ msgQ.bodyptr = pMaxTxParams;
+ msgQ.bodyval = 0;
+ PELOGW(limLog(pMac, LOG1, FL("Posting WDA_SET_MAX_TX_POWER_REQ to WDA\n"));)
+ if(eSIR_SUCCESS != (retCode = wdaPostCtrlMsg(pMac, &msgQ)))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed\n"));)
+ if (NULL != pMaxTxParams)
+ {
+ palFreeMemory(pMac->hHdd, (tANI_U8*)pMaxTxParams);
+ }
+ return retCode;
+ }
+ return retCode;
+}
+#endif
+
+/**
+ * __limProcessSmeAddStaSelfReq()
+ *
+ *FUNCTION:
+ * This function is called to process SME_ADD_STA_SELF_REQ message
+ * from SME. It sends a SIR_HAL_ADD_STA_SELF_REQ message to HAL.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the SME message buffer
+ * @return None
+ */
+
+static void
+__limProcessSmeAddStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tSirMsgQ msg;
+ tpAddStaSelfParams pAddStaSelfParams;
+ tpSirSmeAddStaSelfReq pSmeReq = (tpSirSmeAddStaSelfReq) pMsgBuf;
+
+ if ( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void**) &pAddStaSelfParams,
+ sizeof( tAddStaSelfParams) ) )
+ {
+ limLog( pMac, LOGP, FL("Unable to allocate memory for tAddSelfStaParams") );
+ return;
+ }
+
+ palCopyMemory( pMac->hHdd, pAddStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
+
+ msg.type = SIR_HAL_ADD_STA_SELF_REQ;
+ msg.reserved = 0;
+ msg.bodyptr = pAddStaSelfParams;
+ msg.bodyval = 0;
+
+ PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL\n"));)
+ MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+
+ if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
+ {
+ limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed\n"));
+ }
+ return;
+} /*** end __limProcessAddStaSelfReq() ***/
+
+
+/**
+ * __limProcessSmeDelStaSelfReq()
+ *
+ *FUNCTION:
+ * This function is called to process SME_DEL_STA_SELF_REQ message
+ * from SME. It sends a SIR_HAL_DEL_STA_SELF_REQ message to HAL.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the SME message buffer
+ * @return None
+ */
+
+static void
+__limProcessSmeDelStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ tSirMsgQ msg;
+ tpDelStaSelfParams pDelStaSelfParams;
+ tpSirSmeDelStaSelfReq pSmeReq = (tpSirSmeDelStaSelfReq) pMsgBuf;
+
+ if ( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void**) &pDelStaSelfParams,
+ sizeof( tDelStaSelfParams) ) )
+ {
+ limLog( pMac, LOGP, FL("Unable to allocate memory for tDelStaSelfParams") );
+ return;
+ }
+
+ palCopyMemory( pMac->hHdd, pDelStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
+
+ msg.type = SIR_HAL_DEL_STA_SELF_REQ;
+ msg.reserved = 0;
+ msg.bodyptr = pDelStaSelfParams;
+ msg.bodyval = 0;
+
+ PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL\n"));)
+ MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+
+ if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
+ {
+ limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed\n"));
+ }
+ return;
+} /*** end __limProcessSmeDelStaSelfReq() ***/
+
+
+#ifdef WLAN_FEATURE_P2P
+/**
+ * __limProcessSmeRegisterMgmtFrameReq()
+ *
+ *FUNCTION:
+ * This function is called to process eWNI_SME_REGISTER_MGMT_FRAME_REQ message
+ * from SME. It Register this information within PE.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pMsgBuf A pointer to the SME message buffer
+ * @return None
+ */
+static void
+__limProcessSmeRegisterMgmtFrameReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+ VOS_STATUS vosStatus;
+ tpSirRegisterMgmtFrame pSmeReq = (tpSirRegisterMgmtFrame)pMsgBuf;
+ tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
+
+ PELOG1(limLog(pMac, LOG1,
+ FL("%s: registerFrame %d, frameType %d, matchLen %d\n",
+ __func__, pSmeReq->registerFrame, pSmeReq->frameType,
+ pSmeReq->matchLen)));
+
+ if(pSmeReq->registerFrame)
+ {
+ palAllocateMemory(pMac, (void**)&pLimMgmtRegistration,
+ sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen);
+ if(pLimMgmtRegistration != NULL)
+ {
+ palZeroMemory(pMac, (void*)pLimMgmtRegistration,
+ sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen );
+ pLimMgmtRegistration->frameType = pSmeReq->frameType;
+ pLimMgmtRegistration->matchLen = pSmeReq->matchLen;
+ pLimMgmtRegistration->sessionId = pSmeReq->sessionId;
+ if(pSmeReq->matchLen)
+ {
+ palCopyMemory(pMac,pLimMgmtRegistration->matchData,
+ pSmeReq->matchData, pSmeReq->matchLen);
+ }
+
+ vos_list_insert_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
+ &pLimMgmtRegistration->node);
+ }
+ }
+ else
+ {
+ tANI_BOOLEAN match = VOS_FALSE;
+
+ vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
+ (vos_list_node_t**)&pLimMgmtRegistration);
+
+ while(pLimMgmtRegistration != NULL)
+ {
+ if (pLimMgmtRegistration->frameType == pSmeReq->frameType)
+ {
+ if(pSmeReq->matchLen)
+ {
+ if (pLimMgmtRegistration->matchLen == pSmeReq->matchLen)
+ {
+ if (palEqualMemory(pMac, pLimMgmtRegistration->matchData,
+ pSmeReq->matchData, pLimMgmtRegistration->matchLen))
+ {
+ /* found match! */
+ match = VOS_TRUE;
+ break;
+ }
+ }
+ }
+ else
+ {
+ /* found match! */
+ match = VOS_TRUE;
+ break;
+ }
+ }
+ vosStatus = vos_list_peek_next (
+ &pMac->lim.gLimMgmtFrameRegistratinQueue,
+ (vos_list_node_t*) pLimMgmtRegistration,
+ (vos_list_node_t**) &pNext );
+
+ pLimMgmtRegistration = pNext;
+ pNext = NULL;
+
+ }
+
+ if (match)
+ {
+ vos_list_remove_node(&pMac->lim.gLimMgmtFrameRegistratinQueue,
+ (vos_list_node_t*)pLimMgmtRegistration);
+ palFreeMemory(pMac,pLimMgmtRegistration);
+ }
+ }
+
+ return;
+} /*** end __limProcessSmeRegisterMgmtFrameReq() ***/
+#endif
+
+
+/**
+ * limProcessSmeReqMessages()
+ *
+ *FUNCTION:
+ * This function is called by limProcessMessageQueue(). This
+ * function processes SME request messages from HDD or upper layer
+ * application.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param msgType Indicates the SME message type
+ * @param *pMsgBuf A pointer to the SME message buffer
+ * @return Boolean - TRUE - if pMsgBuf is consumed and can be freed.
+ * FALSE - if pMsgBuf is not to be freed.
+ */
+
+tANI_BOOLEAN
+limProcessSmeReqMessages(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
+{
+ tANI_BOOLEAN bufConsumed = TRUE; //Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed.
+ tANI_U32 *pMsgBuf = pMsg->bodyptr;
+
+ PELOG1(limLog(pMac, LOG1, FL("LIM Received SME Message %s(%d) LimSmeState:%s(%d) LimMlmState: %s(%d)\n"),
+ limMsgStr(pMsg->type), pMsg->type,
+ limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState,
+ limMlmStateStr(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState );)
+
+ switch (pMsg->type)
+ {
+ case eWNI_SME_START_REQ:
+ __limProcessSmeStartReq(pMac, pMsgBuf);
+ break;
+
+ case eWNI_SME_SYS_READY_IND:
+ bufConsumed = __limProcessSmeSysReadyInd(pMac, pMsgBuf);
+ break;
+
+
+ case eWNI_SME_START_BSS_REQ:
+ bufConsumed = __limProcessSmeStartBssReq(pMac, pMsg);
+ break;
+
+ case eWNI_SME_SCAN_REQ:
+ __limProcessSmeScanReq(pMac, pMsgBuf);
+
+ break;
+
+#ifdef WLAN_FEATURE_P2P
+ case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
+ bufConsumed = limProcessRemainOnChnlReq(pMac, pMsgBuf);
+ break;
+
+ case eWNI_SME_UPDATE_NOA:
+ __limProcessSmeNoAUpdate(pMac, pMsgBuf);
+ break;
+#endif
+ case eWNI_SME_JOIN_REQ:
+ __limProcessSmeJoinReq(pMac, pMsgBuf);
+
+ break;
+
+ case eWNI_SME_AUTH_REQ:
+ // __limProcessSmeAuthReq(pMac, pMsgBuf);
+
+ break;
+
+ case eWNI_SME_REASSOC_REQ:
+ __limProcessSmeReassocReq(pMac, pMsgBuf);
+
+ break;
+
+ case eWNI_SME_PROMISCUOUS_MODE_REQ:
+ //__limProcessSmePromiscuousReq(pMac, pMsgBuf);
+
+ break;
+
+ case eWNI_SME_DISASSOC_REQ:
+ __limProcessSmeDisassocReq(pMac, pMsgBuf);
+
+ break;
+
+ case eWNI_SME_DISASSOC_CNF:
+ case eWNI_SME_DEAUTH_CNF:
+ __limProcessSmeDisassocCnf(pMac, pMsgBuf);
+
+ break;
+
+ case eWNI_SME_DEAUTH_REQ:
+ __limProcessSmeDeauthReq(pMac, pMsgBuf);
+
+ break;
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+ case eWNI_SME_SWITCH_CHL_REQ:
+ case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
+ case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
+ bufConsumed = __limProcessSmeSwitchChlReq(pMac, pMsg);
+ break;
+#endif
+
+
+ case eWNI_SME_SETCONTEXT_REQ:
+ __limProcessSmeSetContextReq(pMac, pMsgBuf);
+
+ break;
+
+ case eWNI_SME_REMOVEKEY_REQ:
+ __limProcessSmeRemoveKeyReq(pMac, pMsgBuf);
+
+ break;
+
+ case eWNI_SME_STOP_BSS_REQ:
+ bufConsumed = __limProcessSmeStopBssReq(pMac, pMsg);
+ break;
+
+ case eWNI_SME_ASSOC_CNF:
+ case eWNI_SME_REASSOC_CNF:
+ if (pMsg->type == eWNI_SME_ASSOC_CNF)
+ PELOG1(limLog(pMac, LOG1, FL("Received ASSOC_CNF message\n"));)
+ else
+ PELOG1(limLog(pMac, LOG1, FL("Received REASSOC_CNF message\n"));)
+#ifdef ANI_PRODUCT_TYPE_AP
+ __limProcessSmeAssocCnf(pMac, pMsg->type, pMsgBuf);
+#endif
+ __limProcessSmeAssocCnfNew(pMac, pMsg->type, pMsgBuf);
+ break;
+
+ case eWNI_SME_ADDTS_REQ:
+ PELOG1(limLog(pMac, LOG1, FL("Received ADDTS_REQ message\n"));)
+ __limProcessSmeAddtsReq(pMac, pMsgBuf);
+ break;
+
+ case eWNI_SME_DELTS_REQ:
+ PELOG1(limLog(pMac, LOG1, FL("Received DELTS_REQ message\n"));)
+ __limProcessSmeDeltsReq(pMac, pMsgBuf);
+ break;
+
+ case SIR_LIM_ADDTS_RSP_TIMEOUT:
+ PELOG1(limLog(pMac, LOG1, FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message \n"));)
+ limProcessSmeAddtsRspTimeout(pMac, pMsg->bodyval);
+ break;
+
+ case eWNI_SME_STA_STAT_REQ:
+ case eWNI_SME_AGGR_STAT_REQ:
+ case eWNI_SME_GLOBAL_STAT_REQ:
+ case eWNI_SME_STAT_SUMM_REQ:
+ __limProcessSmeStatsRequest( pMac, pMsgBuf);
+ //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
+ bufConsumed = FALSE;
+ break;
+ case eWNI_SME_GET_STATISTICS_REQ:
+ __limProcessSmeGetStatisticsRequest( pMac, pMsgBuf);
+ //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
+ bufConsumed = FALSE;
+ break;
+ case eWNI_SME_DEL_BA_PEER_IND:
+ limProcessSmeDelBaPeerInd(pMac, pMsgBuf);
+ break;
+ case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
+ limProcessSmeGetScanChannelInfo(pMac, pMsgBuf);
+ break;
+#ifdef WLAN_SOFTAP_FEATURE
+ case eWNI_SME_GET_ASSOC_STAS_REQ:
+ limProcessSmeGetAssocSTAsInfo(pMac, pMsgBuf);
+ break;
+ case eWNI_SME_TKIP_CNTR_MEAS_REQ:
+ limProcessTkipCounterMeasures(pMac, pMsgBuf);
+ break;
+
+ case eWNI_SME_HIDE_SSID_REQ:
+ __limProcessSmeHideSSID(pMac, pMsgBuf);
+ break;
+ case eWNI_SME_UPDATE_APWPSIE_REQ:
+ __limProcessSmeUpdateAPWPSIEs(pMac, pMsgBuf);
+ break;
+ case eWNI_SME_GET_WPSPBC_SESSION_REQ:
+ limProcessSmeGetWPSPBCSessions(pMac, pMsgBuf);
+ break;
+
+ case eWNI_SME_SET_APWPARSNIEs_REQ:
+ __limProcessSmeSetWPARSNIEs(pMac, pMsgBuf);
+ break;
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI
+ case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
+ case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
+ __limProcessReportMessage(pMac, pMsg);
+ break;
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+ case eWNI_SME_FT_PRE_AUTH_REQ:
+ bufConsumed = (tANI_BOOLEAN)limProcessFTPreAuthReq(pMac, pMsg);
+ break;
+ case eWNI_SME_FT_UPDATE_KEY:
+ limProcessFTUpdateKey(pMac, pMsgBuf);
+ break;
+
+ case eWNI_SME_FT_AGGR_QOS_REQ:
+ limProcessFTAggrQosReq(pMac, pMsgBuf);
+ break;
+#endif
+
+#if defined FEATURE_WLAN_CCX
+ case eWNI_SME_CCX_ADJACENT_AP_REPORT:
+ limProcessAdjacentAPRepMsg ( pMac, pMsgBuf );
+ break;
+#endif
+ case eWNI_SME_ADD_STA_SELF_REQ:
+ __limProcessSmeAddStaSelfReq( pMac, pMsgBuf );
+ break;
+ case eWNI_SME_DEL_STA_SELF_REQ:
+ __limProcessSmeDelStaSelfReq( pMac, pMsgBuf );
+ break;
+
+#ifdef WLAN_FEATURE_P2P
+ case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
+ __limProcessSmeRegisterMgmtFrameReq( pMac, pMsgBuf );
+ break;
+#endif
+
+
+ default:
+ vos_mem_free((v_VOID_t*)pMsg->bodyptr);
+ pMsg->bodyptr = NULL;
+ break;
+ } // switch (msgType)
+
+ return bufConsumed;
+} /*** end limProcessSmeReqMessages() ***/
diff --git a/CORE/MAC/src/pe/lim/limPropExtsUtils.c b/CORE/MAC/src/pe/lim/limPropExtsUtils.c
new file mode 100644
index 0000000..cfd824f
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limPropExtsUtils.c
@@ -0,0 +1,1475 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limPropExtsUtils.cc contains the utility functions
+ * to populate, parse proprietary extensions required to
+ * support ANI feature set.
+ *
+ * Author: Chandra Modumudi
+ * Date: 11/27/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#include "aniGlobal.h"
+#ifdef ANI_PRODUCT_TYPE_AP
+#include "wniCfgAp.h"
+#else
+#include "wniCfgSta.h"
+#endif
+#include "sirCommon.h"
+#include "sirDebug.h"
+#include "utilsApi.h"
+#include "cfgApi.h"
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halCommonApi.h"
+#endif
+#include "limApi.h"
+#include "limTypes.h"
+#include "limUtils.h"
+#include "limAssocUtils.h"
+#include "limPropExtsUtils.h"
+#include "limSerDesUtils.h"
+#include "limTrace.h"
+#include "limSession.h"
+
+#define LIM_GET_NOISE_MAX_TRY 5
+#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+/**
+ * limGetCurrentLearnChannel()
+ *
+ *FUNCTION:
+ * This function is called in various places to get current channel
+ * number being 'learned'.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return Channel number
+ */
+tANI_U8
+limGetCurrentLearnChannel(tpAniSirGlobal pMac)
+{
+ tANI_U8 *pChanNum = pMac->lim.gpLimMeasReq->channelList.channelNumber;
+
+ return (*(pChanNum + pMac->lim.gLimMeasParams.nextLearnChannelId));
+} /*** end limGetCurrentLearnChannel() ***/
+#endif //#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+
+/**
+ * limExtractApCapability()
+ *
+ *FUNCTION:
+ * This function is called to extract AP's HCF/WME/WSM capability
+ * from the IEs received from it in Beacon/Probe Response frames
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pIE Pointer to starting IE in Beacon/Probe Response
+ * @param ieLen Length of all IEs combined
+ * @param qosCap Bits are set according to capabilities
+ * @return 0 - If AP does not assert HCF capability & 1 - otherwise
+ */
+
+void
+limExtractApCapability(tpAniSirGlobal pMac, tANI_U8 *pIE, tANI_U16 ieLen,
+ tANI_U8 *qosCap, tANI_U16 *propCap, tANI_U8 *uapsd,
+ tPowerdBm *localConstraint
+ )
+{
+ tSirProbeRespBeacon beaconStruct;
+#if !defined WLAN_FEATURE_VOWIFI
+ tANI_U32 localPowerConstraints = 0;
+#endif
+
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) &beaconStruct, sizeof(beaconStruct));
+
+ *qosCap = 0;
+ *propCap = 0;
+ *uapsd = 0;
+
+ PELOG3(limLog( pMac, LOG3,
+ FL("In limExtractApCapability: The IE's being received are:\n"));
+ sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG3, pIE, ieLen );)
+ if (sirParseBeaconIE(pMac, &beaconStruct, pIE, (tANI_U32)ieLen) == eSIR_SUCCESS)
+ {
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ if (beaconStruct.propIEinfo.hcfEnabled)
+ LIM_BSS_CAPS_SET(HCF, *qosCap);
+#endif
+ if (beaconStruct.wmeInfoPresent || beaconStruct.wmeEdcaPresent)
+ LIM_BSS_CAPS_SET(WME, *qosCap);
+ if (LIM_BSS_CAPS_GET(WME, *qosCap) && beaconStruct.wsmCapablePresent)
+ LIM_BSS_CAPS_SET(WSM, *qosCap);
+ if (beaconStruct.propIEinfo.aniIndicator &&
+ beaconStruct.propIEinfo.capabilityPresent)
+ *propCap = beaconStruct.propIEinfo.capability;
+ if (beaconStruct.HTCaps.present)
+ pMac->lim.htCapabilityPresentInBeacon = 1;
+ else
+ pMac->lim.htCapabilityPresentInBeacon = 0;
+
+ // Extract the UAPSD flag from WMM Parameter element
+ if (beaconStruct.wmeEdcaPresent)
+ *uapsd = beaconStruct.edcaParams.qosInfo.uapsd;
+
+#if defined FEATURE_WLAN_CCX
+ /* If there is Power Constraint Element specifically,
+ * adapt to it. Hence there is else condition check
+ * for this if statement.
+ */
+ if ( beaconStruct.ccxTxPwr.present)
+ {
+ *localConstraint = beaconStruct.ccxTxPwr.power_limit;
+ }
+#endif
+
+ if (beaconStruct.powerConstraintPresent && ( pMac->lim.gLim11hEnable
+#if defined WLAN_FEATURE_VOWIFI
+ || pMac->rrm.rrmPEContext.rrmEnable
+#endif
+ ))
+ {
+#if defined WLAN_FEATURE_VOWIFI
+ *localConstraint -= beaconStruct.localPowerConstraint.localPowerConstraints;
+#else
+ localPowerConstraints = (tANI_U32)beaconStruct.localPowerConstraint.localPowerConstraints;
+#endif
+ }
+
+#if !defined WLAN_FEATURE_VOWIFI
+ if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, localPowerConstraints) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Could not update local power constraint to cfg.\n"));
+ }
+#endif
+ }
+
+ return;
+} /****** end limExtractApCapability() ******/
+
+
+
+#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+/**
+ * limQuietBss()
+ *
+ *FUNCTION:
+ * This function is called to quiet the BSS
+ * while entering into Learn mode
+ *
+ *LOGIC:
+ * Data frame to self with duration value passed is
+ * transmitted
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * If all associated STAs are 11h compliant, Quiet IE
+ * need to be sent in Beacon/Probe Response frames.
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param duration Specifies quiet duration in millisec
+ * @return None
+ */
+
+void
+limQuietBss(tpAniSirGlobal pMac, tANI_U32 duration)
+{
+
+ // Temporarily not quieting BSS
+ (void) pMac; (void) duration;
+ return;
+} /****** end limQuietBss() ******/
+
+
+
+/**
+ * limIsMatrixNodePresent()
+ *
+ *FUNCTION:
+ * This function is called to determine if measurements are
+ * already made on the current learn channel
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return pNode - Pointer to Matrix node if found. Else NULL
+ */
+
+static tpLimMeasMatrixNode
+limIsMatrixNodePresent(tpAniSirGlobal pMac)
+{
+ tANI_U8 i, chanNum = limGetCurrentLearnChannel(pMac);
+ tpLimMeasMatrixNode pNode = pMac->lim.gpLimMeasData->pMeasMatrixInfo;
+
+ if (!pNode)
+ return NULL;
+
+ for (i = 0; i < pMac->lim.gpLimMeasReq->channelList.numChannels; i++)
+ {
+ if (pNode->matrix.channelNumber == chanNum)
+ {
+ return pNode;
+ }
+ else
+ {
+ if (pNode->next)
+ pNode = pNode->next;
+ else
+ break;
+ }
+ }
+
+ return NULL;
+} /****** end limIsMatrixNodePresent() ******/
+
+
+
+/**
+ * limGetMatrixNode()
+ *
+ *FUNCTION:
+ * This function is called to get a metrics node associated
+ * with the current measurement channel. If no node is found
+ * for this channel, one is added at the beginning of the list.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return None
+ */
+
+static tpLimMeasMatrixNode
+limGetMatrixNode(tpAniSirGlobal pMac)
+{
+ tpLimMeasMatrixNode pNewMatrix;
+ eHalStatus status;
+
+ pNewMatrix = limIsMatrixNodePresent(pMac);
+ if (!pNewMatrix)
+ {
+ // Making first time measurements on this channel.
+ // Add matrix node for this at the front.
+ status = palAllocateMemory( pMac->hHdd, (void **)&pNewMatrix, sizeof(*pNewMatrix));
+ if (status != eHAL_STATUS_SUCCESS)
+ {
+ /// Could not allocate buffer for new measMatrix Node
+ // Log error
+ limLog(pMac, LOGP,
+ FL("palAllocateMemory failed for new measMatrix Node\n"));
+ return NULL;
+ }
+
+ status = palZeroMemory( pMac->hHdd, (void *)pNewMatrix, sizeof(*pNewMatrix));
+ if (status != eHAL_STATUS_SUCCESS)
+ {
+ /// Could not allocate buffer for new measMatrix Node
+ // Log error
+ limLog(pMac, LOGP,
+ FL("palZeroMemory failed for new measMatrix Node\n"));
+ return NULL;
+ }
+
+ pNewMatrix->matrix.channelNumber =
+ limGetCurrentLearnChannel(pMac);
+ pNewMatrix->avgRssi = 0;
+
+ PELOG3(limLog(pMac, LOG3, FL("Adding new Matrix info:channel#=%d\n"),
+ pNewMatrix->matrix.channelNumber);)
+
+ pNewMatrix->next = pMac->lim.gpLimMeasData->pMeasMatrixInfo;
+ pMac->lim.gpLimMeasData->pMeasMatrixInfo = pNewMatrix;
+ pMac->lim.gpLimMeasData->numMatrixNodes++;
+ }
+
+ return pNewMatrix;
+} /****** end limGetMatrixNode() ******/
+
+
+
+/**
+ * limComputeAvg()
+ *
+ *FUNCTION:
+ * This function is called to compute exponential average
+ * of RSSI, channel utilization etc.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param oldVal Previous averaged value
+ * @param newVal New averaged value
+ * @return None
+ */
+
+tANI_U32
+limComputeAvg(tpAniSirGlobal pMac, tANI_U32 oldVal, tANI_U32 newVal)
+{
+ return (halExpAvg(newVal,
+ oldVal,
+ pMac->lim.gLimMeasParams.rssiAlpha));
+} /****** end limComputeAvg() ******/
+
+
+
+/**
+ * limCollectRSSI()
+ *
+ *FUNCTION:
+ * This function is called to collect RSSI measurements on
+ * the current learn channel
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limCollectRSSI(tpAniSirGlobal pMac)
+{
+ tpLimMeasMatrixNode pNewMatrix = limGetMatrixNode(pMac);
+ tANI_U32 i, noise;
+
+ for (i = 0; i < LIM_GET_NOISE_MAX_TRY; i++)
+ if ((noise = halGetNoise(pMac)) != HAL_NOISE_INVALID)
+ {
+ pNewMatrix->avgRssi = limComputeAvg(pMac,
+ pNewMatrix->avgRssi,
+ noise);
+ break;
+ }
+} /****** end limCollectRSSI() ******/
+
+
+/**----------------------------------------------------------------------------
+\fn limGetNeighbourBssNode
+
+\brief returns neighbour bss node if it is already present in the list.
+\param pMac
+\param bssid - Bssid of new beacon or data packet.
+\param pSsId - Pointer to SSID of new packet.
+\param nwType - 11b/g/a
+\param chanId - Channel in which we received the packet.
+
+\return tpLimNeighborBssWdsNode or NULL
+-------------------------------------------------------------------------------*/
+static tpLimNeighborBssWdsNode
+limGetNeighbourBssNode(tpAniSirGlobal pMac, tANI_U8 *bssId, tANI_U8 chanId,
+ tSirNwType nwType, tpAniSSID pSsId, tANI_U8 type)
+{
+ tpLimNeighborBssWdsNode pNode = pMac->lim.gpLimMeasData->pNeighborWdsInfo;
+
+ while (pNode)
+ {
+ //Do we need to check for ssId also ?
+ if (palEqualMemory(pMac->hHdd, pNode->info.neighborBssInfo.bssId,
+ bssId, sizeof(tSirMacAddr)) &&
+ (pNode->info.neighborBssInfo.channelId == chanId))
+ {
+#if 0
+/** Commented out assuming that comparing bssId and ChanId would be enough to
+uniquely identify a particular BSS, Uncomment if strict checking is needed,
+eventhough not possible if packet type is DATA. */
+ if (type == eSIR_MAC_MGMT_FRAME)
+ {
+ /** Beacon Frame */
+ if (palEqualMemory(pMac->hHdd, &pNode->info.neighborBssInfo.ssId,
+ pSsId, pSsId->length+1) &&
+ (pNode->info.neighborBssInfo.nwType == nwType))
+ {
+ return pNode;
+ }
+ }
+ else
+#endif
+ return pNode;
+ }
+
+ if (!pNode->next)
+ break;
+ else
+ pNode = pNode->next;
+ }
+
+ return NULL;
+}
+
+
+/**
+ * limCollectMeasurementData()
+ *
+ *FUNCTION:
+ * This function is called upon receiving Beacon/Probe Response
+ * or Data frames to collect measurement related data.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pRxPacketInfo - Pointer to received BD+payload
+ * @param pBeacon - Pointer to parsed BSS info
+ * @return None
+ */
+
+void
+limCollectMeasurementData(tpAniSirGlobal pMac,
+ tANI_U32 *pRxPacketInfo, tpSchBeaconStruct pBeacon)
+{
+ tANI_U16 allocLen=0, len=0, realLen=0, ieLen=0;
+ tANI_U32 i;
+ tANI_U8 found = eANI_BOOLEAN_TRUE;
+ tSirMacFrameCtl fc ;
+ tSirMacAddr bssIdRcv;
+ tSirNwType nwType;
+ tAniSSID ssId;
+ tANI_U8 chanId = 0;
+ tpLimNeighborBssWdsNode pNode = NULL;
+ tpLimMeasMatrixNode pNewMatrix;
+ eHalStatus status;
+ tpSirMacMgmtHdr pHdr;
+
+ PELOG3(limLog(pMac, LOG3, FL("Collecting measurement data for RadioId %d\n"),
+ pMac->sys.gSirRadioId);)
+
+ tANI_U32 ignore = 0;
+ limGetBssidFromBD(pMac, (tpHalBufDesc) pRxPacketInfo, bssIdRcv, &ignore);
+ if (palEqualMemory( pMac->hHdd, bssIdRcv, pMac->lim.gLimBssid, sizeof(tSirMacAddr)))
+ {
+ // Packet received from our own BSS, dont take measurement.
+ return;
+ }
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+ fc = pHdr->fc;
+
+ if (fc.type == SIR_MAC_DATA_FRAME)
+ {
+ PELOG2(limLog(pMac, LOG2, FL("Received DATA packet\n"));)
+ ssId.length = 0;
+ ieLen = 0;
+ }
+ else
+ {
+ /** Probe response or beaccon packet */
+ palCopyMemory(pMac->hHdd, (void *)&ssId, (void *) &pBeacon->ssId,
+ sizeof(ssId));
+ chanId = limGetChannelFromBeacon(pMac, pBeacon);
+ ieLen = pBeacon->wpa.length + pBeacon->propIEinfo.wdsLength;
+ }
+
+ if (chanId == 0)
+ {
+ /* If the channel Id is not retrieved from Beacon, extract the channel from BD */
+ /* Unmapped the channel.This We have to do since we have done mapping in the hal to
+ overcome the limitation of RXBD of not able to accomodate the bigger channel number.*/
+ chanId = WDA_GET_RX_CH(pRxPacketInfo);
+ if(!( chanId = limUnmapChannel(chanId)))
+ {
+ chanId = pMac->lim.gLimCurrentScanChannelId;
+ }
+ }
+
+ /*
+ * Now always returns nwType as 11G for data packets - FIXIT
+ */
+ nwType = limGetNwType(pMac, chanId, fc.type, pBeacon);
+
+ pNewMatrix = limGetMatrixNode(pMac);
+ /** LOGP would result in freeing all dynamicall allocated memories. So
+ * return from here if limGetMatrixNode returns NULL
+ */
+ if (!pNewMatrix)
+ return;
+
+ pNewMatrix->matrix.aggrRssi += WDA_GET_RX_RSSI_DB(pRxPacketInfo);
+ pNewMatrix->matrix.totalPackets++;
+
+ // Find if this neighbor is already 'learned'
+ // If found, update its information.
+ pNode = limGetNeighbourBssNode(pMac, bssIdRcv, chanId, nwType, &ssId, fc.type);
+
+ if (!pNode)
+ {
+ realLen = sizeof(tSirNeighborBssWdsInfo);
+
+ /** Newly discovered neighbor. Inform WSM of this
+ * and add this BSS info at the beginning
+ * Need to limit the number newly discovered BSS added
+ * to the list.
+ */
+ len = LIM_MAX_BUF_SIZE - (sizeof(tSirSmeMeasurementInd) +
+ (pMac->lim.gpLimMeasReq->channelList.numChannels *
+ sizeof(tSirMeasMatrixInfo)));
+ PELOG2(limLog(pMac, LOG2, FL("Current BSS length %d, Real length %d\n"),
+ pMac->lim.gpLimMeasData->totalBssSize, realLen);)
+
+ /** Check if we have enough room for adding a new node.
+ */
+ if (pMac->lim.gpLimMeasData->totalBssSize + realLen < len)
+ {
+ pMac->lim.gpLimMeasData->numBssWds++;
+ pMac->lim.gpLimMeasData->totalBssSize += realLen;
+
+ PELOG2(limPrintMacAddr(pMac, bssIdRcv, LOG2);)
+ }
+ else
+ {
+ PELOG2(limLog(pMac, LOG2, FL("Dropping the measurement packets: No memory!\n"));)
+ return;
+ }
+
+ /** Allocate max memory required even if the packet is of type DATA,
+ * So that next time we receive a beacon, won't run out of memory to
+ * update the information.
+ */
+ allocLen = sizeof(tLimNeighborBssWdsNode) + 4 + ieLen;
+ status = palAllocateMemory( pMac->hHdd, (void **)&pNode, allocLen);
+
+ if (status != eHAL_STATUS_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("palAllocateMemory failed for new NeighborBssWds Node\n"));
+ return;
+ }
+
+ status = palZeroMemory(pMac->hHdd, pNode, allocLen);
+ if (status != eHAL_STATUS_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("palAllocateMemory failed for new NeighborBssWds Node\n"));
+ return;
+ }
+ pNode->next = pMac->lim.gpLimMeasData->pNeighborWdsInfo;
+ pMac->lim.gpLimMeasData->pNeighborWdsInfo = pNode;
+ found = eANI_BOOLEAN_FALSE;
+ }
+
+ pNode->info.neighborBssInfo.rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
+ pNode->info.neighborBssInfo.aggrRssi += pNode->info.neighborBssInfo.rssi;
+ if (fc.type == SIR_MAC_DATA_FRAME)
+ pNode->info.neighborBssInfo.dataCount++;
+ pNode->info.neighborBssInfo.totalPackets++;
+
+ /** If node not found or previous learn was not from a beacon/probe rsp
+ * then learn again.
+ */
+ if (!found || ((pNode->info.neighborBssInfo.ssId.length == 0) &&
+ (fc.type == SIR_MAC_MGMT_FRAME)))
+ {
+ palCopyMemory(pMac->hHdd, pNode->info.neighborBssInfo.bssId, bssIdRcv,
+ sizeof(tSirMacAddr));
+ pNode->info.neighborBssInfo.channelId = chanId;
+ if (fc.type == SIR_MAC_DATA_FRAME)
+ {
+ // Data frame received from other BSS.
+ // Collect as much information as possible
+ pNode->info.neighborBssInfo.wniIndicator = (tAniBool) 0;
+
+ if (fc.toDS || fc.fromDS)
+ pNode->info.neighborBssInfo.bssType = eSIR_INFRASTRUCTURE_MODE;
+ else
+ pNode->info.neighborBssInfo.bssType = eSIR_IBSS_MODE;
+
+ pNode->info.neighborBssInfo.load.numStas = 0;
+ pNode->info.neighborBssInfo.load.channelUtilization = 0;
+ pNode->info.neighborBssInfo.ssId.length = 0;
+ pNode->info.neighborBssInfo.apName.length = 0;
+ pNode->info.neighborBssInfo.rsnIE.length = 0;
+ pNode->info.wdsInfo.wdsLength = 0;
+ }
+ else
+ {
+ //FIXME_CBMODE: need to seperate out TITAN and HT cb modes.
+ if(pBeacon->HTCaps.present)
+ {
+ limGetHtCbAdminState(pMac, pBeacon->HTCaps,
+ &pNode->info.neighborBssInfo.titanHtCaps);
+
+ if( pBeacon->HTInfo.present)
+ {
+ limGetHtCbOpState(pMac, pBeacon->HTInfo,
+ &pNode->info.neighborBssInfo.titanHtCaps);
+ }
+ }
+
+ // This must be either Beacon frame or
+ // Probe Response. Copy all relevant information.
+ pNode->info.neighborBssInfo.wniIndicator = (tAniBool) pBeacon->propIEinfo.aniIndicator;
+ pNode->info.neighborBssInfo.bssType = (tSirBssType) pBeacon->capabilityInfo.ibss;
+ pNode->info.neighborBssInfo.load.numStas = pBeacon->propIEinfo.load.numStas;
+ pNode->info.neighborBssInfo.load.channelUtilization = pBeacon->propIEinfo.load.channelUtilization;
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pNode->info.neighborBssInfo.ssId,
+ &pBeacon->ssId, pBeacon->ssId.length+1);
+ pNode->info.neighborBssInfo.apName.length = pBeacon->propIEinfo.apName.length;
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pNode->info.neighborBssInfo.apName.name,
+ pBeacon->propIEinfo.apName.name, pBeacon->propIEinfo.apName.length);
+
+ pNode->info.neighborBssInfo.rsnIE.length = 0;
+ // Add WPA2 information. Before that make sure that memory is available
+ if (pBeacon->rsnPresent && (pBeacon->rsn.length < SIR_MAC_MAX_IE_LENGTH))
+ {
+ pNode->info.neighborBssInfo.rsnIE.length = 2 + pBeacon->rsn.length;
+ pNode->info.neighborBssInfo.rsnIE.rsnIEdata[0] = SIR_MAC_RSN_EID;
+ pNode->info.neighborBssInfo.rsnIE.rsnIEdata[1] = pBeacon->rsn.length;
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pNode->info.neighborBssInfo.rsnIE.rsnIEdata[2],
+ pBeacon->rsn.info, pBeacon->rsn.length);
+
+ PELOG2(limLog(pMac, LOG2, FL("NeighborBss RSN IE, type=%x, length=%x\n"),
+ pNode->info.neighborBssInfo.rsnIE.rsnIEdata[0],
+ pNode->info.neighborBssInfo.rsnIE.rsnIEdata[1]);)
+ }
+
+ // Add WPA information. Before that make sure that memory is available
+ if (pBeacon->wpaPresent && ((pBeacon->rsn.length + pBeacon->wpa.length) < (SIR_MAC_MAX_IE_LENGTH-2)))
+ {
+ pNode->info.neighborBssInfo.rsnIE.rsnIEdata[pNode->info.neighborBssInfo.rsnIE.length] =
+ SIR_MAC_WPA_EID;
+ pNode->info.neighborBssInfo.rsnIE.rsnIEdata[pNode->info.neighborBssInfo.rsnIE.length + 1] =
+ pBeacon->wpa.length;
+
+ palCopyMemory( pMac->hHdd,
+ (tANI_U8 *) &pNode->info.neighborBssInfo.rsnIE.rsnIEdata[pNode->info.neighborBssInfo.rsnIE.length + 2],
+ pBeacon->wpa.info, pBeacon->wpa.length);
+
+ PELOG2(limLog(pMac, LOG2, FL("NeighborBss WPA IE, type=%x, length=%x\n"),
+ pNode->info.neighborBssInfo.rsnIE.rsnIEdata[pNode->info.neighborBssInfo.rsnIE.length],
+ pNode->info.neighborBssInfo.rsnIE.rsnIEdata[pNode->info.neighborBssInfo.rsnIE.length + 1]);)
+ pNode->info.neighborBssInfo.rsnIE.length += 2 + pBeacon->wpa.length;
+ }
+ pNode->info.wdsInfo.wdsLength = (tANI_U16) pBeacon->propIEinfo.wdsLength;
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pNode->info.wdsInfo.wdsBytes,
+ pBeacon->propIEinfo.wdsData,
+ pBeacon->propIEinfo.wdsLength);
+
+ pNode->info.neighborBssInfo.capabilityInfo = *((tANI_U16*)&pBeacon->capabilityInfo);
+
+#if 0
+ if (pBeacon->HTCaps.present)
+ palCopyMemory( pMac->hHdd, (tANI_U8 *)&pNode->info.neighborBssInfo.HTCaps,
+ (tANI_U8 *)&pBeacon->HTCaps, HT_CAPABILITY_IE_SIZE);
+ else
+ pNode->info.neighborBssInfo.HTCaps.present = 0;
+
+ if (pBeacon->HTInfo.present)
+ palCopyMemory( pMac->hHdd, (tANI_U8 *)&pNode->info.neighborBssInfo.HTInfo,
+ (tANI_U8 *)&pBeacon->HTInfo, HT_INFO_IE_SIZE);
+ else
+ pNode->info.neighborBssInfo.HTInfo.present = 0;
+#endif
+
+ if (pBeacon->suppRatesPresent && (pBeacon->supportedRates.numRates <=
+ SIR_MAC_RATESET_EID_MAX))
+ {
+ pNode->info.neighborBssInfo.operationalRateSet.numRates = pBeacon->supportedRates.numRates;
+
+ PELOG4(limLog(pMac, LOG4, FL("Supported Rates (%d) : "),
+ pNode->info.neighborBssInfo.operationalRateSet.numRates);)
+ for (i=0; i<pBeacon->supportedRates.numRates; i++)
+ {
+ pNode->info.neighborBssInfo.operationalRateSet.rate[i] = pBeacon->supportedRates.rate[i];
+ PELOG4(limLog(pMac, LOG4, FL("%d "), pBeacon->supportedRates.rate[i]);)
+ }
+ PELOG4(limLog(pMac, LOG4, FL("\n"));)
+ }
+
+ if (pBeacon->extendedRatesPresent && (pBeacon->extendedRates.numRates <=
+ SIR_MAC_RATESET_EID_MAX))
+ {
+ pNode->info.neighborBssInfo.extendedRateSet.numRates = pBeacon->extendedRates.numRates;
+
+ PELOG4(limLog(pMac, LOG4, FL("Extended Rates (%d) : "),
+ pNode->info.neighborBssInfo.extendedRateSet.numRates);)
+ for (i=0; i<pBeacon->extendedRates.numRates; i++)
+ {
+ pNode->info.neighborBssInfo.extendedRateSet.rate[i] = pBeacon->extendedRates.rate[i];
+ PELOG4(limLog(pMac, LOG4, FL("%d "), pBeacon->extendedRates.rate[i]);)
+ }
+ }
+ else
+ {
+ pNode->info.neighborBssInfo.extendedRateSet.numRates = 0;
+ }
+ pNode->info.neighborBssInfo.nwType = nwType;
+ pNode->info.neighborBssInfo.hcfEnabled = pBeacon->propIEinfo.hcfEnabled;
+ pNode->info.neighborBssInfo.beaconInterval = pBeacon->beaconInterval;
+ pNode->info.neighborBssInfo.wmeInfoPresent = pBeacon->wmeInfoPresent;
+ pNode->info.neighborBssInfo.wmeEdcaPresent = pBeacon->wmeEdcaPresent;
+ pNode->info.neighborBssInfo.wsmCapablePresent = pBeacon->wsmCapablePresent;
+ pNode->info.neighborBssInfo.propIECapability = pBeacon->propIEinfo.capability;
+ pNode->info.neighborBssInfo.localPowerConstraints = pBeacon->localPowerConstraint.localPowerConstraints;
+ pNode->info.neighborBssInfo.dtimPeriod = pBeacon->tim.dtimPeriod;
+ pNode->info.neighborBssInfo.HTCapsPresent = pBeacon->HTCaps.present;
+ pNode->info.neighborBssInfo.HTInfoPresent = pBeacon->HTInfo.present;
+ }
+ }
+} /****** end limCollectMeasurementData() ******/
+
+/**
+ * limCleanupMatrixNodes()
+ *
+ *FUNCTION:
+ * This function is called from various places within LIM code
+ * to cleanup channel info matrix collected by learn mode measurements.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return None
+ */
+
+static void
+limCleanupMatrixNodes(tpAniSirGlobal pMac)
+{
+ if (pMac->lim.gpLimMeasData->pMeasMatrixInfo)
+ {
+ tpLimMeasMatrixNode pNode = pMac->lim.gpLimMeasData->pMeasMatrixInfo;
+ tpLimMeasMatrixNode pNext;
+
+ while (pNode)
+ {
+ pNext = pNode->next;
+ palFreeMemory( pMac->hHdd, pNode);
+
+ if (pNext)
+ pNode = pNext;
+ else
+ break;
+ }
+ }
+
+ pMac->lim.gpLimMeasData->numMatrixNodes = 0;
+ PELOG2(limLog(pMac, LOG2,
+ FL("Cleaned up channel matrix nodes\n"));)
+
+ pMac->lim.gpLimMeasData->pMeasMatrixInfo = NULL;
+} /****** end limCleanupMatrixNodes() ******/
+
+/**
+ * limCleanupNeighborBssNodes()
+ *
+ *FUNCTION:
+ * This function is called from various places within LIM code
+ * to cleanup neighbor info collected by learn mode measurements.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return None
+ */
+
+static void
+limCleanupNeighborBssNodes(tpAniSirGlobal pMac)
+{
+ if (pMac->lim.gpLimMeasData->pNeighborWdsInfo)
+ {
+ tpLimNeighborBssWdsNode pNode =
+ pMac->lim.gpLimMeasData->pNeighborWdsInfo;
+ tpLimNeighborBssWdsNode pNext;
+ while (pNode)
+ {
+ pNext = pNode->next;
+ pMac->lim.gpLimMeasData->numBssWds--;
+ palFreeMemory( pMac->hHdd, pNode);
+
+ if (pNext)
+ pNode = pNext;
+ else
+ break;
+ }
+ }
+
+ PELOG2(limLog(pMac, LOG2,
+ FL("Cleaned up neighbor nodes\n"));)
+
+ pMac->lim.gpLimMeasData->numBssWds = 0;
+ pMac->lim.gpLimMeasData->totalBssSize = 0;
+ pMac->lim.gpLimMeasData->pNeighborWdsInfo = NULL;
+} /****** end limCleanupNeighborBssNodes() ******/
+
+
+/**
+ * limSendSmeMeasurementInd()
+ *
+ *FUNCTION:
+ * This function is called by limProcessLmmMessages() to
+ * send SME_MEASUREMENT_IND message to WSM.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limSendSmeMeasurementInd(tpAniSirGlobal pMac)
+{
+ tANI_U8 *pMeasInd;
+ tANI_U16 len = 0;
+ tSirMsgQ mmhMsg;
+
+#ifdef GEN6_TODO
+ //fetch the sessionEntry based on the sessionId
+ //priority - MEDIUM
+ tpPESession sessionEntry;
+
+ if((sessionEntry = peFindSessionBySessionId(pMac, pMac->lim.gLimMeasParams.measurementIndTimer.sessionId))== NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+#endif
+
+ if (!pMac->sys.gSysEnableLearnMode ||
+ (pMac->lim.gpLimMeasReq == NULL))
+ {
+ return;
+ }
+
+ len = sizeof(tSirSmeMeasurementInd) +
+ (pMac->lim.gpLimMeasReq->channelList.numChannels *
+ sizeof(tSirMeasMatrixInfo)) +
+ pMac->lim.gpLimMeasData->totalBssSize;
+ if (len > LIM_MAX_BUF_SIZE)
+ {
+ limLog(pMac, LOGP,
+ FL("len %d numChannels %d numBssWds %d totalBssSize %d\n"),
+ len,
+ pMac->lim.gpLimMeasReq->channelList.numChannels,
+ pMac->lim.gpLimMeasData->numBssWds,
+ pMac->lim.gpLimMeasData->totalBssSize);
+ }
+
+ PELOG2(limLog(pMac, LOG2, FL("***** Measurement IND size %d\n"), len);)
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMeasInd, len))
+ {
+ /// Buffer not available. Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for eWNI_SME_MEAS_IND\n"));
+
+ return;
+ }
+
+ PELOG3(limLog(pMac, LOG3,
+ FL("Sending eWNI_SME_MEAS_IND on Radio %d, requested len=%d\n"),
+ pMac->sys.gSirRadioId, len);)
+
+ limMeasurementIndSerDes(pMac, pMeasInd);
+
+ mmhMsg.type = eWNI_SME_MEASUREMENT_IND;
+ mmhMsg.bodyptr = pMeasInd;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+
+ // Cleanup neighbor information
+ limCleanupNeighborBssNodes(pMac);
+ limCleanupMatrixNodes(pMac);
+} /*** end limSendSmeMeasurementInd() ***/
+
+
+
+/**
+ * limCleanupMeasData()
+ *
+ *FUNCTION:
+ * This function is called from various places within LIM code
+ * to cleanup measurement related data.
+ *
+ *LOGIC:
+ * Buffers and associated timer resources will be deleted when
+ * this function is called
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limCleanupMeasData(tpAniSirGlobal pMac)
+{
+ if (pMac->lim.gpLimMeasReq)
+ palFreeMemory( pMac->hHdd, pMac->lim.gpLimMeasReq);
+
+ pMac->lim.gpLimMeasReq = NULL;
+
+ if (!pMac->lim.gpLimMeasData)
+ return;
+
+ if (pMac->lim.gpLimMeasData->pMeasMatrixInfo)
+ {
+ // Retain current channel's data and flush remaining
+ tpLimMeasMatrixNode pMatrix =
+ (pMac->lim.gpLimMeasData->pMeasMatrixInfo)->next;
+ tpLimMeasMatrixNode pNext;
+
+ while (pMatrix)
+ {
+ pNext = pMatrix->next;
+ palFreeMemory( pMac->hHdd, pMatrix);
+
+ if (pNext)
+ pMatrix = pNext;
+ else
+ break;
+ }
+
+ pMac->lim.gpLimMeasData->pMeasMatrixInfo->next = NULL;
+ }
+
+ pMac->lim.gpLimMeasData->numMatrixNodes = 0;
+ PELOG2(limLog(pMac, LOG2,
+ FL("Cleaned up measurement metrics nodes\n"));)
+
+ // Cleanup neighbor information
+ limCleanupNeighborBssNodes(pMac);
+} /****** end limCleanupMeasData() ******/
+
+/**---------------------------------------------------------
+\fn limStopMeasTimers
+\brief Stops all measurement related timers.
+
+\param pMac
+\return None
+ ----------------------------------------------------------*/
+void
+limStopMeasTimers(tpAniSirGlobal pMac)
+{
+ if (pMac->lim.gpLimMeasReq == NULL)
+ return;
+
+ if (pMac->lim.gpLimMeasReq->measControl.periodicMeasEnabled)
+ {
+ if (tx_timer_deactivate(&pMac->lim.gLimMeasParams.measurementIndTimer) != TX_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Cannot stop measurement Ind timer\n"));)
+ }
+ }
+ pMac->lim.gLimMeasParams.isMeasIndTimerActive = 0;
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_LEARN_INTERVAL_TIMER));
+ if (tx_timer_deactivate(&pMac->lim.gLimMeasParams.learnIntervalTimer) != TX_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Cannot stop learn interval timer\n"));)
+ }
+
+ if (pMac->lim.gLimSpecMgmt.fQuietEnabled)
+ {
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_LEARN_DURATION_TIMER));
+ if (tx_timer_deactivate(&pMac->lim.gLimMeasParams.learnDurationTimer) != TX_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Cannot stop learn duration timer\n"));)
+ }
+ }
+
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_LEARN_DURATION_TIMER));
+ if (tx_timer_deactivate(&pMac->lim.gLimMeasParams.learnDurationTimer) != TX_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Cannot stop learn duration timer\n"));)
+ }
+}
+
+/**
+ * limDeleteMeasTimers()
+ *
+ *FUNCTION:
+ * This function is called by limProcessLmmMessages() upon
+ * receiving SME_MEASUREMENT_REQ. This function deletes
+ * timers associated with Measurements.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limDeleteMeasTimers(tpAniSirGlobal pMac)
+{
+ if (pMac->lim.gpLimMeasReq->measControl.periodicMeasEnabled)
+ tx_timer_delete(&pMac->lim.gLimMeasParams.measurementIndTimer);
+ tx_timer_delete(&pMac->lim.gLimMeasParams.learnIntervalTimer);
+ tx_timer_delete(&pMac->lim.gLimMeasParams.learnDurationTimer);
+} /*** end limDeleteMeasTimers() ***/
+
+
+
+/**
+ * limCleanupMeasResources()
+ *
+ *FUNCTION:
+ * This function is called from various places within LIM code
+ * to cleanup measurement related data and resources.
+ *
+ *LOGIC:
+ * Buffers and associated timer resources will be deleted when
+ * this function is called
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limCleanupMeasResources(tpAniSirGlobal pMac)
+{
+ PELOG1( limLog(pMac, LOG1,
+ FL("Cleaning up Learn mode Measurement resources\n"));)
+
+ if (pMac->lim.gpLimMeasReq == NULL)
+ return;
+
+ limDeleteMeasTimers(pMac);
+
+ if (pMac->lim.gpLimMeasData)
+ {
+ limCleanupMeasData(pMac);
+ if (pMac->lim.gpLimMeasData->pMeasMatrixInfo)
+ palFreeMemory( pMac->hHdd, pMac->lim.gpLimMeasData->pMeasMatrixInfo);
+
+ palFreeMemory( pMac->hHdd, pMac->lim.gpLimMeasData);
+ pMac->lim.gpLimMeasData = NULL;
+ }
+} /****** end limCleanupMeasResources() ******/
+
+
+/**
+ * limDeleteCurrentBssWdsNode()
+ *
+ *FUNCTION:
+ * This function is called when Loss of link
+ * is detected with AP and its BssWds info node
+ * to be deleted
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param None
+ * @return None
+ */
+void limDeleteCurrentBssWdsNode(tpAniSirGlobal pMac)
+{
+ tANI_U32 cfg = sizeof(tSirMacAddr);
+ tSirMacAddr currentBssId;
+
+#if 0
+ if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) !=
+ eSIR_SUCCESS)
+ {
+ /// Could not get BSSID from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
+ }
+#endif //TO SUPPORT BT-AMP
+ sirCopyMacAddr(currentBssId,sessionEntry->bssId);
+
+ if (!pMac->lim.gpLimMeasData)
+ return;
+
+ if (pMac->lim.gpLimMeasData->pNeighborWdsInfo)
+ {
+ tpLimNeighborBssWdsNode pNode =
+ pMac->lim.gpLimMeasData->pNeighborWdsInfo;
+ tpLimNeighborBssWdsNode pPrev = pNode;
+ while (pNode)
+ {
+ if (palEqualMemory( pMac->hHdd,pNode->info.neighborBssInfo.bssId,
+ currentBssId,
+ sizeof(tSirMacAddr)))
+ {
+ pMac->lim.gpLimMeasData->numBssWds--;
+ pPrev->next = pNode->next;
+ palFreeMemory( pMac->hHdd, pNode);
+ break;
+ }
+ pPrev = pNode;
+
+ if (pNode->next)
+ pNode = pNode->next;
+ else
+ break;
+ }
+
+ if (!pMac->lim.gpLimMeasData->numBssWds)
+ pMac->lim.gpLimMeasData->pNeighborWdsInfo = NULL;
+ }
+} /****** end limDeleteCurrentBssWdsNode() ******/
+
+
+
+/**
+ * limRestorePreLearnState()
+ *
+ *FUNCTION:
+ * This function is called when Learn duration timer expires
+ * to restore pre-Learn mode state
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limRestorePreLearnState(tpAniSirGlobal pMac)
+{
+ PELOG4(limLog(pMac, LOG4,
+ FL("Restoring from Learn mode on RadioId %d\n"),
+ pMac->sys.gSirRadioId);)
+
+ pMac->lim.gLimSystemInScanLearnMode = 0;
+
+ // Go back to previous state.
+ pMac->lim.gLimSmeState = pMac->lim.gLimPrevSmeState;
+ pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+ PELOG4(limLog(pMac, LOG4,
+ FL("Restored from Learn mode on RadioId %d\n"),
+ pMac->sys.gSirRadioId);)
+} /****** end limRestorePreLearnState() ******/
+
+#endif //#if (defined(ANI_PRODUCT_TYPE_AP) || (ANI_PRODUCT_TYPE_AP_SDK))
+
+/**
+ * limGetPhyCBState
+ *
+ *FUNCTION:
+ * Based on the current state of LIM, this routine determines
+ * the correct PHY enumeration "ePhyChanBondState" to use
+ *
+ *LOGIC:
+ * Is it possible to have a common enumeration?
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return The corresponding PHY enumeration ePhyChanBondState
+ */
+ePhyChanBondState limGetPhyCBState( tpAniSirGlobal pMac )
+{
+ ePhyChanBondState cbState = PHY_SINGLE_CHANNEL_CENTERED;
+
+ if( GET_CB_OPER_STATE( pMac->lim.gCbState ))
+ {
+ if( GET_CB_SEC_CHANNEL( pMac->lim.gCbState ))
+ cbState = PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
+ else
+ cbState = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
+ }
+ return cbState;
+}
+
+
+/**
+ * limGetHTCBState
+ *
+ *FUNCTION:
+ * This routing provides the translation of Airgo Enum to HT enum for determining
+ * secondary channel offset.
+ * Airgo Enum is required for backward compatibility purposes.
+ *
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return The corresponding HT enumeration
+ */
+
+tSirMacHTSecondaryChannelOffset limGetHTCBState(tAniCBSecondaryMode aniCBMode)
+{
+ if(aniCBMode == eANI_CB_SECONDARY_DOWN)
+ return eHT_SECONDARY_CHANNEL_OFFSET_DOWN;
+ else if(aniCBMode == eANI_CB_SECONDARY_UP)
+ return eHT_SECONDARY_CHANNEL_OFFSET_UP;
+ else
+ return eHT_SECONDARY_CHANNEL_OFFSET_NONE;
+}
+
+
+/**
+ * limGetAniCBState
+ *
+ *FUNCTION:
+ * This routing provides the translation of HT Enum to Airgo enum for determining
+ * secondary channel offset.
+ * Airgo Enum is required for backward compatibility purposes.
+ *
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return The corresponding ANI enumeration
+ */
+
+tAniCBSecondaryMode limGetAniCBState( tSirMacHTSecondaryChannelOffset htCBMode)
+{
+ if(eHT_SECONDARY_CHANNEL_OFFSET_DOWN == htCBMode)
+ return eANI_CB_SECONDARY_DOWN;
+ else if(eHT_SECONDARY_CHANNEL_OFFSET_UP == htCBMode)
+ return eANI_CB_SECONDARY_UP;
+ else
+ return eANI_CB_SECONDARY_NONE;
+}
+
+
+/**
+ * limGetStaPeerType
+ *
+ *FUNCTION:
+ * Based on a combination of the following -
+ * 1) tDphHashNode.aniPeer
+ * 2) tDphHashNode.propCapability
+ * this API determines if a given STA is an ANI peer or not
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pStaDs - Pointer to the tpDphHashNode of the STA
+ * under consideration
+ * @return tStaRateMode
+ */
+tStaRateMode limGetStaPeerType( tpAniSirGlobal pMac,
+ tpDphHashNode pStaDs,
+ tpPESession psessionEntry)
+{
+tStaRateMode staPeerType = eSTA_11b;
+
+ // Determine the peer-STA type
+ if( pStaDs->aniPeer )
+ {
+ if(PROP_CAPABILITY_GET( TAURUS, pStaDs->propCapability ))
+ staPeerType = eSTA_TAURUS;
+ else if( PROP_CAPABILITY_GET( TITAN, pStaDs->propCapability ))
+ staPeerType = eSTA_TITAN;
+ else
+ staPeerType = eSTA_POLARIS;
+ }
+ else if(pStaDs->mlmStaContext.htCapability)
+ staPeerType = eSTA_11n;
+ else if(pStaDs->erpEnabled)
+ staPeerType = eSTA_11bg;
+ else if(psessionEntry->limRFBand == SIR_BAND_5_GHZ)
+ staPeerType = eSTA_11a;
+
+ return staPeerType;
+}
+
+/**
+ * setupCBState()
+ *
+ *FUNCTION:
+ * This function is called during eWNI_SME_START_BSS_REQ.
+ * Based on the configured Channel Bonding mode, the
+ * appropriate Channel Bonding state is setup in the global
+ * LIM object - gCbState. This will then be subsequently used
+ * in the proprietary IE field
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param cbMode The CB mode as set by SME (WSM)
+ * @return None
+ */
+void setupCBState( tpAniSirGlobal pMac,
+ tAniCBSecondaryMode cbMode )
+{
+
+ switch( cbMode )
+ {
+ case eANI_CB_SECONDARY_DOWN:
+ SET_CB_OPER_STATE( pMac->lim.gCbState, eHAL_SET );
+ SET_CB_SEC_CHANNEL( pMac->lim.gCbState, eHAL_CLEAR );
+ if (cfgSetInt(pMac, WNI_CFG_CB_SECONDARY_CHANNEL_STATE, WNI_CFG_CB_SECONDARY_CHANNEL_STATE_LOWER) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("cfgSetInt WNI_CFG_CB_SECONDARY_CHANNEL_STATE failed \n"));
+ // AU state is set via CFG
+ break;
+
+ case eANI_CB_SECONDARY_UP:
+ SET_CB_OPER_STATE( pMac->lim.gCbState, eHAL_SET );
+ SET_CB_SEC_CHANNEL( pMac->lim.gCbState, eHAL_SET );
+ if (cfgSetInt(pMac, WNI_CFG_CB_SECONDARY_CHANNEL_STATE, WNI_CFG_CB_SECONDARY_CHANNEL_STATE_HIGHER) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("cfgSetInt WNI_CFG_CB_SECONDARY_CHANNEL_STATE failed \n"));
+ // AU state is set via CFG
+ break;
+
+ case eANI_CB_SECONDARY_NONE:
+ if (cfgSetInt(pMac, WNI_CFG_CB_SECONDARY_CHANNEL_STATE, WNI_CFG_CB_SECONDARY_CHANNEL_STATE_NONE) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("cfgSetInt WNI_CFG_CB_SECONDARY_CHANNEL_STATE failed \n"));
+
+ default:
+ SET_CB_OPER_STATE( pMac->lim.gCbState, eHAL_CLEAR );
+ break;
+ }
+
+
+
+ limLog( pMac, LOG2,
+ FL("New CB State: 0x%1x for Mode %d\n"),
+ pMac->lim.gCbState,
+ cbMode );
+}
+
+/**
+ * limGetCurrentCBSecChannel()
+ *
+ *FUNCTION:
+ * This function is called to determine the current
+ * "secondary" channel when Channel Bonding is enabled
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return Channel number
+ */
+tANI_U8 limGetCurrentCBSecChannel( tpAniSirGlobal pMac,tpPESession psessionEntry)
+{
+tANI_U8 chanNum;
+
+ //
+ // FIXME - This is a HACK!!
+ // Need to have a clean way of determining the current
+ // CB secondary channel!!
+ //
+ chanNum = psessionEntry->currentOperChannel;
+ if( GET_CB_OPER_STATE( pMac->lim.gCbState ))
+ {
+ if( GET_CB_SEC_CHANNEL( pMac->lim.gCbState ))
+ chanNum += 4;
+ else
+ chanNum -= 4;
+ }
+
+ limLog( pMac, LOG4,
+ FL("Returning CB Sec Channel %1d\n"),
+ chanNum );
+
+ return chanNum;
+}
+
+
diff --git a/CORE/MAC/src/pe/lim/limPropExtsUtils.h b/CORE/MAC/src/pe/lim/limPropExtsUtils.h
new file mode 100644
index 0000000..17f2da2
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limPropExtsUtils.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limPropExtsUtils.h contains the definitions
+ * used by all LIM modules to support proprietary features.
+ * Author: Chandra Modumudi
+ * Date: 12/11/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#ifndef __LIM_PROP_EXTS_UTILS_H
+#define __LIM_PROP_EXTS_UTILS_H
+
+
+// Function templates
+void limQuietBss(tpAniSirGlobal, tANI_U32);
+void limCleanupMeasData(tpAniSirGlobal);
+void limDeleteMeasTimers(tpAniSirGlobal);
+void limStopMeasTimers(tpAniSirGlobal pMac);
+void limCleanupMeasResources(tpAniSirGlobal);
+void limRestorePreLearnState(tpAniSirGlobal);
+void limCollectMeasurementData(tpAniSirGlobal,
+ tANI_U32 *, tpSchBeaconStruct);
+void limCollectRSSI(tpAniSirGlobal);
+void limDeleteCurrentBssWdsNode(tpAniSirGlobal);
+tANI_U32 limComputeAvg(tpAniSirGlobal, tANI_U32, tANI_U32);
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+// Timer Handlers
+void limMeasurementTimerHandler(VOID*, tANI_U32);
+#endif
+
+/// Function to extract AP's HCF capability from IE fields
+void limExtractApCapability(tpAniSirGlobal, tANI_U8 *, tANI_U16, tANI_U8 *, tANI_U16 *, tANI_U8 *, tPowerdBm*);
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+/// Function to extract current Learn channel
+tANI_U8 limGetCurrentLearnChannel(tpAniSirGlobal);
+// Determine if a newly discovered BSS is TITAN-compatible
+void handleNonTitanBss( tpAniSirGlobal, tSirNeighborBssWdsInfo );
+#endif
+ePhyChanBondState limGetPhyCBState( tpAniSirGlobal );
+tStaRateMode limGetStaPeerType( tpAniSirGlobal, tpDphHashNode ,tpPESession);
+void setupCBState( tpAniSirGlobal, tAniCBSecondaryMode );
+
+tANI_U8 limGetCurrentCBSecChannel( tpAniSirGlobal,tpPESession );
+
+#endif /* __LIM_PROP_EXTS_UTILS_H */
+
diff --git a/CORE/MAC/src/pe/lim/limRoamingAlgo.c b/CORE/MAC/src/pe/lim/limRoamingAlgo.c
new file mode 100644
index 0000000..a77140a
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limRoamingAlgo.c
@@ -0,0 +1,319 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limRoamingAlgo.cc contains the code for LIM
+ * algorithms.
+ * Author: Chandra Modumudi
+ * Date: 03/01/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+#include "wniCfgAp.h"
+#else
+#include "wniCfgSta.h"
+#endif
+#include "cfgApi.h"
+#include "limTypes.h"
+#include "limTimerUtils.h"
+
+
+
+
+#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA) || defined(ANI_AP_CLIENT_SDK)
+/** ----------------------------------------------------------------------
+\fn limSelectsBackgroundScanMode()
+\brief This function is called by limIsBackgroundScanAllowed().
+\ Here LIM decides whether we shall enforce this background
+\ scan or let HAL decide whether to proceed with the background
+\ scan as HAL sees fits. LIM shall enforce background scan if:
+\ 1) station is not in link established state
+\ 2) station is in link established state, but there has been
+\ max number of consecutive background scan failure.
+\
+\param tpAniSirGlobal pMac
+\return none
+\ ------------------------------------------------------------------------- */
+tSirBackgroundScanMode limSelectsBackgroundScanMode(tpAniSirGlobal pMac)
+{
+ tANI_U32 cfgVal;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE, &cfgVal) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Fail to get WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE value\n"));
+ return eSIR_NORMAL_BACKGROUND_SCAN;
+ }
+
+ if (cfgVal == 0)
+ return eSIR_NORMAL_BACKGROUND_SCAN;
+
+ /* If the "number of consecutive background scan failure"
+ * exceeds the maximum allowed, then LIM shall trigger an
+ * aggressive background scan.
+ */
+ if (pMac->lim.gLimNumOfConsecutiveBkgndScanFailure >= cfgVal)
+ {
+ pMac->lim.gLimNumOfForcedBkgndScan += 1;
+ limLog(pMac, LOGE,
+ FL("Had %d consec scan fail(when expect < %d). Trigger AGGRESSIVE bkgnd scan.\n"),
+ pMac->lim.gLimNumOfConsecutiveBkgndScanFailure, cfgVal);
+ return eSIR_AGGRESSIVE_BACKGROUND_SCAN;
+ }
+
+ return eSIR_NORMAL_BACKGROUND_SCAN;
+}
+
+
+/** -----------------------------------------------------------
+\fn limIsBackgroundScanAllowed
+\brief This function determines if background scan should be
+\ allowed. It is called by limTriggerBackgroundScan().
+\param tpAniSirGlobal pMac
+\return none
+\ ------------------------------------------------------------- */
+static tANI_U8 limIsBackgroundScanAllowed(tpAniSirGlobal pMac)
+{
+ // if we are in the middle of a scan already, skip the background scan
+ if (limIsSystemInScanState(pMac) ||
+ (pMac->lim.gLimBackgroundScanDisable) ||
+ (pMac->lim.gLimForceBackgroundScanDisable) ||
+ (pMac->lim.gLimBackgroundScanTerminate))
+ return false;
+
+ //need to do background scan in IBSS mode.
+ if (pMac->lim.gLimSystemRole == eLIM_STA_IN_IBSS_ROLE)
+ {
+ if (pMac->lim.gLimSmeState != eLIM_SME_NORMAL_STATE)
+ return false;
+ return true;
+ }
+
+ // If station is not in link established state, then skip background scan
+ if ( (pMac->lim.gLimSystemRole == eLIM_STA_ROLE) && (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE) )
+ return false;
+
+ /* now that we have checked for scan state, check for other transitional
+ * states which should not be interrupted by scans
+ */
+ if ((! (pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) ) &&
+ (! (pMac->lim.gLimSmeState == eLIM_SME_JOIN_FAILURE_STATE) ) &&
+ (! (pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_STATE) ) )
+ return false;
+
+ return true;
+}
+
+
+/** ---------------------------------------------------------------
+\fn limTriggerBackgroundScan()
+\brief This function is called upon background scan interval
+\ when there is an exisiting link with an AP.
+\ SME_SCAN_REQ is issued to SME state machine with Active
+\ scanning is performed on one channel at a time.
+\
+\ Assumptions:
+\ Valid channel list at CFG is either populated by Roaming
+\ algorithm upon determining/selecting a regulatory domain
+\ or by default has all 36 possible channels.
+\
+\param tpAniSirGlobal pMac
+\return none
+\ ----------------------------------------------------------------- */
+void limTriggerBackgroundScan(tpAniSirGlobal pMac)
+{
+ tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
+ tANI_U32 ssidLen = SIR_MAC_MAX_SSID_LENGTH;
+ tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
+ tSirSmeScanReq smeScanReq;
+ tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+ tSirBackgroundScanMode backgroundScan;
+
+ PELOG1(limLog(pMac, LOG1, FL("Background Scan: %d success, %d consec fail \n"),
+ pMac->lim.gLimNumOfBackgroundScanSuccess, pMac->lim.gLimNumOfConsecutiveBkgndScanFailure);)
+
+ if (! limIsBackgroundScanAllowed(pMac))
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Skipping Background Scan \n"));)
+ return;
+ }
+
+ // Get background scan channel list from CFG
+ if (wlan_cfgGetStr(pMac, WNI_CFG_BG_SCAN_CHANNEL_LIST,
+ (tANI_U8 *) bgScanChannelList,
+ (tANI_U32 *) &len) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get Valid channel list from CFG.
+ * Log error.
+ */
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list\n"));)
+
+ return;
+ }
+
+ // Time to perform background scan. Prepare and issue
+ // SME_SCAN_REQ to SME State machine
+ smeScanReq.messageType = eWNI_SME_SCAN_REQ;
+ smeScanReq.length = sizeof(tSirSmeScanReq);
+ smeScanReq.bssType = eSIR_INFRASTRUCTURE_MODE;
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) smeScanReq.bssId,
+ (tANI_U8 *) &bcAddr, sizeof(tSirMacAddr));
+
+ if (wlan_cfgGetStr(pMac, WNI_CFG_SSID,
+ (tANI_U8 *) (smeScanReq.ssId[0].ssId),
+ (tANI_U32 *) &ssidLen) != eSIR_SUCCESS)
+ {
+ /// Could not get SSID from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve SSID\n"));
+ }
+ smeScanReq.ssId[0].length = (tANI_U8) ssidLen;
+ smeScanReq.numSsid = 1;
+
+ smeScanReq.scanType = eSIR_ACTIVE_SCAN;
+ smeScanReq.sessionId = 0;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME,
+ &smeScanReq.minChannelTime) != eSIR_SUCCESS)
+ {
+ /// Could not get minChlTime value from CFG. Log error.
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve minChlTime value\n"));)
+
+ return;
+ }
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME,
+ &smeScanReq.maxChannelTime) != eSIR_SUCCESS)
+ {
+ /// Could not get maxChlTime value from CFG. Log error.
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve maxChlTime value\n"));)
+
+ return;
+ }
+
+ smeScanReq.returnAfterFirstMatch = 0;
+ smeScanReq.returnUniqueResults = 1;
+
+ //At the first channel scan, clear the cached results
+ if(pMac->lim.gLimBackgroundScanChannelId == 0)
+ {
+ smeScanReq.returnFreshResults = SIR_BG_SCAN_PURGE_RESUTLS|SIR_BG_SCAN_RETURN_FRESH_RESULTS;
+ }
+ else
+ {
+ smeScanReq.returnFreshResults = SIR_BG_SCAN_RETURN_FRESH_RESULTS;
+ }
+
+
+ smeScanReq.channelList.numChannels = 1;
+ if (pMac->lim.gLimBackgroundScanChannelId >= len)
+ {
+ pMac->lim.gLimBackgroundScanChannelId = 0;
+
+ PELOGE(limLog(pMac, LOGE, FL("Skipping Background Scan since the channel list is exhausted.\n"));)
+ PELOGE(limLog(pMac, LOGE, FL("SME should send WNI_CFG_BACKGROUND_SCAN_PERIOD indication to start the background scan again.\n"));)
+
+ /* Stop the BG scan timer here. SME should send WNI_CFG_BACKGROUND_SCAN_PERIOD
+ * indication to start the background scan again.
+ */
+ if (TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
+ {
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer)
+ != TX_SUCCESS)
+ {
+ // Could not deactivate BackgroundScanTimer timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("unable to deactivate BackgroundScanTimer timer\n"));
+ }
+ }
+
+ pMac->lim.gLimBackgroundScanTerminate = TRUE;
+
+ PELOGE(limLog(pMac, LOGE, FL("Send dummy scan with returnFreshResults as 0 to report BG scan results to SME.\n"));)
+ return;
+ }
+ smeScanReq.channelList.channelNumber[0] =
+ bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId++];
+
+ smeScanReq.uIEFieldLen = 0;
+ smeScanReq.uIEFieldOffset = sizeof(tSirSmeScanReq);
+
+ backgroundScan = limSelectsBackgroundScanMode(pMac);
+ PELOG1(limLog(pMac, LOG1, FL("Performing (mode %d) Background Scan \n"), backgroundScan);)
+ smeScanReq.backgroundScanMode = backgroundScan;
+
+ //determine whether to send the results or not, If so, notify the BG scan results to SME
+ if (pMac->lim.gLimBackgroundScanChannelId >= len)
+ {
+ pMac->lim.gLimReportBackgroundScanResults = TRUE;
+ }
+
+ limPostSmeMessage(pMac,
+ eWNI_SME_SCAN_REQ,
+ (tANI_U32 *) &smeScanReq);
+} /*** limTriggerBackgroundScan() ***/
+
+
+/** ----------------------------------------------------------------------
+\fn limAbortBackgroundScan
+\brief This function aborts background scan and send scan
+\ response to SME.
+\param tpAniSirGlobal pMac
+\return none
+\ ------------------------------------------------------------------------- */
+void limAbortBackgroundScan(tpAniSirGlobal pMac)
+{
+ tANI_U16 scanRspLen = 8;
+
+ if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
+ {
+ limLog(pMac, LOGE, FL("Abort Background Scan \n"));
+ if (TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
+ {
+ limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
+ }
+
+ pMac->lim.gLimBackgroundScanTerminate = TRUE;
+ pMac->lim.gLimBackgroundScanStarted = FALSE;
+
+ if (pMac->lim.gLimSmeScanResultLength == 0)
+ limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS, 0, 0);
+ else
+ {
+ scanRspLen = sizeof(tSirSmeScanRsp) +
+ pMac->lim.gLimSmeScanResultLength -
+ sizeof(tSirBssDescription);
+ limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS, 0, 0);
+ }
+ }
+
+ // reset background scan variables
+ pMac->lim.gLimBackgroundScanChannelId = 0;
+ return;
+}
+
+#endif
diff --git a/CORE/MAC/src/pe/lim/limScanResultUtils.c b/CORE/MAC/src/pe/lim/limScanResultUtils.c
new file mode 100644
index 0000000..a866152
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limScanResultUtils.c
@@ -0,0 +1,922 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limScanResultUtils.cc contains the utility functions
+ * LIM uses for maintaining and accessing scan results on STA.
+ * Author: Chandra Modumudi
+ * Date: 02/13/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+
+#include "limTypes.h"
+#include "limUtils.h"
+#include "limSerDesUtils.h"
+#include "limApi.h"
+#include "limSession.h"
+#if defined WLAN_FEATURE_VOWIFI
+#include "rrmApi.h"
+#endif
+
+
+
+/**
+ * limDeactiveMinChannelTimerDuringScan()
+ *
+ *FUNCTION:
+ * This function is called during scan upon receiving
+ * Beacon/Probe Response frame to deactivate MIN channel
+ * timer if running.
+ *
+ * This function should be called only when pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ *
+ * @return eSIR_SUCCESS in case of success
+ */
+
+tANI_U32
+limDeactivateMinChannelTimerDuringScan(tpAniSirGlobal pMac)
+{
+ if ((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) && (pMac->lim.gLimHalScanState == eLIM_HAL_SCANNING_STATE))
+ {
+ /**
+ * Beacon/Probe Response is received during active scanning.
+ * Deactivate MIN channel timer if running.
+ */
+
+ limDeactivateAndChangeTimer(pMac,eLIM_MIN_CHANNEL_TIMER);
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_MAX_CHANNEL_TIMER));
+ if (tx_timer_activate(&pMac->lim.limTimers.gLimMaxChannelTimer)
+ == TX_TIMER_ERROR)
+ {
+ /// Could not activate max channel timer.
+ // Log error
+ limLog(pMac,LOGP, FL("could not activate max channel timer\n"));
+
+ limCompleteMlmScan(pMac, eSIR_SME_RESOURCES_UNAVAILABLE);
+ return TX_TIMER_ERROR;
+ }
+ }
+ return eSIR_SUCCESS;
+} /*** end limDeactivateMinChannelTimerDuringScan() ***/
+
+
+
+/**
+ * limCollectBssDescription()
+ *
+ *FUNCTION:
+ * This function is called during scan upon receiving
+ * Beacon/Probe Response frame to check if the received
+ * frame matches scan criteria, collect BSS description
+ * and add it to cached scan results.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pBPR - Pointer to parsed Beacon/Probe Response structure
+ * @param pRxPacketInfo - Pointer to Received frame's BD
+ * ---------if defined WLAN_FEATURE_VOWIFI------
+ * @param fScanning - flag to indicate if it is during scan.
+ * ---------------------------------------------
+ *
+ * @return None
+ */
+#if defined WLAN_FEATURE_VOWIFI
+void
+limCollectBssDescription(tpAniSirGlobal pMac,
+ tSirBssDescription *pBssDescr,
+ tpSirProbeRespBeacon pBPR,
+ tANI_U8 *pRxPacketInfo,
+ tANI_U8 fScanning)
+#else
+void
+limCollectBssDescription(tpAniSirGlobal pMac,
+ tSirBssDescription *pBssDescr,
+ tpSirProbeRespBeacon pBPR,
+ tANI_U8 *pRxPacketInfo)
+#endif
+{
+ tANI_U8 *pBody;
+ tANI_U32 ieLen = 0;
+ tpSirMacMgmtHdr pHdr;
+ tANI_U8 channelNum;
+ tANI_U8 rxChannel;
+
+ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+ ieLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo) - SIR_MAC_B_PR_SSID_OFFSET;
+ rxChannel = WDA_GET_RX_CH(pRxPacketInfo);
+ pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
+
+
+ /**
+ * Length of BSS desription is without length of
+ * length itself and length of pointer
+ * that holds the next BSS description
+ */
+ pBssDescr->length = (tANI_U16)(
+ sizeof(tSirBssDescription) - sizeof(tANI_U16) -
+ sizeof(tANI_U32) + ieLen);
+
+ // Copy BSS Id
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pBssDescr->bssId,
+ (tANI_U8 *) pHdr->bssId,
+ sizeof(tSirMacAddr));
+
+ // Copy Timestamp, Beacon Interval and Capability Info
+ pBssDescr->scanSysTimeMsec = vos_timer_get_system_time();
+
+ pBssDescr->timeStamp[0] = pBPR->timeStamp[0];
+ pBssDescr->timeStamp[1] = pBPR->timeStamp[1];
+ pBssDescr->beaconInterval = pBPR->beaconInterval;
+ pBssDescr->capabilityInfo = limGetU16((tANI_U8 *) &pBPR->capabilityInfo);
+
+
+ /*
+ * There is a narrow window after Channel Switch msg is sent to HAL and before the AGC is shut
+ * down and beacons/Probe Rsps can trickle in and we may report the incorrect channel in 5Ghz
+ * band, so not relying on the 'last Scanned Channel' stored in LIM.
+ * Instead use the value returned by RXP in BD. This the the same value which HAL programs into
+ * RXP before every channel switch.
+ * Right now there is a problem in 5Ghz, where we are receiving beacons from a channel different from
+ * the currently scanned channel. so incorrect channel is reported to CSR and association does not happen.
+ * So for now we keep on looking for the channel info in the beacon (DSParamSet IE OR HT Info IE), and only if it
+ * is not present in the beacon, we go for the channel info present in RXP.
+ * This fix will work for 5Ghz 11n devices, but for 11a devices, we have to rely on RXP routing flag to get the correct channel.
+ * So The problem of incorrect channel reporting in 5Ghz will still remain for 11a devices.
+ */
+ pBssDescr->channelId = limGetChannelFromBeacon(pMac, pBPR);
+
+ if (pBssDescr->channelId == 0)
+ {
+ /* If the channel Id is not retrieved from Beacon, extract the channel from BD */
+ /* Unmapped the channel.This We have to do since we have done mapping in the hal to
+ overcome the limitation of RXBD of not able to accomodate the bigger channel number.*/
+ if (!( rxChannel = limUnmapChannel(rxChannel)))
+ {
+ rxChannel = pMac->lim.gLimCurrentScanChannelId;
+ }
+ pBssDescr->channelId = rxChannel;
+ }
+
+ pBssDescr->channelIdSelf = rxChannel;
+ pBssDescr->titanHtCaps = 0;
+
+ //FIXME_CBMODE : need to seperate out TITAN and HT CB mode.
+ //HT neighbor with channel bonding
+ if( pBPR->HTCaps.present )
+ {
+ tAniTitanHtCapabilityInfo titanHtCaps = 0;
+ limGetHtCbAdminState(pMac, pBPR->HTCaps, &titanHtCaps);
+ if( pBPR->HTInfo.present &&
+ pBPR->HTInfo.secondaryChannelOffset )
+ {
+
+ limGetHtCbOpState( pMac,
+ pBPR->HTInfo,
+ &titanHtCaps );
+ }
+ pBssDescr->titanHtCaps = (tANI_U32) titanHtCaps;
+ }
+
+ // Is this is a TITAN neighbor?
+ else if( pBPR->propIEinfo.aniIndicator &&
+ pBPR->propIEinfo.titanPresent )
+ {
+ tAniTitanHtCapabilityInfo titanHtCaps = 0;
+ pBssDescr->titanHtCaps = (tANI_U32) titanHtCaps;
+ }
+
+ //set the network type in bss description
+ channelNum = pBssDescr->channelId;
+ pBssDescr->nwType = limGetNwType(pMac, channelNum, SIR_MAC_MGMT_FRAME, pBPR);
+
+ pBssDescr->aniIndicator = pBPR->propIEinfo.aniIndicator;
+
+ // Copy RSSI & SINR from BD
+
+ PELOG4(limLog(pMac, LOG4, "***********BSS Description for BSSID:*********** ");
+ sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG4, pBssDescr->bssId, 6 );
+ sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG4, (tANI_U8*)pRxPacketInfo, 36 );)
+
+ pBssDescr->rssi = (tANI_S8)WDA_GET_RX_RSSI_DB(pRxPacketInfo);
+
+ //SINR no longer reported by HW
+ pBssDescr->sinr = 0;
+
+ pBssDescr->nReceivedTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
+
+#if defined WLAN_FEATURE_VOWIFI
+ if( fScanning )
+ {
+ rrmGetStartTSF( pMac, pBssDescr->startTSF );
+ pBssDescr->parentTSF = WDA_GET_RX_TIMESTAMP(pRxPacketInfo);
+ }
+#endif
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ // MobilityDomain
+ pBssDescr->mdie[0] = 0;
+ pBssDescr->mdie[1] = 0;
+ pBssDescr->mdie[2] = 0;
+ pBssDescr->mdiePresent = FALSE;
+ // If mdie is present in the probe resp we
+ // fill it in the bss description
+ if( pBPR->mdiePresent)
+ {
+ pBssDescr->mdiePresent = TRUE;
+ pBssDescr->mdie[0] = pBPR->mdie[0];
+ pBssDescr->mdie[1] = pBPR->mdie[1];
+ pBssDescr->mdie[2] = pBPR->mdie[2];
+ }
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+ pBssDescr->QBSSLoad_present = FALSE;
+ pBssDescr->QBSSLoad_avail = 0;
+ if( pBPR->QBSSLoad.present)
+ {
+ pBssDescr->QBSSLoad_present = TRUE;
+ pBssDescr->QBSSLoad_avail = pBPR->QBSSLoad.avail;
+ }
+#endif
+ // Copy IE fields
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pBssDescr->ieFields,
+ pBody + SIR_MAC_B_PR_SSID_OFFSET,
+ ieLen);
+
+ //sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOGW, (tANI_U8 *) pBssDescr, pBssDescr->length + 2 );
+ limLog( pMac, LOG3,
+ FL("Collected BSS Description for Channel(%1d), length(%u), aniIndicator(%d), IE Fields(%u)\n"),
+ pBssDescr->channelId,
+ pBssDescr->length,
+ pBssDescr->aniIndicator,
+ ieLen );
+
+ return;
+} /*** end limCollectBssDescription() ***/
+
+/**
+ * limIsScanRequestedSSID()
+ *
+ *FUNCTION:
+ * This function is called during scan upon receiving
+ * Beacon/Probe Response frame to check if the received
+ * SSID is present in the list of requested SSIDs in scan
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param ssId - SSID Received in beacons/Probe responses that is compared against the
+ requeusted SSID in scan list
+ * ---------------------------------------------
+ *
+ * @return boolean - TRUE if SSID is present in requested list, FALSE otherwise
+ */
+
+tANI_BOOLEAN limIsScanRequestedSSID(tpAniSirGlobal pMac, tSirMacSSid *ssId)
+{
+ tANI_U8 i = 0;
+
+ for (i = 0; i < pMac->lim.gpLimMlmScanReq->numSsid; i++)
+ {
+ if ( eANI_BOOLEAN_TRUE == palEqualMemory( pMac->hHdd,(tANI_U8 *) ssId,
+ (tANI_U8 *) &pMac->lim.gpLimMlmScanReq->ssId[i],
+ (tANI_U8) (pMac->lim.gpLimMlmScanReq->ssId[i].length + 1)))
+ {
+ return eANI_BOOLEAN_TRUE;
+ }
+ }
+ return eANI_BOOLEAN_FALSE;
+}
+
+/**
+ * limCheckAndAddBssDescription()
+ *
+ *FUNCTION:
+ * This function is called during scan upon receiving
+ * Beacon/Probe Response frame to check if the received
+ * frame matches scan criteria, collect BSS description
+ * and add it to cached scan results.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pBPR - Pointer to parsed Beacon/Probe Response structure
+ * @param pRxPacketInfo - Pointer to Received frame's BD
+ * @param fScanning - boolean to indicate whether the BSS is from current scan or just happen to receive a beacon
+ *
+ * @return None
+ */
+
+void
+limCheckAndAddBssDescription(tpAniSirGlobal pMac,
+ tpSirProbeRespBeacon pBPR,
+ tANI_U8 *pRxPacketInfo,
+ tANI_BOOLEAN fScanning,
+ tANI_U8 fProbeRsp)
+{
+ tLimScanResultNode *pBssDescr;
+ tANI_U32 frameLen, ieLen = 0;
+ tANI_U8 rxChannelInBeacon = 0;
+ eHalStatus status;
+
+#ifdef WLAN_FEATURE_P2P
+ tSirMacAddr bssid = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+ tANI_BOOLEAN fFound = FALSE;
+ tpSirMacDataHdr3a pHdr;
+
+ pHdr = WDA_GET_RX_MPDUHEADER3A((tANI_U8 *)pRxPacketInfo);
+
+ //Checking if scanning for a particular BSSID
+ if ((fScanning) && (pMac->lim.gpLimMlmScanReq))
+ {
+ fFound = palEqualMemory(pMac->hHdd, pHdr->addr3, &pMac->lim.gpLimMlmScanReq->bssId, 6);
+ if (!fFound)
+ {
+ if ((pMac->lim.gpLimMlmScanReq->p2pSearch) &&
+ (palEqualMemory(pMac->hHdd, pBPR->P2PProbeRes.P2PDeviceInfo.P2PDeviceAddress,
+ &pMac->lim.gpLimMlmScanReq->bssId, 6)))
+ {
+ fFound = eANI_BOOLEAN_TRUE;
+ }
+ }
+ }
+#endif
+
+ /**
+ * Compare SSID with the one sent in
+ * Probe Request frame, if any.
+ * If they don't match, ignore the
+ * Beacon frame.
+ * pMac->lim.gLimMlmScanReq->ssId.length == 0
+ * indicates Broadcast SSID.
+ * When gLimReturnAfterFirstMatch is set, it means the scan has to match
+ * a SSID (if it is also set). Ignore the other BSS in that case.
+ */
+
+ if (((fScanning) && ( pMac->lim.gLimReturnAfterFirstMatch & 0x01 )
+ && (pMac->lim.gpLimMlmScanReq->numSsid) &&
+ !limIsScanRequestedSSID(pMac, &pBPR->ssId))
+ || (!fFound && (pMac->lim.gpLimMlmScanReq && pMac->lim.gpLimMlmScanReq->bssId) &&
+ !palEqualMemory(pMac->hHdd, bssid, &pMac->lim.gpLimMlmScanReq->bssId, 6))
+ )
+ {
+ /**
+ * Received SSID does not match with
+ * the one we're scanning for.
+ * Ignore received Beacon frame
+ */
+
+ return;
+ }
+
+ /* There is no point in caching & reporting the scan results for APs
+ * which are in the process of switching the channel. So, we are not
+ * caching the scan results for APs which are adverzing the channel-switch
+ * element in their beacons and probe responses.
+ */
+ if(pBPR->channelSwitchPresent)
+ {
+ return;
+ }
+
+ /* If beacon/probe resp DS param channel does not match with
+ * RX BD channel then don't save the results. It might be a beacon
+ * from another channel heard as noise on the current scanning channel
+ */
+
+ if (pBPR->dsParamsPresent)
+ {
+ /* This means that we are in 2.4GHz mode or 5GHz 11n mode */
+ rxChannelInBeacon = limGetChannelFromBeacon(pMac, pBPR);
+ if (rxChannelInBeacon < 15)
+ {
+ /* This means that we are in 2.4GHz mode */
+ if(WDA_GET_RX_CH(pRxPacketInfo) != rxChannelInBeacon)
+ {
+ limLog(pMac, LOG3, FL("Beacon/Probe Rsp dropped. Channel in BD %d. "
+ "Channel in beacon" " %d\n"),
+ WDA_GET_RX_CH(pRxPacketInfo),limGetChannelFromBeacon(pMac, pBPR));
+ return;
+ }
+ }
+ }
+
+ /**
+ * Allocate buffer to hold BSS description from
+ * received Beacon frame.
+ * Include size of fixed fields and IEs length
+ */
+
+ ieLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo) - SIR_MAC_B_PR_SSID_OFFSET;
+ frameLen = sizeof(tLimScanResultNode) + ieLen - sizeof(tANI_U32); // Sizeof(tANI_U32) is for ieFields[1]
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pBssDescr, frameLen))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call for palAllocateMemory failed for storing BSS description\n"));
+
+ return;
+ }
+
+ // In scan state, store scan result.
+#if defined WLAN_FEATURE_VOWIFI
+ limCollectBssDescription(pMac, &pBssDescr->bssDescription,
+ pBPR, pRxPacketInfo, fScanning);
+#else
+ limCollectBssDescription(pMac, &pBssDescr->bssDescription,
+ pBPR, pRxPacketInfo);
+#endif
+
+ pBssDescr->bssDescription.fProbeRsp = fProbeRsp;
+
+ pBssDescr->next = NULL;
+
+ /**
+ * Depending on whether to store unique or all
+ * scan results, pass hash update/add parameter
+ */
+
+ //If it is not scanning, only save unique results
+ if (pMac->lim.gLimReturnUniqueResults || (!fScanning))
+ {
+ status = limLookupNaddHashEntry(pMac, pBssDescr, LIM_HASH_UPDATE);
+ }
+ else
+ {
+ status = limLookupNaddHashEntry(pMac, pBssDescr, LIM_HASH_ADD);
+ }
+
+ if(fScanning)
+ {
+ if ((pBssDescr->bssDescription.channelId <= 14) &&
+ (pMac->lim.gLimReturnAfterFirstMatch & 0x40) &&
+ pBPR->countryInfoPresent)
+ pMac->lim.gLim24Band11dScanDone = 1;
+
+ if ((pBssDescr->bssDescription.channelId > 14) &&
+ (pMac->lim.gLimReturnAfterFirstMatch & 0x80) &&
+ pBPR->countryInfoPresent)
+ pMac->lim.gLim50Band11dScanDone = 1;
+
+ if ( ( pMac->lim.gLimReturnAfterFirstMatch & 0x01 ) ||
+ ( pMac->lim.gLim24Band11dScanDone && ( pMac->lim.gLimReturnAfterFirstMatch & 0x40 ) ) ||
+ ( pMac->lim.gLim50Band11dScanDone && ( pMac->lim.gLimReturnAfterFirstMatch & 0x80 ) )
+#ifdef WLAN_FEATURE_P2P
+ || fFound
+#endif
+ )
+/*
+ if ((pMac->lim.gLimReturnAfterFirstMatch & 0x01) ||
+ (pMac->lim.gLim24Band11dScanDone &&
+ !(pMac->lim.gLimReturnAfterFirstMatch & 0xC0)) ||
+ (pMac->lim.gLim50Band11dScanDone &&
+ !(pMac->lim.gLimReturnAfterFirstMatch & 0xC0)) ||
+ (pMac->lim.gLim24Band11dScanDone &&
+ pMac->lim.gLim50Band11dScanDone &&
+ pMac->lim.gLimReturnAfterFirstMatch & 0xC0))
+*/
+ {
+ /**
+ * Stop scanning and return the BSS description(s)
+ * collected so far.
+ */
+ limLog(pMac,
+ LOGW,
+ FL("Completed scan: 24Band11dScan = %d, 50Band11dScan = %d BSS id\n"),
+ pMac->lim.gLim24Band11dScanDone,
+ pMac->lim.gLim50Band11dScanDone);
+
+ //Need to disable the timers. If they fire, they will send END_SCAN
+ //while we already send FINISH_SCAN here. This may mess up the gLimHalScanState
+ limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
+ limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
+ //Set the resume channel to Any valid channel (invalid).
+ //This will instruct HAL to set it to any previous valid channel.
+ peSetResumeChannel(pMac, 0, 0);
+ limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE );
+ //limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE );
+ }
+ }//(eANI_BOOLEAN_TRUE == fScanning)
+
+ if( eHAL_STATUS_SUCCESS != status )
+ {
+ palFreeMemory( pMac->hHdd, pBssDescr );
+ }
+} /****** end limCheckAndAddBssDescription() ******/
+
+
+
+/**
+ * limScanHashFunction()
+ *
+ *FUNCTION:
+ * This function is called during scan hash entry operations
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param bssId - Received BSSid
+ *
+ * @return Hash index
+ */
+
+tANI_U8
+limScanHashFunction(tSirMacAddr bssId)
+{
+ tANI_U16 i, hash = 0;
+
+ for (i = 0; i < sizeof(tSirMacAddr); i++)
+ hash += bssId[i];
+
+ return hash % LIM_MAX_NUM_OF_SCAN_RESULTS;
+} /****** end limScanHashFunction() ******/
+
+
+
+/**
+ * limInitHashTable()
+ *
+ *FUNCTION:
+ * This function is called upon receiving SME_START_REQ
+ * to initialize global cached scan hash table
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limInitHashTable(tpAniSirGlobal pMac)
+{
+ tANI_U16 i;
+ for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
+ pMac->lim.gLimCachedScanHashTable[i] = NULL;
+} /****** end limInitHashTable() ******/
+
+
+
+/**
+ * limLookupNaddHashEntry()
+ *
+ *FUNCTION:
+ * This function is called upon receiving a Beacon or
+ * Probe Response frame during scan phase to store
+ * received BSS description into scan result hash table.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pBssDescr - Pointer to BSS description to be
+ * added to the scan result hash table.
+ * @param action - Indicates action to be performed
+ * when same BSS description is found. This is
+ * dependent on whether unique scan result to
+ * be stored or not.
+ *
+ * @return None
+ */
+
+eHalStatus
+limLookupNaddHashEntry(tpAniSirGlobal pMac,
+ tLimScanResultNode *pBssDescr, tANI_U8 action)
+{
+ tANI_U8 index, ssidLen = 0;
+ tANI_U8 found = false;
+ tLimScanResultNode *ptemp, *pprev;
+ tSirMacCapabilityInfo *pSirCap, *pSirCapTemp;
+ int idx, len;
+ tANI_U8 *pbIe;
+
+ index = limScanHashFunction(pBssDescr->bssDescription.bssId);
+ ptemp = pMac->lim.gLimCachedScanHashTable[index];
+
+ //ieFields start with TLV of SSID IE
+ ssidLen = * ((tANI_U8 *) &pBssDescr->bssDescription.ieFields + 1);
+ pSirCap = (tSirMacCapabilityInfo *)&pBssDescr->bssDescription.capabilityInfo;
+
+ for (pprev = ptemp; ptemp; pprev = ptemp, ptemp = ptemp->next)
+ {
+ //For infrastructure, only check BSSID. For IBSS, check more
+ pSirCapTemp = (tSirMacCapabilityInfo *)&ptemp->bssDescription.capabilityInfo;
+ if((pSirCapTemp->ess == pSirCap->ess) && //matching ESS type first
+ (palEqualMemory( pMac->hHdd,(tANI_U8 *) pBssDescr->bssDescription.bssId,
+ (tANI_U8 *) ptemp->bssDescription.bssId,
+ sizeof(tSirMacAddr))) && //matching BSSID
+ ((pSirCapTemp->ess) || //we are done for infrastructure
+ //For IBSS, matching SSID, nwType and channelId
+ ((palEqualMemory( pMac->hHdd,((tANI_U8 *) &pBssDescr->bssDescription.ieFields + 1),
+ ((tANI_U8 *) &ptemp->bssDescription.ieFields + 1),
+ (tANI_U8) (ssidLen + 1)) &&
+ (pBssDescr->bssDescription.nwType ==
+ ptemp->bssDescription.nwType) &&
+ (pBssDescr->bssDescription.channelId ==
+ ptemp->bssDescription.channelId))))
+ )
+ {
+ // Found the same BSS description
+ if (action == LIM_HASH_UPDATE)
+ {
+ if(pBssDescr->bssDescription.fProbeRsp != ptemp->bssDescription.fProbeRsp)
+ {
+ //We get a different, save the old frame WSC IE if it is there
+ idx = 0;
+ len = ptemp->bssDescription.length - sizeof(tSirBssDescription) +
+ sizeof(tANI_U16) + sizeof(tANI_U32) - DOT11F_IE_WSCPROBERES_MIN_LEN - 2;
+ pbIe = (tANI_U8 *)ptemp->bssDescription.ieFields;
+ //Save WPS IE if it exists
+ pBssDescr->bssDescription.WscIeLen = 0;
+ while(idx < len)
+ {
+ if((DOT11F_EID_WSCPROBERES == pbIe[0]) &&
+ (0x00 == pbIe[2]) && (0x50 == pbIe[3]) && (0xf2 == pbIe[4]) && (0x04 == pbIe[5]))
+ {
+ //Found it
+ if((DOT11F_IE_WSCPROBERES_MAX_LEN - 2) >= pbIe[1])
+ {
+ palCopyMemory(pMac->hHdd, pBssDescr->bssDescription.WscIeProbeRsp,
+ pbIe, pbIe[1] + 2);
+ pBssDescr->bssDescription.WscIeLen = pbIe[1] + 2;
+ }
+ break;
+ }
+ idx += pbIe[1] + 2;
+ pbIe += pbIe[1] + 2;
+ }
+ }
+
+
+ if(NULL != pMac->lim.gpLimMlmScanReq)
+ {
+ if((pMac->lim.gpLimMlmScanReq->numSsid)&&
+ ( limIsNullSsid((tSirMacSSid *)((tANI_U8 *)
+ &pBssDescr->bssDescription.ieFields + 1))))
+ return eHAL_STATUS_FAILURE;
+ }
+
+ // Delete this entry
+ if (ptemp == pMac->lim.gLimCachedScanHashTable[index])
+ pprev = pMac->lim.gLimCachedScanHashTable[index] = ptemp->next;
+ else
+ pprev->next = ptemp->next;
+
+ pMac->lim.gLimMlmScanResultLength -=
+ ptemp->bssDescription.length + sizeof(tANI_U16);
+
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) ptemp);
+ }
+ found = true;
+ break;
+ }
+ }
+
+ // Add this BSS description at same index
+ if (pprev == pMac->lim.gLimCachedScanHashTable[index])
+ {
+ pBssDescr->next = pMac->lim.gLimCachedScanHashTable[index];
+ pMac->lim.gLimCachedScanHashTable[index] = pBssDescr;
+ }
+ else
+ {
+ pBssDescr->next = pprev->next;
+ pprev->next = pBssDescr;
+ }
+ pMac->lim.gLimMlmScanResultLength +=
+ pBssDescr->bssDescription.length + sizeof(tANI_U16);
+
+ PELOG2(limLog(pMac, LOG2, FL("Added new BSS description size %d TOT %d BSS id\n"),
+ pBssDescr->bssDescription.length,
+ pMac->lim.gLimMlmScanResultLength);
+ limPrintMacAddr(pMac, pBssDescr->bssDescription.bssId, LOG2);)
+
+ // Send new BSS found indication to HDD if CFG option is set
+ if (!found) limSendSmeNeighborBssInd(pMac, pBssDescr);
+
+ //
+ // TODO: IF applicable, do we need to send:
+ // Mesg - eWNI_SME_WM_STATUS_CHANGE_NTF
+ // Status change code - eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP
+ //
+ return eHAL_STATUS_SUCCESS;
+}
+
+
+
+/**
+ * limDeleteHashEntry()
+ *
+ *FUNCTION:
+ * This function is called upon to delete
+ * a BSS description from scan result hash table.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * Yet to find the utility of the function
+ *
+ * @param pBssDescr - Pointer to BSS description to be
+ * deleted from the scan result hash table.
+ *
+ * @return None
+ */
+
+void limDeleteHashEntry(tLimScanResultNode *pBssDescr)
+{
+} /****** end limDeleteHashEntry() ******/
+
+
+
+/**
+ * limCopyScanResult()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeMessages() while
+ * sending SME_SCAN_RSP with scan result to HDD.
+ *
+ *LOGIC:
+ * This function traverses the scan list stored in scan hash table
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pDest - Destination pointer
+ *
+ * @return None
+ */
+
+void
+limCopyScanResult(tpAniSirGlobal pMac, tANI_U8 *pDest)
+{
+ tLimScanResultNode *ptemp;
+ tANI_U16 i;
+ for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
+ {
+ if ((ptemp = pMac->lim.gLimCachedScanHashTable[i]) != NULL)
+ {
+ while(ptemp)
+ {
+ /// Copy entire BSS description including length
+ palCopyMemory( pMac->hHdd, pDest,
+ (tANI_U8 *) &ptemp->bssDescription,
+ ptemp->bssDescription.length + 2);
+ pDest += ptemp->bssDescription.length + 2;
+ ptemp = ptemp->next;
+ }
+ }
+ }
+} /****** end limCopyScanResult() ******/
+
+
+
+/**
+ * limDeleteCachedScanResults()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeMessages() upon receiving
+ * SME_SCAN_REQ with fresh scan result flag set.
+ *
+ *LOGIC:
+ * This function traverses the scan list stored in scan hash table
+ * and deletes the entries if any
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limDeleteCachedScanResults(tpAniSirGlobal pMac)
+{
+ tLimScanResultNode *pNode, *pNextNode;
+ tANI_U16 i;
+ for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
+ {
+ if ((pNode = pMac->lim.gLimCachedScanHashTable[i]) != NULL)
+ {
+ while (pNode)
+ {
+ pNextNode = pNode->next;
+
+ // Delete the current node
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pNode);
+
+ pNode = pNextNode;
+ }
+ }
+ }
+
+ pMac->lim.gLimSmeScanResultLength = 0;
+} /****** end limDeleteCachedScanResults() ******/
+
+
+
+/**
+ * limReInitScanResults()
+ *
+ *FUNCTION:
+ * This function is called delete exisiting scan results
+ * and initialize the scan hash table
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limReInitScanResults(tpAniSirGlobal pMac)
+{
+ limDeleteCachedScanResults(pMac);
+ limInitHashTable(pMac);
+
+ // !!LAC - need to clear out the global scan result length
+ // since the list was just purged from the hash table.
+ pMac->lim.gLimMlmScanResultLength = 0;
+
+} /****** end limReInitScanResults() ******/
diff --git a/CORE/MAC/src/pe/lim/limScanResultUtils.h b/CORE/MAC/src/pe/lim/limScanResultUtils.h
new file mode 100644
index 0000000..0913ea6
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limScanResultUtils.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limScanResultUtils.h contains the utility definitions
+ * LIM uses for maintaining and accessing scan results on STA.
+ * Author: Chandra Modumudi
+ * Date: 02/13/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+#ifndef __LIM_SCAN_UTILS_H
+#define __LIM_SCAN_UTILS_H
+
+#include "parserApi.h"
+#include "limTypes.h"
+
+// Scan result hash related functions
+tANI_U8 limScanHashFunction(tSirMacAddr);
+void limInitHashTable(tpAniSirGlobal);
+eHalStatus
+ limLookupNaddHashEntry(tpAniSirGlobal, tLimScanResultNode *, tANI_U8);
+void limDeleteHashEntry(tLimScanResultNode *);
+void limDeleteCachedScanResults(tpAniSirGlobal);
+void limRestorePreScanState(tpAniSirGlobal);
+void limCopyScanResult(tpAniSirGlobal, tANI_U8 *);
+void limReInitScanResults(tpAniSirGlobal);
+tANI_U32 limDeactivateMinChannelTimerDuringScan(tpAniSirGlobal);
+void limCheckAndAddBssDescription(tpAniSirGlobal, tpSirProbeRespBeacon, tANI_U8 *, tANI_BOOLEAN, tANI_U8);
+#if defined WLAN_FEATURE_VOWIFI
+void limCollectBssDescription(tpAniSirGlobal,
+ tSirBssDescription *,
+ tpSirProbeRespBeacon,
+ tANI_U8 *,
+ tANI_U8);
+#else
+void limCollectBssDescription(tpAniSirGlobal,
+ tSirBssDescription *,
+ tpSirProbeRespBeacon,
+ tANI_U8 *);
+#endif
+
+#endif /* __LIM_SCAN_UTILS_H */
diff --git a/CORE/MAC/src/pe/lim/limSecurityUtils.c b/CORE/MAC/src/pe/lim/limSecurityUtils.c
new file mode 100644
index 0000000..d1c774f
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limSecurityUtils.c
@@ -0,0 +1,1469 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limUtils.cc contains the utility functions
+ * LIM uses.
+ * Author: Chandra Modumudi
+ * Date: 02/13/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+
+#include "aniGlobal.h"
+#include "wniApi.h"
+
+#include "sirCommon.h"
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+#include "wniCfgAp.h"
+#else
+#include "wniCfgSta.h"
+#endif
+#include "cfgApi.h"
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halDataStruct.h"
+#include "halCommonApi.h"
+#endif
+
+#include "utilsApi.h"
+#include "limUtils.h"
+#include "limSecurityUtils.h"
+#include "limSession.h"
+
+
+#define LIM_SEED_LENGTH 16
+
+/**
+ * limIsAuthAlgoSupported()
+ *
+ *FUNCTION:
+ * This function is called in various places within LIM code
+ * to determine whether passed authentication algorithm is enabled
+ * or not
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param authType Indicates MAC based authentication type
+ * (eSIR_OPEN_SYSTEM or eSIR_SHARED_KEY)
+ * If Shared Key authentication to be used,
+ * 'Privacy Option Implemented' flag is also
+ * checked.
+ *
+ * @return true if passed authType is enabled else false
+ */
+#ifdef WLAN_SOFTAP_FEATURE
+tANI_U8
+limIsAuthAlgoSupported(tpAniSirGlobal pMac, tAniAuthType authType, tpPESession psessionEntry)
+#else
+tANI_U8
+limIsAuthAlgoSupported(tpAniSirGlobal pMac, tAniAuthType authType)
+#endif
+{
+ tANI_U32 algoEnable, privacyOptImp;
+
+ if (authType == eSIR_OPEN_SYSTEM)
+ {
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ {
+ if((psessionEntry->authType == eSIR_OPEN_SYSTEM) || (psessionEntry->authType == eSIR_AUTO_SWITCH))
+ return true;
+ else
+ return false;
+ }
+#endif
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE,
+ &algoEnable) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get AuthAlgo1 Enable value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGE,
+ FL("could not retrieve AuthAlgo1 Enable value\n"));
+
+ return false;
+ }
+ else
+ return ( (algoEnable > 0 ? true : false) );
+ }
+ else
+ {
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ {
+ if((psessionEntry->authType == eSIR_SHARED_KEY) || (psessionEntry->authType == eSIR_AUTO_SWITCH))
+ algoEnable = true;
+ else
+ algoEnable = false;
+
+ }
+ else
+#endif
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_SHARED_KEY_AUTH_ENABLE,
+ &algoEnable) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get AuthAlgo2 Enable value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGE,
+ FL("could not retrieve AuthAlgo2 Enable value\n"));
+
+ return false;
+ }
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ {
+ privacyOptImp = psessionEntry->privacy;
+ }
+ else
+#endif
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED,
+ &privacyOptImp) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get PrivacyOptionImplemented value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGE,
+ FL("could not retrieve PrivacyOptImplemented value\n"));
+
+ return false;
+ }
+ return (algoEnable && privacyOptImp);
+ }
+} /****** end limIsAuthAlgoSupported() ******/
+
+
+
+/**
+ * limInitPreAuthList
+ *
+ *FUNCTION:
+ * This function is called while starting a BSS at AP
+ * to initialize MAC authenticated STA list. This may also be called
+ * while joining/starting an IBSS if MAC authentication is allowed
+ * in IBSS mode.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limInitPreAuthList(tpAniSirGlobal pMac)
+{
+ pMac->lim.pLimPreAuthList = NULL;
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE )
+ {
+ tANI_U32 authClnupTimeout;
+ //tANI_U32 cfgValue;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_PREAUTH_CLNUP_TIMEOUT,
+ &authClnupTimeout) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get PreAuthClnupTimeout value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGE,
+ FL("could not retrieve PreAuthClnupTimeout value\n"));
+
+ return;
+ }
+ authClnupTimeout = SYS_MS_TO_TICKS(authClnupTimeout);
+
+ /// Create and start periodic pre-auth context cleanup timeout
+ if (tx_timer_create(&pMac->lim.limTimers.gLimPreAuthClnupTimer,
+ "preAuthCleanup",
+ limTimerHandler,
+ SIR_LIM_PREAUTH_CLNUP_TIMEOUT,
+ authClnupTimeout, authClnupTimeout,
+ TX_AUTO_ACTIVATE) != TX_SUCCESS)
+ {
+ /// Could not create PreAuthCleanup timer.
+ // Log error
+ limLog(pMac, LOGP, FL("could not create PreAuthCleanup timer\n"));
+
+ return;
+ }
+
+#if defined(ANI_OS_TYPE_RTAI_LINUX)
+ tx_timer_set_expiry_list(&pMac->lim.limTimers.gLimPreAuthClnupTimer,
+ LIM_TIMER_EXPIRY_LIST);
+#endif
+ PELOG1(limLog(pMac, LOG1,
+ FL("Created pre-auth cleanup timer\n"));)
+
+ }
+#endif
+} /*** end limInitPreAuthList() ***/
+
+
+
+/**
+ * limDeletePreAuthList
+ *
+ *FUNCTION:
+ * This function is called cleanup Pre-auth list either on
+ * AP or on STA when moving from one persona to other.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limDeletePreAuthList(tpAniSirGlobal pMac)
+{
+ struct tLimPreAuthNode *pCurrNode, *pTempNode;
+
+ pCurrNode = pTempNode = pMac->lim.pLimPreAuthList;
+ while (pCurrNode != NULL)
+ {
+ pTempNode = pCurrNode->next;
+
+ PELOG1(limLog(pMac, LOG1, FL("=====> limDeletePreAuthList \n"));)
+ limReleasePreAuthNode(pMac, pCurrNode);
+
+ pCurrNode = pTempNode;
+ }
+ pMac->lim.pLimPreAuthList = NULL;
+} /*** end limDeletePreAuthList() ***/
+
+
+
+/**
+ * limSearchPreAuthList
+ *
+ *FUNCTION:
+ * This function is called when Authentication frame is received
+ * by AP (or at a STA in IBSS supporting MAC based authentication)
+ * to search if a STA is in the middle of MAC Authentication
+ * transaction sequence.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param macAddr - MAC address of the STA that sent
+ * Authentication frame.
+ *
+ * @return Pointer to pre-auth node if found, else NULL
+ */
+
+struct tLimPreAuthNode *
+limSearchPreAuthList(tpAniSirGlobal pMac, tSirMacAddr macAddr)
+{
+ struct tLimPreAuthNode *pTempNode = pMac->lim.pLimPreAuthList;
+
+ while (pTempNode != NULL)
+ {
+ if (palEqualMemory( pMac->hHdd,(tANI_U8 *) macAddr,
+ (tANI_U8 *) &pTempNode->peerMacAddr,
+ sizeof(tSirMacAddr)) )
+ break;
+
+ pTempNode = pTempNode->next;
+ }
+
+ return pTempNode;
+} /*** end limSearchPreAuthList() ***/
+
+
+
+/**
+ * limAddPreAuthNode
+ *
+ *FUNCTION:
+ * This function is called at AP while sending Authentication
+ * frame2.
+ * This may also be called on a STA in IBSS if MAC authentication is
+ * allowed in IBSS mode.
+ *
+ *LOGIC:
+ * Node is always added to the front of the list
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pAuthNode - Pointer to pre-auth node to be added to the list.
+ *
+ * @return None
+ */
+
+void
+limAddPreAuthNode(tpAniSirGlobal pMac, struct tLimPreAuthNode *pAuthNode)
+{
+ pMac->lim.gLimNumPreAuthContexts++;
+
+ pAuthNode->next = pMac->lim.pLimPreAuthList;
+
+ pMac->lim.pLimPreAuthList = pAuthNode;
+} /*** end limAddPreAuthNode() ***/
+
+
+/**
+ * limReleasePreAuthNode
+ *
+ *FUNCTION:
+ * This function is called to realease the accquired
+ * pre auth node from list.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pAuthNode - Pointer to Pre Auth node to be released
+ * @return None
+ */
+
+void
+limReleasePreAuthNode(tpAniSirGlobal pMac, tpLimPreAuthNode pAuthNode)
+{
+ pAuthNode->fFree = 1;
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_PRE_AUTH_CLEANUP_TIMER));
+ tx_timer_deactivate(&pAuthNode->timer);
+ pMac->lim.gLimNumPreAuthContexts--;
+} /*** end limReleasePreAuthNode() ***/
+
+
+/**
+ * limDeletePreAuthNode
+ *
+ *FUNCTION:
+ * This function is called at AP when a pre-authenticated STA is
+ * Associated/Reassociated or when AuthFrame4 is received after
+ * Auth Response timeout.
+ * This may also be called on a STA in IBSS if MAC authentication and
+ * Association/Reassociation is allowed in IBSS mode.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param peerMacAddr - MAC address of the STA that need to be deleted
+ * from pre-auth node list.
+ *
+ * @return None
+ */
+
+void
+limDeletePreAuthNode(tpAniSirGlobal pMac, tSirMacAddr macAddr)
+{
+ struct tLimPreAuthNode *pPrevNode, *pTempNode;
+
+ pTempNode = pPrevNode = pMac->lim.pLimPreAuthList;
+
+ if (pTempNode == NULL)
+ return;
+
+ if (palEqualMemory( pMac->hHdd,(tANI_U8 *) macAddr,
+ (tANI_U8 *) &pTempNode->peerMacAddr,
+ sizeof(tSirMacAddr)) )
+ {
+ // First node to be deleted
+
+ pMac->lim.pLimPreAuthList = pTempNode->next;
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ // Delete the auth response timer if running
+ if (pTempNode->fTimerStarted)
+ limDeactivateAndChangePerStaIdTimer(pMac,
+ eLIM_AUTH_RSP_TIMER,
+ pTempNode->authNodeIdx);
+
+#endif
+
+ PELOG1(limLog(pMac, LOG1, FL("=====> limDeletePreAuthNode : first node to delete\n"));)
+ PELOG1(limLog(pMac, LOG1, FL("Release data entry: %x id %d peer \n"),
+ pTempNode, pTempNode->authNodeIdx);
+ limPrintMacAddr(pMac, macAddr, LOG1);)
+ limReleasePreAuthNode(pMac, pTempNode);
+
+ return;
+ }
+
+ pTempNode = pTempNode->next;
+
+ while (pTempNode != NULL)
+ {
+ if (palEqualMemory( pMac->hHdd,(tANI_U8 *) macAddr,
+ (tANI_U8 *) &pTempNode->peerMacAddr,
+ sizeof(tSirMacAddr)) )
+ {
+ // Found node to be deleted
+
+ pPrevNode->next = pTempNode->next;
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ // Delete the auth response timer if running
+ if (pTempNode->fTimerStarted)
+ limDeactivateAndChangePerStaIdTimer(pMac,
+ eLIM_AUTH_RSP_TIMER,
+ pTempNode->authNodeIdx);
+#endif
+ PELOG1(limLog(pMac, LOG1, FL("=====> limDeletePreAuthNode : subsequent node to delete\n"));
+ limLog(pMac, LOG1, FL("Release data entry: %x id %d peer \n"),
+ pTempNode, pTempNode->authNodeIdx);
+ limPrintMacAddr(pMac, macAddr, LOG1);)
+ limReleasePreAuthNode(pMac, pTempNode);
+
+ return;
+ }
+
+ pPrevNode = pTempNode;
+ pTempNode = pTempNode->next;
+ }
+
+ // Should not be here
+ // Log error
+ limLog(pMac, LOGP, FL("peer not found in pre-auth list, addr= "));
+ limPrintMacAddr(pMac, macAddr, LOGP);
+
+} /*** end limDeletePreAuthNode() ***/
+
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+/**
+ * limPreAuthClnupHandler
+ *
+ *FUNCTION:
+ * This function is called on AP upon peridic Pre-authentication
+ * context cleanup.
+ *
+ *LOGIC:
+ * A Pre-auth node is marked as seen first time it comes across
+ * the list traversal. It'll be deleted if already 'seen' (during
+ * next Pre-auth cleanup).
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limPreAuthClnupHandler(tpAniSirGlobal pMac)
+{
+ tANI_U16 aid;
+ tANI_U8 firstNode=false;
+ tpDphHashNode pStaDs;
+ struct tLimPreAuthNode *pPrevNode, *pCurrNode;
+
+#ifdef GEN6_TODO
+ //fetch the sessionEntry based on the sessionId
+ //priority - MEDIUM
+ tpPESession sessionEntry;
+
+ if((sessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimPreAuthClnupTimer.sessionId))== NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+#endif
+
+ pCurrNode = pPrevNode = pMac->lim.pLimPreAuthList;
+
+ while (pCurrNode != NULL)
+ {
+ if (pCurrNode->fSeen)
+ {
+ // Found node to be deleted
+
+ if (pCurrNode == pMac->lim.pLimPreAuthList)
+ {
+ // First node being deleted
+ pMac->lim.pLimPreAuthList = pPrevNode = pCurrNode->next;
+ firstNode = true;
+ }
+ else
+ {
+ pPrevNode->next = pCurrNode->next;
+ }
+
+ // Delete the auth response timer if running
+ if (pCurrNode->fTimerStarted)
+ limDeactivateAndChangePerStaIdTimer(pMac,
+ eLIM_AUTH_RSP_TIMER,
+ pCurrNode->authNodeIdx);
+
+ pStaDs = dphLookupHashEntry(pMac,
+ pCurrNode->peerMacAddr,
+ &aid);
+
+ if (!pStaDs)
+ {
+ /**
+ * STA does not have associated context.
+ * Send advisory Deauthentication frame
+ * to STA being deleted
+ */
+ limSendDeauthMgmtFrame(
+ pMac,
+ eSIR_MAC_PREV_AUTH_NOT_VALID_REASON, //=2
+ pCurrNode->peerMacAddr,sessionEntry);
+ }
+
+ limLog(pMac,
+ LOG3,
+ FL("Release preAuth node during periodic cleanup\n"));
+ limReleasePreAuthNode(pMac, pCurrNode);
+
+ if (firstNode)
+ {
+ // First node was deleted
+ if (pMac->lim.pLimPreAuthList == NULL)
+ break;
+
+ pCurrNode = pMac->lim.pLimPreAuthList;
+ firstNode = false;
+ }
+ else
+ {
+ pCurrNode = pPrevNode->next;
+ }
+ }
+ else
+ {
+ // Mark this node as 'seen'. To be deleted next time.
+ pCurrNode->fSeen = 1;
+
+ pPrevNode = pCurrNode;
+ pCurrNode = pCurrNode->next;
+ }
+ }
+} /*** end limPreAuthClnupHandler() ***/
+#endif
+
+
+
+/**
+ * limRestoreFromPreAuthState
+ *
+ *FUNCTION:
+ * This function is called on STA whenever an Authentication
+ * sequence is complete and state prior to auth need to be
+ * restored.
+ *
+ *LOGIC:
+ * MLM_AUTH_CNF is prepared and sent to SME state machine.
+ * In case of restoring from pre-auth:
+ * - Channel Id is programmed at LO/RF synthesizer
+ * - BSSID is programmed at RHP
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param resultCode - result of authentication attempt
+ * @return None
+ */
+
+void
+limRestoreFromAuthState(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode,tpPESession sessionEntry)
+{
+ tSirMacAddr currentBssId;
+ tLimMlmAuthCnf mlmAuthCnf;
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmAuthCnf.peerMacAddr,
+ (tANI_U8 *) &pMac->lim.gpLimMlmAuthReq->peerMacAddr,
+ sizeof(tSirMacAddr));
+ mlmAuthCnf.authType = pMac->lim.gpLimMlmAuthReq->authType;
+ mlmAuthCnf.resultCode = resultCode;
+ mlmAuthCnf.protStatusCode = protStatusCode;
+
+ /* Update PE session ID*/
+ mlmAuthCnf.sessionId = sessionEntry->peSessionId;
+
+ /// Free up buffer allocated
+ /// for pMac->lim.gLimMlmAuthReq
+ palFreeMemory( pMac->hHdd, pMac->lim.gpLimMlmAuthReq);
+ pMac->lim.gpLimMlmAuthReq = NULL;
+
+ sessionEntry->limMlmState = sessionEntry->limPrevMlmState;
+
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+
+ // 'Change' timer for future activations
+ limDeactivateAndChangeTimer(pMac, eLIM_AUTH_FAIL_TIMER);
+
+ #if 0
+ if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) != eSIR_SUCCESS)
+ {
+ /// Could not get BSSID from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
+ }
+ #endif //TO SUPPORT BT-AMP
+ sirCopyMacAddr(currentBssId,sessionEntry->bssId);
+
+ if (sessionEntry->limSmeState == eLIM_SME_WT_PRE_AUTH_STATE)
+ {
+ pMac->lim.gLimPreAuthChannelNumber = 0;
+ }
+
+ limPostSmeMessage(pMac,
+ LIM_MLM_AUTH_CNF,
+ (tANI_U32 *) &mlmAuthCnf);
+} /*** end limRestoreFromAuthState() ***/
+
+
+
+/**
+ * limLookUpKeyMappings()
+ *
+ *FUNCTION:
+ * This function is called in limProcessAuthFrame() function
+ * to determine if there exists a Key Mapping key for a given
+ * MAC address.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param macAddr MAC address of the peer STA for which existence
+ * of Key Mapping key is to be determined
+ *
+ * @return pKeyMapEntry - Pointer to the keyMapEntry returned by CFG
+ */
+
+tCfgWepKeyEntry *
+limLookUpKeyMappings(tSirMacAddr macAddr)
+{
+ return NULL;
+} /****** end limLookUpKeyMappings() ******/
+
+
+
+/**
+ * limEncryptAuthFrame()
+ *
+ *FUNCTION:
+ * This function is called in limProcessAuthFrame() function
+ * to encrypt Authentication frame3 body.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param keyId key id to used
+ * @param pKey Pointer to the key to be used for encryption
+ * @param pPlainText Pointer to the body to be encrypted
+ * @param pEncrBody Pointer to the encrypted auth frame body
+ * @param keyLength 8 (WEP40) or 16 (WEP104)
+ * @return None
+ */
+
+void
+limEncryptAuthFrame(tpAniSirGlobal pMac, tANI_U8 keyId, tANI_U8 *pKey, tANI_U8 *pPlainText,
+ tANI_U8 *pEncrBody, tANI_U32 keyLength)
+{
+ tANI_U8 seed[LIM_SEED_LENGTH], icv[SIR_MAC_WEP_ICV_LENGTH];
+
+ keyLength += 3;
+
+ // Bytes 0-2 of seed is IV
+ // Read TSF timestamp into seed to get random IV - 1st 3 bytes
+ halGetTxTSFtimer(pMac, (tSirMacTimeStamp *) &seed);
+
+ // Bytes 3-7 of seed is key
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &seed[3], pKey, keyLength - 3);
+
+ // Compute CRC-32 and place them in last 4 bytes of plain text
+ limComputeCrc32(icv, pPlainText, sizeof(tSirMacAuthFrameBody));
+
+ palCopyMemory( pMac->hHdd, pPlainText + sizeof(tSirMacAuthFrameBody),
+ icv, SIR_MAC_WEP_ICV_LENGTH);
+
+ // Run RC4 on plain text with the seed
+ limRC4(pEncrBody + SIR_MAC_WEP_IV_LENGTH,
+ (tANI_U8 *) pPlainText, seed, keyLength,
+ LIM_ENCR_AUTH_BODY_LEN - SIR_MAC_WEP_IV_LENGTH);
+
+ // Prepare IV
+ pEncrBody[0] = seed[0];
+ pEncrBody[1] = seed[1];
+ pEncrBody[2] = seed[2];
+ pEncrBody[3] = keyId << 6;
+} /****** end limEncryptAuthFrame() ******/
+
+
+
+/**
+ * limComputeCrc32()
+ *
+ *FUNCTION:
+ * This function is called to compute CRC-32 on a given source.
+ * Used while encrypting/decrypting Authentication frame 3.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pDest Destination location for computed CRC
+ * @param pSrc Source location to be CRC computed
+ * @param len Length over which CRC to be computed
+ * @return None
+ */
+
+void
+limComputeCrc32(tANI_U8 *pDest, tANI_U8 * pSrc, tANI_U8 len)
+{
+ tANI_U32 crc;
+ int i;
+
+ crc = 0;
+ crc = ~crc;
+
+ while(len-- > 0)
+ crc = limCrcUpdate(crc, *pSrc++);
+
+ crc = ~crc;
+
+ for (i=0; i < SIR_MAC_WEP_IV_LENGTH; i++)
+ {
+ pDest[i] = (tANI_U8)crc;
+ crc >>= 8;
+ }
+} /****** end limComputeCrc32() ******/
+
+
+
+/**
+ * limRC4()
+ *
+ *FUNCTION:
+ * This function is called to run RC4 algorithm. Called while
+ * encrypting/decrypting Authentication frame 3.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pDest Destination location for encrypted text
+ * @param pSrc Source location to be encrypted
+ * @param seed Contains seed (IV + key) for PRNG
+ * @param keyLength 8 (WEP40) or 16 (WEP104)
+ * @param frameLen Length of the frame
+ *
+ * @return None
+ */
+
+void
+limRC4(tANI_U8 *pDest, tANI_U8 *pSrc, tANI_U8 *seed, tANI_U32 keyLength, tANI_U16 frameLen)
+{
+ typedef struct
+ {
+ tANI_U8 i, j;
+ tANI_U8 sbox[256];
+ } tRC4Context;
+
+ tRC4Context ctx;
+
+ {
+ tANI_U16 i, j, k;
+
+ //
+ // Initialize sbox using seed
+ //
+
+ ctx.i = ctx.j = 0;
+ for (i=0; i<256; i++)
+ ctx.sbox[i] = (tANI_U8)i;
+
+ j = 0;
+ k = 0;
+ for (i=0; i<256; i++)
+ {
+ tANI_U8 temp;
+
+ j = (tANI_U8)(j + ctx.sbox[i] + seed[k]);
+ temp = ctx.sbox[i];
+ ctx.sbox[i] = ctx.sbox[j];
+ ctx.sbox[j] = temp;
+
+ if (++k >= keyLength)
+ k = 0;
+ }
+ }
+
+ {
+ tANI_U8 i = ctx.i;
+ tANI_U8 j = ctx.j;
+ tANI_U8 len = (tANI_U8) frameLen;
+
+ while (len-- > 0)
+ {
+ tANI_U8 temp1, temp2;
+
+ i = (tANI_U8)(i+1);
+ temp1 = ctx.sbox[i];
+ j = (tANI_U8)(j + temp1);
+
+ ctx.sbox[i] = temp2 = ctx.sbox[j];
+ ctx.sbox[j] = temp1;
+
+ temp1 = (tANI_U8)(temp1 + temp2);
+ temp1 = ctx.sbox[temp1];
+ temp2 = (tANI_U8)(pSrc ? *pSrc++ : 0);
+
+ *pDest++ = (tANI_U8)(temp1 ^ temp2);
+ }
+
+ ctx.i = i;
+ ctx.j = j;
+ }
+} /****** end limRC4() ******/
+
+
+
+/**
+ * limDecryptAuthFrame()
+ *
+ *FUNCTION:
+ * This function is called in limProcessAuthFrame() function
+ * to decrypt received Authentication frame3 body.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pKey Pointer to the key to be used for decryption
+ * @param pEncrBody Pointer to the body to be decrypted
+ * @param pPlainBody Pointer to the decrypted body
+ * @param keyLength 8 (WEP40) or 16 (WEP104)
+ *
+ * @return Decrypt result - eSIR_SUCCESS for success and
+ * LIM_DECRYPT_ICV_FAIL for ICV mismatch.
+ * If decryption is a success, pBody will
+ * have decrypted auth frame body.
+ */
+
+tANI_U8
+limDecryptAuthFrame(tpAniSirGlobal pMac, tANI_U8 *pKey, tANI_U8 *pEncrBody,
+ tANI_U8 *pPlainBody, tANI_U32 keyLength, tANI_U16 frameLen)
+{
+ tANI_U8 seed[LIM_SEED_LENGTH], icv[SIR_MAC_WEP_ICV_LENGTH];
+ int i;
+ keyLength += 3;
+
+
+ // Bytes 0-2 of seed is received IV
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) seed, pEncrBody, SIR_MAC_WEP_IV_LENGTH - 1);
+
+ // Bytes 3-7 of seed is key
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &seed[3], pKey, keyLength - 3);
+
+ // Run RC4 on encrypted text with the seed
+ limRC4(pPlainBody,
+ pEncrBody + SIR_MAC_WEP_IV_LENGTH,
+ seed,
+ keyLength,
+ frameLen);
+
+ PELOG4(limLog(pMac, LOG4, FL("plainbody is \n"));
+ sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG4, pPlainBody, frameLen);)
+
+ // Compute CRC-32 and place them in last 4 bytes of encrypted body
+ limComputeCrc32(icv,
+ (tANI_U8 *) pPlainBody,
+ (tANI_U8) (frameLen - SIR_MAC_WEP_ICV_LENGTH));
+
+ // Compare RX_ICV with computed ICV
+ for (i = 0; i < SIR_MAC_WEP_ICV_LENGTH; i++)
+ {
+ PELOG4(limLog(pMac, LOG4, FL(" computed ICV%d[%x], rxed ICV%d[%x]\n"),
+ i, icv[i], i, pPlainBody[frameLen - SIR_MAC_WEP_ICV_LENGTH + i]);)
+ if (icv[i] != pPlainBody[frameLen - SIR_MAC_WEP_ICV_LENGTH + i])
+ return LIM_DECRYPT_ICV_FAIL;
+ }
+
+ return eSIR_SUCCESS;
+} /****** end limDecryptAuthFrame() ******/
+
+/**
+ * limPostSmeSetKeysCnf
+ *
+ * A utility API to send MLM_SETKEYS_CNF to SME
+ */
+void limPostSmeSetKeysCnf( tpAniSirGlobal pMac,
+ tLimMlmSetKeysReq *pMlmSetKeysReq,
+ tLimMlmSetKeysCnf *mlmSetKeysCnf)
+{
+ // Prepare and Send LIM_MLM_SETKEYS_CNF
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmSetKeysCnf->peerMacAddr,
+ (tANI_U8 *) pMlmSetKeysReq->peerMacAddr,
+ sizeof(tSirMacAddr));
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmSetKeysCnf->peerMacAddr,
+ (tANI_U8 *) pMlmSetKeysReq->peerMacAddr,
+ sizeof(tSirMacAddr));
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ mlmSetKeysCnf->aid = pMlmSetKeysReq->aid;
+#endif
+
+ /// Free up buffer allocated for mlmSetKeysReq
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmSetKeysReq );
+ pMac->lim.gpLimMlmSetKeysReq = NULL;
+
+ limPostSmeMessage( pMac,
+ LIM_MLM_SETKEYS_CNF,
+ (tANI_U32 *) mlmSetKeysCnf );
+}
+
+/**
+ * limPostSmeRemoveKeysCnf
+ *
+ * A utility API to send MLM_REMOVEKEY_CNF to SME
+ */
+void limPostSmeRemoveKeyCnf( tpAniSirGlobal pMac,
+ tLimMlmRemoveKeyReq *pMlmRemoveKeyReq,
+ tLimMlmRemoveKeyCnf *mlmRemoveKeyCnf)
+{
+ // Prepare and Send LIM_MLM_REMOVEKEYS_CNF
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmRemoveKeyCnf->peerMacAddr,
+ (tANI_U8 *) pMlmRemoveKeyReq->peerMacAddr,
+ sizeof(tSirMacAddr));
+
+ /// Free up buffer allocated for mlmRemoveKeysReq
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmRemoveKeyReq );
+ pMac->lim.gpLimMlmRemoveKeyReq = NULL;
+
+ pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState; //Restore the state.
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+ limPostSmeMessage( pMac,
+ LIM_MLM_REMOVEKEY_CNF,
+ (tANI_U32 *) mlmRemoveKeyCnf );
+}
+
+/**
+ * limSendSetBssKeyReq()
+ *
+ *FUNCTION:
+ * This function is called from limProcessMlmSetKeysReq(),
+ * when PE is trying to setup the Group Keys related
+ * to a specified encryption type
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pMlmSetKeysReq Pointer to MLM_SETKEYS_REQ buffer
+ * @return none
+ */
+void limSendSetBssKeyReq( tpAniSirGlobal pMac,
+ tLimMlmSetKeysReq *pMlmSetKeysReq,
+ tpPESession psessionEntry)
+{
+tSirMsgQ msgQ;
+tpSetBssKeyParams pSetBssKeyParams = NULL;
+tLimMlmSetKeysCnf mlmSetKeysCnf;
+tSirRetStatus retCode;
+tANI_U32 val = 0;
+
+ if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
+ {
+ limLog( pMac, LOG1,
+ FL( "numKeys = %d is more than SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS\n" ), pMlmSetKeysReq->numKeys);
+
+ // Respond to SME with error code
+ mlmSetKeysCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
+ goto end;
+ }
+
+ // Package WDA_SET_BSSKEY_REQ message parameters
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pSetBssKeyParams,
+ sizeof( tSetBssKeyParams )))
+ {
+ limLog( pMac, LOGE,
+ FL( "Unable to PAL allocate memory during SET_BSSKEY\n" ));
+
+ // Respond to SME with error code
+ mlmSetKeysCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ goto end;
+ }
+ else
+ palZeroMemory( pMac->hHdd,
+ (void *) pSetBssKeyParams,
+ sizeof( tSetBssKeyParams ));
+
+ // Update the WDA_SET_BSSKEY_REQ parameters
+ pSetBssKeyParams->bssIdx = psessionEntry->bssIdx;
+ pSetBssKeyParams->encType = pMlmSetKeysReq->edType;
+ pSetBssKeyParams->numKeys = pMlmSetKeysReq->numKeys;
+
+ if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
+ {
+ limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC\n" ));
+ }
+
+ pSetBssKeyParams->singleTidRc = (tANI_U8)val;
+
+ /* Update PE session Id*/
+ pSetBssKeyParams->sessionId = psessionEntry ->peSessionId;
+
+ palCopyMemory( pMac->hHdd,
+ (tANI_U8 *) &pSetBssKeyParams->key,
+ (tANI_U8 *) &pMlmSetKeysReq->key,
+ sizeof( tSirKeys ) * pMlmSetKeysReq->numKeys );
+
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+ msgQ.type = WDA_SET_BSSKEY_REQ;
+ //
+ // FIXME_GEN4
+ // A global counter (dialog token) is required to keep track of
+ // all PE <-> HAL communication(s)
+ //
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pSetBssKeyParams;
+ msgQ.bodyval = 0;
+
+ limLog( pMac, LOGW,
+ FL( "Sending WDA_SET_BSSKEY_REQ...\n" ));
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ {
+ limLog( pMac, LOGE,
+ FL("Posting SET_BSSKEY to HAL failed, reason=%X\n"),
+ retCode );
+
+ // Respond to SME with LIM_MLM_SETKEYS_CNF
+ mlmSetKeysCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
+ }
+ else
+ return; // Continue after WDA_SET_BSSKEY_RSP...
+
+end:
+ limPostSmeSetKeysCnf( pMac,
+ pMlmSetKeysReq,
+ &mlmSetKeysCnf );
+
+}
+
+/**
+ * @function : limSendSetStaKeyReq()
+ *
+ * @brief : This function is called from limProcessMlmSetKeysReq(),
+ * when PE is trying to setup the Unicast Keys related
+ * to a specified STA with specified encryption type
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pMlmSetKeysReq Pointer to MLM_SETKEYS_REQ buffer
+ * @param staIdx STA index for which the keys are being set
+ * @param defWEPIdx The default WEP key index [0..3]
+ * @return none
+ */
+void limSendSetStaKeyReq( tpAniSirGlobal pMac,
+ tLimMlmSetKeysReq *pMlmSetKeysReq,
+ tANI_U16 staIdx,
+ tANI_U8 defWEPIdx,
+ tpPESession sessionEntry)
+{
+tSirMsgQ msgQ;
+tpSetStaKeyParams pSetStaKeyParams = NULL;
+tLimMlmSetKeysCnf mlmSetKeysCnf;
+tSirRetStatus retCode;
+tANI_U32 val = 0;
+
+ // Package WDA_SET_STAKEY_REQ message parameters
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **) &pSetStaKeyParams,
+ sizeof( tSetStaKeyParams ))) {
+ limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during SET_BSSKEY\n" ));
+ return;
+ }else
+ palZeroMemory( pMac->hHdd, (void *) pSetStaKeyParams, sizeof( tSetStaKeyParams ));
+
+ // Update the WDA_SET_STAKEY_REQ parameters
+ pSetStaKeyParams->staIdx = staIdx;
+ pSetStaKeyParams->encType = pMlmSetKeysReq->edType;
+
+
+ if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
+ {
+ limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC\n" ));
+ }
+
+ pSetStaKeyParams->singleTidRc = (tANI_U8)val;
+
+ /* Update PE session ID*/
+ pSetStaKeyParams->sessionId = sessionEntry->peSessionId;
+
+ /**
+ * For WEP - defWEPIdx indicates the default WEP
+ * Key to be used for TX
+ * For all others, there's just one key that can
+ * be used and hence it is assumed that
+ * defWEPIdx = 0 (from the caller)
+ */
+
+ pSetStaKeyParams->defWEPIdx = defWEPIdx;
+
+ /** Store the Previous MlmState*/
+ sessionEntry->limPrevMlmState = sessionEntry->limMlmState;
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+
+ if(sessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE && !pMlmSetKeysReq->key[0].unicast) {
+ sessionEntry->limMlmState = eLIM_MLM_WT_SET_STA_BCASTKEY_STATE;
+ msgQ.type = WDA_SET_STA_BCASTKEY_REQ;
+ }else {
+ sessionEntry->limMlmState = eLIM_MLM_WT_SET_STA_KEY_STATE;
+ msgQ.type = WDA_SET_STAKEY_REQ;
+ }
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+ /**
+ * In the Case of WEP_DYNAMIC, ED_TKIP and ED_CCMP
+ * the Key[0] contains the KEY, so just copy that alone,
+ * for the case of WEP_STATIC the hal gets the key from cfg
+ */
+ switch( pMlmSetKeysReq->edType ) {
+ case eSIR_ED_WEP40:
+ case eSIR_ED_WEP104:
+ // FIXME! Is this OK?
+ if( 0 == pMlmSetKeysReq->numKeys ) {
+#ifdef WLAN_SOFTAP_FEATURE
+ tANI_U32 i;
+
+ for(i=0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS ;i++)
+ {
+ palCopyMemory( pMac->hHdd,
+ (tANI_U8 *) &pSetStaKeyParams->key[i],
+ (tANI_U8 *) &pMlmSetKeysReq->key[i], sizeof( tSirKeys ));
+ }
+#endif
+ pSetStaKeyParams->wepType = eSIR_WEP_STATIC;
+ sessionEntry->limMlmState = eLIM_MLM_WT_SET_STA_KEY_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+ }else {
+ pSetStaKeyParams->wepType = eSIR_WEP_DYNAMIC;
+ palCopyMemory( pMac->hHdd,
+ (tANI_U8 *) &pSetStaKeyParams->key,
+ (tANI_U8 *) &pMlmSetKeysReq->key[0], sizeof( tSirKeys ));
+ }
+ break;
+ case eSIR_ED_TKIP:
+ case eSIR_ED_CCMP:
+#ifdef FEATURE_WLAN_WAPI
+ case eSIR_ED_WPI:
+#endif
+ {
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pSetStaKeyParams->key,
+ (tANI_U8 *) &pMlmSetKeysReq->key[0], sizeof( tSirKeys ));
+ }
+ break;
+ default:
+ break;
+ }
+
+
+ //
+ // FIXME_GEN4
+ // A global counter (dialog token) is required to keep track of
+ // all PE <-> HAL communication(s)
+ //
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pSetStaKeyParams;
+ msgQ.bodyval = 0;
+
+ limLog( pMac, LOG1, FL( "Sending WDA_SET_STAKEY_REQ...\n" ));
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) {
+ limLog( pMac, LOGE, FL("Posting SET_STAKEY to HAL failed, reason=%X\n"), retCode );
+ // Respond to SME with LIM_MLM_SETKEYS_CNF
+ mlmSetKeysCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
+ }else
+ return; // Continue after WDA_SET_STAKEY_RSP...
+
+ limPostSmeSetKeysCnf( pMac, pMlmSetKeysReq, &mlmSetKeysCnf );
+}
+
+/**
+ * limSendRemoveBssKeyReq()
+ *
+ *FUNCTION:
+ * This function is called from limProcessMlmRemoveReq(),
+ * when PE is trying to Remove a Group Key related
+ * to a specified encryption type
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pMlmRemoveKeyReq Pointer to MLM_REMOVEKEY_REQ buffer
+ * @return none
+ */
+void limSendRemoveBssKeyReq( tpAniSirGlobal pMac,
+ tLimMlmRemoveKeyReq *pMlmRemoveKeyReq,
+ tpPESession psessionEntry)
+{
+tSirMsgQ msgQ;
+tpRemoveBssKeyParams pRemoveBssKeyParams = NULL;
+tLimMlmRemoveKeyCnf mlmRemoveKeysCnf;
+tSirRetStatus retCode;
+
+ // Package WDA_REMOVE_BSSKEY_REQ message parameters
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pRemoveBssKeyParams,
+ sizeof( tRemoveBssKeyParams )))
+ {
+ limLog( pMac, LOGE,
+ FL( "Unable to PAL allocate memory during REMOVE_BSSKEY\n" ));
+
+ // Respond to SME with error code
+ mlmRemoveKeysCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ goto end;
+ }
+ else
+ palZeroMemory( pMac->hHdd,
+ (void *) pRemoveBssKeyParams,
+ sizeof( tRemoveBssKeyParams ));
+
+ // Update the WDA_REMOVE_BSSKEY_REQ parameters
+ pRemoveBssKeyParams->bssIdx = psessionEntry->bssIdx;
+ pRemoveBssKeyParams->encType = pMlmRemoveKeyReq->edType;
+ pRemoveBssKeyParams->keyId = pMlmRemoveKeyReq->keyId;
+ pRemoveBssKeyParams->wepType = pMlmRemoveKeyReq->wepType;
+
+ /* Update PE session Id*/
+
+ pRemoveBssKeyParams->sessionId = psessionEntry->peSessionId;
+
+ msgQ.type = WDA_REMOVE_BSSKEY_REQ;
+ //
+ // FIXME_GEN4
+ // A global counter (dialog token) is required to keep track of
+ // all PE <-> HAL communication(s)
+ //
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pRemoveBssKeyParams;
+ msgQ.bodyval = 0;
+
+ limLog( pMac, LOGW,
+ FL( "Sending WDA_REMOVE_BSSKEY_REQ...\n" ));
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ {
+ limLog( pMac, LOGE,
+ FL("Posting REMOVE_BSSKEY to HAL failed, reason=%X\n"),
+ retCode );
+
+ // Respond to SME with LIM_MLM_REMOVEKEYS_CNF
+ mlmRemoveKeysCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
+ }
+ else
+ return;
+
+end:
+ limPostSmeRemoveKeyCnf( pMac,
+ pMlmRemoveKeyReq,
+ &mlmRemoveKeysCnf );
+
+}
+
+/**
+ * limSendRemoveStaKeyReq()
+ *
+ *FUNCTION:
+ * This function is called from limProcessMlmRemoveKeysReq(),
+ * when PE is trying to setup the Unicast Keys related
+ * to a specified STA with specified encryption type
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pMlmRemoveKeysReq Pointer to MLM_REMOVEKEYS_REQ buffer
+ * @param staIdx STA index for which the keys are being set
+ * @return none
+ */
+void limSendRemoveStaKeyReq( tpAniSirGlobal pMac,
+ tLimMlmRemoveKeyReq *pMlmRemoveKeyReq,
+ tANI_U16 staIdx ,
+ tpPESession sessionEntry)
+{
+tSirMsgQ msgQ;
+tpRemoveStaKeyParams pRemoveStaKeyParams = NULL;
+tLimMlmRemoveKeyCnf mlmRemoveKeyCnf;
+tSirRetStatus retCode;
+
+
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pRemoveStaKeyParams,
+ sizeof( tRemoveStaKeyParams )))
+ {
+ limLog( pMac, LOGE,
+ FL( "Unable to PAL allocate memory during REMOVE_STAKEY\n" ));
+
+ // Respond to SME with error code
+ mlmRemoveKeyCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ goto end;
+ }
+ else
+ palZeroMemory( pMac->hHdd,
+ (void *) pRemoveStaKeyParams,
+ sizeof( tRemoveStaKeyParams ));
+
+ if( (pMlmRemoveKeyReq->edType == eSIR_ED_WEP104 || pMlmRemoveKeyReq->edType == eSIR_ED_WEP40) &&
+ pMlmRemoveKeyReq->wepType == eSIR_WEP_STATIC )
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Request to remove static WEP keys through station interface\n Should use BSS interface\n"));)
+ mlmRemoveKeyCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
+ goto end;
+ }
+
+ // Update the WDA_REMOVEKEY_REQ parameters
+ pRemoveStaKeyParams->staIdx = staIdx;
+ pRemoveStaKeyParams->encType = pMlmRemoveKeyReq->edType;
+ pRemoveStaKeyParams->keyId = pMlmRemoveKeyReq->keyId;
+ pRemoveStaKeyParams->unicast = pMlmRemoveKeyReq->unicast;
+
+ /* Update PE session ID*/
+ pRemoveStaKeyParams->sessionId = sessionEntry->peSessionId;
+
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+
+ msgQ.type = WDA_REMOVE_STAKEY_REQ;
+ //
+ // FIXME_GEN4
+ // A global counter (dialog token) is required to keep track of
+ // all PE <-> HAL communication(s)
+ //
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pRemoveStaKeyParams;
+ msgQ.bodyval = 0;
+
+ limLog( pMac, LOGW,
+ FL( "Sending WDA_REMOVE_STAKEY_REQ...\n" ));
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ {
+ limLog( pMac, LOGE,
+ FL("Posting REMOVE_STAKEY to HAL failed, reason=%X\n"),
+ retCode );
+
+ // Respond to SME with LIM_MLM_REMOVEKEY_CNF
+ mlmRemoveKeyCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
+ }
+ else
+ return;
+
+end:
+ limPostSmeRemoveKeyCnf( pMac,
+ pMlmRemoveKeyReq,
+ &mlmRemoveKeyCnf );
+
+}
+
+
diff --git a/CORE/MAC/src/pe/lim/limSecurityUtils.h b/CORE/MAC/src/pe/lim/limSecurityUtils.h
new file mode 100644
index 0000000..2479f14
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limSecurityUtils.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limSecurityUtils.h contains the utility definitions
+ * related to WEP encryption/decryption etc.
+ * Author: Chandra Modumudi
+ * Date: 02/13/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+#ifndef __LIM_SECURITY_UTILS_H
+#define __LIM_SECURITY_UTILS_H
+#include "sirMacProtDef.h" //for tSirMacAuthFrameBody
+
+#define LIM_ENCR_AUTH_BODY_LEN sizeof(tSirMacAuthFrameBody) + \
+ SIR_MAC_WEP_IV_LENGTH + \
+ SIR_MAC_WEP_ICV_LENGTH
+struct tLimPreAuthNode;
+
+#ifdef WLAN_SOFTAP_FEATURE
+tANI_U8 limIsAuthAlgoSupported(tpAniSirGlobal, tAniAuthType, tpPESession);
+#else
+tANI_U8 limIsAuthAlgoSupported(tpAniSirGlobal, tAniAuthType);
+#endif
+
+// MAC based authentication related functions
+void limInitPreAuthList(tpAniSirGlobal);
+void limDeletePreAuthList(tpAniSirGlobal);
+struct tLimPreAuthNode *limSearchPreAuthList(tpAniSirGlobal, tSirMacAddr);
+void limAddPreAuthNode(tpAniSirGlobal, struct tLimPreAuthNode *);
+void limDeletePreAuthNode(tpAniSirGlobal, tSirMacAddr);
+void limReleasePreAuthNode(tpAniSirGlobal pMac, tpLimPreAuthNode pAuthNode);
+void limRestoreFromAuthState(tpAniSirGlobal,
+ tSirResultCodes, tANI_U16,tpPESession);
+
+// Encryption/Decryption related functions
+tCfgWepKeyEntry *limLookUpKeyMappings(tSirMacAddr);
+void limComputeCrc32(tANI_U8 *, tANI_U8 *, tANI_U8);
+void limRC4(tANI_U8 *, tANI_U8 *, tANI_U8 *, tANI_U32, tANI_U16);
+void limEncryptAuthFrame(tpAniSirGlobal, tANI_U8, tANI_U8 *, tANI_U8 *, tANI_U8 *, tANI_U32);
+tANI_U8 limDecryptAuthFrame(tpAniSirGlobal, tANI_U8 *, tANI_U8 *, tANI_U8 *, tANI_U32, tANI_U16);
+
+void limSendSetBssKeyReq( tpAniSirGlobal, tLimMlmSetKeysReq *,tpPESession );
+void limSendSetStaKeyReq( tpAniSirGlobal, tLimMlmSetKeysReq *, tANI_U16, tANI_U8,tpPESession);
+void limPostSmeSetKeysCnf( tpAniSirGlobal, tLimMlmSetKeysReq *, tLimMlmSetKeysCnf * );
+
+void limSendRemoveBssKeyReq(tpAniSirGlobal pMac, tLimMlmRemoveKeyReq * pMlmRemoveKeyReq,tpPESession);
+void limSendRemoveStaKeyReq(tpAniSirGlobal pMac, tLimMlmRemoveKeyReq * pMlmRemoveKeyReq, tANI_U16 staIdx,tpPESession);
+void limPostSmeRemoveKeyCnf(tpAniSirGlobal pMac, tLimMlmRemoveKeyReq * pMlmRemoveKeyReq, tLimMlmRemoveKeyCnf * mlmRemoveKeyCnf);
+
+#define PTAPS 0xedb88320
+
+static inline tANI_U32
+limCrcUpdate(tANI_U32 crc, tANI_U8 x)
+{
+
+ // Update CRC computation for 8 bits contained in x
+ //
+ tANI_U32 z;
+ tANI_U32 fb;
+ int i;
+
+ z = crc^x;
+ for (i=0; i<8; i++) {
+ fb = z & 1;
+ z >>= 1;
+ if (fb) z ^= PTAPS;
+ }
+ return z;
+}
+
+#endif /* __LIM_SECURITY_UTILS_H */
diff --git a/CORE/MAC/src/pe/lim/limSendManagementFrames.c b/CORE/MAC/src/pe/lim/limSendManagementFrames.c
new file mode 100644
index 0000000..3ecffb2
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limSendManagementFrames.c
@@ -0,0 +1,5489 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * \file limSendManagementFrames.c
+ *
+ * \brief Code for preparing and sending 802.11 Management frames
+ *
+ * Copyright (C) 2005-2007 Airgo Networks, Incorporated
+ *
+ */
+
+#include "sirApi.h"
+#include "aniGlobal.h"
+#include "sirMacProtDef.h"
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halDataStruct.h"
+#endif
+#include "cfgApi.h"
+#include "utilsApi.h"
+#include "limTypes.h"
+#include "limUtils.h"
+#include "limSecurityUtils.h"
+#include "dot11f.h"
+#include "limStaHashApi.h"
+#include "schApi.h"
+#include "limSendMessages.h"
+#if defined WLAN_FEATURE_VOWIFI
+#include "rrmApi.h"
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+#include <limCcxparserApi.h>
+#endif
+#include "wlan_qct_wda.h"
+#ifdef WLAN_FEATURE_11W
+#include "dot11fdefs.h"
+#endif
+
+
+////////////////////////////////////////////////////////////////////////
+
+/// Get an integral configuration item & check return status; if it
+/// fails, return.
+#define CFG_LIM_GET_INT_NO_STATUS(nStatus, pMac, nItem, cfg ) \
+ (nStatus) = wlan_cfgGetInt( (pMac), (nItem), & (cfg) ); \
+ if ( eSIR_SUCCESS != (nStatus) ) \
+ { \
+ limLog( (pMac), LOGP, FL("Failed to retrieve " \
+ #nItem " from CFG (%d).\n"), \
+ (nStatus) ); \
+ return; \
+ }
+
+/// Get an text configuration item & check return status; if it fails,
+/// return.
+#define CFG_LIM_GET_STR_NO_STATUS(nStatus, pMac, nItem, cfg, nCfg, \
+ nMaxCfg) \
+ (nCfg) = (nMaxCfg); \
+ (nStatus) = wlan_cfgGetStr( (pMac), (nItem), (cfg), & (nCfg) ); \
+ if ( eSIR_SUCCESS != (nStatus) ) \
+ { \
+ limLog( (pMac), LOGP, FL("Failed to retrieve " \
+ #nItem " from CFG (%d).\n"), \
+ (nStatus) ); \
+ return; \
+ }
+
+/**
+ *
+ * \brief This function is called by various LIM modules to prepare the
+ * 802.11 frame MAC header
+ *
+ *
+ * \param pMac Pointer to Global MAC structure
+ *
+ * \param pBD Pointer to the frame buffer that needs to be populate
+ *
+ * \param type Type of the frame
+ *
+ * \param subType Subtype of the frame
+ *
+ * \return eHalStatus
+ *
+ *
+ * The pFrameBuf argument points to the beginning of the frame buffer to
+ * which - a) The 802.11 MAC header is set b) Following this MAC header
+ * will be the MGMT frame payload The payload itself is populated by the
+ * caller API
+ *
+ *
+ */
+
+tSirRetStatus limPopulateMacHeader( tpAniSirGlobal pMac,
+ tANI_U8* pBD,
+ tANI_U8 type,
+ tANI_U8 subType,
+ tSirMacAddr peerAddr ,tSirMacAddr selfMacAddr)
+{
+ tSirRetStatus statusCode = eSIR_SUCCESS;
+ tpSirMacMgmtHdr pMacHdr;
+
+ /// Prepare MAC management header
+ pMacHdr = (tpSirMacMgmtHdr) (pBD);
+
+ // Prepare FC
+ pMacHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION;
+ pMacHdr->fc.type = type;
+ pMacHdr->fc.subType = subType;
+
+ // Prepare Address 1
+ palCopyMemory( pMac->hHdd,
+ (tANI_U8 *) pMacHdr->da,
+ (tANI_U8 *) peerAddr,
+ sizeof( tSirMacAddr ));
+
+ // Prepare Address 2
+ #if 0
+ if ((statusCode = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, (tANI_U8 *) pMacHdr->sa,
+ &cfgLen)) != eSIR_SUCCESS)
+ {
+ // Could not get STA_ID from CFG. Log error.
+ limLog( pMac, LOGP,
+ FL("Failed to retrive STA_ID\n"));
+ return statusCode;
+ }
+ #endif// TO SUPPORT BT-AMP
+ sirCopyMacAddr(pMacHdr->sa,selfMacAddr);
+
+ // Prepare Address 3
+ palCopyMemory( pMac->hHdd,
+ (tANI_U8 *) pMacHdr->bssId,
+ (tANI_U8 *) peerAddr,
+ sizeof( tSirMacAddr ));
+ return statusCode;
+} /*** end limPopulateMacHeader() ***/
+
+/**
+ * \brief limSendProbeReqMgmtFrame
+ *
+ *
+ * \param pMac Pointer to Global MAC structure
+ *
+ * \param pSsid SSID to be sent in Probe Request frame
+ *
+ * \param bssid BSSID to be sent in Probe Request frame
+ *
+ * \param nProbeDelay probe delay to be used before sending Probe Request
+ * frame
+ *
+ * \param nChannelNum Channel # on which the Probe Request is going out
+ *
+ * \param nAdditionalIELen if non-zero, include pAdditionalIE in the Probe Request frame
+ *
+ * \param pAdditionalIE if nAdditionalIELen is non zero, include this field in the Probe Request frame
+ *
+ * This function is called by various LIM modules to send Probe Request frame
+ * during active scan/learn phase.
+ * Probe request is sent out in the following scenarios:
+ * --heartbeat failure: session needed
+ * --join req: session needed
+ * --foreground scan: no session
+ * --background scan: no session
+ * --schBeaconProcessing: to get EDCA parameters: session needed
+ *
+ *
+ */
+tSirRetStatus
+limSendProbeReqMgmtFrame(tpAniSirGlobal pMac,
+ tSirMacSSid *pSsid,
+ tSirMacAddr bssid,
+ tANI_U8 nChannelNum,
+ tSirMacAddr SelfMacAddr,
+ tANI_U32 dot11mode,
+ tANI_U32 nAdditionalIELen,
+ tANI_U8 *pAdditionalIE)
+{
+ tDot11fProbeRequest pr;
+ tANI_U32 nStatus, nBytes, nPayload;
+ tSirRetStatus nSirStatus;
+ tANI_U8 *pFrame;
+ void *pPacket;
+ eHalStatus halstatus;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId;
+#ifdef WLAN_FEATURE_P2P
+ tANI_U8 *p2pIe = NULL;
+#endif
+ tANI_U8 txFlag = 0;
+
+#ifndef GEN4_SCAN
+ return eSIR_FAILURE;
+#endif
+
+#if defined ( ANI_DVT_DEBUG )
+ return eSIR_FAILURE;
+#endif
+
+ /*
+ * session context may or may not be present, when probe request needs to be sent out.
+ * following cases exist:
+ * --heartbeat failure: session needed
+ * --join req: session needed
+ * --foreground scan: no session
+ * --background scan: no session
+ * --schBeaconProcessing: to get EDCA parameters: session needed
+ * If session context does not exist, some IEs will be populated from CFGs,
+ * e.g. Supported and Extended rate set IEs
+ */
+ psessionEntry = peFindSessionByBssid(pMac,bssid,&sessionId);
+
+ // The scheme here is to fill out a 'tDot11fProbeRequest' structure
+ // and then hand it off to 'dot11fPackProbeRequest' (for
+ // serialization). We start by zero-initializing the structure:
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&pr, sizeof( pr ) );
+
+ // & delegating to assorted helpers:
+ PopulateDot11fSSID( pMac, pSsid, &pr.SSID );
+
+#ifdef WLAN_FEATURE_P2P
+ if( nAdditionalIELen && pAdditionalIE )
+ {
+ p2pIe = limGetP2pIEPtr(pMac, pAdditionalIE, nAdditionalIELen);
+ }
+ if( p2pIe != NULL)
+ {
+ /* In the below API pass channel number > 14, do that it fills only
+ * 11a rates in supported rates */
+ PopulateDot11fSuppRates( pMac, 15, &pr.SuppRates,psessionEntry);
+ }
+ else
+ {
+#endif
+ PopulateDot11fSuppRates( pMac, nChannelNum,
+ &pr.SuppRates,psessionEntry);
+
+ if ( WNI_CFG_DOT11_MODE_11B != dot11mode )
+ {
+ PopulateDot11fExtSuppRates1( pMac, nChannelNum, &pr.ExtSuppRates );
+ }
+#ifdef WLAN_FEATURE_P2P
+ }
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI
+ //Table 7-14 in IEEE Std. 802.11k-2008 says
+ //DS params "can" be present in RRM is disabled and "is" present if
+ //RRM is enabled. It should be ok even if we add it into probe req when
+ //RRM is not enabled.
+ PopulateDot11fDSParams( pMac, &pr.DSParams, nChannelNum, psessionEntry );
+ //Call RRM module to get the tx power for management used.
+ {
+ tANI_U8 txPower = (tANI_U8) rrmGetMgmtTxPower( pMac, psessionEntry );
+ PopulateDot11fWFATPC( pMac, &pr.WFATPC, txPower, 0 );
+ }
+#endif
+ pMac->lim.htCapability = IS_DOT11_MODE_HT(dot11mode);
+
+ if (psessionEntry != NULL ) {
+ psessionEntry->htCapabality = IS_DOT11_MODE_HT(dot11mode);
+ //Include HT Capability IE
+ if (psessionEntry->htCapabality)
+ {
+ PopulateDot11fHTCaps( pMac, &pr.HTCaps );
+ }
+ } else {
+ if (pMac->lim.htCapability)
+ {
+ PopulateDot11fHTCaps( pMac, &pr.HTCaps );
+ }
+ }
+
+ // That's it-- now we pack it. First, how much space are we going to
+ // need?
+ nStatus = dot11fGetPackedProbeRequestSize( pMac, &pr, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+ "or a Probe Request (0x%08x).\n"), nStatus );
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fProbeRequest );
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calculating"
+ "the packed size for a Probe Request ("
+ "0x%08x).\n"), nStatus );
+ }
+
+ nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAdditionalIELen;
+
+ // Ok-- try to allocate some memory:
+ halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( tANI_U16 )nBytes, ( void** ) &pFrame,
+ ( void** ) &pPacket );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Pro"
+ "be Request.\n"), nBytes );
+ return eSIR_MEM_ALLOC_FAILED;
+ }
+
+ // Paranoia:
+ palZeroMemory( pMac->hHdd, pFrame, nBytes );
+
+ // Next, we fill out the buffer descriptor:
+ nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_PROBE_REQ, bssid ,SelfMacAddr);
+ if ( eSIR_SUCCESS != nSirStatus )
+ {
+ limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
+ "tor for a Probe Request (%d).\n"),
+ nSirStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( void* ) pFrame, ( void* ) pPacket );
+ return nSirStatus; // allocated!
+ }
+
+ // That done, pack the Probe Request:
+ nStatus = dot11fPackProbeRequest( pMac, &pr, pFrame +
+ sizeof( tSirMacMgmtHdr ),
+ nPayload, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to pack a Probe Request (0x%08x).\n"),
+ nStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return eSIR_FAILURE; // allocated!
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while packing a P"
+ "robe Request (0x%08x).\n") );
+ }
+
+ // Append any AddIE if present.
+ if( nAdditionalIELen )
+ {
+ palCopyMemory( pMac->hHdd, pFrame+sizeof(tSirMacMgmtHdr)+nPayload,
+ pAdditionalIE, nAdditionalIELen );
+ nPayload += nAdditionalIELen;
+ }
+
+ /* If this probe request is sent during P2P Search State, then we need
+ * to send it at OFDM rate.
+ */
+ if( ( SIR_BAND_5_GHZ == limGetRFBand(nChannelNum))
+#ifdef WLAN_FEATURE_P2P
+ || (( pMac->lim.gpLimMlmScanReq != NULL) &&
+ pMac->lim.gpLimMlmScanReq->p2pSearch )
+#endif
+ )
+ {
+ txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
+ }
+
+
+ halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) sizeof(tSirMacMgmtHdr) + nPayload,
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete, pFrame, txFlag );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGE, FL("could not send Probe Request frame!\n" ));
+ //Pkt will be freed up by the callback
+ return eSIR_FAILURE;
+ }
+
+ return eSIR_SUCCESS;
+} // End limSendProbeReqMgmtFrame.
+
+#ifdef WLAN_FEATURE_P2P
+tSirRetStatus limGetAddnIeForProbeResp(tpAniSirGlobal pMac,
+ tANI_U8* addIE, tANI_U16 *addnIELen,
+ tANI_U8 probeReqP2pIe)
+{
+ /* If Probe request doesn't have P2P IE, then take out P2P IE
+ from additional IE */
+ if(!probeReqP2pIe)
+ {
+ tANI_U8* tempbuf = NULL;
+ tANI_U16 tempLen = 0;
+ int left = *addnIELen;
+ v_U8_t *ptr = addIE;
+ v_U8_t elem_id, elem_len;
+
+ if(NULL == addIE)
+ {
+ PELOGE(limLog(pMac, LOGE,
+ FL(" NULL addIE pointer"));)
+ return eSIR_FAILURE;
+ }
+
+ if( (palAllocateMemory(pMac->hHdd, (void**)&tempbuf,
+ left)) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE,
+ FL("Unable to allocate memory to store addn IE"));)
+ return eSIR_MEM_ALLOC_FAILED;
+ }
+
+ while(left >= 2)
+ {
+ elem_id = ptr[0];
+ elem_len = ptr[1];
+ left -= 2;
+ if(elem_len > left)
+ {
+ limLog( pMac, LOGE,
+ FL("****Invalid IEs eid = %d elem_len=%d left=%d*****\n"),
+ elem_id,elem_len,left);
+ palFreeMemory(pMac->hHdd, tempbuf);
+ return eSIR_FAILURE;
+ }
+ if ( !( (SIR_MAC_EID_VENDOR == elem_id) &&
+ (memcmp(&ptr[2], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE)==0) ) )
+ {
+ palCopyMemory ( pMac->hHdd, tempbuf + tempLen, &ptr[0], elem_len + 2);
+ tempLen += (elem_len + 2);
+ }
+ left -= elem_len;
+ ptr += (elem_len + 2);
+ }
+ palCopyMemory ( pMac->hHdd, addIE, tempbuf, tempLen);
+ *addnIELen = tempLen;
+ palFreeMemory(pMac->hHdd, tempbuf);
+ }
+ return eSIR_SUCCESS;
+}
+#endif
+
+void
+limSendProbeRspMgmtFrame(tpAniSirGlobal pMac,
+ tSirMacAddr peerMacAddr,
+ tpAniSSID pSsid,
+ short nStaId,
+ tANI_U8 nKeepAlive,
+ tpPESession psessionEntry,
+ tANI_U8 probeReqP2pIe)
+{
+ tDot11fProbeResponse frm;
+ tSirRetStatus nSirStatus;
+ tANI_U32 cfg, nPayload, nBytes, nStatus;
+ tpSirMacMgmtHdr pMacHdr;
+ tANI_U8 *pFrame;
+ void *pPacket;
+ eHalStatus halstatus;
+ tANI_U32 addnIEPresent;
+ tANI_U32 addnIE1Len=0;
+ tANI_U32 addnIE2Len=0;
+ tANI_U32 addnIE3Len=0;
+ tANI_U16 totalAddnIeLen = 0;
+ tANI_U32 wpsApEnable=0, tmp;
+ tANI_U8 txFlag = 0;
+ tANI_U8 *addIE = NULL;
+#ifdef WLAN_FEATURE_P2P
+ tANI_U8 *pP2pIe = NULL;
+ tANI_U8 noaLen = 0;
+ tANI_U8 total_noaLen = 0;
+ tANI_U8 noaStream[SIR_MAX_NOA_ATTR_LEN
+ + SIR_P2P_IE_HEADER_LEN];
+ tANI_U8 noaIe[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN];
+#endif
+
+ if(pMac->gDriverType == eDRIVER_TYPE_MFG) // We don't answer requests
+ {
+ return; // in this case.
+ }
+
+ if(NULL == psessionEntry)
+ {
+ return;
+ }
+
+ // Fill out 'frm', after which we'll just hand the struct off to
+ // 'dot11fPackProbeResponse'.
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
+
+ // Timestamp to be updated by TFP, below.
+
+ // Beacon Interval:
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ {
+ frm.BeaconInterval.interval = pMac->sch.schObject.gSchBeaconInterval;
+ }
+ else
+ {
+#endif
+ CFG_LIM_GET_INT_NO_STATUS( nSirStatus, pMac,
+ WNI_CFG_BEACON_INTERVAL, cfg );
+ frm.BeaconInterval.interval = ( tANI_U16 ) cfg;
+#ifdef WLAN_SOFTAP_FEATURE
+ }
+#endif
+
+
+ PopulateDot11fCapabilities( pMac, &frm.Capabilities, psessionEntry );
+ PopulateDot11fSSID( pMac, ( tSirMacSSid* )pSsid, &frm.SSID );
+ PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
+ &frm.SuppRates,psessionEntry);
+
+ PopulateDot11fDSParams( pMac, &frm.DSParams, psessionEntry->currentOperChannel, psessionEntry);
+ PopulateDot11fIBSSParams( pMac, &frm.IBSSParams, psessionEntry );
+
+#ifdef ANI_PRODUCT_TYPE_AP
+ PopulateDot11fCFParams( pMac, &frm.Capabilities, &frm.CFParams );
+#endif // AP Image
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ {
+ if(psessionEntry->wps_state != SAP_WPS_DISABLED)
+ {
+ PopulateDot11fProbeResWPSIEs(pMac, &frm.WscProbeRes, psessionEntry);
+ }
+ }
+ else
+ {
+#endif
+ if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_ENABLE, &tmp) != eSIR_SUCCESS)
+ limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_ENABLE );
+
+ wpsApEnable = tmp & WNI_CFG_WPS_ENABLE_AP;
+
+ if (wpsApEnable)
+ {
+ PopulateDot11fWscInProbeRes(pMac, &frm.WscProbeRes);
+ }
+
+ if (pMac->lim.wscIeInfo.probeRespWscEnrollmentState == eLIM_WSC_ENROLL_BEGIN)
+ {
+ PopulateDot11fWscRegistrarInfoInProbeRes(pMac, &frm.WscProbeRes);
+ pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_IN_PROGRESS;
+ }
+
+ if (pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_END)
+ {
+ DePopulateDot11fWscRegistrarInfoInProbeRes(pMac, &frm.WscProbeRes);
+ pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_NOOP;
+ }
+#ifdef WLAN_SOFTAP_FEATURE
+ }
+#endif
+
+ PopulateDot11fCountry( pMac, &frm.Country, psessionEntry);
+ PopulateDot11fEDCAParamSet( pMac, &frm.EDCAParamSet, psessionEntry);
+
+#ifdef ANI_PRODUCT_TYPE_AP
+ if( pMac->lim.gLim11hEnable )
+ {
+ PopulateDot11fPowerConstraints( pMac, &frm.PowerConstraints );
+ PopulateDot11fTPCReport( pMac, &frm.TPCReport, psessionEntry);
+
+ // If .11h isenabled & channel switching is not already started and
+ // we're in either PRIMARY_ONLY or PRIMARY_AND_SECONDARY state, then
+ // populate 802.11h channel switch IE
+ if (( pMac->lim.gLimChannelSwitch.switchCount != 0 ) &&
+ ( pMac->lim.gLimChannelSwitch.state ==
+ eLIM_CHANNEL_SWITCH_PRIMARY_ONLY ||
+ pMac->lim.gLimChannelSwitch.state ==
+ eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY ) )
+ {
+ PopulateDot11fChanSwitchAnn( pMac, &frm.ChanSwitchAnn );
+ PopulateDot11fExtChanSwitchAnn(pMac, &frm.ExtChanSwitchAnn);
+ }
+ }
+#endif
+
+ if (psessionEntry->dot11mode != WNI_CFG_DOT11_MODE_11B)
+ PopulateDot11fERPInfo( pMac, &frm.ERPInfo, psessionEntry);
+
+
+ // N.B. In earlier implementations, the RSN IE would be placed in
+ // the frame here, before the WPA IE, if 'RSN_BEFORE_WPA' was defined.
+ PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
+ &frm.ExtSuppRates, psessionEntry );
+
+ //Populate HT IEs, when operating in 11n or Taurus modes.
+ if ( psessionEntry->htCapabality )
+ {
+ PopulateDot11fHTCaps( pMac, &frm.HTCaps );
+#ifdef WLAN_SOFTAP_FEATURE
+ PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry );
+#else
+ PopulateDot11fHTInfo( pMac, &frm.HTInfo );
+#endif
+ }
+
+ if ( psessionEntry->pLimStartBssReq )
+ {
+ PopulateDot11fWPA( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ),
+ &frm.WPA );
+ PopulateDot11fRSN( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ),
+ &frm.RSN );
+ }
+
+ PopulateDot11fWMM( pMac, &frm.WMMInfoAp, &frm.WMMParams, &frm.WMMCaps, psessionEntry );
+
+#if defined(FEATURE_WLAN_WAPI)
+ if( psessionEntry->pLimStartBssReq )
+ {
+ PopulateDot11fWAPI( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ),
+ &frm.WAPI );
+ }
+
+#endif // defined(FEATURE_WLAN_WAPI)
+
+
+ nStatus = dot11fGetPackedProbeResponseSize( pMac, &frm, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+ "or a Probe Response (0x%08x).\n"),
+ nStatus );
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fProbeResponse );
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calculating"
+ "the packed size for a Probe Response "
+ "(0x%08x).\n"), nStatus );
+ }
+
+ nBytes = nPayload + sizeof( tSirMacMgmtHdr );
+
+ addnIEPresent = false;
+
+#ifdef WLAN_FEATURE_P2P
+ if( pMac->lim.gpLimRemainOnChanReq )
+ {
+ nBytes += (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq ) );
+ }
+ //Only use CFG for non-listen mode. This CFG is not working for concurrency
+ //In listening mode, probe rsp IEs is passed in the message from SME to PE
+ else
+#endif
+ {
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_RSP_ADDNIE_FLAG,
+ &addnIEPresent) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_FLAG"));
+ return;
+ }
+ }
+
+ if (addnIEPresent)
+ {
+ if( (palAllocateMemory(pMac->hHdd, (void**)&addIE,
+ WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN*3 )) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE,
+ FL("Unable to allocate memory to store addn IE"));)
+ return;
+ }
+
+ //Probe rsp IE available
+ if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac,
+ WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addnIE1Len) )
+ {
+ limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 length"));
+ palFreeMemory(pMac->hHdd, addIE);
+ return;
+ }
+ if (addnIE1Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN && addnIE1Len &&
+ (nBytes + addnIE1Len) <= SIR_MAX_PACKET_SIZE)
+ {
+ if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac,
+ WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addIE[0],
+ &addnIE1Len) )
+ {
+ limLog(pMac, LOGP,
+ FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 String"));
+ palFreeMemory(pMac->hHdd, addIE);
+ return;
+ }
+ }
+
+ //Probe rsp IE available
+ if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac,
+ WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addnIE2Len) )
+ {
+ limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 length"));
+ palFreeMemory(pMac->hHdd, addIE);
+ return;
+ }
+ if (addnIE2Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA2_LEN && addnIE2Len &&
+ (nBytes + addnIE2Len) <= SIR_MAX_PACKET_SIZE)
+ {
+ if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac,
+ WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addIE[addnIE1Len],
+ &addnIE2Len) )
+ {
+ limLog(pMac, LOGP,
+ FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 String"));
+ palFreeMemory(pMac->hHdd, addIE);
+ return;
+ }
+ }
+
+ //Probe rsp IE available
+ if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac,
+ WNI_CFG_PROBE_RSP_ADDNIE_DATA3, &addnIE3Len) )
+ {
+ limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 length"));
+ palFreeMemory(pMac->hHdd, addIE);
+ return;
+ }
+ if (addnIE3Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA3_LEN && addnIE3Len &&
+ (nBytes + addnIE3Len) <= SIR_MAX_PACKET_SIZE)
+ {
+ if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac,
+ WNI_CFG_PROBE_RSP_ADDNIE_DATA3,
+ &addIE[addnIE1Len + addnIE2Len],
+ &addnIE3Len) )
+ {
+ limLog(pMac, LOGP,
+ FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 String"));
+ palFreeMemory(pMac->hHdd, addIE);
+ return;
+ }
+ }
+ totalAddnIeLen = addnIE1Len + addnIE2Len + addnIE3Len;
+
+#ifdef WLAN_FEATURE_P2P
+ if(eSIR_SUCCESS != limGetAddnIeForProbeResp(pMac, addIE, &totalAddnIeLen, probeReqP2pIe))
+ {
+ limLog(pMac, LOGP,
+ FL("Unable to get final Additional IE for Probe Req"));
+ palFreeMemory(pMac->hHdd, addIE);
+ return;
+ }
+ nBytes = nBytes + totalAddnIeLen;
+
+ if (probeReqP2pIe)
+ {
+ pP2pIe = limGetP2pIEPtr(pMac, &addIE[0], totalAddnIeLen);
+ if (pP2pIe != NULL)
+ {
+ //get NoA attribute stream P2P IE
+ noaLen = limGetNoaAttrStream(pMac, noaStream, psessionEntry);
+ if (noaLen != 0)
+ {
+ total_noaLen = limBuildP2pIe(pMac, &noaIe[0],
+ &noaStream[0], noaLen);
+ nBytes = nBytes + total_noaLen;
+ }
+ }
+ }
+#endif
+ }
+
+ halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( tANI_U16 )nBytes, ( void** ) &pFrame,
+ ( void** ) &pPacket );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Pro"
+ "be Response.\n"), nBytes );
+ if ( addIE != NULL )
+ {
+ palFreeMemory(pMac->hHdd, addIE);
+ }
+ return;
+ }
+
+ // Paranoia:
+ palZeroMemory( pMac->hHdd, pFrame, nBytes );
+
+ // Next, we fill out the buffer descriptor:
+ nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_PROBE_RSP, peerMacAddr,psessionEntry->selfMacAddr);
+ if ( eSIR_SUCCESS != nSirStatus )
+ {
+ limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
+ "tor for a Probe Response (%d).\n"),
+ nSirStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( void* ) pFrame, ( void* ) pPacket );
+ if ( addIE != NULL )
+ {
+ palFreeMemory(pMac->hHdd, addIE);
+ }
+ return;
+ }
+
+ pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
+
+ sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
+
+ // That done, pack the Probe Response:
+ nStatus = dot11fPackProbeResponse( pMac, &frm, pFrame + sizeof(tSirMacMgmtHdr),
+ nPayload, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to pack a Probe Response (0x%08x).\n"),
+ nStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ if ( addIE != NULL )
+ {
+ palFreeMemory(pMac->hHdd, addIE);
+ }
+ return; // allocated!
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while packing a P"
+ "robe Response (0x%08x).\n") );
+ }
+
+ PELOG3(limLog( pMac, LOG3, FL("Sending Probe Response frame to ") );
+ limPrintMacAddr( pMac, peerMacAddr, LOG3 );)
+
+ pMac->sys.probeRespond++;
+
+#ifdef WLAN_FEATURE_P2P
+ if( pMac->lim.gpLimRemainOnChanReq )
+ {
+ palCopyMemory ( pMac->hHdd, pFrame+sizeof(tSirMacMgmtHdr)+nPayload,
+ pMac->lim.gpLimRemainOnChanReq->probeRspIe, (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq )) );
+ }
+#endif
+
+ if ( addnIEPresent )
+ {
+ if (palCopyMemory ( pMac->hHdd, pFrame+sizeof(tSirMacMgmtHdr)+nPayload,
+ &addIE[0], totalAddnIeLen) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Additional Probe Rp IE request failed while Appending: %x"),halstatus);
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( void* ) pFrame, ( void* ) pPacket );
+ if ( addIE != NULL )
+ {
+ palFreeMemory(pMac->hHdd, addIE);
+ }
+ return;
+ }
+ }
+#ifdef WLAN_FEATURE_P2P
+ if (noaLen != 0)
+ {
+ if (palCopyMemory ( pMac->hHdd, &pFrame[nBytes - (total_noaLen)],
+ &noaIe[0], total_noaLen) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGE,
+ FL("Not able to insert NoA because of length constraint"));
+ }
+ }
+#endif
+
+ if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
+#ifdef WLAN_FEATURE_P2P
+ || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
+ ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
+#endif
+ )
+ {
+ txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
+ }
+
+ // Queue Probe Response frame in high priority WQ
+ halstatus = halTxFrame( ( tHalHandle ) pMac, pPacket,
+ ( tANI_U16 ) nBytes,
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_LOW,
+ limTxComplete, pFrame, txFlag );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGE, FL("Could not send Probe Response.\n") );
+ //Pkt will be freed up by the callback
+ }
+
+ if ( addIE != NULL )
+ {
+ palFreeMemory(pMac->hHdd, addIE);
+ }
+
+} // End limSendProbeRspMgmtFrame.
+
+void
+limSendAddtsReqActionFrame(tpAniSirGlobal pMac,
+ tSirMacAddr peerMacAddr,
+ tSirAddtsReqInfo *pAddTS,
+ tpPESession psessionEntry)
+{
+ tANI_U16 i;
+ tANI_U8 *pFrame;
+ tSirRetStatus nSirStatus;
+ tDot11fAddTSRequest AddTSReq;
+ tDot11fWMMAddTSRequest WMMAddTSReq;
+ tANI_U32 nPayload, nBytes, nStatus;
+ tpSirMacMgmtHdr pMacHdr;
+ void *pPacket;
+#ifdef FEATURE_WLAN_CCX
+ tANI_U32 phyMode;
+#endif
+ eHalStatus halstatus;
+ tANI_U8 txFlag = 0;
+
+ if(NULL == psessionEntry)
+ {
+ return;
+ }
+
+ if ( ! pAddTS->wmeTspecPresent )
+ {
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&AddTSReq, sizeof( AddTSReq ) );
+
+ AddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ;
+ AddTSReq.DialogToken.token = pAddTS->dialogToken;
+ AddTSReq.Category.category = SIR_MAC_ACTION_QOS_MGMT;
+ if ( pAddTS->lleTspecPresent )
+ {
+ PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSReq.TSPEC );
+ }
+ else
+ {
+ PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSReq.WMMTSPEC );
+ }
+
+ if ( pAddTS->lleTspecPresent )
+ {
+ AddTSReq.num_WMMTCLAS = 0;
+ AddTSReq.num_TCLAS = pAddTS->numTclas;
+ for ( i = 0; i < pAddTS->numTclas; ++i)
+ {
+ PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i],
+ &AddTSReq.TCLAS[i] );
+ }
+ }
+ else
+ {
+ AddTSReq.num_TCLAS = 0;
+ AddTSReq.num_WMMTCLAS = pAddTS->numTclas;
+ for ( i = 0; i < pAddTS->numTclas; ++i)
+ {
+ PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i],
+ &AddTSReq.WMMTCLAS[i] );
+ }
+ }
+
+ if ( pAddTS->tclasProcPresent )
+ {
+ if ( pAddTS->lleTspecPresent )
+ {
+ AddTSReq.TCLASSPROC.processing = pAddTS->tclasProc;
+ AddTSReq.TCLASSPROC.present = 1;
+ }
+ else
+ {
+ AddTSReq.WMMTCLASPROC.version = 1;
+ AddTSReq.WMMTCLASPROC.processing = pAddTS->tclasProc;
+ AddTSReq.WMMTCLASPROC.present = 1;
+ }
+ }
+
+ nStatus = dot11fGetPackedAddTSRequestSize( pMac, &AddTSReq, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+ "or an Add TS Request (0x%08x).\n"),
+ nStatus );
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fAddTSRequest );
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calculating"
+ "the packed size for an Add TS Request"
+ " (0x%08x).\n"), nStatus );
+ }
+ }
+ else
+ {
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&WMMAddTSReq, sizeof( WMMAddTSReq ) );
+
+ WMMAddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ;
+ WMMAddTSReq.DialogToken.token = pAddTS->dialogToken;
+ WMMAddTSReq.Category.category = SIR_MAC_ACTION_WME;
+
+ // WMM spec 2.2.10 - status code is only filled in for ADDTS response
+ WMMAddTSReq.StatusCode.statusCode = 0;
+
+ PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSReq.WMMTSPEC );
+#ifdef FEATURE_WLAN_CCX
+ limGetPhyMode(pMac, &phyMode, psessionEntry);
+
+ if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A)
+ {
+ pAddTS->tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS;
+ }
+ else
+ {
+ pAddTS->tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS;
+ }
+ PopulateDot11TSRSIE(pMac,&pAddTS->tsrsIE, &WMMAddTSReq.CCXTrafStrmRateSet,sizeof(tANI_U8));
+#endif
+ // fillWmeTspecIE
+
+ nStatus = dot11fGetPackedWMMAddTSRequestSize( pMac, &WMMAddTSReq, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+ "or a WMM Add TS Request (0x%08x).\n"),
+ nStatus );
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fAddTSRequest );
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calculating"
+ "the packed size for a WMM Add TS Requ"
+ "est (0x%08x).\n"), nStatus );
+ }
+ }
+
+ nBytes = nPayload + sizeof( tSirMacMgmtHdr );
+
+ halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( tANI_U16 )nBytes, ( void** ) &pFrame,
+ ( void** ) &pPacket );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an Ad"
+ "d TS Request.\n"), nBytes );
+ return;
+ }
+
+ // Paranoia:
+ palZeroMemory( pMac->hHdd, pFrame, nBytes );
+
+ // Next, we fill out the buffer descriptor:
+ nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_ACTION, peerMacAddr,psessionEntry->selfMacAddr);
+ if ( eSIR_SUCCESS != nSirStatus )
+ {
+ limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
+ "tor for an Add TS Request (%d).\n"),
+ nSirStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( void* ) pFrame, ( void* ) pPacket );
+ return;
+ }
+
+ pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
+
+ #if 0
+ cfgLen = SIR_MAC_ADDR_LENGTH;
+ if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID,
+ ( tANI_U8* )pMacHdr->bssId, &cfgLen ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil"
+ "e sending an Add TS Request.\n") );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( void* ) pFrame, ( void* ) pPacket );
+ return;
+ }
+ #endif //TO SUPPORT BT-AMP
+
+ sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
+
+ // That done, pack the struct:
+ if ( ! pAddTS->wmeTspecPresent )
+ {
+ nStatus = dot11fPackAddTSRequest( pMac, &AddTSReq,
+ pFrame + sizeof(tSirMacMgmtHdr),
+ nPayload, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to pack an Add TS Request "
+ "(0x%08x).\n"),
+ nStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return; // allocated!
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while packing"
+ "an Add TS Request (0x%08x).\n") );
+ }
+ }
+ else
+ {
+ nStatus = dot11fPackWMMAddTSRequest( pMac, &WMMAddTSReq,
+ pFrame + sizeof(tSirMacMgmtHdr),
+ nPayload, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to pack a WMM Add TS Reque"
+ "st (0x%08x).\n"),
+ nStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return; // allocated!
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while packing"
+ "a WMM Add TS Request (0x%08x).\n") );
+ }
+ }
+
+ PELOG3(limLog( pMac, LOG3, FL("Sending an Add TS Request frame to ") );
+ limPrintMacAddr( pMac, peerMacAddr, LOG3 );)
+
+ if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
+#ifdef WLAN_FEATURE_P2P
+ || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
+ ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
+#endif
+ )
+ {
+ txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
+ }
+
+ // Queue Addts Response frame in high priority WQ
+ halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete, pFrame, txFlag );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGE, FL( "*** Could not send an Add TS Request"
+ " (%X) ***\n" ), halstatus );
+ //Pkt will be freed up by the callback
+ }
+
+} // End limSendAddtsReqActionFrame.
+
+/* Added ANI_PRODUCT_TYPE_CLIENT for BT-AMP Support */
+#ifdef ANI_PRODUCT_TYPE_AP
+
+void
+limSendAssocRspMgmtFrame(tpAniSirGlobal pMac,
+ tANI_U16 statusCode,
+ tANI_U16 aid,
+ tSirMacAddr peerMacAddr,
+ tANI_U8 subType,
+ tpDphHashNode pSta,
+ tpPESession psessionEntry)
+{
+ tDot11fAssocResponse frm;
+ tANI_U8 *pFrame, *macAddr;
+ tpSirMacMgmtHdr pMacHdr;
+ tSirRetStatus nSirStatus;
+ tANI_U8 lleMode = 0, fAddTS, edcaInclude = 0;
+ tHalBitVal qosMode, wmeMode;
+ tANI_U32 nPayload, nBytes, nStatus, cfgLen;
+ void *pPacket;
+ eHalStatus halstatus;
+ tUpdateBeaconParams beaconParams;
+ tANI_U32 wpsApEnable=0, tmp;
+ tANI_U8 txFlag = 0;
+
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
+
+ limGetQosMode(pMac, &qosMode);
+ limGetWmeMode(pMac, &wmeMode);
+
+ // An Add TS IE is added only if the AP supports it and the requesting
+ // STA sent a traffic spec.
+ fAddTS = ( qosMode && pSta && pSta->qos.addtsPresent ) ? 1 : 0;
+
+ PopulateDot11fCapabilities( pMac, &frm.Capabilities, psessionEntry);
+
+ frm.Status.status = statusCode;
+
+ frm.AID.associd = aid | LIM_AID_MASK;
+
+ PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.SuppRates );
+
+ if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_ENABLE, &tmp) != eSIR_SUCCESS)
+ limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_ENABLE );
+
+ wpsApEnable = tmp & WNI_CFG_WPS_ENABLE_AP;
+
+ if (wpsApEnable)
+ {
+ PopulateDot11fWscInAssocRes(pMac, &frm.WscAssocRes);
+ }
+
+ PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
+ &frm.ExtSuppRates, psessionEntry );
+
+ if ( NULL != pSta )
+ {
+ if ( eHAL_SET == qosMode )
+ {
+ if ( pSta->lleEnabled )
+ {
+ lleMode = 1;
+ if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) )
+ {
+ PopulateDot11fEDCAParamSet( pMac, &frm.EDCAParamSet, psessionEntry);
+
+// FramesToDo:...
+// if ( fAddTS )
+// {
+// tANI_U8 *pAf = pBody;
+// *pAf++ = SIR_MAC_QOS_ACTION_EID;
+// tANI_U32 tlen;
+// status = sirAddtsRspFill(pMac, pAf, statusCode, &pSta->qos.addts, NULL,
+// &tlen, bufLen - frameLen);
+// } // End if on Add TS.
+ }
+ } // End if on .11e enabled in 'pSta'.
+ } // End if on QOS Mode on.
+
+ if ( ( ! lleMode ) && ( eHAL_SET == wmeMode ) && pSta->wmeEnabled )
+ {
+ if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) )
+ {
+ PopulateDot11fWMMParams( pMac, &frm.WMMParams );
+
+ if ( pSta->wsmEnabled )
+ {
+ PopulateDot11fWMMCaps(&frm.WMMCaps );
+ }
+ }
+ }
+
+ if ( pSta->aniPeer )
+ {
+ if ( ( lleMode && PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) ||
+ ( pSta->wmeEnabled && PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) )
+ {
+ edcaInclude = 1;
+ }
+
+ } // End if on Airgo peer.
+
+ if ( pSta->mlmStaContext.htCapability &&
+ pMac->lim.htCapability )
+ {
+ PopulateDot11fHTCaps( pMac, &frm.HTCaps );
+ PopulateDot11fHTInfo( pMac, &frm.HTInfo );
+ }
+ } // End if on non-NULL 'pSta'.
+
+
+ if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
+ limDecideApProtection(pMac, peerMacAddr, &beaconParams);
+ limUpdateShortPreamble(pMac, peerMacAddr, &beaconParams);
+ limUpdateShortSlotTime(pMac, peerMacAddr, &beaconParams);
+
+ //Send message to HAL about beacon parameter change.
+ if(beaconParams.paramChangeBitmap)
+ {
+ schSetFixedBeaconFields(pMac,psessionEntry);
+ limSendBeaconParams(pMac, &beaconParams, psessionEntry );
+ }
+
+ // Allocate a buffer for this frame:
+ nStatus = dot11fGetPackedAssocResponseSize( pMac, &frm, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to calculate the packed size f"
+ "or an Association Response (0x%08x).\n"),
+ nStatus );
+ return;
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calculating"
+ "the packed size for an Association Re"
+ "sponse (0x%08x).\n"), nStatus );
+ }
+
+ nBytes = sizeof( tSirMacMgmtHdr ) + nPayload;
+
+ halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( tANI_U16 )nBytes, ( void** ) &pFrame,
+ ( void** ) &pPacket );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog(pMac, LOGP, FL("Call to bufAlloc failed for RE/ASSOC RSP.\n"));
+ return;
+ }
+
+ // Paranoia:
+ palZeroMemory( pMac->hHdd, pFrame, nBytes );
+
+ // Next, we fill out the buffer descriptor:
+ nSirStatus = limPopulateMacHeader( pMac,
+ pFrame,
+ SIR_MAC_MGMT_FRAME,
+ ( LIM_ASSOC == subType ) ?
+ SIR_MAC_MGMT_ASSOC_RSP :
+ SIR_MAC_MGMT_REASSOC_RSP,
+ peerMacAddr);
+ if ( eSIR_SUCCESS != nSirStatus )
+ {
+ limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
+ "tor for an Association Response (%d).\n"),
+ nSirStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( void* ) pFrame, ( void* ) pPacket );
+ return;
+ }
+
+ pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
+
+
+ cfgLen = SIR_MAC_ADDR_LENGTH;
+ if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID,
+ ( tANI_U8* )pMacHdr->bssId, &cfgLen ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil"
+ "e sending an Association Response.\n") );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return; // allocated!
+ }
+
+ nStatus = dot11fPackAssocResponse( pMac, &frm,
+ pFrame + sizeof( tSirMacMgmtHdr ),
+ nPayload, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to pack an Association Response (0x%08x).\n"),
+ nStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( void* ) pFrame, ( void* ) pPacket );
+ return; // allocated!
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while packing an "
+ "Association Response (0x%08x).\n") );
+ }
+
+ macAddr = pMacHdr->da;
+
+ if (subType == LIM_ASSOC)
+ limLog(pMac, LOG1,
+ FL("*** Sending Assoc Resp status %d aid %d to "),
+ statusCode, aid);
+ else
+ limLog(pMac, LOG1,
+ FL("*** Sending ReAssoc Resp status %d aid %d to "),
+ statusCode, aid);
+ limPrintMacAddr(pMac, pMacHdr->da, LOG1);
+
+ if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
+#ifdef WLAN_FEATURE_P2P
+ || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
+ ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
+#endif
+ )
+ {
+ txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
+ }
+
+ /// Queue Association Response frame in high priority WQ
+ halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete, pFrame, txFlag );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog(pMac, LOGE,
+ FL("*** Could not Send Re/AssocRsp, retCode=%X ***\n"),
+ nSirStatus);
+
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ (void *) pFrame, (void *) pPacket );
+ }
+
+ // update the ANI peer station count
+ //FIXME_PROTECTION : take care of different type of station
+ // counter inside this function.
+ limUtilCountStaAdd(pMac, pSta, psessionEntry);
+
+} // End limSendAssocRspMgmtFrame.
+
+
+#endif // ANI_PRODUCT_TYPE_AP
+
+
+void
+limSendAssocRspMgmtFrame(tpAniSirGlobal pMac,
+ tANI_U16 statusCode,
+ tANI_U16 aid,
+ tSirMacAddr peerMacAddr,
+ tANI_U8 subType,
+ tpDphHashNode pSta,tpPESession psessionEntry)
+{
+ static tDot11fAssocResponse frm;
+ tANI_U8 *pFrame, *macAddr;
+ tpSirMacMgmtHdr pMacHdr;
+ tSirRetStatus nSirStatus;
+ tANI_U8 lleMode = 0, fAddTS, edcaInclude = 0;
+ tHalBitVal qosMode, wmeMode;
+ tANI_U32 nPayload, nBytes, nStatus;
+ void *pPacket;
+ eHalStatus halstatus;
+ tUpdateBeaconParams beaconParams;
+ tANI_U8 txFlag = 0;
+ tANI_U32 addnIEPresent = false;
+ tANI_U32 addnIELen=0;
+ tANI_U8 addIE[WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN];
+ tpSirAssocReq pAssocReq = NULL;
+
+ if(NULL == psessionEntry)
+ {
+ return;
+ }
+
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
+
+ limGetQosMode(psessionEntry, &qosMode);
+ limGetWmeMode(psessionEntry, &wmeMode);
+
+ // An Add TS IE is added only if the AP supports it and the requesting
+ // STA sent a traffic spec.
+ fAddTS = ( qosMode && pSta && pSta->qos.addtsPresent ) ? 1 : 0;
+
+ PopulateDot11fCapabilities( pMac, &frm.Capabilities, psessionEntry );
+
+ frm.Status.status = statusCode;
+
+ frm.AID.associd = aid | LIM_AID_MASK;
+
+ if ( NULL == pSta )
+ {
+ PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.SuppRates,psessionEntry);
+ PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.ExtSuppRates, psessionEntry );
+ }
+ else
+ {
+ PopulateDot11fAssocRspRates( pMac, &frm.SuppRates, &frm.ExtSuppRates,
+ pSta->supportedRates.llbRates, pSta->supportedRates.llaRates );
+ }
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ {
+ if( pSta != NULL && eSIR_SUCCESS == statusCode )
+ {
+ pAssocReq =
+ (tpSirAssocReq) psessionEntry->parsedAssocReq[pSta->assocId];
+#ifdef WLAN_FEATURE_P2P
+ /* populate P2P IE in AssocRsp when assocReq from the peer includes P2P IE */
+ if( pAssocReq != NULL && pAssocReq->addIEPresent ) {
+ PopulateDot11AssocResP2PIE(pMac, &frm.P2PAssocRes, pAssocReq);
+ }
+#endif
+ }
+ }
+#endif
+
+ if ( NULL != pSta )
+ {
+ if ( eHAL_SET == qosMode )
+ {
+ if ( pSta->lleEnabled )
+ {
+ lleMode = 1;
+ if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) )
+ {
+ PopulateDot11fEDCAParamSet( pMac, &frm.EDCAParamSet, psessionEntry);
+
+// FramesToDo:...
+// if ( fAddTS )
+// {
+// tANI_U8 *pAf = pBody;
+// *pAf++ = SIR_MAC_QOS_ACTION_EID;
+// tANI_U32 tlen;
+// status = sirAddtsRspFill(pMac, pAf, statusCode, &pSta->qos.addts, NULL,
+// &tlen, bufLen - frameLen);
+// } // End if on Add TS.
+ }
+ } // End if on .11e enabled in 'pSta'.
+ } // End if on QOS Mode on.
+
+ if ( ( ! lleMode ) && ( eHAL_SET == wmeMode ) && pSta->wmeEnabled )
+ {
+ if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) )
+ {
+
+#ifdef WLAN_SOFTAP_FEATURE
+ PopulateDot11fWMMParams( pMac, &frm.WMMParams, psessionEntry);
+#else
+ PopulateDot11fWMMParams( pMac, &frm.WMMParams );
+#endif
+
+ if ( pSta->wsmEnabled )
+ {
+ PopulateDot11fWMMCaps(&frm.WMMCaps );
+ }
+ }
+ }
+
+ if ( pSta->aniPeer )
+ {
+ if ( ( lleMode && PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) ||
+ ( pSta->wmeEnabled && PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) )
+ {
+ edcaInclude = 1;
+ }
+
+ } // End if on Airgo peer.
+
+ if ( pSta->mlmStaContext.htCapability &&
+ psessionEntry->htCapabality )
+ {
+ PopulateDot11fHTCaps( pMac, &frm.HTCaps );
+#ifdef WLAN_SOFTAP_FEATURE
+ PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry );
+#else
+ PopulateDot11fHTInfo( pMac, &frm.HTInfo );
+#endif
+ }
+ } // End if on non-NULL 'pSta'.
+
+
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams) );
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if( psessionEntry->limSystemRole == eLIM_AP_ROLE ){
+ if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
+ limDecideApProtection(pMac, peerMacAddr, &beaconParams,psessionEntry);
+ }
+#endif
+
+ limUpdateShortPreamble(pMac, peerMacAddr, &beaconParams, psessionEntry);
+ limUpdateShortSlotTime(pMac, peerMacAddr, &beaconParams, psessionEntry);
+
+ beaconParams.bssIdx = psessionEntry->bssIdx;
+
+ //Send message to HAL about beacon parameter change.
+ if(beaconParams.paramChangeBitmap)
+ {
+ schSetFixedBeaconFields(pMac,psessionEntry);
+ limSendBeaconParams(pMac, &beaconParams, psessionEntry );
+ }
+
+ // Allocate a buffer for this frame:
+ nStatus = dot11fGetPackedAssocResponseSize( pMac, &frm, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to calculate the packed size f"
+ "or an Association Response (0x%08x).\n"),
+ nStatus );
+ return;
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calculating"
+ "the packed size for an Association Re"
+ "sponse (0x%08x).\n"), nStatus );
+ }
+
+ nBytes = sizeof( tSirMacMgmtHdr ) + nPayload;
+
+ if ( pAssocReq != NULL )
+ {
+ if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_FLAG,
+ &addnIEPresent) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Unable to get WNI_CFG_ASSOC_RSP_ADDNIE_FLAG"));
+ return;
+ }
+
+ if (addnIEPresent)
+ {
+ //Assoc rsp IE available
+ if (wlan_cfgGetStrLen(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA,
+ &addnIELen) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Unable to get WNI_CFG_ASSOC_RSP_ADDNIE_DATA length"));
+ return;
+ }
+
+ if (addnIELen <= WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN && addnIELen &&
+ (nBytes + addnIELen) <= SIR_MAX_PACKET_SIZE)
+ {
+ if (wlan_cfgGetStr(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA,
+ &addIE[0], &addnIELen) == eSIR_SUCCESS)
+ {
+ nBytes = nBytes + addnIELen;
+ }
+ }
+ }
+ }
+
+ halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( tANI_U16 )nBytes, ( void** ) &pFrame,
+ ( void** ) &pPacket );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog(pMac, LOGP, FL("Call to bufAlloc failed for RE/ASSOC RSP.\n"));
+ return;
+ }
+
+ // Paranoia:
+ palZeroMemory( pMac->hHdd, pFrame, nBytes );
+
+ // Next, we fill out the buffer descriptor:
+ nSirStatus = limPopulateMacHeader( pMac,
+ pFrame,
+ SIR_MAC_MGMT_FRAME,
+ ( LIM_ASSOC == subType ) ?
+ SIR_MAC_MGMT_ASSOC_RSP :
+ SIR_MAC_MGMT_REASSOC_RSP,
+ peerMacAddr,psessionEntry->selfMacAddr);
+ if ( eSIR_SUCCESS != nSirStatus )
+ {
+ limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
+ "tor for an Association Response (%d).\n"),
+ nSirStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( void* ) pFrame, ( void* ) pPacket );
+ return;
+ }
+
+ pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
+
+ #if 0
+ cfgLen = SIR_MAC_ADDR_LENGTH;
+ if ( eSIR_SUCCESS != cfgGetStr( pMac, WNI_CFG_BSSID,
+ ( tANI_U8* )pMacHdr->bssId, &cfgLen ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil"
+ "e sending an Association Response.\n") );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return; // allocated!
+ }
+ #endif //TO SUPPORT BT-AMP
+ sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
+
+ nStatus = dot11fPackAssocResponse( pMac, &frm,
+ pFrame + sizeof( tSirMacMgmtHdr ),
+ nPayload, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to pack an Association Response (0x%08x).\n"),
+ nStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( void* ) pFrame, ( void* ) pPacket );
+ return; // allocated!
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while packing an "
+ "Association Response (0x%08x).\n") );
+ }
+
+ macAddr = pMacHdr->da;
+
+ if (subType == LIM_ASSOC)
+ {
+ PELOG1(limLog(pMac, LOG1,
+ FL("*** Sending Assoc Resp status %d aid %d to "),
+ statusCode, aid);)
+ }
+ else{
+ PELOG1(limLog(pMac, LOG1,
+ FL("*** Sending ReAssoc Resp status %d aid %d to "),
+ statusCode, aid);)
+ }
+ PELOG1(limPrintMacAddr(pMac, pMacHdr->da, LOG1);)
+
+ if ( addnIEPresent )
+ {
+ if (palCopyMemory ( pMac->hHdd, pFrame+sizeof(tSirMacMgmtHdr)+nPayload,
+ &addIE[0], addnIELen ) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Additional Assoc IEs request failed while Appending: %x\n"),halstatus);
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( void* ) pFrame, ( void* ) pPacket );
+ return;
+ }
+ }
+
+ if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
+#ifdef WLAN_FEATURE_P2P
+ || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
+ ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
+#endif
+ )
+ {
+ txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
+ }
+
+ /// Queue Association Response frame in high priority WQ
+ halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete, pFrame, txFlag );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog(pMac, LOGE,
+ FL("*** Could not Send Re/AssocRsp, retCode=%X ***\n"),
+ nSirStatus);
+
+ //Pkt will be freed up by the callback
+ }
+
+ // update the ANI peer station count
+ //FIXME_PROTECTION : take care of different type of station
+ // counter inside this function.
+ limUtilCountStaAdd(pMac, pSta, psessionEntry);
+
+} // End limSendAssocRspMgmtFrame.
+
+
+
+void
+limSendAddtsRspActionFrame(tpAniSirGlobal pMac,
+ tSirMacAddr peer,
+ tANI_U16 nStatusCode,
+ tSirAddtsReqInfo *pAddTS,
+ tSirMacScheduleIE *pSchedule,
+ tpPESession psessionEntry)
+{
+ tANI_U8 *pFrame;
+ tpSirMacMgmtHdr pMacHdr;
+ tDot11fAddTSResponse AddTSRsp;
+ tDot11fWMMAddTSResponse WMMAddTSRsp;
+ tSirRetStatus nSirStatus;
+ tANI_U32 i, nBytes, nPayload, nStatus;
+ void *pPacket;
+ eHalStatus halstatus;
+ tANI_U8 txFlag = 0;
+
+ if(NULL == psessionEntry)
+ {
+ return;
+ }
+
+ if ( ! pAddTS->wmeTspecPresent )
+ {
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&AddTSRsp, sizeof( AddTSRsp ) );
+
+ AddTSRsp.Category.category = SIR_MAC_ACTION_QOS_MGMT;
+ AddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP;
+ AddTSRsp.DialogToken.token = pAddTS->dialogToken;
+ AddTSRsp.Status.status = nStatusCode;
+
+ // The TsDelay information element is only filled in for a specific
+ // status code:
+ if ( eSIR_MAC_TS_NOT_CREATED_STATUS == nStatusCode )
+ {
+ if ( pAddTS->wsmTspecPresent )
+ {
+ AddTSRsp.WMMTSDelay.version = 1;
+ AddTSRsp.WMMTSDelay.delay = 10;
+ AddTSRsp.WMMTSDelay.present = 1;
+ }
+ else
+ {
+ AddTSRsp.TSDelay.delay = 10;
+ AddTSRsp.TSDelay.present = 1;
+ }
+ }
+
+ if ( pAddTS->wsmTspecPresent )
+ {
+ PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSRsp.WMMTSPEC );
+ }
+ else
+ {
+ PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSRsp.TSPEC );
+ }
+
+ if ( pAddTS->wsmTspecPresent )
+ {
+ AddTSRsp.num_WMMTCLAS = 0;
+ AddTSRsp.num_TCLAS = pAddTS->numTclas;
+ for ( i = 0; i < AddTSRsp.num_TCLAS; ++i)
+ {
+ PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i],
+ &AddTSRsp.TCLAS[i] );
+ }
+ }
+ else
+ {
+ AddTSRsp.num_TCLAS = 0;
+ AddTSRsp.num_WMMTCLAS = pAddTS->numTclas;
+ for ( i = 0; i < AddTSRsp.num_WMMTCLAS; ++i)
+ {
+ PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i],
+ &AddTSRsp.WMMTCLAS[i] );
+ }
+ }
+
+ if ( pAddTS->tclasProcPresent )
+ {
+ if ( pAddTS->wsmTspecPresent )
+ {
+ AddTSRsp.WMMTCLASPROC.version = 1;
+ AddTSRsp.WMMTCLASPROC.processing = pAddTS->tclasProc;
+ AddTSRsp.WMMTCLASPROC.present = 1;
+ }
+ else
+ {
+ AddTSRsp.TCLASSPROC.processing = pAddTS->tclasProc;
+ AddTSRsp.TCLASSPROC.present = 1;
+ }
+ }
+
+ // schedule element is included only if requested in the tspec and we are
+ // using hcca (or both edca and hcca)
+ // 11e-D8.0 is inconsistent on whether the schedule element is included
+ // based on tspec schedule bit or not. Sec 7.4.2.2. says one thing but
+ // pg 46, line 17-18 says something else. So just include it and let the
+ // sta figure it out
+ if ((pSchedule != NULL) &&
+ ((pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
+ (pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH)))
+ {
+ if ( pAddTS->wsmTspecPresent )
+ {
+ PopulateDot11fWMMSchedule( pSchedule, &AddTSRsp.WMMSchedule );
+ }
+ else
+ {
+ PopulateDot11fSchedule( pSchedule, &AddTSRsp.Schedule );
+ }
+ }
+
+ nStatus = dot11fGetPackedAddTSResponseSize( pMac, &AddTSRsp, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to calculate the packed si"
+ "ze for an Add TS Response (0x%08x).\n"),
+ nStatus );
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fAddTSResponse );
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calcula"
+ "tingthe packed size for an Add TS"
+ " Response (0x%08x).\n"), nStatus );
+ }
+ }
+ else
+ {
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&WMMAddTSRsp, sizeof( WMMAddTSRsp ) );
+
+ WMMAddTSRsp.Category.category = SIR_MAC_ACTION_WME;
+ WMMAddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP;
+ WMMAddTSRsp.DialogToken.token = pAddTS->dialogToken;
+ WMMAddTSRsp.StatusCode.statusCode = (tANI_U8)nStatusCode;
+
+ PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSRsp.WMMTSPEC );
+
+ nStatus = dot11fGetPackedWMMAddTSResponseSize( pMac, &WMMAddTSRsp, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to calculate the packed si"
+ "ze for a WMM Add TS Response (0x%08x).\n"),
+ nStatus );
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fWMMAddTSResponse );
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calcula"
+ "tingthe packed size for a WMM Add"
+ "TS Response (0x%08x).\n"), nStatus );
+ }
+ }
+
+ nBytes = nPayload + sizeof( tSirMacMgmtHdr );
+
+ halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an Ad"
+ "d TS Response.\n"), nBytes );
+ return;
+ }
+
+ // Paranoia:
+ palZeroMemory( pMac->hHdd, pFrame, nBytes );
+
+ // Next, we fill out the buffer descriptor:
+ nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_ACTION, peer,psessionEntry->selfMacAddr);
+ if ( eSIR_SUCCESS != nSirStatus )
+ {
+ limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
+ "tor for an Add TS Response (%d).\n"),
+ nSirStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return; // allocated!
+ }
+
+ pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
+
+
+ #if 0
+ if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID,
+ ( tANI_U8* )pMacHdr->bssId, &cfgLen ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil"
+ "e sending an Add TS Response.\n") );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return; // allocated!
+ }
+ #endif //TO SUPPORT BT-AMP
+ sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
+
+ // That done, pack the struct:
+ if ( ! pAddTS->wmeTspecPresent )
+ {
+ nStatus = dot11fPackAddTSResponse( pMac, &AddTSRsp,
+ pFrame + sizeof( tSirMacMgmtHdr ),
+ nPayload, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to pack an Add TS Response "
+ "(0x%08x).\n"),
+ nStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return;
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while packing"
+ "an Add TS Response (0x%08x).\n") );
+ }
+ }
+ else
+ {
+ nStatus = dot11fPackWMMAddTSResponse( pMac, &WMMAddTSRsp,
+ pFrame + sizeof( tSirMacMgmtHdr ),
+ nPayload, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to pack a WMM Add TS Response "
+ "(0x%08x).\n"),
+ nStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return;
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while packing"
+ "a WMM Add TS Response (0x%08x).\n") );
+ }
+ }
+
+ PELOG1(limLog( pMac, LOG1, FL("Sending an Add TS Response (status %d) to "),
+ nStatusCode );
+ limPrintMacAddr( pMac, pMacHdr->da, LOG1 );)
+
+ if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
+#ifdef WLAN_FEATURE_P2P
+ || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
+ ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
+#endif
+ )
+ {
+ txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
+ }
+
+ // Queue the frame in high priority WQ:
+ halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete, pFrame, txFlag );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to send Add TS Response (%X)!\n"),
+ nSirStatus );
+ //Pkt will be freed up by the callback
+ }
+
+} // End limSendAddtsRspActionFrame.
+
+void
+limSendDeltsReqActionFrame(tpAniSirGlobal pMac,
+ tSirMacAddr peer,
+ tANI_U8 wmmTspecPresent,
+ tSirMacTSInfo *pTsinfo,
+ tSirMacTspecIE *pTspecIe,
+ tpPESession psessionEntry)
+{
+ tANI_U8 *pFrame;
+ tpSirMacMgmtHdr pMacHdr;
+ tDot11fDelTS DelTS;
+ tDot11fWMMDelTS WMMDelTS;
+ tSirRetStatus nSirStatus;
+ tANI_U32 nBytes, nPayload, nStatus;
+ void *pPacket;
+ eHalStatus halstatus;
+ tANI_U8 txFlag = 0;
+
+ if(NULL == psessionEntry)
+ {
+ return;
+ }
+
+ if ( ! wmmTspecPresent )
+ {
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&DelTS, sizeof( DelTS ) );
+
+ DelTS.Category.category = SIR_MAC_ACTION_QOS_MGMT;
+ DelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ;
+ PopulateDot11fTSInfo( pTsinfo, &DelTS.TSInfo );
+
+ nStatus = dot11fGetPackedDelTSSize( pMac, &DelTS, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to calculate the packed si"
+ "ze for a Del TS (0x%08x).\n"),
+ nStatus );
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fDelTS );
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calcula"
+ "ting the packed size for a Del TS"
+ " (0x%08x).\n"), nStatus );
+ }
+ }
+ else
+ {
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&WMMDelTS, sizeof( WMMDelTS ) );
+
+ WMMDelTS.Category.category = SIR_MAC_ACTION_WME;
+ WMMDelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ;
+ WMMDelTS.DialogToken.token = 0;
+ WMMDelTS.StatusCode.statusCode = 0;
+ PopulateDot11fWMMTSPEC( pTspecIe, &WMMDelTS.WMMTSPEC );
+ nStatus = dot11fGetPackedWMMDelTSSize( pMac, &WMMDelTS, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to calculate the packed si"
+ "ze for a WMM Del TS (0x%08x).\n"),
+ nStatus );
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fDelTS );
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calcula"
+ "ting the packed size for a WMM De"
+ "l TS (0x%08x).\n"), nStatus );
+ }
+ }
+
+ nBytes = nPayload + sizeof( tSirMacMgmtHdr );
+
+ halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an Ad"
+ "d TS Response.\n"), nBytes );
+ return;
+ }
+
+ // Paranoia:
+ palZeroMemory( pMac->hHdd, pFrame, nBytes );
+
+ // Next, we fill out the buffer descriptor:
+ nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_ACTION, peer,
+ psessionEntry->selfMacAddr);
+ if ( eSIR_SUCCESS != nSirStatus )
+ {
+ limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
+ "tor for an Add TS Response (%d).\n"),
+ nSirStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return; // allocated!
+ }
+
+ pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
+
+ #if 0
+
+ cfgLen = SIR_MAC_ADDR_LENGTH;
+ if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID,
+ ( tANI_U8* )pMacHdr->bssId, &cfgLen ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil"
+ "e sending an Add TS Response.\n") );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return; // allocated!
+ }
+ #endif //TO SUPPORT BT-AMP
+ sirCopyMacAddr(pMacHdr->bssId, psessionEntry->bssId);
+
+ // That done, pack the struct:
+ if ( !wmmTspecPresent )
+ {
+ nStatus = dot11fPackDelTS( pMac, &DelTS,
+ pFrame + sizeof( tSirMacMgmtHdr ),
+ nPayload, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to pack a Del TS frame (0x%08x).\n"),
+ nStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return; // allocated!
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while packing"
+ "a Del TS frame (0x%08x).\n") );
+ }
+ }
+ else
+ {
+ nStatus = dot11fPackWMMDelTS( pMac, &WMMDelTS,
+ pFrame + sizeof( tSirMacMgmtHdr ),
+ nPayload, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to pack a WMM Del TS frame (0x%08x).\n"),
+ nStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return; // allocated!
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while packing"
+ "a WMM Del TS frame (0x%08x).\n") );
+ }
+ }
+
+ PELOG1(limLog(pMac, LOG1, FL("Sending DELTS REQ (size %d) to "), nBytes);
+ limPrintMacAddr(pMac, pMacHdr->da, LOG1);)
+
+ if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
+#ifdef WLAN_FEATURE_P2P
+ || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
+ ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
+#endif
+ )
+ {
+ txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
+ }
+
+ halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete, pFrame, txFlag );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to send Del TS (%X)!\n"),
+ nSirStatus );
+ //Pkt will be freed up by the callback
+ }
+
+} // End limSendDeltsReqActionFrame.
+
+void
+limSendAssocReqMgmtFrame(tpAniSirGlobal pMac,
+ tLimMlmAssocReq *pMlmAssocReq,
+ tpPESession psessionEntry)
+{
+ tDot11fAssocRequest frm;
+ tANI_U16 caps;
+ tANI_U8 *pFrame;
+ tSirRetStatus nSirStatus;
+ tLimMlmAssocCnf mlmAssocCnf;
+ tANI_U32 nBytes, nPayload, nStatus;
+ tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled;
+ void *pPacket;
+ eHalStatus halstatus;
+ tANI_U16 nAddIELen;
+ tANI_U8 *pAddIE;
+ tANI_U8 *wpsIe = NULL;
+#if defined WLAN_FEATURE_VOWIFI
+ tANI_U8 PowerCapsPopulated = FALSE;
+#endif
+ tANI_U8 txFlag = 0;
+
+ if(NULL == psessionEntry)
+ {
+ return;
+ }
+
+ if(NULL == psessionEntry->pLimJoinReq)
+ {
+ return;
+ }
+
+ /* check this early to avoid unncessary operation */
+ if(NULL == psessionEntry->pLimJoinReq)
+ {
+ return;
+ }
+ nAddIELen = psessionEntry->pLimJoinReq->addIEAssoc.length;
+ pAddIE = psessionEntry->pLimJoinReq->addIEAssoc.addIEdata;
+
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
+
+ caps = pMlmAssocReq->capabilityInfo;
+ if ( PROP_CAPABILITY_GET( 11EQOS, psessionEntry->limCurrentBssPropCap ) )
+ ((tSirMacCapabilityInfo *) &caps)->qos = 0;
+#if defined(FEATURE_WLAN_WAPI)
+ /* CR: 262463 :
+ According to WAPI standard:
+ 7.3.1.4 Capability Information field
+ In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted
+ Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and
+ Reassociation management frames. */
+ if ( psessionEntry->encryptType == eSIR_ED_WPI)
+ ((tSirMacCapabilityInfo *) &caps)->privacy = 0;
+#endif
+ swapBitField16(caps, ( tANI_U16* )&frm.Capabilities );
+
+ frm.ListenInterval.interval = pMlmAssocReq->listenInterval;
+ PopulateDot11fSSID2( pMac, &frm.SSID );
+ PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
+ &frm.SuppRates,psessionEntry);
+
+ fQosEnabled = ( psessionEntry->limQosEnabled) &&
+ SIR_MAC_GET_QOS( psessionEntry->limCurrentBssCaps );
+
+ fWmeEnabled = ( psessionEntry->limWmeEnabled ) &&
+ LIM_BSS_CAPS_GET( WME, psessionEntry->limCurrentBssQosCaps );
+
+ // We prefer .11e asociations:
+ if ( fQosEnabled ) fWmeEnabled = false;
+
+ fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled &&
+ LIM_BSS_CAPS_GET( WSM, psessionEntry->limCurrentBssQosCaps );
+
+ if ( psessionEntry->lim11hEnable &&
+ psessionEntry->pLimJoinReq->spectrumMgtIndicator == eSIR_TRUE )
+ {
+#if defined WLAN_FEATURE_VOWIFI
+ PowerCapsPopulated = TRUE;
+
+ PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_ASSOC,psessionEntry);
+#endif
+ PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_ASSOC,psessionEntry);
+
+ }
+
+#if defined WLAN_FEATURE_VOWIFI
+ if( pMac->rrm.rrmPEContext.rrmEnable &&
+ SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) )
+ {
+ if (PowerCapsPopulated == FALSE)
+ {
+ PowerCapsPopulated = TRUE;
+ PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_ASSOC, psessionEntry);
+ }
+ }
+#endif
+
+ if ( fQosEnabled &&
+ ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limCurrentBssPropCap)))
+ PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation );
+
+ PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
+ &frm.ExtSuppRates, psessionEntry );
+
+#if defined WLAN_FEATURE_VOWIFI
+ if( pMac->rrm.rrmPEContext.rrmEnable &&
+ SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) )
+ {
+ PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry );
+ }
+#endif
+ // The join request *should* contain zero or one of the WPA and RSN
+ // IEs. The payload send along with the request is a
+ // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie':
+
+ // typedef struct sSirRSNie
+ // {
+ // tANI_U16 length;
+ // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
+ // } tSirRSNie, *tpSirRSNie;
+
+ // So, we should be able to make the following two calls harmlessly,
+ // since they do nothing if they don't find the given IE in the
+ // bytestream with which they're provided.
+
+ // The net effect of this will be to faithfully transmit whatever
+ // security IE is in the join request.
+
+ // *However*, if we're associating for the purpose of WPS
+ // enrollment, and we've been configured to indicate that by
+ // eliding the WPA or RSN IE, we just skip this:
+ if( nAddIELen && pAddIE )
+ {
+ wpsIe = limGetWscIEPtr (pMac, pAddIE, nAddIELen);
+ }
+ if ( NULL == wpsIe )
+ {
+ PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ),
+ &frm.RSNOpaque );
+ PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ),
+ &frm.WPAOpaque );
+#if defined(FEATURE_WLAN_WAPI)
+ PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ),
+ &frm.WAPIOpaque );
+#endif // defined(FEATURE_WLAN_WAPI)
+ }
+
+ // include WME EDCA IE as well
+ if ( fWmeEnabled )
+ {
+ if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limCurrentBssPropCap ) )
+ {
+ PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation );
+ }
+
+ if ( fWsmEnabled &&
+ ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limCurrentBssPropCap )))
+ {
+ PopulateDot11fWMMCaps( &frm.WMMCaps );
+ }
+ }
+
+ //Populate HT IEs, when operating in 11n or Taurus modes AND
+ //when AP is also operating in 11n mode.
+ if ( psessionEntry->htCapabality &&
+ pMac->lim.htCapabilityPresentInBeacon)
+ {
+ PopulateDot11fHTCaps( pMac, &frm.HTCaps );
+#ifdef DISABLE_GF_FOR_INTEROP
+
+ /*
+ * To resolve the interop problem with Broadcom AP,
+ * where TQ STA could not pass traffic with GF enabled,
+ * TQ STA will do Greenfield only with TQ AP, for
+ * everybody else it will be turned off.
+ */
+
+ if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
+ {
+ limLog( pMac, LOG1, FL("Sending Assoc Req to Non-TQ AP, Turning off Greenfield"));
+ frm.HTCaps.greenField = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
+ }
+#endif
+
+ }
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+ if (psessionEntry->pLimJoinReq->is11Rconnection)
+ {
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+ limLog( pMac, LOGE, FL("mdie = %02x %02x %02x\n"),
+ (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[0],
+ (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[1],
+ (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[2]);
+#endif
+ PopulateMDIE( pMac, &frm.MobilityDomain, psessionEntry->pLimJoinReq->bssDescription.mdie);
+ }
+ else
+ {
+ // No 11r IEs dont send any MDIE
+ limLog( pMac, LOGE, FL("mdie not present\n"));
+ }
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+ // For CCX Associations fill the CCX IEs
+ if (psessionEntry->isCCXconnection)
+ {
+ PopulateDot11fCCXRadMgmtCap(&frm.CCXRadMgmtCap);
+ PopulateDot11fCCXVersion(&frm.CCXVersion);
+ }
+#endif
+
+ nStatus = dot11fGetPackedAssocRequestSize( pMac, &frm, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+ "or an Association Request (0x%08x).\n"),
+ nStatus );
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fAssocRequest );
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calculating"
+ "the packed size for an Association Re "
+ "quest(0x%08x).\n"), nStatus );
+ }
+
+ nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen;
+
+ halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( tANI_U16 )nBytes, ( void** ) &pFrame,
+ ( void** ) &pPacket );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an As"
+ "sociation Request.\n"), nBytes );
+
+ psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+
+ /* Update PE session id*/
+ mlmAssocCnf.sessionId = psessionEntry->peSessionId;
+
+ mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( void* ) pFrame, ( void* ) pPacket );
+
+ limPostSmeMessage( pMac, LIM_MLM_ASSOC_CNF,
+ ( tANI_U32* ) &mlmAssocCnf);
+
+ return;
+ }
+
+ // Paranoia:
+ palZeroMemory( pMac->hHdd, pFrame, nBytes );
+
+ // Next, we fill out the buffer descriptor:
+ nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_ASSOC_REQ, psessionEntry->bssId,psessionEntry->selfMacAddr);
+ if ( eSIR_SUCCESS != nSirStatus )
+ {
+ limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
+ "tor for an Association Request (%d).\n"),
+ nSirStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return;
+ }
+
+
+ // That done, pack the Probe Request:
+ nStatus = dot11fPackAssocRequest( pMac, &frm, pFrame +
+ sizeof(tSirMacMgmtHdr),
+ nPayload, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to pack a Probe Response (0x%0"
+ "8x).\n"),
+ nStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( void* ) pFrame, ( void* ) pPacket );
+ return;
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while packing a P"
+ "robe Response (0x%08x).\n") );
+ }
+
+ PELOG1(limLog( pMac, LOG1, FL("*** Sending Association Request length %d"
+ "to \n"),
+ nBytes );)
+ // limPrintMacAddr( pMac, bssid, LOG1 );
+
+ if( psessionEntry->assocReq != NULL )
+ {
+ palFreeMemory(pMac->hHdd, psessionEntry->assocReq);
+ psessionEntry->assocReq = NULL;
+ }
+
+ if( nAddIELen )
+ {
+ palCopyMemory( pMac->hHdd, pFrame + sizeof(tSirMacMgmtHdr) + nPayload,
+ pAddIE,
+ nAddIELen );
+ nPayload += nAddIELen;
+ }
+
+ if( (palAllocateMemory(pMac->hHdd, (void**)&psessionEntry->assocReq, nPayload)) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));)
+ }
+ else
+ {
+ //Store the Assoc request. This is sent to csr/hdd in join cnf response.
+ palCopyMemory(pMac->hHdd, psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload);
+ psessionEntry->assocReqLen = nPayload;
+ }
+
+ if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
+#ifdef WLAN_FEATURE_P2P
+ || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
+ ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
+#endif
+ )
+ {
+ txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
+ }
+
+ halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload),
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete, pFrame, txFlag );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to send Association Request (%X)!\n"),
+ halstatus );
+ //Pkt will be freed up by the callback
+ return;
+ }
+
+ // Free up buffer allocated for mlmAssocReq
+ palFreeMemory( pMac->hHdd, ( tANI_U8* ) pMlmAssocReq );
+
+} // End limSendAssocReqMgmtFrame
+
+
+
+#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX
+/*------------------------------------------------------------------------------------
+ *
+ * Send Reassoc Req with FTIEs.
+ *
+ *-----------------------------------------------------------------------------------
+ */
+void
+limSendReassocReqWithFTIEsMgmtFrame(tpAniSirGlobal pMac,
+ tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry)
+{
+ static tDot11fReAssocRequest frm;
+ tANI_U16 caps;
+ tANI_U8 *pFrame;
+ tSirRetStatus nSirStatus;
+ tANI_U32 nBytes, nPayload, nStatus;
+ tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled;
+ void *pPacket;
+ eHalStatus halstatus;
+#if defined WLAN_FEATURE_VOWIFI
+ tANI_U8 PowerCapsPopulated = FALSE;
+#endif
+ tANI_U16 ft_ies_length = 0;
+ tANI_U8 *pBody;
+ tANI_U16 nAddIELen;
+ tANI_U8 *pAddIE;
+#ifdef FEATURE_WLAN_CCX
+ tANI_U8 *wpsIe = NULL;
+#endif
+ tANI_U8 txFlag = 0;
+
+ if (NULL == psessionEntry)
+ {
+ return;
+ }
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+ if (psessionEntry->is11Rconnection)
+ {
+ if (pMac->ft.ftSmeContext.reassoc_ft_ies_length == 0)
+ {
+ return;
+ }
+ }
+#endif
+
+ /* check this early to avoid unncessary operation */
+ if(NULL == psessionEntry->pLimReAssocReq)
+ {
+ return;
+ }
+ nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length;
+ pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata;
+ limLog( pMac, LOGE, FL("limSendReassocReqWithFTIEsMgmtFrame received in "
+ "state (%d).\n"), psessionEntry->limMlmState);
+
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
+
+ caps = pMlmReassocReq->capabilityInfo;
+ if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap))
+ ((tSirMacCapabilityInfo *) &caps)->qos = 0;
+#if defined(FEATURE_WLAN_WAPI)
+ /* CR: 262463 :
+ According to WAPI standard:
+ 7.3.1.4 Capability Information field
+ In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted
+ Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and
+ Reassociation management frames. */
+ if ( psessionEntry->encryptType == eSIR_ED_WPI)
+ ((tSirMacCapabilityInfo *) &caps)->privacy = 0;
+#endif
+ swapBitField16(caps, ( tANI_U16* )&frm.Capabilities );
+
+ frm.ListenInterval.interval = pMlmReassocReq->listenInterval;
+
+ // Get the old bssid of the older AP.
+ palCopyMemory( pMac->hHdd, ( tANI_U8* )frm.CurrentAPAddress.mac,
+ pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, 6);
+
+ PopulateDot11fSSID2( pMac, &frm.SSID );
+ PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
+ &frm.SuppRates,psessionEntry);
+
+ fQosEnabled = ( psessionEntry->limQosEnabled) &&
+ SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps );
+
+ fWmeEnabled = ( psessionEntry->limWmeEnabled ) &&
+ LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps );
+
+ fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled &&
+ LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps );
+
+ if ( psessionEntry->lim11hEnable &&
+ psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE )
+ {
+#if defined WLAN_FEATURE_VOWIFI
+ PowerCapsPopulated = TRUE;
+
+ PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry);
+ PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry);
+#endif
+ }
+
+#if defined WLAN_FEATURE_VOWIFI
+ if( pMac->rrm.rrmPEContext.rrmEnable &&
+ SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) )
+ {
+ if (PowerCapsPopulated == FALSE)
+ {
+ PowerCapsPopulated = TRUE;
+ PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry);
+ }
+ }
+#endif
+
+ if ( fQosEnabled &&
+ ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) ))
+ {
+ PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation );
+ }
+
+ PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
+ &frm.ExtSuppRates, psessionEntry );
+
+#if defined WLAN_FEATURE_VOWIFI
+ if( pMac->rrm.rrmPEContext.rrmEnable &&
+ SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) )
+ {
+ PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry );
+ }
+#endif
+
+ // Ideally this should be enabled for 11r also. But 11r does
+ // not follow the usual norm of using the Opaque object
+ // for rsnie and fties. Instead we just add
+ // the rsnie and fties at the end of the pack routine for 11r.
+ // This should ideally! be fixed.
+#ifdef FEATURE_WLAN_CCX
+ //
+ // The join request *should* contain zero or one of the WPA and RSN
+ // IEs. The payload send along with the request is a
+ // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie':
+
+ // typedef struct sSirRSNie
+ // {
+ // tANI_U16 length;
+ // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
+ // } tSirRSNie, *tpSirRSNie;
+
+ // So, we should be able to make the following two calls harmlessly,
+ // since they do nothing if they don't find the given IE in the
+ // bytestream with which they're provided.
+
+ // The net effect of this will be to faithfully transmit whatever
+ // security IE is in the join request.
+
+ // *However*, if we're associating for the purpose of WPS
+ // enrollment, and we've been configured to indicate that by
+ // eliding the WPA or RSN IE, we just skip this:
+ if (!psessionEntry->is11Rconnection)
+ {
+ if( nAddIELen && pAddIE )
+ {
+ wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen);
+ }
+ if ( NULL == wpsIe )
+ {
+ PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
+ &frm.RSNOpaque );
+ PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
+ &frm.WPAOpaque );
+ }
+
+ if(psessionEntry->pLimReAssocReq->cckmIE.length)
+ {
+ PopulateDot11fCCXCckmOpaque( pMac, &( psessionEntry->pLimReAssocReq->cckmIE ),
+ &frm.CCXCckmOpaque );
+ }
+ }
+
+ // For CCX Associations fill the CCX IEs
+ if (psessionEntry->isCCXconnection)
+ {
+ PopulateDot11fCCXRadMgmtCap(&frm.CCXRadMgmtCap);
+ PopulateDot11fCCXVersion(&frm.CCXVersion);
+ }
+#endif
+
+ // include WME EDCA IE as well
+ if ( fWmeEnabled )
+ {
+ if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) )
+ {
+ PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation );
+ }
+
+ if ( fWsmEnabled &&
+ ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap )))
+ {
+ PopulateDot11fWMMCaps( &frm.WMMCaps );
+ }
+#ifdef FEATURE_WLAN_CCX
+ if (psessionEntry->isCCXconnection)
+ {
+ PopulateDot11fReAssocTspec(pMac, &frm, psessionEntry);
+
+ // Populate the TSRS IE if TSPEC is included in the reassoc request
+ if (psessionEntry->pLimReAssocReq->ccxTspecInfo.numTspecs)
+ {
+ tANI_U32 phyMode;
+ tSirMacCCXTSRSIE tsrsIE;
+ limGetPhyMode(pMac, &phyMode, psessionEntry);
+
+ tsrsIE.tsid = 0;
+ if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A)
+ {
+ tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS;
+ }
+ else
+ {
+ tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS;
+ }
+ PopulateDot11TSRSIE(pMac,&tsrsIE, &frm.CCXTrafStrmRateSet, sizeof(tANI_U8));
+ }
+ }
+#endif
+ }
+
+ if ( psessionEntry->htCapabality &&
+ pMac->lim.htCapabilityPresentInBeacon)
+ {
+ PopulateDot11fHTCaps( pMac, &frm.HTCaps );
+ }
+
+ nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+ "or a Re-Association Request (0x%08x).\n"),
+ nStatus );
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fReAssocRequest );
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calculating"
+ "the packed size for a Re-Association Re "
+ "quest(0x%08x).\n"), nStatus );
+ }
+
+ nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; ;
+
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+ limLog( pMac, LOGE, FL("FT IE Reassoc Req (%d).\n"),
+ pMac->ft.ftSmeContext.reassoc_ft_ies_length);
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+ if (psessionEntry->is11Rconnection)
+ {
+ ft_ies_length = pMac->ft.ftSmeContext.reassoc_ft_ies_length;
+ }
+#endif
+
+ halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( tANI_U16 )nBytes+ft_ies_length, ( void** ) &pFrame,
+ ( void** ) &pPacket );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+ limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Re-As"
+ "sociation Request.\n"), nBytes );
+ goto end;
+ }
+
+ // Paranoia:
+ palZeroMemory( pMac->hHdd, pFrame, nBytes + ft_ies_length);
+
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX
+ limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
+#endif
+ // Next, we fill out the buffer descriptor:
+ nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_REASSOC_REQ,
+ psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr);
+ if ( eSIR_SUCCESS != nSirStatus )
+ {
+ limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
+ "tor for an Association Request (%d).\n"),
+ nSirStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ goto end;
+ }
+
+
+ // That done, pack the ReAssoc Request:
+ nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame +
+ sizeof(tSirMacMgmtHdr),
+ nPayload, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque"
+ "st (0x%08x).\n"),
+ nStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ goto end;
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while packing a R"
+ "e-Association Request (0x%08x).\n") );
+ }
+
+ PELOG3(limLog( pMac, LOG3,
+ FL("*** Sending Re-Association Request length %d %d to \n"),
+ nBytes, nPayload );)
+ if( psessionEntry->assocReq != NULL )
+ {
+ palFreeMemory(pMac->hHdd, psessionEntry->assocReq);
+ psessionEntry->assocReq = NULL;
+ }
+
+ if( nAddIELen )
+ {
+ palCopyMemory( pMac->hHdd, pFrame + sizeof(tSirMacMgmtHdr) + nPayload,
+ pAddIE,
+ nAddIELen );
+ nPayload += nAddIELen;
+ }
+
+ if( (palAllocateMemory(pMac->hHdd, (void**)&psessionEntry->assocReq, nPayload)) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));)
+ }
+ else
+ {
+ //Store the Assoc request. This is sent to csr/hdd in join cnf response.
+ palCopyMemory(pMac->hHdd, psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload);
+ psessionEntry->assocReqLen = nPayload;
+ }
+
+ if (psessionEntry->is11Rconnection)
+ {
+ {
+ int i = 0;
+
+ pBody = pFrame + nBytes;
+ for (i=0; i<ft_ies_length; i++)
+ {
+ *pBody = pMac->ft.ftSmeContext.reassoc_ft_ies[i];
+ pBody++;
+ }
+ }
+ }
+
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog(pMac, LOGE, FL("Re-assoc Req Frame is: "));
+ sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOGE,
+ (tANI_U8 *)pFrame,
+ (nBytes + ft_ies_length));)
+#endif
+
+
+ if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
+#ifdef WLAN_FEATURE_P2P
+ || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
+ ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
+#endif
+ )
+ {
+ txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
+ }
+
+ halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (nBytes + ft_ies_length),
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete, pFrame, txFlag );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to send Re-Association Request"
+ "(%X)!\n"),
+ nSirStatus );
+ //Pkt will be freed up by the callback
+ goto end;
+ }
+
+end:
+ // Free up buffer allocated for mlmAssocReq
+ palFreeMemory( pMac->hHdd, ( tANI_U8* ) pMlmReassocReq );
+ psessionEntry->pLimMlmReassocReq = NULL;
+
+}
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+
+void
+limSendReassocReqMgmtFrame(tpAniSirGlobal pMac,
+ tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry)
+{
+ static tDot11fReAssocRequest frm;
+ tANI_U16 caps;
+ tANI_U8 *pFrame;
+ tSirRetStatus nSirStatus;
+ tANI_U32 nBytes, nPayload, nStatus;
+ tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled;
+ void *pPacket;
+ eHalStatus halstatus;
+ tANI_U16 nAddIELen;
+ tANI_U8 *pAddIE;
+ tANI_U8 *wpsIe = NULL;
+ tANI_U8 txFlag = 0;
+#if defined WLAN_FEATURE_VOWIFI
+ tANI_U8 PowerCapsPopulated = FALSE;
+#endif
+
+ if(NULL == psessionEntry)
+ {
+ return;
+ }
+
+ /* check this early to avoid unncessary operation */
+ if(NULL == psessionEntry->pLimReAssocReq)
+ {
+ return;
+ }
+ nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length;
+ pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata;
+
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
+
+ caps = pMlmReassocReq->capabilityInfo;
+ if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap))
+ ((tSirMacCapabilityInfo *) &caps)->qos = 0;
+#if defined(FEATURE_WLAN_WAPI)
+ /* CR: 262463 :
+ According to WAPI standard:
+ 7.3.1.4 Capability Information field
+ In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted
+ Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and
+ Reassociation management frames. */
+ if ( psessionEntry->encryptType == eSIR_ED_WPI)
+ ((tSirMacCapabilityInfo *) &caps)->privacy = 0;
+#endif
+ swapBitField16(caps, ( tANI_U16* )&frm.Capabilities );
+
+ frm.ListenInterval.interval = pMlmReassocReq->listenInterval;
+
+ palCopyMemory( pMac->hHdd, ( tANI_U8* )frm.CurrentAPAddress.mac,
+ ( tANI_U8* )psessionEntry->bssId, 6 );
+
+ PopulateDot11fSSID2( pMac, &frm.SSID );
+ PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
+ &frm.SuppRates,psessionEntry);
+
+ fQosEnabled = ( psessionEntry->limQosEnabled ) &&
+ SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps );
+
+ fWmeEnabled = ( psessionEntry->limWmeEnabled ) &&
+ LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps );
+
+ fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled &&
+ LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps );
+
+
+ if ( psessionEntry->lim11hEnable &&
+ psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE )
+ {
+#if defined WLAN_FEATURE_VOWIFI
+ PowerCapsPopulated = TRUE;
+ PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry);
+ PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry);
+#endif
+ }
+
+#if defined WLAN_FEATURE_VOWIFI
+ if( pMac->rrm.rrmPEContext.rrmEnable &&
+ SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) )
+ {
+ if (PowerCapsPopulated == FALSE)
+ {
+ PowerCapsPopulated = TRUE;
+ PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry);
+ }
+ }
+#endif
+
+ if ( fQosEnabled &&
+ ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) ))
+ {
+ PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation );
+ }
+
+ PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
+ &frm.ExtSuppRates, psessionEntry );
+
+#if defined WLAN_FEATURE_VOWIFI
+ if( pMac->rrm.rrmPEContext.rrmEnable &&
+ SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) )
+ {
+ PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry );
+ }
+#endif
+ // The join request *should* contain zero or one of the WPA and RSN
+ // IEs. The payload send along with the request is a
+ // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie':
+
+ // typedef struct sSirRSNie
+ // {
+ // tANI_U16 length;
+ // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
+ // } tSirRSNie, *tpSirRSNie;
+
+ // So, we should be able to make the following two calls harmlessly,
+ // since they do nothing if they don't find the given IE in the
+ // bytestream with which they're provided.
+
+ // The net effect of this will be to faithfully transmit whatever
+ // security IE is in the join request.
+
+ // *However*, if we're associating for the purpose of WPS
+ // enrollment, and we've been configured to indicate that by
+ // eliding the WPA or RSN IE, we just skip this:
+ if( nAddIELen && pAddIE )
+ {
+ wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen);
+ }
+ if ( NULL == wpsIe )
+ {
+ PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
+ &frm.RSNOpaque );
+ PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
+ &frm.WPAOpaque );
+#if defined(FEATURE_WLAN_WAPI)
+ PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
+ &frm.WAPIOpaque );
+#endif // defined(FEATURE_WLAN_WAPI)
+ }
+
+ // include WME EDCA IE as well
+ if ( fWmeEnabled )
+ {
+ if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) )
+ {
+ PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation );
+ }
+
+ if ( fWsmEnabled &&
+ ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap )))
+ {
+ PopulateDot11fWMMCaps( &frm.WMMCaps );
+ }
+ }
+
+ if ( psessionEntry->htCapabality &&
+ pMac->lim.htCapabilityPresentInBeacon)
+ {
+ PopulateDot11fHTCaps( pMac, &frm.HTCaps );
+ }
+
+ nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+ "or a Re-Association Request (0x%08x).\n"),
+ nStatus );
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fReAssocRequest );
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calculating"
+ "the packed size for a Re-Association Re "
+ "quest(0x%08x).\n"), nStatus );
+ }
+
+ nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen;
+
+ halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( tANI_U16 )nBytes, ( void** ) &pFrame,
+ ( void** ) &pPacket );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+ limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Re-As"
+ "sociation Request.\n"), nBytes );
+ goto end;
+ }
+
+ // Paranoia:
+ palZeroMemory( pMac->hHdd, pFrame, nBytes );
+
+ // Next, we fill out the buffer descriptor:
+ nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_REASSOC_REQ,
+ psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr);
+ if ( eSIR_SUCCESS != nSirStatus )
+ {
+ limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
+ "tor for an Association Request (%d).\n"),
+ nSirStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ goto end;
+ }
+
+
+ // That done, pack the Probe Request:
+ nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame +
+ sizeof(tSirMacMgmtHdr),
+ nPayload, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque"
+ "st (0x%08x).\n"),
+ nStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ goto end;
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while packing a R"
+ "e-Association Request (0x%08x).\n") );
+ }
+
+ PELOG1(limLog( pMac, LOG1, FL("*** Sending Re-Association Request length %d"
+ "to \n"),
+ nBytes );)
+
+ if( psessionEntry->assocReq != NULL )
+ {
+ palFreeMemory(pMac->hHdd, psessionEntry->assocReq);
+ psessionEntry->assocReq = NULL;
+ }
+
+ if( nAddIELen )
+ {
+ palCopyMemory( pMac->hHdd, pFrame + sizeof(tSirMacMgmtHdr) + nPayload,
+ pAddIE,
+ nAddIELen );
+ nPayload += nAddIELen;
+ }
+
+ if( (palAllocateMemory(pMac->hHdd, (void**)&psessionEntry->assocReq, nPayload)) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));)
+ }
+ else
+ {
+ //Store the Assoc request. This is sent to csr/hdd in join cnf response.
+ palCopyMemory(pMac->hHdd, psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload);
+ psessionEntry->assocReqLen = nPayload;
+ }
+
+ if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
+#ifdef WLAN_FEATURE_P2P
+ || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
+ ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
+#endif
+ )
+ {
+ txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
+ }
+
+ halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload),
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete, pFrame, txFlag );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to send Re-Association Request"
+ "(%X)!\n"),
+ nSirStatus );
+ //Pkt will be freed up by the callback
+ goto end;
+ }
+
+end:
+ // Free up buffer allocated for mlmAssocReq
+ palFreeMemory( pMac->hHdd, ( tANI_U8* ) pMlmReassocReq );
+ psessionEntry->pLimMlmReassocReq = NULL;
+
+} // limSendReassocReqMgmtFrame
+
+/**
+ * \brief Send an Authentication frame
+ *
+ *
+ * \param pMac Pointer to Global MAC structure
+ *
+ * \param pAuthFrameBody Pointer to Authentication frame structure that need
+ * to be sent
+ *
+ * \param peerMacAddr MAC address of the peer entity to which Authentication
+ * frame is destined
+ *
+ * \param wepBit Indicates whether wep bit to be set in FC while sending
+ * Authentication frame3
+ *
+ *
+ * This function is called by limProcessMlmMessages(). Authentication frame
+ * is formatted and sent when this function is called.
+ *
+ *
+ */
+
+void
+limSendAuthMgmtFrame(tpAniSirGlobal pMac,
+ tpSirMacAuthFrameBody pAuthFrameBody,
+ tSirMacAddr peerMacAddr,
+ tANI_U8 wepBit,
+ tpPESession psessionEntry
+ )
+{
+ tANI_U8 *pFrame, *pBody;
+ tANI_U32 frameLen = 0, bodyLen = 0;
+ tpSirMacMgmtHdr pMacHdr;
+ tANI_U16 i;
+ void *pPacket;
+ eHalStatus halstatus;
+ tANI_U8 txFlag = 0;
+
+ if(NULL == psessionEntry)
+ {
+ return;
+ }
+
+ if (wepBit == LIM_WEP_IN_FC)
+ {
+ /// Auth frame3 to be sent with encrypted framebody
+ /**
+ * Allocate buffer for Authenticaton frame of size equal
+ * to management frame header length plus 2 bytes each for
+ * auth algorithm number, transaction number, status code,
+ * 128 bytes for challenge text and 4 bytes each for
+ * IV & ICV.
+ */
+
+ frameLen = sizeof(tSirMacMgmtHdr) + LIM_ENCR_AUTH_BODY_LEN;
+
+ bodyLen = LIM_ENCR_AUTH_BODY_LEN;
+ } // if (wepBit == LIM_WEP_IN_FC)
+ else
+ {
+ switch (pAuthFrameBody->authTransactionSeqNumber)
+ {
+ case SIR_MAC_AUTH_FRAME_1:
+ /**
+ * Allocate buffer for Authenticaton frame of size
+ * equal to management frame header length plus 2 bytes
+ * each for auth algorithm number, transaction number
+ * and status code.
+ */
+
+ frameLen = sizeof(tSirMacMgmtHdr) +
+ SIR_MAC_AUTH_CHALLENGE_OFFSET;
+ bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET;
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+ if (pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH)
+ {
+ if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies)
+ {
+ frameLen += pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length;
+ limLog(pMac, LOG3, FL("Auth frame, FTIES length added=%d\n"),
+ pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length);
+ }
+ else
+ limLog(pMac, LOG3, FL("Auth frame, Does not contain FTIES!!!\n"));
+ }
+#endif
+ break;
+
+ case SIR_MAC_AUTH_FRAME_2:
+ if ((pAuthFrameBody->authAlgoNumber == eSIR_OPEN_SYSTEM) ||
+ ((pAuthFrameBody->authAlgoNumber == eSIR_SHARED_KEY) &&
+ (pAuthFrameBody->authStatusCode != eSIR_MAC_SUCCESS_STATUS)))
+ {
+ /**
+ * Allocate buffer for Authenticaton frame of size
+ * equal to management frame header length plus
+ * 2 bytes each for auth algorithm number,
+ * transaction number and status code.
+ */
+
+ frameLen = sizeof(tSirMacMgmtHdr) +
+ SIR_MAC_AUTH_CHALLENGE_OFFSET;
+ bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET;
+ }
+ else
+ {
+ // Shared Key algorithm with challenge text
+ // to be sent
+ /**
+ * Allocate buffer for Authenticaton frame of size
+ * equal to management frame header length plus
+ * 2 bytes each for auth algorithm number,
+ * transaction number, status code and 128 bytes
+ * for challenge text.
+ */
+
+ frameLen = sizeof(tSirMacMgmtHdr) +
+ sizeof(tSirMacAuthFrame);
+ bodyLen = sizeof(tSirMacAuthFrameBody);
+ }
+
+ break;
+
+ case SIR_MAC_AUTH_FRAME_3:
+ /// Auth frame3 to be sent without encrypted framebody
+ /**
+ * Allocate buffer for Authenticaton frame of size equal
+ * to management frame header length plus 2 bytes each
+ * for auth algorithm number, transaction number and
+ * status code.
+ */
+
+ frameLen = sizeof(tSirMacMgmtHdr) +
+ SIR_MAC_AUTH_CHALLENGE_OFFSET;
+ bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET;
+
+ break;
+
+ case SIR_MAC_AUTH_FRAME_4:
+ /**
+ * Allocate buffer for Authenticaton frame of size equal
+ * to management frame header length plus 2 bytes each
+ * for auth algorithm number, transaction number and
+ * status code.
+ */
+
+ frameLen = sizeof(tSirMacMgmtHdr) +
+ SIR_MAC_AUTH_CHALLENGE_OFFSET;
+ bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET;
+
+ break;
+ } // switch (pAuthFrameBody->authTransactionSeqNumber)
+ } // end if (wepBit == LIM_WEP_IN_FC)
+
+
+ halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )frameLen, ( void** ) &pFrame, ( void** ) &pPacket );
+
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ // Log error
+ limLog(pMac, LOGP, FL("call to bufAlloc failed for AUTH frame\n"));
+
+ return;
+ }
+
+ for (i = 0; i < frameLen; i++)
+ pFrame[i] = 0;
+
+ // Prepare BD
+ if (limPopulateMacHeader(pMac, pFrame, SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_AUTH, peerMacAddr,psessionEntry->selfMacAddr) != eSIR_SUCCESS)
+ {
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return;
+ }
+
+ pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
+ pMacHdr->fc.wep = wepBit;
+
+ // Prepare BSSId
+ if( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
+ {
+ palCopyMemory( pMac->hHdd,(tANI_U8 *) pMacHdr->bssId,
+ (tANI_U8 *) psessionEntry->bssId,
+ sizeof( tSirMacAddr ));
+ }
+
+ /// Prepare Authentication frame body
+ pBody = pFrame + sizeof(tSirMacMgmtHdr);
+
+ if (wepBit == LIM_WEP_IN_FC)
+ {
+ palCopyMemory( pMac->hHdd, pBody, (tANI_U8 *) pAuthFrameBody, bodyLen);
+
+ PELOG1(limLog(pMac, LOG1,
+ FL("*** Sending Auth seq# 3 status %d (%d) to\n"),
+ pAuthFrameBody->authStatusCode,
+ (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS));
+
+ limPrintMacAddr(pMac, pMacHdr->da, LOG1);)
+ }
+ else
+ {
+ *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authAlgoNumber);
+ pBody += sizeof(tANI_U16);
+ bodyLen -= sizeof(tANI_U16);
+
+ *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authTransactionSeqNumber);
+ pBody += sizeof(tANI_U16);
+ bodyLen -= sizeof(tANI_U16);
+
+ *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authStatusCode);
+ pBody += sizeof(tANI_U16);
+ bodyLen -= sizeof(tANI_U16);
+
+ palCopyMemory( pMac->hHdd, pBody, (tANI_U8 *) &pAuthFrameBody->type, bodyLen);
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+ if ((pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) &&
+ (pAuthFrameBody->authTransactionSeqNumber == SIR_MAC_AUTH_FRAME_1))
+ {
+
+ {
+ int i = 0;
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+ if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Auth1 Frame FTIE is: "));
+ sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOGE,
+ (tANI_U8 *)pBody,
+ (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length));)
+ }
+#endif
+ for (i=0; i<pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; i++)
+ {
+ *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[i];
+ pBody++;
+ }
+ }
+ }
+#endif
+
+ PELOG1(limLog(pMac, LOG1,
+ FL("*** Sending Auth seq# %d status %d (%d) to "),
+ pAuthFrameBody->authTransactionSeqNumber,
+ pAuthFrameBody->authStatusCode,
+ (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS));
+
+ limPrintMacAddr(pMac, pMacHdr->da, LOG1);)
+ }
+ PELOG2(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, pFrame, frameLen);)
+
+ if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
+#ifdef WLAN_FEATURE_P2P
+ || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
+ ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
+#endif
+ )
+ {
+ txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
+ }
+
+ /// Queue Authentication frame in high priority WQ
+ halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) frameLen,
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete, pFrame, txFlag );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog(pMac, LOGE,
+ FL("*** Could not send Auth frame, retCode=%X ***\n"),
+ halstatus);
+
+ //Pkt will be freed up by the callback
+ }
+
+ return;
+} /*** end limSendAuthMgmtFrame() ***/
+
+/**
+ * \brief This function is called to send Disassociate frame.
+ *
+ *
+ * \param pMac Pointer to Global MAC structure
+ *
+ * \param nReason Indicates the reason that need to be sent in
+ * Disassociation frame
+ *
+ * \param peerMacAddr MAC address of the STA to which Disassociation frame is
+ * sent
+ *
+ *
+ */
+
+void
+limSendDisassocMgmtFrame(tpAniSirGlobal pMac,
+ tANI_U16 nReason,
+ tSirMacAddr peer,tpPESession psessionEntry)
+{
+ tDot11fDisassociation frm;
+ tANI_U8 *pFrame;
+ tSirRetStatus nSirStatus;
+ tpSirMacMgmtHdr pMacHdr;
+ tANI_U32 nBytes, nPayload, nStatus;
+ void *pPacket;
+ eHalStatus halstatus;
+ tANI_U8 txFlag = 0;
+
+ if(NULL == psessionEntry)
+ {
+ return;
+ }
+
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
+
+ frm.Reason.code = nReason;
+
+ nStatus = dot11fGetPackedDisassociationSize( pMac, &frm, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+ "or a Disassociation (0x%08x).\n"),
+ nStatus );
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fDisassociation );
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calculating"
+ "the packed size for a Disassociation "
+ "(0x%08x).\n"), nStatus );
+ }
+
+ nBytes = nPayload + sizeof( tSirMacMgmtHdr );
+
+ halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( tANI_U16 )nBytes, ( void** ) &pFrame,
+ ( void** ) &pPacket );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Dis"
+ "association.\n"), nBytes );
+ return;
+ }
+
+ // Paranoia:
+ palZeroMemory( pMac->hHdd, pFrame, nBytes );
+
+ // Next, we fill out the buffer descriptor:
+ nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_DISASSOC, peer,psessionEntry->selfMacAddr);
+ if ( eSIR_SUCCESS != nSirStatus )
+ {
+ limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
+ "tor for a Disassociation (%d).\n"),
+ nSirStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( void* ) pFrame, ( void* ) pPacket );
+ return; // just allocated...
+ }
+
+ pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
+
+ // Prepare the BSSID
+ sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
+
+ nStatus = dot11fPackDisassociation( pMac, &frm, pFrame +
+ sizeof(tSirMacMgmtHdr),
+ nPayload, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to pack a Disassociation (0x%08x).\n"),
+ nStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( void* ) pFrame, ( void* ) pPacket );
+ return; // allocated!
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while packing a D"
+ "isassociation (0x%08x).\n") );
+ }
+
+ PELOG1(limLog( pMac, LOG1, FL("*** Sending Disassociation frame with rea"
+ "son %d to\n"), nReason );
+ limPrintMacAddr( pMac, pMacHdr->da, LOG1 );)
+
+ if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
+#ifdef WLAN_FEATURE_P2P
+ || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
+ ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
+#endif
+ )
+ {
+ txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
+ }
+
+ // Queue Disassociation frame in high priority WQ
+ halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete, pFrame, txFlag );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to send Disassociation "
+ "(%X)!\n"),
+ nSirStatus );
+ //Pkt will be freed up by the callback
+ return;
+ }
+
+} // End limSendDisassocMgmtFrame.
+
+/**
+ * \brief This function is called to send a Deauthenticate frame
+ *
+ *
+ * \param pMac Pointer to global MAC structure
+ *
+ * \param nReason Indicates the reason that need to be sent in the
+ * Deauthenticate frame
+ *
+ * \param peeer address of the STA to which the frame is to be sent
+ *
+ *
+ */
+
+void
+limSendDeauthMgmtFrame(tpAniSirGlobal pMac,
+ tANI_U16 nReason,
+ tSirMacAddr peer,tpPESession psessionEntry)
+{
+ tDot11fDeAuth frm;
+ tANI_U8 *pFrame;
+ tSirRetStatus nSirStatus;
+ tpSirMacMgmtHdr pMacHdr;
+ tANI_U32 nBytes, nPayload, nStatus;
+ void *pPacket;
+ eHalStatus halstatus;
+ tANI_U8 txFlag = 0;
+
+ if(NULL == psessionEntry)
+ {
+ return;
+ }
+
+ palZeroMemory( pMac->hHdd, ( tANI_U8* ) &frm, sizeof( frm ) );
+
+ frm.Reason.code = nReason;
+
+ nStatus = dot11fGetPackedDeAuthSize( pMac, &frm, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+ "or a De-Authentication (0x%08x).\n"),
+ nStatus );
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fDeAuth );
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calculating"
+ "the packed size for a De-Authentication "
+ "(0x%08x).\n"), nStatus );
+ }
+
+ nBytes = nPayload + sizeof( tSirMacMgmtHdr );
+
+ halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( tANI_U16 )nBytes, ( void** ) &pFrame,
+ ( void** ) &pPacket );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a De-"
+ "Authentication.\n"), nBytes );
+ return;
+ }
+
+ // Paranoia:
+ palZeroMemory( pMac->hHdd, pFrame, nBytes );
+
+ // Next, we fill out the buffer descriptor:
+ nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_DEAUTH, peer,psessionEntry->selfMacAddr);
+ if ( eSIR_SUCCESS != nSirStatus )
+ {
+ limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
+ "tor for a De-Authentication (%d).\n"),
+ nSirStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( void* ) pFrame, ( void* ) pPacket );
+ return; // just allocated...
+ }
+
+ pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
+
+ // Prepare the BSSID
+ sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
+
+ nStatus = dot11fPackDeAuth( pMac, &frm, pFrame +
+ sizeof(tSirMacMgmtHdr),
+ nPayload, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to pack a DeAuthentication (0x%08x).\n"),
+ nStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+ ( void* ) pFrame, ( void* ) pPacket );
+ return;
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while packing a D"
+ "e-Authentication (0x%08x).\n") );
+ }
+
+ PELOG1(limLog( pMac, LOG1, FL("*** Sending De-Authentication frame with rea"
+ "son %d to\n"), nReason );
+ limPrintMacAddr( pMac, pMacHdr->da, LOG1 );)
+
+ if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
+#ifdef WLAN_FEATURE_P2P
+ || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
+ ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
+#endif
+ )
+ {
+ txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
+ }
+
+ // Queue Disassociation frame in high priority WQ
+ halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete, pFrame, txFlag );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to send De-Authentication "
+ "(%X)!\n"),
+ nSirStatus );
+ //Pkt will be freed up by the callback
+ return;
+ }
+
+} // End limSendDeauthMgmtFrame.
+
+
+#ifdef ANI_SUPPORT_11H
+/**
+ * \brief Send a Measurement Report Action frame
+ *
+ *
+ * \param pMac Pointer to the global MAC structure
+ *
+ * \param pMeasReqFrame Address of a tSirMacMeasReqActionFrame
+ *
+ * \return eSIR_SUCCESS on success, eSIR_FAILURE else
+ *
+ *
+ */
+
+tSirRetStatus
+limSendMeasReportFrame(tpAniSirGlobal pMac,
+ tpSirMacMeasReqActionFrame pMeasReqFrame,
+ tSirMacAddr peer)
+{
+ tDot11fMeasurementReport frm;
+ tANI_U8 *pFrame;
+ tSirRetStatus nSirStatus;
+ tpSirMacMgmtHdr pMacHdr;
+ tANI_U32 nBytes, nPayload, nStatus, nCfg;
+ void *pPacket;
+ eHalStatus halstatus;
+
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
+
+ frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
+ frm.Action.action = SIR_MAC_ACTION_MEASURE_REPORT_ID;
+ frm.DialogToken.token = pMeasReqFrame->actionHeader.dialogToken;
+
+ switch ( pMeasReqFrame->measReqIE.measType )
+ {
+ case SIR_MAC_BASIC_MEASUREMENT_TYPE:
+ nSirStatus =
+ PopulateDot11fMeasurementReport0( pMac, pMeasReqFrame,
+ &frm.MeasurementReport );
+ break;
+ case SIR_MAC_CCA_MEASUREMENT_TYPE:
+ nSirStatus =
+ PopulateDot11fMeasurementReport1( pMac, pMeasReqFrame,
+ &frm.MeasurementReport );
+ break;
+ case SIR_MAC_RPI_MEASUREMENT_TYPE:
+ nSirStatus =
+ PopulateDot11fMeasurementReport2( pMac, pMeasReqFrame,
+ &frm.MeasurementReport );
+ break;
+ default:
+ limLog( pMac, LOGE, FL("Unknown measurement type %d in limSen"
+ "dMeasReportFrame.\n"),
+ pMeasReqFrame->measReqIE.measType );
+ return eSIR_FAILURE;
+ }
+
+ if ( eSIR_SUCCESS != nSirStatus ) return eSIR_FAILURE;
+
+ nStatus = dot11fGetPackedMeasurementReportSize( pMac, &frm, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+ "or a Measurement Report (0x%08x).\n"),
+ nStatus );
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fMeasurementReport );
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calculating"
+ "the packed size for a Measurement Rep"
+ "ort (0x%08x).\n"), nStatus );
+ }
+
+ nBytes = nPayload + sizeof( tSirMacMgmtHdr );
+
+ halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a De-"
+ "Authentication.\n"), nBytes );
+ return eSIR_FAILURE;
+ }
+
+ // Paranoia:
+ palZeroMemory( pMac->hHdd, pFrame, nBytes );
+
+ // Next, we fill out the buffer descriptor:
+ nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_ACTION, peer);
+ if ( eSIR_SUCCESS != nSirStatus )
+ {
+ limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
+ "tor for a Measurement Report (%d).\n"),
+ nSirStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return eSIR_FAILURE; // just allocated...
+ }
+
+ pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
+
+ nCfg = 6;
+ nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg );
+ if ( eSIR_SUCCESS != nSirStatus )
+ {
+ limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from"
+ " CFG (%d).\n"),
+ nSirStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return eSIR_FAILURE; // just allocated...
+ }
+
+ nStatus = dot11fPackMeasurementReport( pMac, &frm, pFrame +
+ sizeof(tSirMacMgmtHdr),
+ nPayload, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to pack a Measurement Report (0x%08x).\n"),
+ nStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return eSIR_FAILURE; // allocated!
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while packing a M"
+ "easurement Report (0x%08x).\n") );
+ }
+
+ halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete, pFrame, 0 );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to send a Measurement Report "
+ "(%X)!\n"),
+ nSirStatus );
+ //Pkt will be freed up by the callback
+ return eSIR_FAILURE; // just allocated...
+ }
+
+ return eSIR_SUCCESS;
+
+} // End limSendMeasReportFrame.
+
+
+/**
+ * \brief Send a TPC Request Action frame
+ *
+ *
+ * \param pMac Pointer to the global MAC datastructure
+ *
+ * \param peer MAC address to which the frame should be sent
+ *
+ *
+ */
+
+void
+limSendTpcRequestFrame(tpAniSirGlobal pMac,
+ tSirMacAddr peer)
+{
+ tDot11fTPCRequest frm;
+ tANI_U8 *pFrame;
+ tSirRetStatus nSirStatus;
+ tpSirMacMgmtHdr pMacHdr;
+ tANI_U32 nBytes, nPayload, nStatus, nCfg;
+ void *pPacket;
+ eHalStatus halstatus;
+
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
+
+ frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
+ frm.Action.action = SIR_MAC_ACTION_TPC_REQUEST_ID;
+ frm.DialogToken.token = 1;
+ frm.TPCRequest.present = 1;
+
+ nStatus = dot11fGetPackedTPCRequestSize( pMac, &frm, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+ "or a TPC Request (0x%08x).\n"),
+ nStatus );
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fTPCRequest );
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calculating"
+ "the packed size for a TPC Request (0x"
+ "%08x).\n"), nStatus );
+ }
+
+ nBytes = nPayload + sizeof( tSirMacMgmtHdr );
+
+ halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC"
+ " Request.\n"), nBytes );
+ return;
+ }
+
+ // Paranoia:
+ palZeroMemory( pMac->hHdd, pFrame, nBytes );
+
+ // Next, we fill out the buffer descriptor:
+ nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_ACTION, peer);
+ if ( eSIR_SUCCESS != nSirStatus )
+ {
+ limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
+ "tor for a TPC Request (%d).\n"),
+ nSirStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return; // just allocated...
+ }
+
+ pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
+
+ nCfg = 6;
+ nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg );
+ if ( eSIR_SUCCESS != nSirStatus )
+ {
+ limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from"
+ " CFG (%d).\n"),
+ nSirStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return; // just allocated...
+ }
+
+ nStatus = dot11fPackTPCRequest( pMac, &frm, pFrame +
+ sizeof(tSirMacMgmtHdr),
+ nPayload, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to pack a TPC Request (0x%08x).\n"),
+ nStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return; // allocated!
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while packing a T"
+ "PC Request (0x%08x).\n") );
+ }
+
+ halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete, pFrame, 0 );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to send a TPC Request "
+ "(%X)!\n"),
+ nSirStatus );
+ //Pkt will be freed up by the callback
+ return;
+ }
+
+} // End limSendTpcRequestFrame.
+
+
+/**
+ * \brief Send a TPC Report Action frame
+ *
+ *
+ * \param pMac Pointer to the global MAC datastructure
+ *
+ * \param pTpcReqFrame Pointer to the received TPC Request
+ *
+ * \return eSIR_SUCCESS on success, eSIR_FAILURE else
+ *
+ *
+ */
+
+tSirRetStatus
+limSendTpcReportFrame(tpAniSirGlobal pMac,
+ tpSirMacTpcReqActionFrame pTpcReqFrame,
+ tSirMacAddr peer)
+{
+ tDot11fTPCReport frm;
+ tANI_U8 *pFrame;
+ tSirRetStatus nSirStatus;
+ tpSirMacMgmtHdr pMacHdr;
+ tANI_U32 nBytes, nPayload, nStatus, nCfg;
+ void *pPacket;
+ eHalStatus halstatus;
+
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
+
+ frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
+ frm.Action.action = SIR_MAC_ACTION_TPC_REPORT_ID;
+ frm.DialogToken.token = pTpcReqFrame->actionHeader.dialogToken;
+
+ // FramesToDo: On the Gen4_TVM branch, there was a comment:
+ // "misplaced this function, need to replace:
+ // txPower = halGetRateToPwrValue(pMac, staid,
+ // pMac->lim.gLimCurrentChannelId, 0);
+ frm.TPCReport.tx_power = 0;
+ frm.TPCReport.link_margin = 0;
+ frm.TPCReport.present = 1;
+
+ nStatus = dot11fGetPackedTPCReportSize( pMac, &frm, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+ "or a TPC Report (0x%08x).\n"),
+ nStatus );
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fTPCReport );
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calculating"
+ "the packed size for a TPC Report (0x"
+ "%08x).\n"), nStatus );
+ }
+
+ nBytes = nPayload + sizeof( tSirMacMgmtHdr );
+
+ halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC"
+ " Report.\n"), nBytes );
+ return eSIR_FAILURE;
+ }
+
+ // Paranoia:
+ palZeroMemory( pMac->hHdd, pFrame, nBytes );
+
+ // Next, we fill out the buffer descriptor:
+ nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_ACTION, peer);
+ if ( eSIR_SUCCESS != nSirStatus )
+ {
+ limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
+ "tor for a TPC Report (%d).\n"),
+ nSirStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return eSIR_FAILURE; // just allocated...
+ }
+
+ pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
+
+ nCfg = 6;
+ nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg );
+ if ( eSIR_SUCCESS != nSirStatus )
+ {
+ limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from"
+ " CFG (%d).\n"),
+ nSirStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return eSIR_FAILURE; // just allocated...
+ }
+
+ nStatus = dot11fPackTPCReport( pMac, &frm, pFrame +
+ sizeof(tSirMacMgmtHdr),
+ nPayload, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to pack a TPC Report (0x%08x).\n"),
+ nStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return eSIR_FAILURE; // allocated!
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while packing a T"
+ "PC Report (0x%08x).\n") );
+ }
+
+
+ halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete, pFrame, 0 );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to send a TPC Report "
+ "(%X)!\n"),
+ nSirStatus );
+ //Pkt will be freed up by the callback
+ return eSIR_FAILURE; // just allocated...
+ }
+
+ return eSIR_SUCCESS;
+
+} // End limSendTpcReportFrame.
+#endif //ANI_SUPPORT_11H
+
+
+#ifdef ANI_PRODUCT_TYPE_AP
+/**
+ * \brief Send a Channel Switch Announcement
+ *
+ *
+ * \param pMac Pointer to the global MAC datastructure
+ *
+ * \param peer MAC address to which this frame will be sent
+ *
+ * \param nMode
+ *
+ * \param nNewChannel
+ *
+ * \param nCount
+ *
+ * \return eSIR_SUCCESS on success, eSIR_FAILURE else
+ *
+ *
+ */
+
+tSirRetStatus
+limSendChannelSwitchMgmtFrame(tpAniSirGlobal pMac,
+ tSirMacAddr peer,
+ tANI_U8 nMode,
+ tANI_U8 nNewChannel,
+ tANI_U8 nCount)
+{
+ tDot11fChannelSwitch frm;
+ tANI_U8 *pFrame;
+ tSirRetStatus nSirStatus;
+ tpSirMacMgmtHdr pMacHdr;
+ tANI_U32 nBytes, nPayload, nStatus, nCfg;
+ void *pPacket;
+ eHalStatus halstatus;
+
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
+
+ frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
+ frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID;
+ frm.ChanSwitchAnn.switchMode = nMode;
+ frm.ChanSwitchAnn.newChannel = nNewChannel;
+ frm.ChanSwitchAnn.switchCount = nCount;
+ frm.ChanSwitchAnn.present = 1;
+
+ nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+ "or a Channel Switch (0x%08x).\n"),
+ nStatus );
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fChannelSwitch );
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calculating"
+ "the packed size for a Channel Switch (0x"
+ "%08x).\n"), nStatus );
+ }
+
+ nBytes = nPayload + sizeof( tSirMacMgmtHdr );
+
+ halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC"
+ " Report.\n"), nBytes );
+ return eSIR_FAILURE;
+ }
+
+ // Paranoia:
+ palZeroMemory( pMac->hHdd, pFrame, nBytes );
+
+ // Next, we fill out the buffer descriptor:
+ nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_ACTION, peer);
+ if ( eSIR_SUCCESS != nSirStatus )
+ {
+ limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
+ "tor for a Channel Switch (%d).\n"),
+ nSirStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return eSIR_FAILURE; // just allocated...
+ }
+
+ pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
+
+ nCfg = 6;
+ nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg );
+ if ( eSIR_SUCCESS != nSirStatus )
+ {
+ limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from"
+ " CFG (%d).\n"),
+ nSirStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return eSIR_FAILURE; // just allocated...
+ }
+
+ nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame +
+ sizeof(tSirMacMgmtHdr),
+ nPayload, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to pack a Channel Switch (0x%08x).\n"),
+ nStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return eSIR_FAILURE; // allocated!
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while packing a C"
+ "hannel Switch (0x%08x).\n") );
+ }
+
+ halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete, pFrame, 0 );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to send a Channel Switch "
+ "(%X)!\n"),
+ nSirStatus );
+ //Pkt will be freed up by the callback
+ return eSIR_FAILURE;
+ }
+
+ return eSIR_SUCCESS;
+
+} // End limSendChannelSwitchMgmtFrame.
+
+#endif // (ANI_PRODUCT_TYPE_AP)
+
+
+/**
+ * \brief Send an ADDBA Req Action Frame to peer
+ *
+ * \sa limSendAddBAReq
+ *
+ * \param pMac The global tpAniSirGlobal object
+ *
+ * \param pMlmAddBAReq A pointer to tLimMlmAddBAReq. This contains
+ * the necessary parameters reqd by PE send the ADDBA Req Action
+ * Frame to the peer
+ *
+ * \return eSIR_SUCCESS if setup completes successfully
+ * eSIR_FAILURE is some problem is encountered
+ */
+tSirRetStatus limSendAddBAReq( tpAniSirGlobal pMac,
+ tpLimMlmAddBAReq pMlmAddBAReq ,tpPESession psessionEntry)
+{
+ tDot11fAddBAReq frmAddBAReq;
+ tANI_U8 *pAddBAReqBuffer = NULL;
+ tpSirMacMgmtHdr pMacHdr;
+ tANI_U32 frameLen = 0, nStatus, nPayload;
+ tSirRetStatus statusCode;
+ eHalStatus halStatus;
+ void *pPacket;
+ tANI_U8 txFlag = 0;
+
+ if(NULL == psessionEntry)
+ {
+ return eSIR_FAILURE;
+ }
+
+ palZeroMemory( pMac->hHdd, (void *) &frmAddBAReq, sizeof( frmAddBAReq ));
+
+ // Category - 3 (BA)
+ frmAddBAReq.Category.category = SIR_MAC_ACTION_BLKACK;
+
+ // Action - 0 (ADDBA Req)
+ frmAddBAReq.Action.action = SIR_MAC_BLKACK_ADD_REQ;
+
+ // FIXME - Dialog Token, generalize this...
+ frmAddBAReq.DialogToken.token = pMlmAddBAReq->baDialogToken;
+
+ // Fill the ADDBA Parameter Set
+ frmAddBAReq.AddBAParameterSet.tid = pMlmAddBAReq->baTID;
+ frmAddBAReq.AddBAParameterSet.policy = pMlmAddBAReq->baPolicy;
+ frmAddBAReq.AddBAParameterSet.bufferSize = pMlmAddBAReq->baBufferSize;
+
+ // BA timeout
+ // 0 - indicates no BA timeout
+ frmAddBAReq.BATimeout.timeout = pMlmAddBAReq->baTimeout;
+
+ // BA Starting Sequence Number
+ // Fragment number will always be zero
+ if (pMlmAddBAReq->baSSN < LIM_TX_FRAMES_THRESHOLD_ON_CHIP) {
+ pMlmAddBAReq->baSSN = LIM_TX_FRAMES_THRESHOLD_ON_CHIP;
+ }
+
+ frmAddBAReq.BAStartingSequenceControl.ssn =
+ pMlmAddBAReq->baSSN - LIM_TX_FRAMES_THRESHOLD_ON_CHIP;
+
+ nStatus = dot11fGetPackedAddBAReqSize( pMac, &frmAddBAReq, &nPayload );
+
+ if( DOT11F_FAILED( nStatus ))
+ {
+ limLog( pMac, LOGW,
+ FL( "Failed to calculate the packed size for "
+ "an ADDBA Request (0x%08x).\n"),
+ nStatus );
+
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fAddBAReq );
+ }
+ else if( DOT11F_WARNED( nStatus ))
+ {
+ limLog( pMac, LOGW,
+ FL( "There were warnings while calculating"
+ "the packed size for an ADDBA Req (0x%08x).\n"),
+ nStatus );
+ }
+
+ // Add the MGMT header to frame length
+ frameLen = nPayload + sizeof( tSirMacMgmtHdr );
+
+ // Need to allocate a buffer for ADDBA AF
+ if( eHAL_STATUS_SUCCESS !=
+ (halStatus = palPktAlloc( pMac->hHdd,
+ HAL_TXRX_FRM_802_11_MGMT,
+ (tANI_U16) frameLen,
+ (void **) &pAddBAReqBuffer,
+ (void **) &pPacket )))
+ {
+ // Log error
+ limLog( pMac, LOGP,
+ FL("palPktAlloc FAILED! Length [%d], Status [%d]\n"),
+ frameLen,
+ halStatus );
+
+ statusCode = eSIR_MEM_ALLOC_FAILED;
+ goto returnAfterError;
+ }
+
+ palZeroMemory( pMac->hHdd, (void *) pAddBAReqBuffer, frameLen );
+
+ // Copy necessary info to BD
+ if( eSIR_SUCCESS !=
+ (statusCode = limPopulateMacHeader( pMac,
+ pAddBAReqBuffer,
+ SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_ACTION,
+ pMlmAddBAReq->peerMacAddr,psessionEntry->selfMacAddr)))
+ goto returnAfterError;
+
+ // Update A3 with the BSSID
+ pMacHdr = ( tpSirMacMgmtHdr ) pAddBAReqBuffer;
+
+ #if 0
+ cfgLen = SIR_MAC_ADDR_LENGTH;
+ if( eSIR_SUCCESS != cfgGetStr( pMac,
+ WNI_CFG_BSSID,
+ (tANI_U8 *) pMacHdr->bssId,
+ &cfgLen ))
+ {
+ limLog( pMac, LOGP,
+ FL( "Failed to retrieve WNI_CFG_BSSID while"
+ "sending an ACTION Frame\n" ));
+
+ // FIXME - Need to convert to tSirRetStatus
+ statusCode = eSIR_FAILURE;
+ goto returnAfterError;
+ }
+ #endif//TO SUPPORT BT-AMP
+ sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
+
+ // Now, we're ready to "pack" the frames
+ nStatus = dot11fPackAddBAReq( pMac,
+ &frmAddBAReq,
+ pAddBAReqBuffer + sizeof( tSirMacMgmtHdr ),
+ nPayload,
+ &nPayload );
+
+ if( DOT11F_FAILED( nStatus ))
+ {
+ limLog( pMac, LOGE,
+ FL( "Failed to pack an ADDBA Req (0x%08x).\n" ),
+ nStatus );
+
+ // FIXME - Need to convert to tSirRetStatus
+ statusCode = eSIR_FAILURE;
+ goto returnAfterError;
+ }
+ else if( DOT11F_WARNED( nStatus ))
+ {
+ limLog( pMac, LOGW,
+ FL( "There were warnings while packing an ADDBA Req (0x%08x).\n" ));
+ }
+
+ limLog( pMac, LOGW,
+ FL( "Sending an ADDBA REQ to \n" ));
+ limPrintMacAddr( pMac, pMlmAddBAReq->peerMacAddr, LOGW );
+
+ if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
+#ifdef WLAN_FEATURE_P2P
+ || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
+ ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
+#endif
+ )
+ {
+ txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
+ }
+
+ if( eHAL_STATUS_SUCCESS !=
+ (halStatus = halTxFrame( pMac,
+ pPacket,
+ (tANI_U16) frameLen,
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete,
+ pAddBAReqBuffer, txFlag )))
+ {
+ limLog( pMac, LOGE,
+ FL( "halTxFrame FAILED! Status [%d]\n"),
+ halStatus );
+
+ // FIXME - Need to convert eHalStatus to tSirRetStatus
+ statusCode = eSIR_FAILURE;
+ //Pkt will be freed up by the callback
+ return statusCode;
+ }
+ else
+ return eSIR_SUCCESS;
+
+returnAfterError:
+
+ // Release buffer, if allocated
+ if( NULL != pAddBAReqBuffer )
+ palPktFree( pMac->hHdd,
+ HAL_TXRX_FRM_802_11_MGMT,
+ (void *) pAddBAReqBuffer,
+ (void *) pPacket );
+
+ return statusCode;
+}
+
+/**
+ * \brief Send an ADDBA Rsp Action Frame to peer
+ *
+ * \sa limSendAddBARsp
+ *
+ * \param pMac The global tpAniSirGlobal object
+ *
+ * \param pMlmAddBARsp A pointer to tLimMlmAddBARsp. This contains
+ * the necessary parameters reqd by PE send the ADDBA Rsp Action
+ * Frame to the peer
+ *
+ * \return eSIR_SUCCESS if setup completes successfully
+ * eSIR_FAILURE is some problem is encountered
+ */
+tSirRetStatus limSendAddBARsp( tpAniSirGlobal pMac,
+ tpLimMlmAddBARsp pMlmAddBARsp,
+ tpPESession psessionEntry)
+{
+ tDot11fAddBARsp frmAddBARsp;
+ tANI_U8 *pAddBARspBuffer = NULL;
+ tpSirMacMgmtHdr pMacHdr;
+ tANI_U32 frameLen = 0, nStatus, nPayload;
+ tSirRetStatus statusCode;
+ eHalStatus halStatus;
+ void *pPacket;
+ tANI_U8 txFlag = 0;
+
+ if(NULL == psessionEntry)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Session entry is NULL!!!\n"));)
+ return eSIR_FAILURE;
+ }
+
+ palZeroMemory( pMac->hHdd, (void *) &frmAddBARsp, sizeof( frmAddBARsp ));
+
+ // Category - 3 (BA)
+ frmAddBARsp.Category.category = SIR_MAC_ACTION_BLKACK;
+ // Action - 1 (ADDBA Rsp)
+ frmAddBARsp.Action.action = SIR_MAC_BLKACK_ADD_RSP;
+
+ // Should be same as the one we received in the ADDBA Req
+ frmAddBARsp.DialogToken.token = pMlmAddBARsp->baDialogToken;
+
+ // ADDBA Req status
+ frmAddBARsp.Status.status = pMlmAddBARsp->addBAResultCode;
+
+ // Fill the ADDBA Parameter Set as provided by caller
+ frmAddBARsp.AddBAParameterSet.tid = pMlmAddBARsp->baTID;
+ frmAddBARsp.AddBAParameterSet.policy = pMlmAddBARsp->baPolicy;
+ frmAddBARsp.AddBAParameterSet.bufferSize = pMlmAddBARsp->baBufferSize;
+
+ // BA timeout
+ // 0 - indicates no BA timeout
+ frmAddBARsp.BATimeout.timeout = pMlmAddBARsp->baTimeout;
+
+ nStatus = dot11fGetPackedAddBARspSize( pMac, &frmAddBARsp, &nPayload );
+
+ if( DOT11F_FAILED( nStatus ))
+ {
+ limLog( pMac, LOGW,
+ FL( "Failed to calculate the packed size for "
+ "an ADDBA Response (0x%08x).\n"),
+ nStatus );
+
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fAddBARsp );
+ }
+ else if( DOT11F_WARNED( nStatus ))
+ {
+ limLog( pMac, LOGW,
+ FL( "There were warnings while calculating"
+ "the packed size for an ADDBA Rsp (0x%08x).\n"),
+ nStatus );
+ }
+
+ // Need to allocate a buffer for ADDBA AF
+ frameLen = nPayload + sizeof( tSirMacMgmtHdr );
+
+ // Allocate shared memory
+ if( eHAL_STATUS_SUCCESS !=
+ (halStatus = palPktAlloc( pMac->hHdd,
+ HAL_TXRX_FRM_802_11_MGMT,
+ (tANI_U16) frameLen,
+ (void **) &pAddBARspBuffer,
+ (void **) &pPacket )))
+ {
+ // Log error
+ limLog( pMac, LOGP,
+ FL("palPktAlloc FAILED! Length [%d], Status [%d]\n"),
+ frameLen,
+ halStatus );
+
+ statusCode = eSIR_MEM_ALLOC_FAILED;
+ goto returnAfterError;
+ }
+
+ palZeroMemory( pMac->hHdd, (void *) pAddBARspBuffer, frameLen );
+
+ // Copy necessary info to BD
+ if( eSIR_SUCCESS !=
+ (statusCode = limPopulateMacHeader( pMac,
+ pAddBARspBuffer,
+ SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_ACTION,
+ pMlmAddBARsp->peerMacAddr,psessionEntry->selfMacAddr)))
+ goto returnAfterError;
+
+ // Update A3 with the BSSID
+
+ pMacHdr = ( tpSirMacMgmtHdr ) pAddBARspBuffer;
+
+ #if 0
+ cfgLen = SIR_MAC_ADDR_LENGTH;
+ if( eSIR_SUCCESS != wlan_cfgGetStr( pMac,
+ WNI_CFG_BSSID,
+ (tANI_U8 *) pMacHdr->bssId,
+ &cfgLen ))
+ {
+ limLog( pMac, LOGP,
+ FL( "Failed to retrieve WNI_CFG_BSSID while"
+ "sending an ACTION Frame\n" ));
+
+ // FIXME - Need to convert to tSirRetStatus
+ statusCode = eSIR_FAILURE;
+ goto returnAfterError;
+ }
+ #endif // TO SUPPORT BT-AMP
+ sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
+
+ // Now, we're ready to "pack" the frames
+ nStatus = dot11fPackAddBARsp( pMac,
+ &frmAddBARsp,
+ pAddBARspBuffer + sizeof( tSirMacMgmtHdr ),
+ nPayload,
+ &nPayload );
+
+ if( DOT11F_FAILED( nStatus ))
+ {
+ limLog( pMac, LOGE,
+ FL( "Failed to pack an ADDBA Rsp (0x%08x).\n" ),
+ nStatus );
+
+ // FIXME - Need to convert to tSirRetStatus
+ statusCode = eSIR_FAILURE;
+ goto returnAfterError;
+ }
+ else if( DOT11F_WARNED( nStatus ))
+ {
+ limLog( pMac, LOGW,
+ FL( "There were warnings while packing an ADDBA Rsp (0x%08x).\n" ));
+ }
+
+ limLog( pMac, LOGW,
+ FL( "Sending an ADDBA RSP to \n" ));
+ limPrintMacAddr( pMac, pMlmAddBARsp->peerMacAddr, LOGW );
+
+ if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
+#ifdef WLAN_FEATURE_P2P
+ || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
+ ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
+#endif
+ )
+ {
+ txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
+ }
+
+ if( eHAL_STATUS_SUCCESS !=
+ (halStatus = halTxFrame( pMac,
+ pPacket,
+ (tANI_U16) frameLen,
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete,
+ pAddBARspBuffer, txFlag )))
+ {
+ limLog( pMac, LOGE,
+ FL( "halTxFrame FAILED! Status [%d]\n" ),
+ halStatus );
+
+ // FIXME - HAL error codes are different from PE error
+ // codes!! And, this routine is returning tSirRetStatus
+ statusCode = eSIR_FAILURE;
+ //Pkt will be freed up by the callback
+ return statusCode;
+ }
+ else
+ return eSIR_SUCCESS;
+
+ returnAfterError:
+
+ // Release buffer, if allocated
+ if( NULL != pAddBARspBuffer )
+ palPktFree( pMac->hHdd,
+ HAL_TXRX_FRM_802_11_MGMT,
+ (void *) pAddBARspBuffer,
+ (void *) pPacket );
+
+ return statusCode;
+}
+
+/**
+ * \brief Send a DELBA Indication Action Frame to peer
+ *
+ * \sa limSendDelBAInd
+ *
+ * \param pMac The global tpAniSirGlobal object
+ *
+ * \param peerMacAddr MAC Address of peer
+ *
+ * \param reasonCode Reason for the DELBA notification
+ *
+ * \param pBAParameterSet The DELBA Parameter Set.
+ * This identifies the TID for which the BA session is
+ * being deleted.
+ *
+ * \return eSIR_SUCCESS if setup completes successfully
+ * eSIR_FAILURE is some problem is encountered
+ */
+tSirRetStatus limSendDelBAInd( tpAniSirGlobal pMac,
+ tpLimMlmDelBAReq pMlmDelBAReq,tpPESession psessionEntry)
+{
+ tDot11fDelBAInd frmDelBAInd;
+ tANI_U8 *pDelBAIndBuffer = NULL;
+ //tANI_U32 val;
+ tpSirMacMgmtHdr pMacHdr;
+ tANI_U32 frameLen = 0, nStatus, nPayload;
+ tSirRetStatus statusCode;
+ eHalStatus halStatus;
+ void *pPacket;
+ tANI_U8 txFlag = 0;
+
+ if(NULL == psessionEntry)
+ {
+ return eSIR_FAILURE;
+ }
+
+ palZeroMemory( pMac->hHdd, (void *) &frmDelBAInd, sizeof( frmDelBAInd ));
+
+ // Category - 3 (BA)
+ frmDelBAInd.Category.category = SIR_MAC_ACTION_BLKACK;
+ // Action - 2 (DELBA)
+ frmDelBAInd.Action.action = SIR_MAC_BLKACK_DEL;
+
+ // Fill the DELBA Parameter Set as provided by caller
+ frmDelBAInd.DelBAParameterSet.tid = pMlmDelBAReq->baTID;
+ frmDelBAInd.DelBAParameterSet.initiator = pMlmDelBAReq->baDirection;
+
+ // BA Starting Sequence Number
+ // Fragment number will always be zero
+ frmDelBAInd.Reason.code = pMlmDelBAReq->delBAReasonCode;
+
+ nStatus = dot11fGetPackedDelBAIndSize( pMac, &frmDelBAInd, &nPayload );
+
+ if( DOT11F_FAILED( nStatus ))
+ {
+ limLog( pMac, LOGW,
+ FL( "Failed to calculate the packed size for "
+ "an DELBA Indication (0x%08x).\n"),
+ nStatus );
+
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fDelBAInd );
+ }
+ else if( DOT11F_WARNED( nStatus ))
+ {
+ limLog( pMac, LOGW,
+ FL( "There were warnings while calculating"
+ "the packed size for an DELBA Ind (0x%08x).\n"),
+ nStatus );
+ }
+
+ // Add the MGMT header to frame length
+ frameLen = nPayload + sizeof( tSirMacMgmtHdr );
+
+ // Allocate shared memory
+ if( eHAL_STATUS_SUCCESS !=
+ (halStatus = palPktAlloc( pMac->hHdd,
+ HAL_TXRX_FRM_802_11_MGMT,
+ (tANI_U16) frameLen,
+ (void **) &pDelBAIndBuffer,
+ (void **) &pPacket )))
+ {
+ // Log error
+ limLog( pMac, LOGP,
+ FL("palPktAlloc FAILED! Length [%d], Status [%d]\n"),
+ frameLen,
+ halStatus );
+
+ statusCode = eSIR_MEM_ALLOC_FAILED;
+ goto returnAfterError;
+ }
+
+ palZeroMemory( pMac->hHdd, (void *) pDelBAIndBuffer, frameLen );
+
+ // Copy necessary info to BD
+ if( eSIR_SUCCESS !=
+ (statusCode = limPopulateMacHeader( pMac,
+ pDelBAIndBuffer,
+ SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_ACTION,
+ pMlmDelBAReq->peerMacAddr,psessionEntry->selfMacAddr)))
+ goto returnAfterError;
+
+ // Update A3 with the BSSID
+ pMacHdr = ( tpSirMacMgmtHdr ) pDelBAIndBuffer;
+
+ #if 0
+ cfgLen = SIR_MAC_ADDR_LENGTH;
+ if( eSIR_SUCCESS != cfgGetStr( pMac,
+ WNI_CFG_BSSID,
+ (tANI_U8 *) pMacHdr->bssId,
+ &cfgLen ))
+ {
+ limLog( pMac, LOGP,
+ FL( "Failed to retrieve WNI_CFG_BSSID while"
+ "sending an ACTION Frame\n" ));
+
+ // FIXME - Need to convert to tSirRetStatus
+ statusCode = eSIR_FAILURE;
+ goto returnAfterError;
+ }
+ #endif //TO SUPPORT BT-AMP
+ sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
+
+ // Now, we're ready to "pack" the frames
+ nStatus = dot11fPackDelBAInd( pMac,
+ &frmDelBAInd,
+ pDelBAIndBuffer + sizeof( tSirMacMgmtHdr ),
+ nPayload,
+ &nPayload );
+
+ if( DOT11F_FAILED( nStatus ))
+ {
+ limLog( pMac, LOGE,
+ FL( "Failed to pack an DELBA Ind (0x%08x).\n" ),
+ nStatus );
+
+ // FIXME - Need to convert to tSirRetStatus
+ statusCode = eSIR_FAILURE;
+ goto returnAfterError;
+ }
+ else if( DOT11F_WARNED( nStatus ))
+ {
+ limLog( pMac, LOGW,
+ FL( "There were warnings while packing an DELBA Ind (0x%08x).\n" ));
+ }
+
+ limLog( pMac, LOGW,
+ FL( "Sending a DELBA IND to \n" ));
+ limPrintMacAddr( pMac, pMlmDelBAReq->peerMacAddr, LOGW );
+
+ if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
+#ifdef WLAN_FEATURE_P2P
+ || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
+ ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
+#endif
+ )
+ {
+ txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
+ }
+
+ if( eHAL_STATUS_SUCCESS !=
+ (halStatus = halTxFrame( pMac,
+ pPacket,
+ (tANI_U16) frameLen,
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete,
+ pDelBAIndBuffer, txFlag )))
+ {
+ PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]\n" ), halStatus );)
+ statusCode = eSIR_FAILURE;
+ //Pkt will be freed up by the callback
+ return statusCode;
+ }
+ else
+ return eSIR_SUCCESS;
+
+ returnAfterError:
+
+ // Release buffer, if allocated
+ if( NULL != pDelBAIndBuffer )
+ palPktFree( pMac->hHdd,
+ HAL_TXRX_FRM_802_11_MGMT,
+ (void *) pDelBAIndBuffer,
+ (void *) pPacket );
+
+ return statusCode;
+}
+
+#if defined WLAN_FEATURE_VOWIFI
+
+/**
+ * \brief Send a Neighbor Report Request Action frame
+ *
+ *
+ * \param pMac Pointer to the global MAC structure
+ *
+ * \param pNeighborReq Address of a tSirMacNeighborReportReq
+ *
+ * \param peer mac address of peer station.
+ *
+ * \param psessionEntry address of session entry.
+ *
+ * \return eSIR_SUCCESS on success, eSIR_FAILURE else
+ *
+ *
+ */
+
+tSirRetStatus
+limSendNeighborReportRequestFrame(tpAniSirGlobal pMac,
+ tpSirMacNeighborReportReq pNeighborReq,
+ tSirMacAddr peer,
+ tpPESession psessionEntry
+ )
+{
+ tSirRetStatus statusCode = eSIR_SUCCESS;
+ tDot11fNeighborReportRequest frm;
+ tANI_U8 *pFrame;
+ tpSirMacMgmtHdr pMacHdr;
+ tANI_U32 nBytes, nPayload, nStatus;
+ void *pPacket;
+ eHalStatus halstatus;
+ tANI_U8 txFlag = 0;
+
+ if ( psessionEntry == NULL )
+ {
+ limLog( pMac, LOGE, FL("(psession == NULL) in Request to send Neighbor Report request action frame\n") );
+ return eSIR_FAILURE;
+ }
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
+
+ frm.Category.category = SIR_MAC_ACTION_RRM;
+ frm.Action.action = SIR_MAC_RRM_NEIGHBOR_REQ;
+ frm.DialogToken.token = pNeighborReq->dialogToken;
+
+
+ if( pNeighborReq->ssid_present )
+ {
+ PopulateDot11fSSID( pMac, &pNeighborReq->ssid, &frm.SSID );
+ }
+
+ nStatus = dot11fGetPackedNeighborReportRequestSize( pMac, &frm, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+ "or a Neighbor Report Request(0x%08x).\n"),
+ nStatus );
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fNeighborReportRequest );
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calculating"
+ "the packed size for a Neighbor Rep"
+ "ort Request(0x%08x).\n"), nStatus );
+ }
+
+ nBytes = nPayload + sizeof( tSirMacMgmtHdr );
+
+ halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Neighbor "
+ "Report Request.\n"), nBytes );
+ return eSIR_FAILURE;
+ }
+
+ // Paranoia:
+ palZeroMemory( pMac->hHdd, pFrame, nBytes );
+
+ // Copy necessary info to BD
+ if( eSIR_SUCCESS !=
+ (statusCode = limPopulateMacHeader( pMac,
+ pFrame,
+ SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_ACTION,
+ peer, psessionEntry->selfMacAddr)))
+ goto returnAfterError;
+
+ // Update A3 with the BSSID
+ pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
+
+ sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId );
+
+ // Now, we're ready to "pack" the frames
+ nStatus = dot11fPackNeighborReportRequest( pMac,
+ &frm,
+ pFrame + sizeof( tSirMacMgmtHdr ),
+ nPayload,
+ &nPayload );
+
+ if( DOT11F_FAILED( nStatus ))
+ {
+ limLog( pMac, LOGE,
+ FL( "Failed to pack an Neighbor Report Request (0x%08x).\n" ),
+ nStatus );
+
+ // FIXME - Need to convert to tSirRetStatus
+ statusCode = eSIR_FAILURE;
+ goto returnAfterError;
+ }
+ else if( DOT11F_WARNED( nStatus ))
+ {
+ limLog( pMac, LOGW,
+ FL( "There were warnings while packing Neighbor Report Request (0x%08x).\n" ));
+ }
+
+ limLog( pMac, LOGW,
+ FL( "Sending a Neighbor Report Request to \n" ));
+ limPrintMacAddr( pMac, peer, LOGW );
+
+ if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
+#ifdef WLAN_FEATURE_P2P
+ || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
+ ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
+#endif
+ )
+ {
+ txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
+ }
+
+ if( eHAL_STATUS_SUCCESS !=
+ (halstatus = halTxFrame( pMac,
+ pPacket,
+ (tANI_U16) nBytes,
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete,
+ pFrame, txFlag )))
+ {
+ PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]\n" ), halstatus );)
+ statusCode = eSIR_FAILURE;
+ //Pkt will be freed up by the callback
+ return statusCode;
+ }
+ else
+ return eSIR_SUCCESS;
+
+returnAfterError:
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+
+ return statusCode;
+} // End limSendNeighborReportRequestFrame.
+
+/**
+ * \brief Send a Link Report Action frame
+ *
+ *
+ * \param pMac Pointer to the global MAC structure
+ *
+ * \param pLinkReport Address of a tSirMacLinkReport
+ *
+ * \param peer mac address of peer station.
+ *
+ * \param psessionEntry address of session entry.
+ *
+ * \return eSIR_SUCCESS on success, eSIR_FAILURE else
+ *
+ *
+ */
+
+tSirRetStatus
+limSendLinkReportActionFrame(tpAniSirGlobal pMac,
+ tpSirMacLinkReport pLinkReport,
+ tSirMacAddr peer,
+ tpPESession psessionEntry
+ )
+{
+ tSirRetStatus statusCode = eSIR_SUCCESS;
+ tDot11fLinkMeasurementReport frm;
+ tANI_U8 *pFrame;
+ tpSirMacMgmtHdr pMacHdr;
+ tANI_U32 nBytes, nPayload, nStatus;
+ void *pPacket;
+ eHalStatus halstatus;
+ tANI_U8 txFlag = 0;
+
+
+ if ( psessionEntry == NULL )
+ {
+ limLog( pMac, LOGE, FL("(psession == NULL) in Request to send Link Report action frame\n") );
+ return eSIR_FAILURE;
+ }
+
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
+
+ frm.Category.category = SIR_MAC_ACTION_RRM;
+ frm.Action.action = SIR_MAC_RRM_LINK_MEASUREMENT_RPT;
+ frm.DialogToken.token = pLinkReport->dialogToken;
+
+
+ //IEEE Std. 802.11 7.3.2.18. for the report element.
+ //Even though TPC report an IE, it is represented using fixed fields since it is positioned
+ //in the middle of other fixed fields in the link report frame(IEEE Std. 802.11k section7.4.6.4
+ //and frame parser always expects IEs to come after all fixed fields. It is easier to handle
+ //such case this way than changing the frame parser.
+ frm.TPCEleID.TPCId = SIR_MAC_TPC_RPT_EID;
+ frm.TPCEleLen.TPCLen = 2;
+ frm.TxPower.txPower = pLinkReport->txPower;
+ frm.LinkMargin.linkMargin = 0;
+
+ frm.RxAntennaId.antennaId = pLinkReport->rxAntenna;
+ frm.TxAntennaId.antennaId = pLinkReport->txAntenna;
+ frm.RCPI.rcpi = pLinkReport->rcpi;
+ frm.RSNI.rsni = pLinkReport->rsni;
+
+ nStatus = dot11fGetPackedLinkMeasurementReportSize( pMac, &frm, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+ "or a Link Report (0x%08x).\n"),
+ nStatus );
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fLinkMeasurementReport );
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calculating"
+ "the packed size for a Link Rep"
+ "ort (0x%08x).\n"), nStatus );
+ }
+
+ nBytes = nPayload + sizeof( tSirMacMgmtHdr );
+
+ halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Link "
+ "Report.\n"), nBytes );
+ return eSIR_FAILURE;
+ }
+
+ // Paranoia:
+ palZeroMemory( pMac->hHdd, pFrame, nBytes );
+
+ // Copy necessary info to BD
+ if( eSIR_SUCCESS !=
+ (statusCode = limPopulateMacHeader( pMac,
+ pFrame,
+ SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_ACTION,
+ peer, psessionEntry->selfMacAddr)))
+ goto returnAfterError;
+
+ // Update A3 with the BSSID
+ pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
+
+ sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId );
+
+ // Now, we're ready to "pack" the frames
+ nStatus = dot11fPackLinkMeasurementReport( pMac,
+ &frm,
+ pFrame + sizeof( tSirMacMgmtHdr ),
+ nPayload,
+ &nPayload );
+
+ if( DOT11F_FAILED( nStatus ))
+ {
+ limLog( pMac, LOGE,
+ FL( "Failed to pack an Link Report (0x%08x).\n" ),
+ nStatus );
+
+ // FIXME - Need to convert to tSirRetStatus
+ statusCode = eSIR_FAILURE;
+ goto returnAfterError;
+ }
+ else if( DOT11F_WARNED( nStatus ))
+ {
+ limLog( pMac, LOGW,
+ FL( "There were warnings while packing Link Report (0x%08x).\n" ));
+ }
+
+ limLog( pMac, LOGW,
+ FL( "Sending a Link Report to \n" ));
+ limPrintMacAddr( pMac, peer, LOGW );
+
+ if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
+#ifdef WLAN_FEATURE_P2P
+ || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
+ ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
+#endif
+ )
+ {
+ txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
+ }
+
+ if( eHAL_STATUS_SUCCESS !=
+ (halstatus = halTxFrame( pMac,
+ pPacket,
+ (tANI_U16) nBytes,
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete,
+ pFrame, txFlag )))
+ {
+ PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]\n" ), halstatus );)
+ statusCode = eSIR_FAILURE;
+ //Pkt will be freed up by the callback
+ return statusCode;
+ }
+ else
+ return eSIR_SUCCESS;
+
+returnAfterError:
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+
+ return statusCode;
+} // End limSendLinkReportActionFrame.
+
+/**
+ * \brief Send a Beacon Report Action frame
+ *
+ *
+ * \param pMac Pointer to the global MAC structure
+ *
+ * \param dialog_token dialog token to be used in the action frame.
+ *
+ * \param num_report number of reports in pRRMReport.
+ *
+ * \param pRRMReport Address of a tSirMacRadioMeasureReport.
+ *
+ * \param peer mac address of peer station.
+ *
+ * \param psessionEntry address of session entry.
+ *
+ * \return eSIR_SUCCESS on success, eSIR_FAILURE else
+ *
+ *
+ */
+
+tSirRetStatus
+limSendRadioMeasureReportActionFrame(tpAniSirGlobal pMac,
+ tANI_U8 dialog_token,
+ tANI_U8 num_report,
+ tpSirMacRadioMeasureReport pRRMReport,
+ tSirMacAddr peer,
+ tpPESession psessionEntry
+ )
+{
+ tSirRetStatus statusCode = eSIR_SUCCESS;
+ tDot11fRadioMeasurementReport frm;
+ tANI_U8 *pFrame;
+ tpSirMacMgmtHdr pMacHdr;
+ tANI_U32 nBytes, nPayload, nStatus;
+ void *pPacket;
+ eHalStatus halstatus;
+ tANI_U8 i;
+ tANI_U8 txFlag = 0;
+
+ if ( psessionEntry == NULL )
+ {
+ limLog( pMac, LOGE, FL("(psession == NULL) in Request to send Beacon Report action frame\n") );
+ return eSIR_FAILURE;
+ }
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
+
+ frm.Category.category = SIR_MAC_ACTION_RRM;
+ frm.Action.action = SIR_MAC_RRM_RADIO_MEASURE_RPT;
+ frm.DialogToken.token = dialog_token;
+
+ frm.num_MeasurementReport = (num_report > RADIO_REPORTS_MAX_IN_A_FRAME ) ? RADIO_REPORTS_MAX_IN_A_FRAME : num_report;
+
+ for( i = 0 ; i < frm.num_MeasurementReport ; i++ )
+ {
+ frm.MeasurementReport[i].type = pRRMReport[i].type;
+ frm.MeasurementReport[i].token = pRRMReport[i].token;
+ frm.MeasurementReport[i].late = 0; //IEEE 802.11k section 7.3.22. (always zero in rrm)
+ switch( pRRMReport[i].type )
+ {
+ case SIR_MAC_RRM_BEACON_TYPE:
+ PopulateDot11fBeaconReport( pMac, &frm.MeasurementReport[i], &pRRMReport[i].report.beaconReport );
+ frm.MeasurementReport[i].incapable = pRRMReport[i].incapable;
+ frm.MeasurementReport[i].refused = pRRMReport[i].refused;
+ frm.MeasurementReport[i].present = 1;
+ break;
+ default:
+ frm.MeasurementReport[i].present = 1;
+ break;
+ }
+ }
+
+ nStatus = dot11fGetPackedRadioMeasurementReportSize( pMac, &frm, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+ "or a Radio Measure Report (0x%08x).\n"),
+ nStatus );
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fLinkMeasurementReport );
+ return eSIR_FAILURE;
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calculating"
+ "the packed size for a Radio Measure Rep"
+ "ort (0x%08x).\n"), nStatus );
+ }
+
+ nBytes = nPayload + sizeof( tSirMacMgmtHdr );
+
+ halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Radio Measure "
+ "Report.\n"), nBytes );
+ return eSIR_FAILURE;
+ }
+
+ // Paranoia:
+ palZeroMemory( pMac->hHdd, pFrame, nBytes );
+
+ // Copy necessary info to BD
+ if( eSIR_SUCCESS !=
+ (statusCode = limPopulateMacHeader( pMac,
+ pFrame,
+ SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_ACTION,
+ peer, psessionEntry->selfMacAddr)))
+ goto returnAfterError;
+
+ // Update A3 with the BSSID
+ pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
+
+ sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId );
+
+ // Now, we're ready to "pack" the frames
+ nStatus = dot11fPackRadioMeasurementReport( pMac,
+ &frm,
+ pFrame + sizeof( tSirMacMgmtHdr ),
+ nPayload,
+ &nPayload );
+
+ if( DOT11F_FAILED( nStatus ))
+ {
+ limLog( pMac, LOGE,
+ FL( "Failed to pack an Radio Measure Report (0x%08x).\n" ),
+ nStatus );
+
+ // FIXME - Need to convert to tSirRetStatus
+ statusCode = eSIR_FAILURE;
+ goto returnAfterError;
+ }
+ else if( DOT11F_WARNED( nStatus ))
+ {
+ limLog( pMac, LOGW,
+ FL( "There were warnings while packing Radio Measure Report (0x%08x).\n" ));
+ }
+
+ limLog( pMac, LOGW,
+ FL( "Sending a Radio Measure Report to \n" ));
+ limPrintMacAddr( pMac, peer, LOGW );
+
+ if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
+#ifdef WLAN_FEATURE_P2P
+ || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
+ ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
+#endif
+ )
+ {
+ txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
+ }
+
+ if( eHAL_STATUS_SUCCESS !=
+ (halstatus = halTxFrame( pMac,
+ pPacket,
+ (tANI_U16) nBytes,
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete,
+ pFrame, txFlag )))
+ {
+ PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]\n" ), halstatus );)
+ statusCode = eSIR_FAILURE;
+ //Pkt will be freed up by the callback
+ return statusCode;
+ }
+ else
+ return eSIR_SUCCESS;
+
+returnAfterError:
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+
+ return statusCode;
+} // End limSendBeaconReportActionFrame.
+
+#endif
+
+#ifdef WLAN_FEATURE_11W
+/**
+ * \brief Send SA query response action frame to peer
+ *
+ * \sa limSendSaQueryResponseFrame
+ *
+ *
+ * \param pMac The global tpAniSirGlobal object
+ *
+ * \param peer The Mac address of the AP to which this action frame is
+addressed
+ *
+ * \param transId Transaction identifier received in SA query request action
+frame
+ *
+ * \return eSIR_SUCCESS if setup completes successfully
+ * eSIR_FAILURE is some problem is encountered
+ */
+
+tSirRetStatus limSendSaQueryResponseFrame( tpAniSirGlobal pMac, tANI_U16 transId,
+tSirMacAddr peer,tpPESession psessionEntry)
+{
+
+ tDot11wSaQueryRsp frm; // SA query reponse action frame
+ tANI_U8 *pFrame;
+ tSirRetStatus nSirStatus;
+ tpSirMacMgmtHdr pMacHdr;
+ tANI_U32 nBytes, nPayload;
+ void *pPacket;
+ eHalStatus halstatus;
+ // Local variables used to dump prepared SA query response frame
+ tANI_U8 *pDump;
+ tANI_U16 dumpCount;
+ tANI_U8 txFlag = 0;
+ //tANI_U16 nBytes
+
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
+ frm.category = SIR_MAC_ACTION_SA_QUERY;
+ /*11w action fiedl is :
+ action: 0 --> SA query request action frame
+ action: 1 --> SA query response action frame */
+ frm.action = 1;
+ /*11w Draft9.0 SA query response transId is same as
+ SA query request transId*/
+ frm.transId = transId;
+
+ nPayload = sizeof(tDot11wSaQueryRsp);
+ nBytes = nPayload + sizeof( tSirMacMgmtHdr );
+ halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a SA query response"
+ " action frame\n"), nBytes );
+ return eSIR_FAILURE;
+ }
+
+ // Paranoia:
+ palZeroMemory( pMac->hHdd, pFrame, nBytes );
+
+ // Next, we fill out the buffer descriptor:
+ nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_ACTION, peer,psessionEntry->selfMacAddr );
+ if ( eSIR_SUCCESS != nSirStatus )
+ {
+ limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
+ "tor for a TPC Report (%d).\n"),
+ nSirStatus );
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+ return eSIR_FAILURE; // just allocated...
+ }
+
+ pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
+
+ // Pack 11w SA query response frame
+ DOT11F_MEMCPY(pMac, (tANI_U8 *)(pFrame + sizeof(tSirMacMgmtHdr)),(tANI_U8 *)&frm, nPayload);
+ pDump = (tANI_U8 *) pFrame;
+
+ halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
+ HAL_TXRX_FRM_802_11_MGMT,
+ ANI_TXDIR_TODS,
+ 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+ limTxComplete, pFrame,txFlag);
+ if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to send a SA Query resp frame "
+ "(%X)!\n"),halstatus );
+ //Pkt will be freed up by the callback
+ return eSIR_FAILURE; // just allocated...
+ }
+
+ return eSIR_SUCCESS;
+}
+#endif
diff --git a/CORE/MAC/src/pe/lim/limSendMessages.c b/CORE/MAC/src/pe/lim/limSendMessages.c
new file mode 100644
index 0000000..3b95f1d
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limSendMessages.c
@@ -0,0 +1,747 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * limSendMessages.c: Provides functions to send messages or Indications to HAL.
+ * Author: Sunit Bhatia
+ * Date: 09/21/2006
+ * History:-
+ * Date Modified by Modification Information
+ *
+ * --------------------------------------------------------------------------
+ *
+ */
+
+#include "limSendMessages.h"
+#include "cfgApi.h"
+#include "limTrace.h"
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+#include "vos_diag_core_log.h"
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+/* When beacon filtering is enabled, firmware will
+ * analyze the selected beacons received during BMPS,
+ * and monitor any changes in the IEs as listed below.
+ * The format of the table is:
+ * - EID
+ * - Check for IE presence
+ * - Byte offset
+ * - Byte value
+ * - Bit Mask
+ * - Byte refrence
+ */
+static tBeaconFilterIe beaconFilterTable[] = {
+ {SIR_MAC_DS_PARAM_SET_EID, 0, {0, 0, DS_PARAM_CHANNEL_MASK, 0}},
+ {SIR_MAC_ERP_INFO_EID, 0, {0, 0, ERP_FILTER_MASK, 0}},
+ {SIR_MAC_EDCA_PARAM_SET_EID, 0, {0, 0, EDCA_FILTER_MASK, 0}},
+ {SIR_MAC_QOS_CAPABILITY_EID, 0, {0, 0, QOS_FILTER_MASK, 0}},
+ {SIR_MAC_CHNL_SWITCH_ANN_EID, 1, {0, 0, 0, 0}},
+ {SIR_MAC_QUIET_EID, 1, {0, 0, 0, 0}},
+ {SIR_MAC_HT_INFO_EID, 0, {0, 0, HT_BYTE0_FILTER_MASK, 0}},
+ {SIR_MAC_HT_INFO_EID, 0, {2, 0, HT_BYTE2_FILTER_MASK, 0}},
+ {SIR_MAC_HT_INFO_EID, 0, {5, 0, HT_BYTE5_FILTER_MASK, 0}}
+#if defined WLAN_FEATURE_VOWIFI
+ ,{SIR_MAC_PWR_CONSTRAINT_EID, 0, {0, 0, 0, 0}}
+#endif
+};
+
+
+/**
+ * limSendCFParams()
+ *
+ *FUNCTION:
+ * This function is called to send CFP Parameters to WDA, when they are changed.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac pointer to Global Mac structure.
+ * @param bssIdx Bss Index of the BSS to which STA is associated.
+ * @param cfpCount CFP Count, if that is changed.
+ * @param cfpPeriod CFP Period if that is changed.
+ *
+ * @return success if message send is ok, else false.
+ */
+
+tSirRetStatus limSendCFParams(tpAniSirGlobal pMac, tANI_U8 bssIdx, tANI_U8 cfpCount, tANI_U8 cfpPeriod)
+{
+ tpUpdateCFParams pCFParams = NULL;
+ tSirRetStatus retCode = eSIR_SUCCESS;
+ tSirMsgQ msgQ;
+
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pCFParams,
+ sizeof( tUpdateCFParams )))
+ {
+ limLog( pMac, LOGP,
+ FL( "Unable to PAL allocate memory during Update CF Params\n" ));
+
+ retCode = eSIR_MEM_ALLOC_FAILED;
+ goto returnFailure;
+ }
+
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pCFParams, sizeof(tUpdateCFParams));
+
+ pCFParams->cfpCount = cfpCount;
+ pCFParams->cfpPeriod = cfpPeriod;
+ pCFParams->bssIdx = bssIdx;
+
+
+ msgQ.type = WDA_UPDATE_CF_IND;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pCFParams;
+ msgQ.bodyval = 0;
+
+ limLog( pMac, LOG3,
+ FL( "Sending WDA_UPDATE_CF_IND..." ));
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ {
+ palFreeMemory(pMac->hHdd, pCFParams);
+ limLog( pMac, LOGP,
+ FL("Posting WDA_UPDATE_CF_IND to WDA failed, reason=%X\n"),
+ retCode );
+ }
+
+returnFailure:
+ return retCode;
+}
+
+
+
+/**
+ * limSendBeaconParams()
+ *
+ *FUNCTION:
+ * This function is called to send beacnon interval, short preamble or other
+ * parameters to WDA, which are changed and indication is received in beacon.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac pointer to Global Mac structure.
+ * @param tpUpdateBeaconParams pointer to the structure,
+ which contains the beacon parameters which are changed.
+ *
+ * @return success if message send is ok, else false.
+ */
+
+tSirRetStatus limSendBeaconParams(tpAniSirGlobal pMac,
+ tpUpdateBeaconParams pUpdatedBcnParams,
+ tpPESession psessionEntry )
+{
+ tpUpdateBeaconParams pBcnParams = NULL;
+ tSirRetStatus retCode = eSIR_SUCCESS;
+ tSirMsgQ msgQ;
+
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pBcnParams, sizeof(*pBcnParams)))
+ {
+ limLog( pMac, LOGP,
+ FL( "Unable to PAL allocate memory during Update Beacon Params\n" ));
+
+ return eSIR_MEM_ALLOC_FAILED;
+ }
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pBcnParams, pUpdatedBcnParams, sizeof(*pBcnParams));
+
+ msgQ.type = WDA_UPDATE_BEACON_IND;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pBcnParams;
+ msgQ.bodyval = 0;
+
+ PELOG3(limLog( pMac, LOG3,
+ FL( "Sending WDA_UPDATE_BEACON_IND, paramChangeBitmap in hex = %x" ),
+ pUpdatedBcnParams->paramChangeBitmap);)
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ {
+ palFreeMemory(pMac->hHdd, pBcnParams);
+ limLog( pMac, LOGP,
+ FL("Posting WDA_UPDATE_BEACON_IND to WDA failed, reason=%X\n"),
+ retCode );
+ }
+#ifdef WLAN_SOFTAP_FEATURE
+ limSendBeaconInd(pMac, psessionEntry);
+#endif
+
+ return retCode;
+}
+
+
+/**
+ * limSendSwitchChnlParams()
+ *
+ *FUNCTION:
+ * This function is called to send Channel Switch Indication to WDA
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac pointer to Global Mac structure.
+ * @param chnlNumber New Channel Number to be switched to.
+ * @param secondaryChnlOffset an enum for secondary channel offset.
+ * @param localPowerConstraint 11h local power constraint value
+ *
+ * @return success if message send is ok, else false.
+ */
+
+#if !defined WLAN_FEATURE_VOWIFI
+tSirRetStatus limSendSwitchChnlParams(tpAniSirGlobal pMac,
+ tANI_U8 chnlNumber,
+ tSirMacHTSecondaryChannelOffset secondaryChnlOffset,
+ tANI_U8 localPwrConstraint, tANI_U8 peSessionId)
+#else
+tSirRetStatus limSendSwitchChnlParams(tpAniSirGlobal pMac,
+ tANI_U8 chnlNumber,
+ tSirMacHTSecondaryChannelOffset secondaryChnlOffset,
+ tPowerdBm maxTxPower, tANI_U8 peSessionId)
+
+#endif
+{
+ tpSwitchChannelParams pChnlParams = NULL;
+ tSirRetStatus retCode = eSIR_SUCCESS;
+ tSirMsgQ msgQ;
+ tpPESession pSessionEntry;
+
+ if((pSessionEntry = peFindSessionBySessionId(pMac , peSessionId)) == NULL)
+ {
+ limLog( pMac, LOGP,
+ FL( "Unable to get Session for session Id %d\n" ), peSessionId);
+ return eSIR_FAILURE;
+
+ }
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pChnlParams,
+ sizeof( tSwitchChannelParams )))
+ {
+ limLog( pMac, LOGP,
+ FL( "Unable to PAL allocate memory during Switch Channel Params\n" ));
+
+ retCode = eSIR_MEM_ALLOC_FAILED;
+ goto returnFailure;
+ }
+
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pChnlParams, sizeof(tSwitchChannelParams));
+
+ pChnlParams->secondaryChannelOffset = secondaryChnlOffset;
+ pChnlParams->channelNumber= chnlNumber;
+#if defined WLAN_FEATURE_VOWIFI
+ pChnlParams->maxTxPower = maxTxPower;
+ palCopyMemory( pMac->hHdd, pChnlParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
+#else
+ pChnlParams->localPowerConstraint = localPwrConstraint;
+#endif
+
+ palCopyMemory( pMac->hHdd, pChnlParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
+ pChnlParams->peSessionId = peSessionId;
+
+ //we need to defer the message until we get the response back from WDA.
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+
+ msgQ.type = WDA_CHNL_SWITCH_REQ;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pChnlParams;
+ msgQ.bodyval = 0;
+
+#if !defined WLAN_FEATURE_VOWIFI
+ PELOG3(limLog( pMac, LOG3,
+ FL( "Sending WDA_CHNL_SWITCH_REQ with SecondaryChnOffset - %d, ChannelNumber - %d, maxTxPower - %d"),
+ pChnlParams->secondaryChannelOffset, pChnlParams->channelNumber, pChnlParams->maxTxPower);)
+#else
+ PELOG3(limLog( pMac, LOG3,
+ FL( "Sending WDA_CHNL_SWITCH_REQ with SecondaryChnOffset - %d, ChannelNumber - %d, LocalPowerConstraint - %d"),
+ pChnlParams->secondaryChannelOffset, pChnlParams->channelNumber, pChnlParams->localPowerConstraint);)
+#endif
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ {
+ palFreeMemory(pMac->hHdd, pChnlParams);
+ limLog( pMac, LOGP,
+ FL("Posting WDA_CHNL_SWITCH_REQ to WDA failed, reason=%X\n"),
+ retCode );
+ }
+
+returnFailure:
+ return retCode;
+}
+
+
+/**
+ * limSendEdcaParams()
+ *
+ *FUNCTION:
+ * This function is called to send dynamically changing EDCA Parameters to WDA.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac pointer to Global Mac structure.
+ * @param tpUpdatedEdcaParams pointer to the structure which contains
+ * dynamically changing EDCA parameters.
+ * @param highPerformance If the peer is Airgo (taurus) then switch to highPerformance is true.
+ *
+ * @return success if message send is ok, else false.
+ */
+
+tSirRetStatus limSendEdcaParams(tpAniSirGlobal pMac, tSirMacEdcaParamRecord *pUpdatedEdcaParams, tANI_U16 bssIdx, tANI_BOOLEAN highPerformance)
+{
+ tEdcaParams *pEdcaParams = NULL;
+ tSirRetStatus retCode = eSIR_SUCCESS;
+ tSirMsgQ msgQ;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pEdcaParams,
+ sizeof(tEdcaParams)))
+ {
+ limLog( pMac, LOGP,
+ FL( "Unable to PAL allocate memory during Update EDCA Params\n" ));
+
+ retCode = eSIR_MEM_ALLOC_FAILED;
+ return retCode;
+ }
+
+ pEdcaParams->bssIdx = bssIdx;
+ pEdcaParams->acbe = pUpdatedEdcaParams[EDCA_AC_BE];
+ pEdcaParams->acbk = pUpdatedEdcaParams[EDCA_AC_BK];
+ pEdcaParams->acvi = pUpdatedEdcaParams[EDCA_AC_VI];
+ pEdcaParams->acvo = pUpdatedEdcaParams[EDCA_AC_VO];
+ pEdcaParams->highPerformance = highPerformance;
+
+ msgQ.type = WDA_UPDATE_EDCA_PROFILE_IND;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pEdcaParams;
+ msgQ.bodyval = 0;
+
+ {
+ tANI_U8 i;
+ PELOG1(limLog( pMac, LOG1,FL("Sending WDA_UPDATE_EDCA_PROFILE_IND with EDCA Parameters:" ));)
+ for(i=0; i<MAX_NUM_AC; i++)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("AC[%d]: AIFSN %d, ACM %d, CWmin %d, CWmax %d, TxOp %d \n"),
+ i, pUpdatedEdcaParams[i].aci.aifsn, pUpdatedEdcaParams[i].aci.acm,
+ pUpdatedEdcaParams[i].cw.min, pUpdatedEdcaParams[i].cw.max, pUpdatedEdcaParams[i].txoplimit);)
+ }
+ }
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ {
+ palFreeMemory(pMac->hHdd, pEdcaParams);
+ limLog( pMac, LOGP,
+ FL("Posting WDA_UPDATE_EDCA_PROFILE_IND to WDA failed, reason=%X\n"),
+ retCode );
+ }
+
+ return retCode;
+}
+
+
+/**
+ * limSetActiveEdcaParams()
+ *
+ * FUNCTION:
+ * This function is called to set the most up-to-date EDCA parameters
+ * given the default local EDCA parameters. The rules are as following:
+ * - If ACM bit is set for all ACs, then downgrade everything to Best Effort.
+ * - If ACM is not set for any AC, then PE will use the default EDCA
+ * parameters as advertised by AP.
+ * - If ACM is set in any of the ACs, PE will use the EDCA parameters
+ * from the next best AC for which ACM is not enabled.
+ *
+ * @param pMac pointer to Global Mac structure.
+ * @param plocalEdcaParams pointer to the local EDCA parameters
+ * @ param psessionEntry point to the session entry
+ * @return none
+ */
+ void limSetActiveEdcaParams(tpAniSirGlobal pMac, tSirMacEdcaParamRecord *plocalEdcaParams, tpPESession psessionEntry)
+{
+ tANI_U8 ac, newAc, i;
+ tANI_U8 acAdmitted;
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ vos_log_qos_edca_pkt_type *log_ptr = NULL;
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ // Initialize gLimEdcaParamsActive[] to be same as localEdcaParams
+ psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE] = plocalEdcaParams[EDCA_AC_BE];
+ psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK] = plocalEdcaParams[EDCA_AC_BK];
+ psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI] = plocalEdcaParams[EDCA_AC_VI];
+ psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO] = plocalEdcaParams[EDCA_AC_VO];
+
+ /* An AC requires downgrade if the ACM bit is set, and the AC has not
+ * yet been admitted in uplink or bi-directions.
+ * If an AC requires downgrade, it will downgrade to the next beset AC
+ * for which ACM is not enabled.
+ *
+ * - There's no need to downgrade AC_BE since it IS the lowest AC. Hence
+ * start the for loop with AC_BK.
+ * - If ACM bit is set for an AC, initially downgrade it to AC_BE. Then
+ * traverse thru the AC list. If we do find the next best AC which is
+ * better than AC_BE, then use that one. For example, if ACM bits are set
+ * such that: BE_ACM=1, BK_ACM=1, VI_ACM=1, VO_ACM=0
+ * then all AC will be downgraded to AC_BE.
+ */
+ limLog(pMac, LOG1, FL("adAdmitMask[UPLINK] = 0x%x \n"), pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] );
+ limLog(pMac, LOG1, FL("adAdmitMask[DOWNLINK] = 0x%x \n"), pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] );
+ for (ac = EDCA_AC_BK; ac <= EDCA_AC_VO; ac++)
+ {
+ acAdmitted = ( (pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] & (1 << ac)) >> ac );
+ limLog(pMac, LOG1, FL("For AC[%d]: acm=%d, acAdmit=%d \n"), ac, plocalEdcaParams[ac].aci.acm, acAdmitted);
+
+ if ( (plocalEdcaParams[ac].aci.acm == 1) && (acAdmitted == 0) )
+ {
+ limLog(pMac, LOG1, FL("We need to downgrade AC %d!! "), ac);
+ newAc = EDCA_AC_BE;
+ for (i=ac-1; i>0; i--)
+ {
+ if (plocalEdcaParams[i].aci.acm == 0)
+ {
+ newAc = i;
+ break;
+ }
+ }
+ limLog(pMac, LOGW, FL("Downgrading AC %d ---> AC %d "), ac, newAc);
+ psessionEntry->gLimEdcaParamsActive[ac] = plocalEdcaParams[newAc];
+ }
+ }
+//log: LOG_WLAN_QOS_EDCA_C
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ WLAN_VOS_DIAG_LOG_ALLOC(log_ptr, vos_log_qos_edca_pkt_type, LOG_WLAN_QOS_EDCA_C);
+ if(log_ptr)
+ {
+ log_ptr->aci_be = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].aci.aci;
+ log_ptr->cw_be = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].cw.max << 4 |
+ psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].cw.min;
+ log_ptr->txoplimit_be = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].txoplimit;
+ log_ptr->aci_bk = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].aci.aci;
+ log_ptr->cw_bk = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].cw.max << 4 |
+ psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].cw.min;
+ log_ptr->txoplimit_bk = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].txoplimit;
+ log_ptr->aci_vi = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].aci.aci;
+ log_ptr->cw_vi = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].cw.max << 4 |
+ psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].cw.min;
+ log_ptr->txoplimit_vi = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].txoplimit;
+ log_ptr->aci_vo = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].aci.aci;
+ log_ptr->cw_vo = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].cw.max << 4 |
+ psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].cw.min;
+ log_ptr->txoplimit_vo = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].txoplimit;
+ }
+ WLAN_VOS_DIAG_LOG_REPORT(log_ptr);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ return;
+ }
+
+
+/** ---------------------------------------------------------
+\fn limSetLinkState
+\brief LIM sends a message to WDA to set the link state
+\param tpAniSirGlobal pMac
+\param tSirLinkState state
+\return None
+ -----------------------------------------------------------*/
+ //Original code with out anu's change
+#if 0
+tSirRetStatus limSetLinkState(tpAniSirGlobal pMac, tSirLinkState state,tSirMacAddr bssId)
+{
+ tSirMsgQ msg;
+ tSirRetStatus retCode;
+
+ msg.type = WDA_SET_LINK_STATE;
+ msg.bodyval = (tANI_U32) state;
+ msg.bodyptr = NULL;
+
+ MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+ retCode = wdaPostCtrlMsg(pMac, &msg);
+ if (retCode != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x \n"), retCode);
+
+ return retCode;
+}
+#endif //0
+
+tSirRetStatus limSetLinkState(tpAniSirGlobal pMac, tSirLinkState state,tSirMacAddr bssId,
+ tSirMacAddr selfMacAddr, tpSetLinkStateCallback callback,
+ void *callbackArg)
+{
+ tSirMsgQ msgQ;
+ tSirRetStatus retCode;
+ tpLinkStateParams pLinkStateParams = NULL;
+
+ // Allocate memory.
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pLinkStateParams,
+ sizeof(tLinkStateParams)))
+ {
+ limLog( pMac, LOGP,
+ FL( "Unable to PAL allocate memory while sending Set Link State\n" ));
+
+ retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ return retCode;
+ }
+
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pLinkStateParams, sizeof(tLinkStateParams));
+
+ pLinkStateParams->state = state;
+ pLinkStateParams->callback = callback;
+ pLinkStateParams->callbackArg = callbackArg;
+
+
+ /* Copy Mac address */
+ sirCopyMacAddr(pLinkStateParams->bssid,bssId);
+ sirCopyMacAddr(pLinkStateParams->selfMacAddr, selfMacAddr);
+
+
+ msgQ.type = WDA_SET_LINK_STATE;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pLinkStateParams;
+ msgQ.bodyval = 0;
+
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+
+ retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ);
+ if (retCode != eSIR_SUCCESS)
+ {
+ palFreeMemory(pMac, (void*)pLinkStateParams);
+ limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x \n"), retCode);
+ }
+
+ return retCode;
+}
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+extern tSirRetStatus limSetLinkStateFT(tpAniSirGlobal pMac, tSirLinkState
+state,tSirMacAddr bssId, tSirMacAddr selfMacAddr, int ft, tpPESession psessionEntry)
+{
+ tSirMsgQ msgQ;
+ tSirRetStatus retCode;
+ tpLinkStateParams pLinkStateParams = NULL;
+
+ // Allocate memory.
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pLinkStateParams,
+ sizeof(tLinkStateParams)))
+ {
+ limLog( pMac, LOGP,
+ FL( "Unable to PAL allocate memory while sending Set Link State\n" ));
+
+ retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+ return retCode;
+ }
+
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pLinkStateParams, sizeof(tLinkStateParams));
+
+ pLinkStateParams->state = state;
+
+ /* Copy Mac address */
+ sirCopyMacAddr(pLinkStateParams->bssid,bssId);
+ sirCopyMacAddr(pLinkStateParams->selfMacAddr, selfMacAddr);
+ pLinkStateParams->ft = 1;
+ pLinkStateParams->session = psessionEntry;
+
+
+ msgQ.type = WDA_SET_LINK_STATE;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pLinkStateParams;
+ msgQ.bodyval = 0;
+
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+
+ retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ);
+ if (retCode != eSIR_SUCCESS)
+ {
+ palFreeMemory(pMac, (void*)pLinkStateParams);
+ limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x \n"), retCode);
+ }
+
+ return retCode;
+}
+#endif
+
+
+
+/** ---------------------------------------------------------
+\fn limSendSetTxPowerReq
+\brief LIM sends a WDA_SET_TX_POWER_REQ message to WDA
+\param tpAniSirGlobal pMac
+\param tpSirSetTxPowerReq request message
+\return None
+ -----------------------------------------------------------*/
+tSirRetStatus limSendSetTxPowerReq(tpAniSirGlobal pMac, tpSirSetTxPowerReq pTxPowerReq)
+{
+ tSirRetStatus retCode = eSIR_SUCCESS;
+ tSirMsgQ msgQ;
+
+ if (NULL == pTxPowerReq)
+ return retCode;
+
+ msgQ.type = WDA_SET_TX_POWER_REQ;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pTxPowerReq;
+ msgQ.bodyval = 0;
+
+ PELOGW(limLog(pMac, LOGW, FL( "Sending WDA_SET_TX_POWER_REQ to WDA"));)
+
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ {
+ limLog( pMac, LOGP, FL("Posting WDA_SET_TX_POWER_REQ to WDA failed, reason=%X"), retCode );
+ if (NULL != pTxPowerReq)
+ {
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pTxPowerReq);
+ }
+ return retCode;
+ }
+ return retCode;
+}
+
+/** ---------------------------------------------------------
+\fn limSendGetTxPowerReq
+\brief LIM sends a WDA_GET_TX_POWER_REQ message to WDA
+\param tpAniSirGlobal pMac
+\param tpSirGetTxPowerReq request message
+\return None
+ -----------------------------------------------------------*/
+tSirRetStatus limSendGetTxPowerReq(tpAniSirGlobal pMac, tpSirGetTxPowerReq pTxPowerReq)
+{
+ tSirRetStatus retCode = eSIR_SUCCESS;
+ tSirMsgQ msgQ;
+
+ if (NULL == pTxPowerReq)
+ return retCode;
+
+ msgQ.type = WDA_GET_TX_POWER_REQ;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pTxPowerReq;
+ msgQ.bodyval = 0;
+
+ PELOGW(limLog(pMac, LOGW, FL( "Sending WDA_GET_TX_POWER_REQ to WDA"));)
+
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ {
+ limLog( pMac, LOGP, FL("Posting WDA_GET_TX_POWER_REQ to WDA failed, reason=%X"), retCode );
+ if (NULL != pTxPowerReq)
+ {
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pTxPowerReq);
+ }
+ return retCode;
+ }
+ return retCode;
+}
+
+/** ---------------------------------------------------------
+\fn limSendBeaconFilterInfo
+\brief LIM sends beacon filtering info to WDA
+\param tpAniSirGlobal pMac
+\return None
+ -----------------------------------------------------------*/
+tSirRetStatus limSendBeaconFilterInfo(tpAniSirGlobal pMac)
+{
+ tpBeaconFilterMsg pBeaconFilterMsg = NULL;
+ tSirRetStatus retCode = eSIR_SUCCESS;
+ tSirMsgQ msgQ;
+ tANI_U8 *ptr;
+ tANI_U32 i;
+ tANI_U32 msgSize;
+ tpBeaconFilterIe pIe;
+ tpPESession psessionEntry = &pMac->lim.gpSession[0]; //TBD-RAJESH get the sessionEntry from the caller
+
+
+ msgSize = sizeof(tBeaconFilterMsg) + sizeof(beaconFilterTable);
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pBeaconFilterMsg, msgSize) )
+ {
+ limLog( pMac, LOGP, FL("Fail to allocate memory for beaconFiilterMsg \n"));
+ retCode = eSIR_MEM_ALLOC_FAILED;
+ return retCode;
+ }
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pBeaconFilterMsg, msgSize);
+
+ // Fill in capability Info and mask
+ //TBD-RAJESH get the BSS capability from session.
+ //Don't send this message if no active Infra session is found.
+ pBeaconFilterMsg->capabilityInfo = psessionEntry->limCurrentBssCaps;
+ pBeaconFilterMsg->capabilityMask = CAPABILITY_FILTER_MASK;
+
+ pBeaconFilterMsg->beaconInterval = (tANI_U16) psessionEntry->beaconParams.beaconInterval;
+
+ // Fill in number of IEs in beaconFilterTable
+ pBeaconFilterMsg->ieNum = (tANI_U16) (sizeof(beaconFilterTable) / sizeof(tBeaconFilterIe));
+
+ //Fill message with info contained in the beaconFilterTable
+ ptr = (tANI_U8 *)pBeaconFilterMsg + sizeof(tBeaconFilterMsg);
+ for(i=0; i < (pBeaconFilterMsg->ieNum); i++)
+ {
+ pIe = (tpBeaconFilterIe) ptr;
+ pIe->elementId = beaconFilterTable[i].elementId;
+ pIe->checkIePresence = beaconFilterTable[i].checkIePresence;
+ pIe->byte.offset = beaconFilterTable[i].byte.offset;
+ pIe->byte.value = beaconFilterTable[i].byte.value;
+ pIe->byte.bitMask = beaconFilterTable[i].byte.bitMask;
+ pIe->byte.ref = beaconFilterTable[i].byte.ref;
+ ptr += sizeof(tBeaconFilterIe);
+ }
+
+ msgQ.type = WDA_BEACON_FILTER_IND;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pBeaconFilterMsg;
+ msgQ.bodyval = 0;
+
+ limLog( pMac, LOG3, FL( "Sending WDA_BEACON_FILTER_IND..." ));
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ {
+ palFreeMemory(pMac->hHdd, pBeaconFilterMsg);
+ limLog( pMac, LOGP,
+ FL("Posting WDA_BEACON_FILTER_IND to WDA failed, reason=%X\n"),
+ retCode );
+ return retCode;
+ }
+
+ return retCode;
+}
+
diff --git a/CORE/MAC/src/pe/lim/limSendMessages.h b/CORE/MAC/src/pe/lim/limSendMessages.h
new file mode 100644
index 0000000..3871659
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limSendMessages.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * limSendMessages.h: Provides functions to send messages or Indications to HAL.
+ * Author: Sunit Bhatia
+ * Date: 09/21/2006
+ * History:-
+ * Date Modified by Modification Information
+ *
+ * --------------------------------------------------------------------------
+ *
+ */
+#ifndef __LIM_SEND_MESSAGES_H
+#define __LIM_SEND_MESSAGES_H
+
+
+
+#include "aniGlobal.h"
+#include "limTypes.h"
+#include "halMsgApi.h"
+#include "sirParams.h"
+
+tSirRetStatus limSendCFParams(tpAniSirGlobal pMac, tANI_U8 bssIdx, tANI_U8 cfpCount, tANI_U8 cfpPeriod);
+tSirRetStatus limSendBeaconParams(tpAniSirGlobal pMac,
+ tpUpdateBeaconParams pUpdatedBcnParams,
+ tpPESession psessionEntry );
+
+//tSirRetStatus limSendBeaconParams(tpAniSirGlobal pMac, tpUpdateBeaconParams pUpdatedBcnParams);
+#if defined WLAN_FEATURE_VOWIFI
+tSirRetStatus limSendSwitchChnlParams(tpAniSirGlobal pMac, tANI_U8 chnlNumber,
+ tSirMacHTSecondaryChannelOffset secondaryChnlOffset,
+ tPowerdBm maxTxPower,tANI_U8 peSessionId);
+#else
+tSirRetStatus limSendSwitchChnlParams(tpAniSirGlobal pMac, tANI_U8 chnlNumber,
+ tSirMacHTSecondaryChannelOffset secondaryChnlOffset,
+ tANI_U8 localPwrConstraint,tANI_U8 peSessionId);
+#endif
+tSirRetStatus limSendEdcaParams(tpAniSirGlobal pMac, tSirMacEdcaParamRecord *pUpdatedEdcaParams, tANI_U16 bssIdx, tANI_BOOLEAN highPerformance);
+tSirRetStatus limSetLinkState(tpAniSirGlobal pMac, tSirLinkState state, tSirMacAddr bssId,
+ tSirMacAddr selfMac, tpSetLinkStateCallback callback,
+ void *callbackArg);
+#ifdef WLAN_FEATURE_VOWIFI_11R
+extern tSirRetStatus limSetLinkStateFT(tpAniSirGlobal pMac, tSirLinkState
+state,tSirMacAddr bssId, tSirMacAddr selfMacAddr, int ft, tpPESession psessionEntry);
+#endif
+tSirRetStatus limSendSetTxPowerReq(tpAniSirGlobal pMac, tpSirSetTxPowerReq pTxPowerReq);
+tSirRetStatus limSendGetTxPowerReq(tpAniSirGlobal pMac, tpSirGetTxPowerReq pTxPowerReq);
+
+void limSetActiveEdcaParams(tpAniSirGlobal pMac, tSirMacEdcaParamRecord *plocalEdcaParams, tpPESession psessionEntry);
+
+#define CAPABILITY_FILTER_MASK 0x73CF
+#define ERP_FILTER_MASK 0xF8
+#define EDCA_FILTER_MASK 0xF0
+#define QOS_FILTER_MASK 0xF0
+#define HT_BYTE0_FILTER_MASK 0x0
+#define HT_BYTE2_FILTER_MASK 0xEB
+#define HT_BYTE5_FILTER_MASK 0xFD
+#define DS_PARAM_CHANNEL_MASK 0x0
+
+
+tSirRetStatus limSendBeaconFilterInfo(tpAniSirGlobal pMac);
+
+
+#endif
diff --git a/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c b/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c
new file mode 100644
index 0000000..a77d8ff
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c
@@ -0,0 +1,2443 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limSendSmeRspMessages.cc contains the functions
+ * for sending SME response/notification messages to applications
+ * above MAC software.
+ * Author: Chandra Modumudi
+ * Date: 02/13/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+
+#include "vos_types.h"
+#include "wniApi.h"
+#include "sirCommon.h"
+#include "aniGlobal.h"
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+#include "wniCfgAp.h"
+#else
+#include "wniCfgSta.h"
+#endif
+#include "sysDef.h"
+#include "cfgApi.h"
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halDataStruct.h"
+#include "halCommonApi.h"
+#endif
+
+#include "schApi.h"
+#include "utilsApi.h"
+#include "limUtils.h"
+#include "limSecurityUtils.h"
+#include "limSerDesUtils.h"
+#include "limSendSmeRspMessages.h"
+#include "limIbssPeerMgmt.h"
+#include "limSessionUtils.h"
+
+
+/**
+ * limSendSmeRsp()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeReqMessages() to send
+ * eWNI_SME_START_RSP, eWNI_SME_MEASUREMENT_RSP, eWNI_SME_STOP_BSS_RSP
+ * or eWNI_SME_SWITCH_CHL_RSP messages to applications above MAC
+ * Software.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param msgType Indicates message type
+ * @param resultCode Indicates the result of previously issued
+ * eWNI_SME_msgType_REQ message
+ *
+ * @return None
+ */
+
+void
+limSendSmeRsp(tpAniSirGlobal pMac, tANI_U16 msgType,
+ tSirResultCodes resultCode,tANI_U8 smesessionId, tANI_U16 smetransactionId)
+{
+ tSirMsgQ mmhMsg;
+ tSirSmeRsp *pSirSmeRsp;
+
+ PELOG1(limLog(pMac, LOG1,
+ FL("Sending message %s with reasonCode %s\n"),
+ limMsgStr(msgType), limResultCodeStr(resultCode));)
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeRsp, sizeof(tSirSmeRsp)))
+ {
+ /// Buffer not available. Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for eWNI_SME_*_RSP\n"));
+
+ return;
+ }
+
+#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
+ sirStoreU16N((tANI_U8*)&pSirSmeRsp->messageType, msgType);
+ sirStoreU16N((tANI_U8*)&pSirSmeRsp->length, sizeof(tSirSmeRsp));
+#else
+ pSirSmeRsp->messageType = msgType;
+ pSirSmeRsp->length = sizeof(tSirSmeRsp);
+#endif
+ pSirSmeRsp->statusCode = resultCode;
+
+ /* Update SME session Id and Transaction Id */
+ pSirSmeRsp->sessionId = smesessionId;
+ pSirSmeRsp->transactionId = smetransactionId;
+
+
+ mmhMsg.type = msgType;
+ mmhMsg.bodyptr = pSirSmeRsp;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ {
+ tpPESession psessionEntry = peGetValidPowerSaveSession(pMac);
+ switch(msgType)
+ {
+ case eWNI_PMC_ENTER_BMPS_RSP:
+ limDiagEventReport(pMac, WLAN_PE_DIAG_ENTER_BMPS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
+ break;
+ case eWNI_PMC_EXIT_BMPS_RSP:
+ limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_BMPS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
+ break;
+ case eWNI_PMC_ENTER_IMPS_RSP:
+ limDiagEventReport(pMac, WLAN_PE_DIAG_ENTER_IMPS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
+ break;
+ case eWNI_PMC_EXIT_IMPS_RSP:
+ limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_IMPS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
+ break;
+ case eWNI_PMC_ENTER_UAPSD_RSP:
+ limDiagEventReport(pMac, WLAN_PE_DIAG_ENTER_UAPSD_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
+ break;
+ case eWNI_PMC_EXIT_UAPSD_RSP:
+ limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_UAPSD_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
+ break;
+ case eWNI_SME_SWITCH_CHL_RSP:
+ limDiagEventReport(pMac, WLAN_PE_DIAG_SWITCH_CHL_RSP_EVENT, NULL, (tANI_U16)resultCode, 0);
+ break;
+ case eWNI_SME_STOP_BSS_RSP:
+ limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_RSP_EVENT, NULL, (tANI_U16)resultCode, 0);
+ break;
+ case eWNI_PMC_ENTER_WOWL_RSP:
+ limDiagEventReport(pMac, WLAN_PE_DIAG_ENTER_WOWL_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
+ break;
+ case eWNI_PMC_EXIT_WOWL_RSP:
+ limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_WOWL_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
+ break;
+ }
+ }
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+} /*** end limSendSmeRsp() ***/
+
+
+/**
+ * limSendSmeJoinReassocRspAfterResume()
+ *
+ *FUNCTION:
+ * This function is called to send Join/Reassoc rsp
+ * message to SME after the resume link.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param status Resume link status
+ * @param ctx context passed while calling resmune link.
+ * (join response to be sent)
+ *
+ * @return None
+ */
+static void limSendSmeJoinReassocRspAfterResume( tpAniSirGlobal pMac,
+ eHalStatus status, tANI_U32 *ctx)
+{
+ tSirMsgQ mmhMsg;
+ tpSirSmeJoinRsp pSirSmeJoinRsp = (tpSirSmeJoinRsp) ctx;
+
+ mmhMsg.type = pSirSmeJoinRsp->messageType;
+ mmhMsg.bodyptr = pSirSmeJoinRsp;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+}
+
+
+/**
+ * limSendSmeJoinReassocRsp()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeReqMessages() to send
+ * eWNI_SME_JOIN_RSP or eWNI_SME_REASSOC_RSP messages to applications
+ * above MAC Software.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param msgType Indicates message type
+ * @param resultCode Indicates the result of previously issued
+ * eWNI_SME_msgType_REQ message
+ *
+ * @return None
+ */
+
+void
+limSendSmeJoinReassocRsp(tpAniSirGlobal pMac, tANI_U16 msgType,
+ tSirResultCodes resultCode, tANI_U16 protStatusCode,
+ tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
+{
+ tpSirSmeJoinRsp pSirSmeJoinRsp;
+ tANI_U32 rspLen;
+ tpDphHashNode pStaDs = NULL;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ if (msgType == eWNI_SME_REASSOC_RSP)
+ limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
+ else
+ limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ PELOG1(limLog(pMac, LOG1,
+ FL("Sending message %s with reasonCode %s\n"),
+ limMsgStr(msgType), limResultCodeStr(resultCode));)
+
+ if(psessionEntry == NULL)
+ {
+
+ rspLen = sizeof(tSirSmeJoinRsp);
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeJoinRsp, rspLen))
+ {
+ /// Buffer not available. Log error
+ limLog(pMac, LOGP, FL("call to palAllocateMemory failed for JOIN/REASSOC_RSP\n"));
+ return;
+ }
+
+ palZeroMemory(pMac, (tANI_U8*)pSirSmeJoinRsp, rspLen);
+
+
+ pSirSmeJoinRsp->beaconLength = 0;
+ pSirSmeJoinRsp->assocReqLength = 0;
+ pSirSmeJoinRsp->assocRspLength = 0;
+ }
+
+ else
+ {
+ rspLen = psessionEntry->assocReqLen + psessionEntry->assocRspLen +
+ psessionEntry->bcnLen +
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ psessionEntry->RICDataLen +
+#endif
+#ifdef FEATURE_WLAN_CCX
+ psessionEntry->tspecLen +
+#endif
+ sizeof(tSirSmeJoinRsp) - sizeof(tANI_U8) ;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeJoinRsp, rspLen))
+ {
+ /// Buffer not available. Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for JOIN/REASSOC_RSP\n"));
+
+ return;
+ }
+
+ palZeroMemory(pMac, (tANI_U8*)pSirSmeJoinRsp, rspLen);
+
+#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
+ sirStoreU16N((tANI_U8*)&pSirSmeJoinRsp->messageType, msgType);
+ sirStoreU16N((tANI_U8*)&pSirSmeJoinRsp->length, rspLen);
+#endif
+
+#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA)
+ if (resultCode == eSIR_SME_SUCCESS)
+ {
+ pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
+ if (pStaDs == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not Get Self Entry for the station\n"));)
+ }
+ else
+ {
+ //Pass the peer's staId
+ pSirSmeJoinRsp->staId = pStaDs->staIndex;
+ pSirSmeJoinRsp->ucastSig = pStaDs->ucUcastSig;
+ pSirSmeJoinRsp->bcastSig = pStaDs->ucBcastSig;
+ }
+ }
+#endif
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ if (resultCode == eSIR_SME_TRANSFER_STA)
+ {
+ palCopyMemory( pMac->hHdd, pSirSmeJoinRsp->alternateBssId,
+ pMac->lim.gLimAlternateRadio.bssId,
+ sizeof(tSirMacAddr));
+ pSirSmeJoinRsp->alternateChannelId =
+ pMac->lim.gLimAlternateRadio.channelId;
+ }
+#endif
+
+ pSirSmeJoinRsp->beaconLength = 0;
+ pSirSmeJoinRsp->assocReqLength = 0;
+ pSirSmeJoinRsp->assocRspLength = 0;
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ pSirSmeJoinRsp->parsedRicRspLen = 0;
+#endif
+#ifdef FEATURE_WLAN_CCX
+ pSirSmeJoinRsp->tspecIeLen = 0;
+#endif
+
+ if(resultCode == eSIR_SME_SUCCESS)
+ {
+
+ if(psessionEntry->beacon != NULL)
+ {
+ pSirSmeJoinRsp->beaconLength = psessionEntry->bcnLen;
+ palCopyMemory(pMac->hHdd, pSirSmeJoinRsp->frames, psessionEntry->beacon, pSirSmeJoinRsp->beaconLength);
+ palFreeMemory(pMac->hHdd, psessionEntry->beacon);
+ psessionEntry->beacon = NULL;
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOG1(limLog(pMac, LOG1, FL("Beacon=%d\n"), psessionEntry->bcnLen);)
+#endif
+ }
+
+ if(psessionEntry->assocReq != NULL)
+ {
+ pSirSmeJoinRsp->assocReqLength = psessionEntry->assocReqLen;
+ palCopyMemory(pMac->hHdd, pSirSmeJoinRsp->frames + psessionEntry->bcnLen, psessionEntry->assocReq, pSirSmeJoinRsp->assocReqLength);
+ palFreeMemory(pMac->hHdd, psessionEntry->assocReq);
+ psessionEntry->assocReq = NULL;
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOG1(limLog(pMac, LOG1, FL("AssocReq=%d\n"), psessionEntry->assocReqLen);)
+#endif
+ }
+ if(psessionEntry->assocRsp != NULL)
+ {
+ pSirSmeJoinRsp->assocRspLength = psessionEntry->assocRspLen;
+ palCopyMemory(pMac->hHdd, pSirSmeJoinRsp->frames + psessionEntry->bcnLen + psessionEntry->assocReqLen, psessionEntry->assocRsp, pSirSmeJoinRsp->assocRspLength);
+ palFreeMemory(pMac->hHdd, psessionEntry->assocRsp);
+ psessionEntry->assocRsp = NULL;
+ }
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ if(psessionEntry->ricData != NULL)
+ {
+ pSirSmeJoinRsp->parsedRicRspLen = psessionEntry->RICDataLen;
+ palCopyMemory(pMac->hHdd, pSirSmeJoinRsp->frames + psessionEntry->bcnLen + psessionEntry->assocReqLen + psessionEntry->assocRspLen, psessionEntry->ricData, pSirSmeJoinRsp->parsedRicRspLen);
+ palFreeMemory(pMac->hHdd, psessionEntry->ricData);
+ psessionEntry->ricData = NULL;
+ PELOG1(limLog(pMac, LOG1, FL("RicLength=%d\n"), psessionEntry->parsedRicRspLen);)
+ }
+#endif
+#ifdef FEATURE_WLAN_CCX
+ if(psessionEntry->tspecIes != NULL)
+ {
+ pSirSmeJoinRsp->tspecIeLen = psessionEntry->tspecLen;
+ palCopyMemory(pMac->hHdd, pSirSmeJoinRsp->frames + psessionEntry->bcnLen + psessionEntry->assocReqLen + psessionEntry->assocRspLen + psessionEntry->RICDataLen, psessionEntry->tspecIes, pSirSmeJoinRsp->tspecIeLen);
+ palFreeMemory(pMac->hHdd, psessionEntry->tspecIes);
+ psessionEntry->tspecIes = NULL;
+ PELOG1(limLog(pMac, LOG1, FL("CCX-TspecLen=%d\n"), psessionEntry->tspecLen);)
+ }
+#endif
+ pSirSmeJoinRsp->aid = psessionEntry->limAID;
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOG1(limLog(pMac, LOG1, FL("AssocRsp=%d\n"), psessionEntry->assocRspLen);)
+#endif
+ }
+ }
+
+
+ pSirSmeJoinRsp->messageType = msgType;
+ pSirSmeJoinRsp->length = (tANI_U16) rspLen;
+ pSirSmeJoinRsp->statusCode = resultCode;
+ pSirSmeJoinRsp->protStatusCode = protStatusCode;
+
+ /* Update SME session ID and transaction Id */
+ pSirSmeJoinRsp->sessionId = smesessionId;
+ pSirSmeJoinRsp->transactionId = smetransactionId;
+
+ if(IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
+ {
+ if( psessionEntry && psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE )
+ {
+ peSetResumeChannel( pMac, psessionEntry->currentOperChannel, 0);
+ }
+ else
+ {
+ peSetResumeChannel( pMac, 0, 0);
+ }
+ limResumeLink( pMac, limSendSmeJoinReassocRspAfterResume,
+ (tANI_U32*) pSirSmeJoinRsp );
+ }
+ else
+ {
+ limSendSmeJoinReassocRspAfterResume( pMac, eHAL_STATUS_SUCCESS,
+ (tANI_U32*) pSirSmeJoinRsp );
+ }
+} /*** end limSendSmeJoinReassocRsp() ***/
+
+
+
+/**
+ * limSendSmeStartBssRsp()
+ *
+ *FUNCTION:
+ * This function is called to send eWNI_SME_START_BSS_RSP
+ * message to applications above MAC Software.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param msgType Indicates message type
+ * @param resultCode Indicates the result of previously issued
+ * eWNI_SME_msgType_REQ message
+ *
+ * @return None
+ */
+
+void
+limSendSmeStartBssRsp(tpAniSirGlobal pMac,
+ tANI_U16 msgType, tSirResultCodes resultCode,tpPESession psessionEntry,
+ tANI_U8 smesessionId,tANI_U16 smetransactionId)
+{
+
+
+ tANI_U16 size = 0;
+ tSirMsgQ mmhMsg;
+ tSirSmeStartBssRsp *pSirSmeRsp;
+ tANI_U16 ieLen;
+ tANI_U16 ieOffset, curLen;
+
+ PELOG1(limLog(pMac, LOG1, FL("Sending message %s with reasonCode %s\n"),
+ limMsgStr(msgType), limResultCodeStr(resultCode));)
+
+ size = sizeof(tSirSmeStartBssRsp);
+
+ if(psessionEntry == NULL)
+ {
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeRsp, size))
+ {
+ /// Buffer not available. Log error
+ limLog(pMac, LOGP,FL("call to palAllocateMemory failed for eWNI_SME_START_BSS_RSP\n"));
+ return;
+ }
+ palZeroMemory(pMac, (tANI_U8*)pSirSmeRsp, size);
+
+ }
+ else
+ {
+ //subtract size of beaconLength + Mac Hdr + Fixed Fields before SSID
+ ieOffset = sizeof(tAniBeaconStruct) + SIR_MAC_B_PR_SSID_OFFSET;
+ ieLen = pMac->sch.schObject.gSchBeaconOffsetBegin + pMac->sch.schObject.gSchBeaconOffsetEnd - ieOffset;
+ //calculate the memory size to allocate
+ size += ieLen;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeRsp, size))
+ {
+ /// Buffer not available. Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for eWNI_SME_START_BSS_RSP\n"));
+
+ return;
+ }
+ palZeroMemory(pMac, (tANI_U8*)pSirSmeRsp, size);
+ size = sizeof(tSirSmeStartBssRsp);
+ if (resultCode == eSIR_SME_SUCCESS)
+ {
+
+ sirCopyMacAddr(pSirSmeRsp->bssDescription.bssId, psessionEntry->bssId);
+
+ /* Read beacon interval from session */
+ pSirSmeRsp->bssDescription.beaconInterval = (tANI_U16) psessionEntry->beaconParams.beaconInterval;
+ pSirSmeRsp->bssType = psessionEntry->bssType;
+
+ if (cfgGetCapabilityInfo( pMac, &pSirSmeRsp->bssDescription.capabilityInfo,psessionEntry)
+ != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("could not retrieve Capabilities value\n"));
+
+ limGetPhyMode(pMac, (tANI_U32 *)&pSirSmeRsp->bssDescription.nwType, psessionEntry);
+
+#if 0
+ if (wlan_cfgGetInt(pMac, WNI_CFG_CURRENT_CHANNEL, &len) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("could not retrieve CURRENT_CHANNEL from CFG\n"));
+
+#endif// TO SUPPORT BT-AMP
+
+ pSirSmeRsp->bssDescription.channelId = psessionEntry->currentOperChannel;
+
+ pSirSmeRsp->bssDescription.aniIndicator = 1;
+
+ curLen = pMac->sch.schObject.gSchBeaconOffsetBegin - ieOffset;
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pSirSmeRsp->bssDescription.ieFields,
+ pMac->sch.schObject.gSchBeaconFrameBegin + ieOffset,
+ (tANI_U32)curLen);
+
+ palCopyMemory( pMac->hHdd, ((tANI_U8 *) &pSirSmeRsp->bssDescription.ieFields) + curLen,
+ pMac->sch.schObject.gSchBeaconFrameEnd,
+ (tANI_U32)pMac->sch.schObject.gSchBeaconOffsetEnd);
+
+
+ //subtracting size of length indicator itself and size of pointer to ieFields
+ pSirSmeRsp->bssDescription.length = sizeof(tSirBssDescription) -
+ sizeof(tANI_U16) - sizeof(tANI_U32) +
+ ieLen;
+ //This is the size of the message, subtracting the size of the pointer to ieFields
+ size += ieLen - sizeof(tANI_U32);
+ }
+
+
+
+#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
+ sirStoreU16N((tANI_U8*)&pSirSmeRsp->messageType, msgType);
+ sirStoreU16N((tANI_U8*)&pSirSmeRsp->length, size);
+
+#endif
+
+ }
+
+ pSirSmeRsp->messageType = msgType;
+ pSirSmeRsp->length = size;
+
+ /* Update SME session Id and transaction Id */
+ pSirSmeRsp->sessionId = smesessionId;
+ pSirSmeRsp->transactionId = smetransactionId;
+ pSirSmeRsp->statusCode = resultCode;
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry != NULL )
+ pSirSmeRsp->staId = psessionEntry->staId; //else it will be always zero smeRsp StaID = 0
+
+#endif
+
+ mmhMsg.type = msgType;
+ mmhMsg.bodyptr = pSirSmeRsp;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+} /*** end limSendSmeStartBssRsp() ***/
+
+
+
+
+
+#define LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED 20
+#define LIM_SIZE_OF_EACH_BSS 400 // this is a rough estimate
+
+
+/**
+ * limSendSmeScanRsp()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeReqMessages() to send
+ * eWNI_SME_SCAN_RSP message to applications above MAC
+ * Software.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param length Indicates length of message
+ * @param resultCode Indicates the result of previously issued
+ * eWNI_SME_SCAN_REQ message
+ *
+ * @return None
+ */
+
+void
+limSendSmeScanRsp(tpAniSirGlobal pMac, tANI_U16 length,
+ tSirResultCodes resultCode,tANI_U8 smesessionId,tANI_U16 smetranscationId)
+{
+ tSirMsgQ mmhMsg;
+ tpSirSmeScanRsp pSirSmeScanRsp=NULL;
+ tLimScanResultNode *ptemp = NULL;
+ tANI_U16 msgLen, allocLength, curMsgLen = 0;
+ tANI_U16 i, bssCount;
+ tANI_U8 *pbBuf;
+ tSirBssDescription *pDesc;
+
+ PELOG1(limLog(pMac, LOG1,
+ FL("Sending message SME_SCAN_RSP with length=%d reasonCode %s\n"),
+ length, limResultCodeStr(resultCode));)
+
+ if (resultCode != eSIR_SME_SUCCESS)
+ {
+ limPostSmeScanRspMessage(pMac, length, resultCode,smesessionId,smetranscationId);
+ return;
+ }
+
+ mmhMsg.type = eWNI_SME_SCAN_RSP;
+ i = 0;
+ bssCount = 0;
+ msgLen = 0;
+ allocLength = LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED * LIM_SIZE_OF_EACH_BSS;
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeScanRsp, allocLength))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for eWNI_SME_SCAN_RSP\n"));
+
+ return;
+ }
+ for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
+ {
+ //when ptemp is not NULL it is a left over
+ ptemp = pMac->lim.gLimCachedScanHashTable[i];
+ while(ptemp)
+ {
+ pbBuf = ((tANI_U8 *)pSirSmeScanRsp) + msgLen;
+ if(0 == bssCount)
+ {
+ msgLen = sizeof(tSirSmeScanRsp) -
+ sizeof(tSirBssDescription) +
+ ptemp->bssDescription.length +
+ sizeof(ptemp->bssDescription.length);
+ pDesc = pSirSmeScanRsp->bssDescription;
+ }
+ else
+ {
+ msgLen += ptemp->bssDescription.length +
+ sizeof(ptemp->bssDescription.length);
+ pDesc = (tSirBssDescription *)pbBuf;
+ }
+ if( (allocLength < msgLen) ||
+ (LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED <= bssCount++) )
+ {
+ pSirSmeScanRsp->statusCode =
+ eSIR_SME_MORE_SCAN_RESULTS_FOLLOW;
+#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
+ sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->messageType,
+ eWNI_SME_SCAN_RSP);
+ sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->length, curMsgLen);
+#else
+ pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
+ pSirSmeScanRsp->length = curMsgLen;
+#endif
+ mmhMsg.bodyptr = pSirSmeScanRsp;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeScanRsp, allocLength))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for eWNI_SME_SCAN_RSP\n"));
+ return;
+ }
+ msgLen = sizeof(tSirSmeScanRsp) -
+ sizeof(tSirBssDescription) +
+ ptemp->bssDescription.length +
+ sizeof(ptemp->bssDescription.length);
+ pDesc = pSirSmeScanRsp->bssDescription;
+ bssCount = 1;
+ }
+ curMsgLen = msgLen;
+
+ PELOG2(limLog(pMac, LOG2, FL("ScanRsp : msgLen %d, bssDescr Len=%d\n"),
+ msgLen, ptemp->bssDescription.length);)
+#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
+ sirStoreU16N((tANI_U8*)&pDesc->length,
+ ptemp->bssDescription.length);
+#else
+ pDesc->length
+ = ptemp->bssDescription.length;
+#endif
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pDesc->bssId,
+ (tANI_U8 *) &ptemp->bssDescription.bssId,
+ ptemp->bssDescription.length);
+
+ PELOG2(limLog(pMac, LOG2, FL("BssId "));
+ limPrintMacAddr(pMac, ptemp->bssDescription.bssId, LOG2);)
+
+ pSirSmeScanRsp->sessionId = smesessionId;
+ pSirSmeScanRsp->transcationId = smetranscationId;
+
+ ptemp = ptemp->next;
+ } //while(ptemp)
+ } //for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
+
+ if(0 == bssCount)
+ {
+ limPostSmeScanRspMessage(pMac, length, resultCode, smesessionId, smetranscationId);
+ }
+ else
+ {
+ // send last message
+ pSirSmeScanRsp->statusCode = eSIR_SME_SUCCESS;
+#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
+ sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->messageType,
+ eWNI_SME_SCAN_RSP);
+ sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->length, curMsgLen);
+#else
+ pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
+ pSirSmeScanRsp->length = curMsgLen;
+#endif
+
+ /* Update SME session Id and SME transcation Id */
+ pSirSmeScanRsp->sessionId = smesessionId;
+ pSirSmeScanRsp->transcationId = smetranscationId;
+
+ mmhMsg.type = eWNI_SME_SCAN_RSP;
+ mmhMsg.bodyptr = pSirSmeScanRsp;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+ PELOG2(limLog(pMac, LOG2, FL("statusCode : eSIR_SME_SUCCESS\n"));)
+ }
+
+ return;
+
+} /*** end limSendSmeScanRsp() ***/
+
+
+/**
+ * limPostSmeScanRspMessage()
+ *
+ *FUNCTION:
+ * This function is called by limSendSmeScanRsp() to send
+ * eWNI_SME_SCAN_RSP message with failed result code
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param length Indicates length of message
+ * @param resultCode failed result code
+ *
+ * @return None
+ */
+
+void
+limPostSmeScanRspMessage(tpAniSirGlobal pMac,
+ tANI_U16 length,
+ tSirResultCodes resultCode,tANI_U8 smesessionId, tANI_U16 smetransactionId)
+{
+ tpSirSmeScanRsp pSirSmeScanRsp;
+ tSirMsgQ mmhMsg;
+
+ PELOG1(limLog(pMac, LOG1,
+ FL("limPostSmeScanRspMessage: send SME_SCAN_RSP (len %d, reasonCode %s). \n"),
+ length, limResultCodeStr(resultCode));)
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeScanRsp, length))
+ {
+ limLog(pMac, LOGP, FL("palAllocateMemory failed for eWNI_SME_SCAN_RSP\n"));
+ return;
+ }
+ palZeroMemory(pMac->hHdd, (void*)pSirSmeScanRsp, length);
+
+#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
+ sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->messageType, eWNI_SME_SCAN_RSP);
+ sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->length, length);
+#else
+ pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
+ pSirSmeScanRsp->length = length;
+#endif
+
+ if(sizeof(tSirSmeScanRsp) <= length)
+ {
+ pSirSmeScanRsp->bssDescription->length = sizeof(tSirBssDescription);
+ }
+
+ pSirSmeScanRsp->statusCode = resultCode;
+
+ /*Update SME session Id and transaction Id */
+ pSirSmeScanRsp->sessionId = smesessionId;
+ pSirSmeScanRsp->transcationId = smetransactionId;
+
+ mmhMsg.type = eWNI_SME_SCAN_RSP;
+ mmhMsg.bodyptr = pSirSmeScanRsp;
+ mmhMsg.bodyval = 0;
+
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_RSP_EVENT, NULL, (tANI_U16)resultCode, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+ return;
+
+} /*** limPostSmeScanRspMessage ***/
+
+
+
+/**
+ * limSendSmeAuthRsp()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeMessages() to send
+ * eWNI_SME_AUTH_RSP message to host
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param statusCode Indicates the result of previously issued
+ * eWNI_SME_AUTH_REQ message
+ *
+ * @return None
+ */
+void
+limSendSmeAuthRsp(tpAniSirGlobal pMac,
+ tSirResultCodes statusCode,
+ tSirMacAddr peerMacAddr,
+ tAniAuthType authType,
+ tANI_U16 protStatusCode,
+ tpPESession psessionEntry,tANI_U8 smesessionId,
+ tANI_U16 smetransactionId)
+{
+#if 0
+ tSirMsgQ mmhMsg;
+ tSirSmeAuthRsp *pSirSmeAuthRsp;
+
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeAuthRsp, sizeof(tSirSmeAuthRsp)))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for eWNI_SME_AUTH_RSP\n"));
+
+ return;
+ }
+
+#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
+ sirStoreU16N((tANI_U8*)&pSirSmeAuthRsp->messageType, eWNI_SME_AUTH_RSP);
+ sirStoreU16N((tANI_U8*)&pSirSmeAuthRsp->length, sizeof(tSirSmeAuthRsp));
+
+#endif
+
+
+ if(psessionEntry != NULL)
+ {
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pSirSmeAuthRsp->peerMacAddr,
+ (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
+ pSirSmeAuthRsp->authType = authType;
+
+ }
+
+ pSirSmeAuthRsp->messageType = eWNI_SME_AUTH_RSP;
+ pSirSmeAuthRsp->length = sizeof(tSirSmeAuthRsp);
+ pSirSmeAuthRsp->statusCode = statusCode;
+ pSirSmeAuthRsp->protStatusCode = protStatusCode;
+
+ /* Update SME session and transaction Id*/
+ pSirSmeAuthRsp->sessionId = smesessionId;
+ pSirSmeAuthRsp->transactionId = smetransactionId;
+
+ mmhMsg.type = eWNI_SME_AUTH_RSP;
+ mmhMsg.bodyptr = pSirSmeAuthRsp;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+#endif
+} /*** end limSendSmeAuthRsp() ***/
+
+
+void limSendSmeDisassocDeauthNtfPostResume( tpAniSirGlobal pMac,
+ eHalStatus status, tANI_U32 *pCtx )
+{
+ tSirMsgQ mmhMsg;
+ tSirMsgQ *pMsg = (tSirMsgQ*) pCtx;
+
+ mmhMsg.type = pMsg->type;
+ mmhMsg.bodyptr = pMsg;
+ mmhMsg.bodyval = 0;
+
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+}
+/**
+ * limSendSmeDisassocNtf()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeMessages() to send
+ * eWNI_SME_DISASSOC_RSP/IND message to host
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * This function is used for sending eWNI_SME_DISASSOC_CNF,
+ * or eWNI_SME_DISASSOC_IND to host depending on
+ * disassociation trigger.
+ *
+ * @param peerMacAddr Indicates the peer MAC addr to which
+ * disassociate was initiated
+ * @param reasonCode Indicates the reason for Disassociation
+ * @param disassocTrigger Indicates the trigger for Disassociation
+ * @param aid Indicates the STAID. This parameter is
+ * present only on AP.
+ *
+ * @return None
+ */
+void
+limSendSmeDisassocNtf(tpAniSirGlobal pMac,
+ tSirMacAddr peerMacAddr,
+ tSirResultCodes reasonCode,
+ tANI_U16 disassocTrigger,
+ tANI_U16 aid,
+ tANI_U8 smesessionId,
+ tANI_U16 smetransactionId,
+ tpPESession psessionEntry)
+{
+
+ tANI_U8 *pBuf;
+ tSirSmeDisassocRsp *pSirSmeDisassocRsp;
+ tSirSmeDisassocInd *pSirSmeDisassocInd;
+ tANI_U32 *pMsg;
+
+ switch (disassocTrigger)
+ {
+ case eLIM_PEER_ENTITY_DISASSOC:
+ return;
+
+ case eLIM_HOST_DISASSOC:
+ /**
+ * Disassociation response due to
+ * host triggered disassociation
+ */
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDisassocRsp, sizeof(tSirSmeDisassocRsp)))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for eWNI_SME_DISASSOC_RSP\n"));
+
+ return;
+ }
+
+#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
+ sirStoreU16N((tANI_U8*)&pSirSmeDisassocRsp->messageType,
+ eWNI_SME_DISASSOC_RSP);
+ sirStoreU16N((tANI_U8*)&pSirSmeDisassocRsp->length,
+ sizeof(tSirSmeDisassocRsp));
+#else
+ pSirSmeDisassocRsp->messageType = eWNI_SME_DISASSOC_RSP;
+ pSirSmeDisassocRsp->length = sizeof(tSirSmeDisassocRsp);
+#endif
+ //sessionId
+ pBuf = (tANI_U8 *) &pSirSmeDisassocRsp->sessionId;
+ *pBuf = smesessionId;
+ pBuf++;
+
+ //transactionId
+ limCopyU16(pBuf, smetransactionId);
+ pBuf += sizeof(tANI_U16);
+
+ //statusCode
+ limCopyU32(pBuf, reasonCode);
+ pBuf += sizeof(tSirResultCodes);
+
+ //peerMacAddr
+ palCopyMemory( pMac->hHdd, pBuf, peerMacAddr, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ limCopyU16(pBuf, aid);
+ pBuf += sizeof(tANI_U16);
+
+ // perStaStats
+ limStatSerDes(pMac, &pMac->hal.halMac.macStats.pPerStaStats[aid].staStat, pBuf);
+#else
+ // Clear Station Stats
+ //for sta, it is always 1, IBSS is handled at halInitSta
+
+#endif//#if (WNI_POLARIS_FW_PRODUCT == AP)
+
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_RSP_EVENT,
+ psessionEntry, (tANI_U16)reasonCode, 0);
+#endif
+ pMsg = (tANI_U32*) pSirSmeDisassocRsp;
+ break;
+
+ default:
+ /**
+ * Disassociation indication due to Disassociation
+ * frame reception from peer entity or due to
+ * loss of link with peer entity.
+ */
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDisassocInd, sizeof(tSirSmeDisassocInd)))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for eWNI_SME_DISASSOC_IND\n"));
+
+ return;
+ }
+
+#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
+ sirStoreU16N((tANI_U8*)&pSirSmeDisassocInd->messageType,
+ eWNI_SME_DISASSOC_IND);
+ sirStoreU16N((tANI_U8*)&pSirSmeDisassocInd->length,
+ sizeof(tSirSmeDisassocInd));
+#else
+ pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND;
+ pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd);
+
+ /* Update SME session Id and Transaction Id */
+ pSirSmeDisassocInd->sessionId = smesessionId;
+ pSirSmeDisassocInd->transactionId = smetransactionId;
+#endif
+ pBuf = (tANI_U8 *) &pSirSmeDisassocInd->statusCode;
+
+ limCopyU32(pBuf, reasonCode);
+ pBuf += sizeof(tSirResultCodes);
+
+ palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+
+ palCopyMemory( pMac->hHdd, pBuf, peerMacAddr, sizeof(tSirMacAddr));
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ pBuf += sizeof(tSirMacAddr);
+ limCopyU16(pBuf, aid);
+ pBuf += sizeof(tANI_U16);
+
+ limStatSerDes(pMac, &pMac->hal.halMac.macStats.pPerStaStats[aid].staStat, pBuf);
+
+#endif//#if (WNI_POLARIS_FW_PRODUCT == AP)
+
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT,
+ psessionEntry, (tANI_U16)reasonCode, 0);
+#endif
+ pMsg = (tANI_U32*) pSirSmeDisassocInd;
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ PELOG1(limLog(pMac, LOG1,
+ FL("*** Sending DisAssocInd staId=%d, reasonCode=%d ***\n"),
+ aid, reasonCode);)
+#endif
+
+ break;
+ }
+
+ /* Delete the PE session Created */
+ if((psessionEntry != NULL) && ((psessionEntry ->limSystemRole == eLIM_STA_ROLE) ||
+ (psessionEntry ->limSystemRole == eLIM_BT_AMP_STA_ROLE)) )
+ {
+ peDeleteSession(pMac,psessionEntry);
+ }
+
+ if( IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
+ {
+ //Resume on the first active session channel.
+ peSetResumeChannel( pMac, peGetActiveSessionChannel( pMac ), 0);
+
+ limResumeLink( pMac, limSendSmeDisassocDeauthNtfPostResume,
+ (tANI_U32*) pMsg );
+ }
+ else
+ {
+ limSendSmeDisassocDeauthNtfPostResume( pMac, eHAL_STATUS_SUCCESS,
+ (tANI_U32*) pMsg );
+ }
+} /*** end limSendSmeDisassocNtf() ***/
+
+
+/** -----------------------------------------------------------------
+ \brief limSendSmeDisassocInd() - sends SME_DISASSOC_IND
+
+ After receiving disassociation frame from peer entity, this
+ function sends a eWNI_SME_DISASSOC_IND to SME with a specific
+ reason code.
+
+ \param pMac - global mac structure
+ \param pStaDs - station dph hash node
+ \return none
+ \sa
+ ----------------------------------------------------------------- */
+void
+limSendSmeDisassocInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
+{
+ tSirMsgQ mmhMsg;
+ tSirSmeDisassocInd *pSirSmeDisassocInd;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDisassocInd, sizeof(tSirSmeDisassocInd)))
+ {
+ limLog(pMac, LOGP, FL("palAllocateMemory failed for eWNI_SME_DISASSOC_IND\n"));
+ return;
+ }
+
+ //psessionEntry = peFindSessionByBssid(pMac,pStaDs->staAddr,&sessionId);
+#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
+ sirStoreU16N((tANI_U8*)&pSirSmeDisassocInd->messageType, eWNI_SME_DISASSOC_IND);
+ sirStoreU16N((tANI_U8*)&pSirSmeDisassocInd->length, sizeof(tSirSmeDisassocInd));
+#else
+ pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND;
+ pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd);
+#endif
+
+#if 0 //Commenting out all the serialization
+ //statusCode
+ pBuf = (tANI_U8 *) &pSirSmeDisassocInd->statusCode;
+ limCopyU32(pBuf, pStaDs->mlmStaContext.disassocReason);
+ pBuf += sizeof(tSirResultCodes);
+
+ //peerMacAddr
+ palCopyMemory( pMac->hHdd, pBuf, pStaDs->staAddr, sizeof(tSirMacAddr));
+
+#ifdef ANI_PRODUCT_TYPE_AP
+ pBuf += sizeof(tSirMacAddr);
+ //aid
+ limCopyU16(pBuf, pStaDs->assocId);
+ pBuf += sizeof(tANI_U16);
+
+ //perStaStats
+ limStatSerDes(pMac, &pMac->hal.halMac.macStats.pPerStaStats[pStaDs->assocId].staStat, pBuf);
+#endif
+#endif
+ pSirSmeDisassocInd->sessionId = psessionEntry->smeSessionId;
+ pSirSmeDisassocInd->transactionId = psessionEntry->transactionId;
+ pSirSmeDisassocInd->statusCode = pStaDs->mlmStaContext.disassocReason;
+
+ palCopyMemory( pMac->hHdd, pSirSmeDisassocInd->bssId , psessionEntry->bssId , sizeof(tSirMacAddr));
+
+ palCopyMemory( pMac->hHdd, pSirSmeDisassocInd->peerMacAddr , pStaDs->staAddr, sizeof(tSirMacAddr));
+
+#ifdef ANI_PRODUCT_TYPE_AP
+ pSirSmeDisassocInd->aid = pStaDs->assocId;
+ limStatSerDes(pMac, &pMac->hal.halMac.macStats.pPerStaStats[pStaDs->assocId].staStat,(tANI_U8*)&pSirSmeDisassocInd-> perStaStats );
+#endif
+#ifdef WLAN_SOFTAP_FEATURE
+ pSirSmeDisassocInd->staId = pStaDs->staIndex;
+#endif
+
+ mmhMsg.type = eWNI_SME_DISASSOC_IND;
+ mmhMsg.bodyptr = pSirSmeDisassocInd;
+ mmhMsg.bodyval = 0;
+
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT, psessionEntry, 0, (tANI_U16)pStaDs->mlmStaContext.disassocReason);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+
+} /*** end limSendSmeDisassocInd() ***/
+
+
+/** -----------------------------------------------------------------
+ \brief limSendSmeDeauthInd() - sends SME_DEAUTH_IND
+
+ After receiving deauthentication frame from peer entity, this
+ function sends a eWNI_SME_DEAUTH_IND to SME with a specific
+ reason code.
+
+ \param pMac - global mac structure
+ \param pStaDs - station dph hash node
+ \return none
+ \sa
+ ----------------------------------------------------------------- */
+void
+limSendSmeDeauthInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
+{
+#ifndef WLAN_SOFTAP_FEATURE
+ tANI_U8 *pBuf;
+#endif
+ tSirMsgQ mmhMsg;
+ tSirSmeDeauthInd *pSirSmeDeauthInd;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDeauthInd, sizeof(tSirSmeDeauthInd)))
+ {
+ limLog(pMac, LOGP, FL("palAllocateMemory failed for eWNI_SME_DEAUTH_IND \n"));
+ return;
+ }
+
+#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
+ sirStoreU16N((tANI_U8*)&pSirSmeDeauthInd->messageType, eWNI_SME_DEAUTH_IND);
+ sirStoreU16N((tANI_U8*)&pSirSmeDeauthInd->length, sizeof(tSirSmeDeauthInd));
+#else
+ pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
+ pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE
+ pSirSmeDeauthInd->sessionId = psessionEntry->smeSessionId;
+ pSirSmeDeauthInd->transactionId = psessionEntry->transactionId;
+ if(eSIR_INFRA_AP_MODE == psessionEntry->bssType)
+ {
+ pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.cleanupTrigger;
+ }
+ else
+ {
+ //Need to indicatet he reascon code over the air
+ pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.disassocReason;
+ }
+ //BSSID
+ palCopyMemory( pMac->hHdd, pSirSmeDeauthInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
+ //peerMacAddr
+ palCopyMemory( pMac->hHdd, pSirSmeDeauthInd->peerMacAddr, pStaDs->staAddr, sizeof(tSirMacAddr));
+#else
+
+ //sessionId
+ pBuf = (tANI_U8 *) &pSirSmeDeauthInd->sessionId;
+ *pBuf++ = psessionEntry->smeSessionId;
+
+ //transactionId
+ limCopyU16(pBuf, 0);
+ pBuf += sizeof(tANI_U16);
+
+ // status code
+ limCopyU32(pBuf, pStaDs->mlmStaContext.cleanupTrigger);
+ pBuf += sizeof(tSirResultCodes);
+
+ //bssid
+ palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+
+ //peerMacAddr
+ palCopyMemory( pMac->hHdd, pBuf, pStaDs->staAddr, sizeof(tSirMacAddr));
+#endif
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ pBuf += sizeof(tSirMacAddr);
+ limCopyU16(pBuf, pStaDs->staAddr);
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE
+ pSirSmeDeauthInd->staId = pStaDs->staIndex;
+#endif
+
+ mmhMsg.type = eWNI_SME_DEAUTH_IND;
+ mmhMsg.bodyptr = pSirSmeDeauthInd;
+ mmhMsg.bodyval = 0;
+
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT, psessionEntry, 0, pStaDs->mlmStaContext.cleanupTrigger);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+ return;
+} /*** end limSendSmeDeauthInd() ***/
+
+
+/**
+ * limSendSmeDeauthNtf()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeMessages() to send
+ * eWNI_SME_DISASSOC_RSP/IND message to host
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * This function is used for sending eWNI_SME_DEAUTH_CNF or
+ * eWNI_SME_DEAUTH_IND to host depending on deauthentication trigger.
+ *
+ * @param peerMacAddr Indicates the peer MAC addr to which
+ * deauthentication was initiated
+ * @param reasonCode Indicates the reason for Deauthetication
+ * @param deauthTrigger Indicates the trigger for Deauthetication
+ * @param aid Indicates the STAID. This parameter is present
+ * only on AP.
+ *
+ * @return None
+ */
+void
+limSendSmeDeauthNtf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tSirResultCodes reasonCode,
+ tANI_U16 deauthTrigger, tANI_U16 aid,tANI_U8 smesessionId, tANI_U16 smetransactionId)
+{
+ tANI_U8 *pBuf;
+ tSirSmeDeauthRsp *pSirSmeDeauthRsp;
+ tSirSmeDeauthInd *pSirSmeDeauthInd;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId;
+ tANI_U32 *pMsg;
+
+ psessionEntry = peFindSessionByBssid(pMac,peerMacAddr,&sessionId);
+ switch (deauthTrigger)
+ {
+ case eLIM_PEER_ENTITY_DEAUTH:
+ return;
+
+ case eLIM_HOST_DEAUTH:
+ /**
+ * Deauthentication response to host triggered
+ * deauthentication.
+ */
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDeauthRsp, sizeof(tSirSmeDeauthRsp)))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for eWNI_SME_DEAUTH_RSP\n"));
+
+ return;
+ }
+
+#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
+ sirStoreU16N((tANI_U8*) &(pSirSmeDeauthRsp->messageType),
+ eWNI_SME_DEAUTH_RSP);
+ sirStoreU16N((tANI_U8*) &(pSirSmeDeauthRsp->length),
+ sizeof(tSirSmeDeauthRsp));
+#else
+ pSirSmeDeauthRsp->messageType = eWNI_SME_DEAUTH_RSP;
+ pSirSmeDeauthRsp->length = sizeof(tSirSmeDeauthRsp);
+#endif
+ pSirSmeDeauthRsp->statusCode = reasonCode;
+ pSirSmeDeauthRsp->sessionId = smesessionId;
+ pSirSmeDeauthRsp->transactionId = smetransactionId;
+
+ pBuf = (tANI_U8 *) pSirSmeDeauthRsp->peerMacAddr;
+ palCopyMemory( pMac->hHdd, pBuf, peerMacAddr, sizeof(tSirMacAddr));
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ pBuf += sizeof(tSirMacAddr);
+ limCopyU16(pBuf, aid);
+#endif
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_RSP_EVENT,
+ psessionEntry, 0, (tANI_U16)reasonCode);
+#endif
+ pMsg = (tANI_U32*)pSirSmeDeauthRsp;
+
+ break;
+
+ default:
+ /**
+ * Deauthentication indication due to Deauthentication
+ * frame reception from peer entity or due to
+ * loss of link with peer entity.
+ */
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDeauthInd, sizeof(tSirSmeDeauthInd)))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for eWNI_SME_DEAUTH_Ind\n"));
+
+ return;
+ }
+
+#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
+ sirStoreU16N((tANI_U8*)&pSirSmeDeauthInd->messageType,
+ eWNI_SME_DEAUTH_IND);
+ sirStoreU16N((tANI_U8*)&pSirSmeDeauthInd->length,
+ sizeof(tSirSmeDeauthInd));
+#else
+ pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
+ pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
+#endif
+
+ // sessionId
+ pBuf = (tANI_U8*) &pSirSmeDeauthInd->sessionId;
+ *pBuf++ = smesessionId;
+
+ //transaction ID
+ limCopyU16(pBuf, smetransactionId);
+ pBuf += sizeof(tANI_U16);
+
+ // status code
+ limCopyU32(pBuf, reasonCode);
+ pBuf += sizeof(tSirResultCodes);
+
+ //bssId
+ palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+
+ //peerMacAddr
+ palCopyMemory( pMac->hHdd, pSirSmeDeauthInd->peerMacAddr, peerMacAddr, sizeof(tSirMacAddr));
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ pBuf += sizeof(tSirMacAddr);
+ limCopyU16(pBuf, aid);
+#endif
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT,
+ psessionEntry, 0, (tANI_U16)reasonCode);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+ pMsg = (tANI_U32*)pSirSmeDeauthInd;
+
+ break;
+ }
+
+ /*Delete the PE session created */
+ if(psessionEntry != NULL)
+ {
+ peDeleteSession(pMac,psessionEntry);
+ }
+
+ if( IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
+ {
+ //Resume on the first active session channel.
+ peSetResumeChannel( pMac, peGetActiveSessionChannel( pMac ), 0);
+
+ limResumeLink( pMac, limSendSmeDisassocDeauthNtfPostResume,
+ (tANI_U32*) pMsg );
+ }
+ else
+ {
+ limSendSmeDisassocDeauthNtfPostResume( pMac, eHAL_STATUS_SUCCESS,
+ (tANI_U32*) pMsg );
+ }
+} /*** end limSendSmeDeauthNtf() ***/
+
+
+/**
+ * limSendSmeWmStatusChangeNtf()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeMessages() to send
+ * eWNI_SME_WM_STATUS_CHANGE_NTF message to host.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param statusChangeCode Indicates the change in the wireless medium.
+ * @param statusChangeInfo Indicates the information associated with
+ * change in the wireless medium.
+ * @param infoLen Indicates the length of status change information
+ * being sent.
+ *
+ * @return None
+ */
+void
+limSendSmeWmStatusChangeNtf(tpAniSirGlobal pMac, tSirSmeStatusChangeCode statusChangeCode,
+ tANI_U32 *pStatusChangeInfo, tANI_U16 infoLen, tANI_U8 sessionId)
+{
+ tSirMsgQ mmhMsg;
+ tSirSmeWmStatusChangeNtf *pSirSmeWmStatusChangeNtf;
+ eHalStatus status;
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+ tANI_U32 bufLen;
+ tANI_U16 length=0;
+ tANI_U8 *pBuf;
+#endif
+
+
+
+ status = palAllocateMemory( pMac->hHdd, (void **)&pSirSmeWmStatusChangeNtf,
+ sizeof(tSirSmeWmStatusChangeNtf));
+ if (status != eHAL_STATUS_SUCCESS)
+ {
+ limLog(pMac, LOGE,
+ FL("call to palAllocateMemory failed for eWNI_SME_WM_STATUS_CHANGE_NTF, status = %d\n"),
+ status);
+ return;
+ }
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+ pBuf = (tANI_U8 *)pSirSmeWmStatusChangeNtf;
+#endif
+
+ mmhMsg.type = eWNI_SME_WM_STATUS_CHANGE_NTF;
+ mmhMsg.bodyval = 0;
+ mmhMsg.bodyptr = pSirSmeWmStatusChangeNtf;
+
+ switch(statusChangeCode)
+ {
+ case eSIR_SME_RADAR_DETECTED:
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+ bufLen = sizeof(tSirSmeWmStatusChangeNtf);
+ if ((limSmeWmStatusChangeHeaderSerDes(pMac,
+ statusChangeCode,
+ pBuf,
+ &length,
+ bufLen,
+ sessionId) != eSIR_SUCCESS))
+ {
+ palFreeMemory(pMac->hHdd, (void *) pSirSmeWmStatusChangeNtf);
+ limLog(pMac, LOGP, FL("Header SerDes failed \n"));
+ return;
+ }
+ pBuf += length;
+ bufLen -= length;
+ if ((limRadioInfoSerDes(pMac,
+ (tpSirRadarInfo)pStatusChangeInfo,
+ pBuf,
+ &length,
+ bufLen) != eSIR_SUCCESS))
+ {
+ palFreeMemory(pMac->hHdd, (void *) pSirSmeWmStatusChangeNtf);
+ limLog(pMac, LOGP, FL("Radio Info SerDes failed \n"));
+ return;
+ }
+
+ pBuf = (tANI_U8 *) pSirSmeWmStatusChangeNtf;
+ pBuf += sizeof(tANI_U16);
+ limCopyU16(pBuf, length);
+#endif
+ break;
+
+ case eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP:
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+
+ if( eSIR_SUCCESS != nonTitanBssFoundSerDes( pMac,
+ (tpSirNeighborBssWdsInfo) pStatusChangeInfo,
+ pBuf,
+ &length,
+ sessionId))
+ {
+ palFreeMemory(pMac->hHdd, (void *) pSirSmeWmStatusChangeNtf);
+ limLog( pMac, LOGP,
+ FL("Unable to serialize nonTitanBssFoundSerDes!\n"));
+ return;
+ }
+#endif
+ break;
+
+ case eSIR_SME_BACKGROUND_SCAN_FAIL:
+ limPackBkgndScanFailNotify(pMac,
+ statusChangeCode,
+ (tpSirBackgroundScanInfo)pStatusChangeInfo,
+ pSirSmeWmStatusChangeNtf, sessionId);
+ break;
+
+ default:
+#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
+ sirStoreU16N((tANI_U8*)&pSirSmeWmStatusChangeNtf->messageType,
+ eWNI_SME_WM_STATUS_CHANGE_NTF );
+ sirStoreU16N((tANI_U8*)&pSirSmeWmStatusChangeNtf->length,
+ (sizeof(tSirSmeWmStatusChangeNtf)));
+ pSirSmeWmStatusChangeNtf->sessionId = sessionId;
+ sirStoreU32N((tANI_U8*)&pSirSmeWmStatusChangeNtf->statusChangeCode,
+ statusChangeCode);
+#else
+ pSirSmeWmStatusChangeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF;
+ pSirSmeWmStatusChangeNtf->statusChangeCode = statusChangeCode;
+ pSirSmeWmStatusChangeNtf->length = sizeof(tSirSmeWmStatusChangeNtf);
+ pSirSmeWmStatusChangeNtf->sessionId = sessionId;
+#endif
+ if(sizeof(pSirSmeWmStatusChangeNtf->statusChangeInfo) >= infoLen)
+ {
+ palCopyMemory( pMac->hHdd, (tANI_U8 *)&pSirSmeWmStatusChangeNtf->statusChangeInfo, (tANI_U8 *)pStatusChangeInfo, infoLen);
+ }
+ limLog(pMac, LOGE, FL("***---*** StatusChg: code 0x%x, length %d ***---***\n"),
+ statusChangeCode, infoLen);
+ break;
+ }
+
+
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ if (eSIR_SUCCESS != limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT))
+ {
+ palFreeMemory(pMac->hHdd, (void *) pSirSmeWmStatusChangeNtf);
+ limLog( pMac, LOGP, FL("limSysProcessMmhMsgApi failed\n"));
+ }
+
+} /*** end limSendSmeWmStatusChangeNtf() ***/
+
+
+/**
+ * limSendSmeSetContextRsp()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeMessages() to send
+ * eWNI_SME_SETCONTEXT_RSP message to host
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param peerMacAddr Indicates the peer MAC addr to which
+ * setContext was performed
+ * @param aid Indicates the aid corresponding to the peer MAC
+ * address
+ * @param resultCode Indicates the result of previously issued
+ * eWNI_SME_SETCONTEXT_RSP message
+ *
+ * @return None
+ */
+void
+limSendSmeSetContextRsp(tpAniSirGlobal pMac,
+ tSirMacAddr peerMacAddr, tANI_U16 aid,
+ tSirResultCodes resultCode,
+ tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
+{
+
+ tANI_U8 *pBuf;
+ tSirMsgQ mmhMsg;
+ tSirSmeSetContextRsp *pSirSmeSetContextRsp;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeSetContextRsp, sizeof(tSirSmeSetContextRsp)))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for SmeSetContextRsp\n"));
+
+ return;
+ }
+
+#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
+ sirStoreU16N((tANI_U8*)&pSirSmeSetContextRsp->messageType,
+ eWNI_SME_SETCONTEXT_RSP);
+ sirStoreU16N((tANI_U8*)&pSirSmeSetContextRsp->length,
+ sizeof(tSirSmeSetContextRsp));
+#else
+ pSirSmeSetContextRsp->messageType = eWNI_SME_SETCONTEXT_RSP;
+ pSirSmeSetContextRsp->length = sizeof(tSirSmeSetContextRsp);
+#endif
+ pSirSmeSetContextRsp->statusCode = resultCode;
+
+ pBuf = pSirSmeSetContextRsp->peerMacAddr;
+
+ palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ limCopyU16(pBuf, aid);
+ pBuf += sizeof(tANI_U16);
+#endif
+
+ /* Update SME session and transaction Id*/
+ pSirSmeSetContextRsp->sessionId = smesessionId;
+ pSirSmeSetContextRsp->transactionId = smetransactionId;
+
+ mmhMsg.type = eWNI_SME_SETCONTEXT_RSP;
+ mmhMsg.bodyptr = pSirSmeSetContextRsp;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+} /*** end limSendSmeSetContextRsp() ***/
+
+/**
+ * limSendSmeRemoveKeyRsp()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeMessages() to send
+ * eWNI_SME_REMOVEKEY_RSP message to host
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param peerMacAddr Indicates the peer MAC addr to which
+ * Removekey was performed
+ * @param aid Indicates the aid corresponding to the peer MAC
+ * address
+ * @param resultCode Indicates the result of previously issued
+ * eWNI_SME_REMOVEKEY_RSP message
+ *
+ * @return None
+ */
+void
+limSendSmeRemoveKeyRsp(tpAniSirGlobal pMac,
+ tSirMacAddr peerMacAddr,
+ tSirResultCodes resultCode,
+ tpPESession psessionEntry,tANI_U8 smesessionId,
+ tANI_U16 smetransactionId)
+{
+ tANI_U8 *pBuf;
+ tSirMsgQ mmhMsg;
+ tSirSmeRemoveKeyRsp *pSirSmeRemoveKeyRsp;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeRemoveKeyRsp, sizeof(tSirSmeRemoveKeyRsp)))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for SmeRemoveKeyRsp\n"));
+
+ return;
+ }
+
+#if defined (ANI_PRODUCT_TYPE_AP) && defined(ANI_LITTLE_BYTE_ENDIAN)
+ sirStoreU16N((tANI_U8*)&pSirSmeRemoveKeyRsp->messageType,
+ eWNI_SME_REMOVEKEY_RSP);
+ sirStoreU16N((tANI_U8*)&pSirSmeRemoveKeyRsp->length,
+ sizeof(tSirSmeRemoveKeyRsp));
+
+#endif
+
+
+ if(psessionEntry != NULL)
+ {
+ pBuf = pSirSmeRemoveKeyRsp->peerMacAddr;
+ palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ limCopyU32(pBuf, resultCode);
+ }
+
+ pSirSmeRemoveKeyRsp->messageType = eWNI_SME_REMOVEKEY_RSP;
+ pSirSmeRemoveKeyRsp->length = sizeof(tSirSmeRemoveKeyRsp);
+ pSirSmeRemoveKeyRsp->statusCode = resultCode;
+
+ /* Update SME session and transaction Id*/
+ pSirSmeRemoveKeyRsp->sessionId = smesessionId;
+ pSirSmeRemoveKeyRsp->transactionId = smetransactionId;
+
+ mmhMsg.type = eWNI_SME_REMOVEKEY_RSP;
+ mmhMsg.bodyptr = pSirSmeRemoveKeyRsp;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+} /*** end limSendSmeSetContextRsp() ***/
+
+
+/**
+ * limSendSmePromiscuousModeRsp()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeMessages() to send
+ * eWNI_PROMISCUOUS_MODE_RSP message to host
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * This function is used for sending eWNI_SME_PROMISCUOUS_MODE_RSP to
+ * host as a reply to eWNI_SME_PROMISCUOUS_MODE_REQ directive from it.
+ *
+ * @param None
+ * @return None
+ */
+void
+limSendSmePromiscuousModeRsp(tpAniSirGlobal pMac)
+{
+#if 0
+ tSirMsgQ mmhMsg;
+ tSirMbMsg *pMbMsg;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMbMsg, sizeof(tSirMbMsg)))
+ {
+ // Log error
+ limLog(pMac, LOGP, FL("call to palAllocateMemory failed\n"));
+
+ return;
+ }
+
+ pMbMsg->type = eWNI_SME_PROMISCUOUS_MODE_RSP;
+ pMbMsg->msgLen = 4;
+
+ mmhMsg.type = eWNI_SME_PROMISCUOUS_MODE_RSP;
+ mmhMsg.bodyptr = pMbMsg;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+#endif
+} /*** end limSendSmePromiscuousModeRsp() ***/
+
+
+
+/**
+ * limSendSmeNeighborBssInd()
+ *
+ *FUNCTION:
+ * This function is called by limLookupNaddHashEntry() to send
+ * eWNI_SME_NEIGHBOR_BSS_IND message to host
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * This function is used for sending eWNI_SME_NEIGHBOR_BSS_IND to
+ * host upon detecting new BSS during background scanning if CFG
+ * option is enabled for sending such indication
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limSendSmeNeighborBssInd(tpAniSirGlobal pMac,
+ tLimScanResultNode *pBssDescr)
+{
+ tSirMsgQ msgQ;
+ tANI_U32 val;
+ tSirSmeNeighborBssInd *pNewBssInd;
+
+ if ((pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_WT_SCAN_STATE) ||
+ ((pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE) &&
+ pMac->lim.gLimRspReqd))
+ {
+ // LIM is not in background scan state OR
+ // current scan is initiated by HDD.
+ // No need to send new BSS indication to HDD
+ return;
+ }
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, &val) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("could not get NEIGHBOR_BSS_IND from CFG\n"));
+
+ return;
+ }
+
+ if (val == 0)
+ return;
+
+ /**
+ * Need to indicate new BSSs found during
+ * background scanning to host.
+ * Allocate buffer for sending indication.
+ * Length of buffer is length of BSS description
+ * and length of header itself
+ */
+ val = pBssDescr->bssDescription.length + sizeof(tANI_U16) + sizeof(tANI_U32) + sizeof(tANI_U8);
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pNewBssInd, val))
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for eWNI_SME_NEIGHBOR_BSS_IND\n"));
+
+ return;
+ }
+
+#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
+ sirStoreU16N((tANI_U8*) &pNewBssInd->messageType,
+ eWNI_SME_NEIGHBOR_BSS_IND);
+ sirStoreU16N((tANI_U8*)&pNewBssInd->length, (tANI_U16)val );
+#else
+ pNewBssInd->messageType = eWNI_SME_NEIGHBOR_BSS_IND;
+ pNewBssInd->length = (tANI_U16) val;
+#endif
+ pNewBssInd->sessionId = 0;
+
+#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA)
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pNewBssInd->bssDescription,
+ (tANI_U8 *) &pBssDescr->bssDescription,
+ pBssDescr->bssDescription.length + sizeof(tANI_U16));
+#endif
+
+ msgQ.type = eWNI_SME_NEIGHBOR_BSS_IND;
+ msgQ.bodyptr = pNewBssInd;
+ msgQ.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
+} /*** end limSendSmeNeighborBssInd() ***/
+
+/** -----------------------------------------------------------------
+ \brief limSendSmeAddtsRsp() - sends SME ADDTS RSP
+ \ This function sends a eWNI_SME_ADDTS_RSP to SME.
+ \ SME only looks at rc and tspec field.
+ \param pMac - global mac structure
+ \param rspReqd - is SmeAddTsRsp required
+ \param status - status code of SME_ADD_TS_RSP
+ \return tspec
+ \sa
+ ----------------------------------------------------------------- */
+void
+limSendSmeAddtsRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd, tANI_U32 status, tpPESession psessionEntry,
+ tSirMacTspecIE tspec, tANI_U8 smesessionId, tANI_U16 smetransactionId)
+{
+ tpSirAddtsRsp rsp;
+ tSirMsgQ mmhMsg;
+
+ if (! rspReqd)
+ return;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp, sizeof(tSirAddtsRsp)))
+ {
+ limLog(pMac, LOGP, FL("palAllocateMemory failed for ADDTS_RSP"));
+ return;
+ }
+
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
+ rsp->messageType = eWNI_SME_ADDTS_RSP;
+ rsp->rc = status;
+ rsp->rsp.status = (enum eSirMacStatusCodes) status;
+ //palCopyMemory( pMac->hHdd, (tANI_U8 *) &rsp->rsp.tspec, (tANI_U8 *) &addts->tspec, sizeof(addts->tspec));
+ rsp->rsp.tspec = tspec;
+
+ /* Update SME session Id and transcation Id */
+ rsp->sessionId = smesessionId;
+ rsp->transactionId = smetransactionId;
+
+ mmhMsg.type = eWNI_SME_ADDTS_RSP;
+ mmhMsg.bodyptr = rsp;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_RSP_EVENT, psessionEntry, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+ return;
+}
+
+void
+limSendSmeAddtsInd(tpAniSirGlobal pMac, tpSirAddtsReqInfo addts)
+{
+ tpSirAddtsRsp rsp;
+ tSirMsgQ mmhMsg;
+
+ limLog(pMac, LOGW, "SendSmeAddtsInd (token %d, tsid %d, up %d)\n",
+ addts->dialogToken,
+ addts->tspec.tsinfo.traffic.tsid,
+ addts->tspec.tsinfo.traffic.userPrio);
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp, sizeof(tSirAddtsRsp)))
+ {
+ // Log error
+ limLog(pMac, LOGP, FL("palAllocateMemory failed for ADDTS_IND\n"));
+ return;
+ }
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
+
+ rsp->messageType = eWNI_SME_ADDTS_IND;
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &rsp->rsp, (tANI_U8 *) addts, sizeof(*addts));
+
+ mmhMsg.type = eWNI_SME_ADDTS_IND;
+ mmhMsg.bodyptr = rsp;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+}
+
+void
+limSendSmeDeltsRsp(tpAniSirGlobal pMac, tpSirDeltsReq delts, tANI_U32 status,tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
+{
+ tpSirDeltsRsp rsp;
+ tSirMsgQ mmhMsg;
+
+ limLog(pMac, LOGW, "SendSmeDeltsRsp (aid %d, tsid %d, up %d) status %d\n",
+ delts->aid,
+ delts->req.tsinfo.traffic.tsid,
+ delts->req.tsinfo.traffic.userPrio,
+ status);
+ if (! delts->rspReqd)
+ return;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp, sizeof(tSirDeltsRsp)))
+ {
+ // Log error
+ limLog(pMac, LOGP, FL("palAllocateMemory failed for DELTS_RSP\n"));
+ return;
+ }
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
+
+ if(psessionEntry != NULL)
+ {
+
+ rsp->aid = delts->aid;
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &rsp->macAddr[0], (tANI_U8 *) &delts->macAddr[0], 6);
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &rsp->rsp, (tANI_U8 *) &delts->req, sizeof(tSirDeltsReqInfo));
+ }
+
+
+ rsp->messageType = eWNI_SME_DELTS_RSP;
+ rsp->rc = status;
+
+ /* Update SME session Id and transcation Id */
+ rsp->sessionId = smesessionId;
+ rsp->transactionId = smetransactionId;
+
+ mmhMsg.type = eWNI_SME_DELTS_RSP;
+ mmhMsg.bodyptr = rsp;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+}
+
+void
+limSendSmeDeltsInd(tpAniSirGlobal pMac, tpSirDeltsReqInfo delts, tANI_U16 aid,tpPESession psessionEntry)
+{
+ tpSirDeltsRsp rsp;
+ tSirMsgQ mmhMsg;
+
+ limLog(pMac, LOGW, "SendSmeDeltsInd (aid %d, tsid %d, up %d)\n",
+ aid,
+ delts->tsinfo.traffic.tsid,
+ delts->tsinfo.traffic.userPrio);
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp, sizeof(tSirDeltsRsp)))
+ {
+ // Log error
+ limLog(pMac, LOGP, FL("palAllocateMemory failed for DELTS_IND\n"));
+ return;
+ }
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
+
+ rsp->messageType = eWNI_SME_DELTS_IND;
+ rsp->rc = eSIR_SUCCESS;
+ rsp->aid = aid;
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &rsp->rsp, (tANI_U8 *) delts, sizeof(*delts));
+
+ /* Update SME session Id and SME transaction Id */
+
+ rsp->sessionId = psessionEntry->smeSessionId;
+ rsp->transactionId = psessionEntry->transactionId;
+
+ mmhMsg.type = eWNI_SME_DELTS_IND;
+ mmhMsg.bodyptr = rsp;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_IND_EVENT, psessionEntry, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+}
+
+/**
+ * limSendSmeStatsRsp()
+ *
+ *FUNCTION:
+ * This function is called to send 802.11 statistics response to HDD.
+ * This function posts the result back to HDD. This is a response to
+ * HDD's request for statistics.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param p80211Stats Statistics sent in response
+ * @param resultCode TODO:
+ *
+ *
+ * @return none
+ */
+
+void
+limSendSmeStatsRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
+{
+ tSirMsgQ mmhMsg;
+ tSirSmeRsp *pMsgHdr = (tSirSmeRsp*) stats;
+
+ switch(msgType)
+ {
+ case WDA_STA_STAT_RSP:
+ mmhMsg.type = eWNI_SME_STA_STAT_RSP;
+ break;
+ case WDA_AGGR_STAT_RSP:
+ mmhMsg.type = eWNI_SME_AGGR_STAT_RSP;
+ break;
+ case WDA_GLOBAL_STAT_RSP:
+ mmhMsg.type = eWNI_SME_GLOBAL_STAT_RSP;
+ break;
+ case WDA_STAT_SUMM_RSP:
+ mmhMsg.type = eWNI_SME_STAT_SUMM_RSP;
+ break;
+ default:
+ mmhMsg.type = msgType; //Response from within PE
+ break;
+ }
+
+ pMsgHdr->messageType = mmhMsg.type;
+
+ mmhMsg.bodyptr = stats;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+
+ return;
+
+} /*** end limSendSmeStatsRsp() ***/
+
+/**
+ * limSendSmePEStatisticsRsp()
+ *
+ *FUNCTION:
+ * This function is called to send 802.11 statistics response to HDD.
+ * This function posts the result back to HDD. This is a response to
+ * HDD's request for statistics.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param p80211Stats Statistics sent in response
+ * @param resultCode TODO:
+ *
+ *
+ * @return none
+ */
+
+void
+limSendSmePEStatisticsRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
+{
+ tSirMsgQ mmhMsg;
+ tANI_U8 sessionId;
+ tAniGetPEStatsRsp *pPeStats = (tAniGetPEStatsRsp *) stats;
+ tpPESession pPeSessionEntry;
+
+ //Get the Session Id based on Sta Id
+ pPeSessionEntry = peFindSessionByStaId(pMac, pPeStats->staId, &sessionId);
+
+ //Fill the Session Id
+ if(NULL != pPeSessionEntry)
+ {
+ //Fill the Session Id
+ pPeStats->sessionId = pPeSessionEntry->smeSessionId;
+ }
+
+ pPeStats->msgType = eWNI_SME_GET_STATISTICS_RSP;
+
+
+ //msgType should be WDA_GET_STATISTICS_RSP
+ mmhMsg.type = eWNI_SME_GET_STATISTICS_RSP;
+
+ mmhMsg.bodyptr = stats;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+
+ return;
+
+} /*** end limSendSmePEStatisticsRsp() ***/
+
+
+void
+limSendSmeIBSSPeerInd(
+ tpAniSirGlobal pMac,
+ tSirMacAddr peerMacAddr,
+ tANI_U16 staIndex,
+ tANI_U8 ucastIdx,
+ tANI_U8 bcastIdx,
+ tANI_U8 *beacon,
+ tANI_U16 beaconLen,
+ tANI_U16 msgType,
+ tANI_U8 sessionId)
+{
+ tSirMsgQ mmhMsg;
+ tSmeIbssPeerInd *pNewPeerInd;
+
+ if(eSIR_SUCCESS !=
+ palAllocateMemory(pMac->hHdd,(void * *) &pNewPeerInd,(sizeof(tSmeIbssPeerInd) + beaconLen)))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
+ return;
+ }
+
+ palZeroMemory(pMac->hHdd, (void *) pNewPeerInd, (sizeof(tSmeIbssPeerInd) + beaconLen));
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pNewPeerInd->peerAddr,
+ peerMacAddr, sizeof(tSirMacAddr));
+ pNewPeerInd->staId= staIndex;
+ pNewPeerInd->ucastSig = ucastIdx;
+ pNewPeerInd->bcastSig = bcastIdx;
+ pNewPeerInd->mesgLen = sizeof(tSmeIbssPeerInd) + beaconLen;
+ pNewPeerInd->mesgType = msgType;
+ pNewPeerInd->sessionId = sessionId;
+
+ if ( beacon != NULL )
+ {
+ palCopyMemory(pMac->hHdd, (void*) ((tANI_U8*)pNewPeerInd+sizeof(tSmeIbssPeerInd)), (void*)beacon, beaconLen);
+ }
+
+ mmhMsg.type = msgType;
+// mmhMsg.bodyval = (tANI_U32) pNewPeerInd;
+ mmhMsg.bodyptr = pNewPeerInd;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+
+}
+
+
+/** -----------------------------------------------------------------
+ \brief limSendExitBmpsInd() - sends exit bmps indication
+
+ This function sends a eWNI_PMC_EXIT_BMPS_IND with a specific reason
+ code to SME. This will trigger SME to get out of BMPS mode.
+
+ \param pMac - global mac structure
+ \param reasonCode - reason for which PE wish to exit BMPS
+ \return none
+ \sa
+ ----------------------------------------------------------------- */
+void limSendExitBmpsInd(tpAniSirGlobal pMac, tExitBmpsReason reasonCode)
+{
+ tSirMsgQ mmhMsg;
+ tANI_U16 msgLen = 0;
+ tpSirSmeExitBmpsInd pExitBmpsInd;
+
+ msgLen = sizeof(tSirSmeExitBmpsInd);
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pExitBmpsInd, msgLen ))
+ {
+ limLog(pMac, LOGP, FL("palAllocateMemory failed for PMC_EXIT_BMPS_IND \n"));
+ return;
+ }
+ palZeroMemory(pMac->hHdd, pExitBmpsInd, msgLen);
+
+#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
+ sirStoreU16N((tANI_U8*)&pExitBmpsInd->mesgType, eWNI_PMC_EXIT_BMPS_IND);
+ sirStoreU16N((tANI_U8*)&pExitBmpsInd->mesgLen, msgLen);
+#else
+ pExitBmpsInd->mesgType = eWNI_PMC_EXIT_BMPS_IND;
+ pExitBmpsInd->mesgLen = msgLen;
+#endif
+ pExitBmpsInd->exitBmpsReason = reasonCode;
+ pExitBmpsInd->statusCode = eSIR_SME_SUCCESS;
+
+ mmhMsg.type = eWNI_PMC_EXIT_BMPS_IND;
+ mmhMsg.bodyptr = pExitBmpsInd;
+ mmhMsg.bodyval = 0;
+
+ PELOG1(limLog(pMac, LOG1, FL("Sending eWNI_PMC_EXIT_BMPS_IND to SME. \n"));)
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_BMPS_IND_EVENT, peGetValidPowerSaveSession(pMac), 0, (tANI_U16)reasonCode);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+ return;
+
+} /*** end limSendExitBmpsInd() ***/
+
+
+
+
+/*--------------------------------------------------------------------------
+ \brief peDeleteSession() - Handle the Delete BSS Response from HAL.
+
+
+ \param pMac - pointer to global adapter context
+ \param sessionId - Message pointer.
+
+ \sa
+ --------------------------------------------------------------------------*/
+
+void limHandleDeleteBssRsp(tpAniSirGlobal pMac,tpSirMsgQ MsgQ)
+{
+ tpPESession psessionEntry;
+ tpDeleteBssParams pDelBss = (tpDeleteBssParams)(MsgQ->bodyptr);
+ if((psessionEntry = peFindSessionBySessionId(pMac,pDelBss->sessionId))==NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+ if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
+ {
+ limIbssDelBssRsp(pMac, MsgQ->bodyptr,psessionEntry);
+ }
+ else if(psessionEntry->limSystemRole == eLIM_UNKNOWN_ROLE)
+ {
+ limProcessSmeDelBssRsp(pMac, MsgQ->bodyval,psessionEntry);
+ }
+
+ else
+ limProcessMlmDelBssRsp(pMac,MsgQ,psessionEntry);
+
+}
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+/** -----------------------------------------------------------------
+ \brief limSendSmeAggrQosRsp() - sends SME FT AGGR QOS RSP
+ \ This function sends a eWNI_SME_FT_AGGR_QOS_RSP to SME.
+ \ SME only looks at rc and tspec field.
+ \param pMac - global mac structure
+ \param rspReqd - is SmeAddTsRsp required
+ \param status - status code of eWNI_SME_FT_AGGR_QOS_RSP
+ \return tspec
+ \sa
+ ----------------------------------------------------------------- */
+void
+limSendSmeAggrQosRsp(tpAniSirGlobal pMac, tpSirAggrQosRsp aggrQosRsp,
+ tANI_U8 smesessionId)
+{
+ tSirMsgQ mmhMsg;
+
+ mmhMsg.type = eWNI_SME_FT_AGGR_QOS_RSP;
+ mmhMsg.bodyptr = aggrQosRsp;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+
+ return;
+}
+#endif
+
+/** -----------------------------------------------------------------
+ \brief limSendSmePreChannelSwitchInd() - sends an indication to SME
+ before switching channels for spectrum manangement.
+
+ This function sends a eWNI_SME_PRE_SWITCH_CHL_IND to SME.
+
+ \param pMac - global mac structure
+ \return none
+ \sa
+ ----------------------------------------------------------------- */
+void
+limSendSmePreChannelSwitchInd(tpAniSirGlobal pMac)
+{
+ tSirMsgQ mmhMsg;
+
+ mmhMsg.type = eWNI_SME_PRE_SWITCH_CHL_IND;
+ mmhMsg.bodyptr = NULL;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+
+ return;
+}
+
+/** -----------------------------------------------------------------
+ \brief limSendSmePostChannelSwitchInd() - sends an indication to SME
+ after channel switch for spectrum manangement is complete.
+
+ This function sends a eWNI_SME_POST_SWITCH_CHL_IND to SME.
+
+ \param pMac - global mac structure
+ \return none
+ \sa
+ ----------------------------------------------------------------- */
+void
+limSendSmePostChannelSwitchInd(tpAniSirGlobal pMac)
+{
+ tSirMsgQ mmhMsg;
+
+ mmhMsg.type = eWNI_SME_POST_SWITCH_CHL_IND;
+ mmhMsg.bodyptr = NULL;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+
+ return;
+}
+
+void limSendSmeMaxAssocExceededNtf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
+ tANI_U8 smesessionId)
+{
+ tSirMsgQ mmhMsg;
+ tSmeMaxAssocInd *pSmeMaxAssocInd;
+
+ if(eSIR_SUCCESS !=
+ palAllocateMemory(pMac->hHdd,(void **)&pSmeMaxAssocInd, sizeof(tSmeMaxAssocInd)))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
+ return;
+ }
+ palZeroMemory(pMac->hHdd, (void *) pSmeMaxAssocInd, sizeof(tSmeMaxAssocInd));
+ palCopyMemory( pMac->hHdd, (tANI_U8 *)pSmeMaxAssocInd->peerMac,
+ (tANI_U8 *)peerMacAddr, sizeof(tSirMacAddr));
+ pSmeMaxAssocInd->mesgType = eWNI_SME_MAX_ASSOC_EXCEEDED;
+ pSmeMaxAssocInd->mesgLen = sizeof(tSmeMaxAssocInd);
+ pSmeMaxAssocInd->sessionId = smesessionId;
+ mmhMsg.type = pSmeMaxAssocInd->mesgType;
+ mmhMsg.bodyptr = pSmeMaxAssocInd;
+ PELOG1(limLog(pMac, LOG1, FL("msgType %s peerMacAddr %02x-%02x-%02x-%02x-%02x-%02x"
+ "sme session id %d\n"),"eWNI_SME_MAX_ASSOC_EXCEEDED", peerMacAddr[0], peerMacAddr[1],
+ peerMacAddr[2], peerMacAddr[3], peerMacAddr[4], peerMacAddr[5], smesessionId);)
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+
+ return;
+}
diff --git a/CORE/MAC/src/pe/lim/limSendSmeRspMessages.h b/CORE/MAC/src/pe/lim/limSendSmeRspMessages.h
new file mode 100644
index 0000000..d5e8050
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limSendSmeRspMessages.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limSendSmeRspMessages.h contains the definitions for
+ * sending SME response/notification messages to applications above
+ * MAC software.
+ * Author: Chandra Modumudi
+ * Date: 02/11/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+#ifndef __LIM_SEND_SME_RSP_H
+#define __LIM_SEND_SME_RSP_H
+
+#include "sirCommon.h"
+#include "sirApi.h"
+#include "sirMacProtDef.h"
+
+
+// Functions for sending responses to Host
+void limSendSmeRsp(tpAniSirGlobal, tANI_U16, tSirResultCodes, tANI_U8 , tANI_U16);
+void limSendSmeStartBssRsp(tpAniSirGlobal, tANI_U16, tSirResultCodes,tpPESession,tANI_U8,tANI_U16);
+void limSendSmeScanRsp(tpAniSirGlobal, tANI_U16, tSirResultCodes,tANI_U8, tANI_U16);
+void limPostSmeScanRspMessage(tpAniSirGlobal, tANI_U16, tSirResultCodes,tANI_U8,tANI_U16);
+void limSendSmeAuthRsp(tpAniSirGlobal, tSirResultCodes,
+ tSirMacAddr, tAniAuthType, tANI_U16,tpPESession,tANI_U8,tANI_U16);
+
+void limSendSmeJoinReassocRsp(tpAniSirGlobal, tANI_U16, tSirResultCodes, tANI_U16,tpPESession,tANI_U8,tANI_U16);
+void limSendSmeDisassocNtf(tpAniSirGlobal, tSirMacAddr, tSirResultCodes, tANI_U16, tANI_U16,tANI_U8,tANI_U16,tpPESession);
+void limSendSmeDeauthNtf(tpAniSirGlobal, tSirMacAddr, tSirResultCodes, tANI_U16, tANI_U16, tANI_U8, tANI_U16);
+void limSendSmeDisassocInd(tpAniSirGlobal, tpDphHashNode,tpPESession);
+void limSendSmeDeauthInd(tpAniSirGlobal, tpDphHashNode, tpPESession psessionEntry);
+
+
+
+void limSendSmeWmStatusChangeNtf(tpAniSirGlobal, tSirSmeStatusChangeCode, tANI_U32 *, tANI_U16, tANI_U8);
+void limSendSmeSetContextRsp(tpAniSirGlobal,
+ tSirMacAddr, tANI_U16, tSirResultCodes,tpPESession,tANI_U8,tANI_U16);
+void limSendSmePromiscuousModeRsp(tpAniSirGlobal pMac);
+void limSendSmeNeighborBssInd(tpAniSirGlobal,
+ tLimScanResultNode *);
+#if (WNI_POLARIS_FW_PRODUCT == AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+void limSendSmeMeasurementInd(tpAniSirGlobal);
+#endif
+void limHandleDeleteBssRsp(tpAniSirGlobal pMac,tpSirMsgQ MsgQ);
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+void
+limSendSmeAggrQosRsp(tpAniSirGlobal pMac, tpSirAggrQosRsp aggrQosRsp,
+ tANI_U8 smesessionId);
+#endif /*WLAN_FEATURE_VOWIFI_11R*/
+
+
+void limSendSmeAddtsRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd, tANI_U32 status, tpPESession psessionEntry, tSirMacTspecIE tspec, tANI_U8 smesessionId, tANI_U16 smetransactionId);
+void limSendSmeAddtsInd(tpAniSirGlobal pMac, tpSirAddtsReqInfo addts);
+void limSendSmeDeltsRsp(tpAniSirGlobal pMac, tpSirDeltsReq delts, tANI_U32 status,tpPESession psessionEntry,tANI_U8 smessionId,tANI_U16 smetransactionId);
+void limSendSmeDeltsInd(tpAniSirGlobal pMac, tpSirDeltsReqInfo delts, tANI_U16 aid,tpPESession);
+void limSendSmeStatsRsp(tpAniSirGlobal pMac, tANI_U16 msgtype, void * stats);
+
+void limSendSmePEStatisticsRsp(tpAniSirGlobal pMac, tANI_U16 msgtype, void * stats);
+void limSendSmeRemoveKeyRsp(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tSirResultCodes resultCode,tpPESession,tANI_U8,tANI_U16);
+
+
+void limSendSmeGetTxPowerRsp(tpAniSirGlobal pMac, tANI_U32 power, tANI_U32 status);
+void limSendSmeGetNoiseRsp(tpAniSirGlobal pMac, tSirMacNoise noise);
+void limSendSmeIBSSPeerInd(tpAniSirGlobal pMac,tSirMacAddr peerMacAddr,tANI_U16 staIndex,tANI_U8 ucastIdx,tANI_U8 bcastIdx,
+ tANI_U8 *beacon,tANI_U16 beaconLen, tANI_U16 msgType, tANI_U8 sessionId);
+void limSendExitBmpsInd(tpAniSirGlobal pMac, tExitBmpsReason reasonCode);
+
+
+void limSendSmePreChannelSwitchInd(tpAniSirGlobal pMac);
+void limSendSmePostChannelSwitchInd(tpAniSirGlobal pMac);
+void limSendSmeMaxAssocExceededNtf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tANI_U8 smesessionId);
+
+#endif /* __LIM_SEND_SME_RSP_H */
+
diff --git a/CORE/MAC/src/pe/lim/limSerDesUtils.c b/CORE/MAC/src/pe/lim/limSerDesUtils.c
new file mode 100644
index 0000000..b663bea
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limSerDesUtils.c
@@ -0,0 +1,4279 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ *
+ * This file limSerDesUtils.cc contains the serializer/deserializer
+ * utility functions LIM uses while communicating with upper layer
+ * software entities
+ * Author: Chandra Modumudi
+ * Date: 10/20/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+
+#include "aniSystemDefs.h"
+#include "utilsApi.h"
+#include "limTypes.h"
+#include "limUtils.h"
+#include "limSerDesUtils.h"
+
+
+
+/**
+ * limCheckRemainingLength()
+ *
+ *FUNCTION:
+ * This function is called while de-serializing received SME_REQ
+ * message.
+ *
+ *LOGIC:
+ * Remaining message length is checked for > 0.
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param len - Remaining message length
+ * @return retCode - eSIR_SUCCESS if len > 0, else eSIR_FAILURE
+ */
+
+static inline tSirRetStatus
+limCheckRemainingLength(tpAniSirGlobal pMac, tANI_S16 len)
+{
+ if (len > 0)
+ return eSIR_SUCCESS;
+ else
+ {
+ limLog(pMac, LOGW,
+ FL("Received SME message with invalid rem length=%d\n"),
+ len);
+ return eSIR_FAILURE;
+ }
+} /*** end limCheckRemainingLength(pMac, ) ***/
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+#else
+/**
+ * limGetBssDescription()
+ *
+ *FUNCTION:
+ * This function is called by various LIM functions to copy
+ * BSS description from a tANI_U8* buffer pointer to tSirBssDescription
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pBssDescription Pointer to the BssDescription to be copied
+ * @param *pBuf Pointer to the source buffer
+ * @param rLen Remaining message length being extracted
+ * @return retCode Indicates whether message is successfully
+ * de-serialized (eSIR_SUCCESS) or
+ * failure (eSIR_FAILURE).
+ */
+
+static tSirRetStatus
+limGetBssDescription( tpAniSirGlobal pMac, tSirBssDescription *pBssDescription,
+ tANI_S16 rLen, tANI_S16 *lenUsed, tANI_U8 *pBuf)
+{
+ tANI_U16 len = 0;
+
+ pBssDescription->length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len = pBssDescription->length;
+
+ if (rLen < (tANI_S16) (len + sizeof(tANI_U16)))
+ return eSIR_FAILURE;
+
+ *lenUsed = len + sizeof(tANI_U16);
+
+ // Extract bssId
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pBssDescription->bssId,
+ pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ len -= sizeof(tSirMacAddr);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract timer
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) (&pBssDescription->scanSysTimeMsec),
+ pBuf, sizeof(v_TIME_t));
+ pBuf += sizeof(v_TIME_t);
+ len -= sizeof(v_TIME_t);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract timeStamp
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pBssDescription->timeStamp,
+ pBuf, sizeof(tSirMacTimeStamp));
+ pBuf += sizeof(tSirMacTimeStamp);
+ len -= sizeof(tSirMacTimeStamp);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract beaconInterval
+ pBssDescription->beaconInterval = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract capabilityInfo
+ pBssDescription->capabilityInfo = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract nwType
+ pBssDescription->nwType = (tSirNwType) limGetU32(pBuf);
+ pBuf += sizeof(tSirNwType);
+ len -= sizeof(tSirNwType);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract aniIndicator
+ pBssDescription->aniIndicator = *pBuf++;
+ len --;
+
+ // Extract rssi
+ pBssDescription->rssi = (tANI_S8) *pBuf++;
+ len --;
+
+ // Extract sinr
+ pBssDescription->sinr = (tANI_S8) *pBuf++;
+ len --;
+
+ // Extract channelId
+ pBssDescription->channelId = *pBuf++;
+ len --;
+
+ // Extract channelIdSelf
+ pBssDescription->channelIdSelf = *pBuf++;
+ len --;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract reserved bssDescription
+ pBuf += sizeof(pBssDescription->sSirBssDescriptionRsvd);
+ len -= sizeof(pBssDescription->sSirBssDescriptionRsvd);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract the TITAN capability info
+ // NOTE - titanHtCaps is now DWORD aligned
+ pBssDescription->titanHtCaps = limGetU32( pBuf );
+ pBuf += sizeof(tANI_U32);
+ len -= sizeof(tANI_U32);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ //pass the timestamp
+ pBssDescription->nReceivedTime = limGetU32( pBuf );
+ pBuf += sizeof(tANI_TIMESTAMP);
+ len -= sizeof(tANI_TIMESTAMP);
+
+#if defined WLAN_FEATURE_VOWIFI
+ //TSF when the beacon received (parent TSF)
+ pBssDescription->parentTSF = limGetU32( pBuf );
+ pBuf += sizeof(tANI_U32);
+ len -= sizeof(tANI_U32);
+
+ //start TSF of scan during which this BSS desc was updated.
+ pBssDescription->startTSF[0] = limGetU32( pBuf );
+ pBuf += sizeof(tANI_U32);
+ len -= sizeof(tANI_U32);
+
+ //start TSF of scan during which this BSS desc was updated.
+ pBssDescription->startTSF[1] = limGetU32( pBuf );
+ pBuf += sizeof(tANI_U32);
+ len -= sizeof(tANI_U32);
+#endif
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ // MobilityDomain
+ pBssDescription->mdiePresent = *pBuf++;
+ len --;
+ pBssDescription->mdie[0] = *pBuf++;
+ len --;
+ pBssDescription->mdie[1] = *pBuf++;
+ len --;
+ pBssDescription->mdie[2] = *pBuf++;
+ len --;
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+ PELOGE(limLog(pMac, LOGE, FL("mdie=%02x %02x %02x\n"),
+ pBssDescription->mdie[0],
+ pBssDescription->mdie[1],
+ pBssDescription->mdie[2]);)
+#endif
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+ pBssDescription->QBSSLoad_present = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract QBSSLoad_avail
+ pBssDescription->QBSSLoad_avail = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+#endif
+
+ if (pBssDescription->WscIeLen)
+ {
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pBssDescription->WscIeProbeRsp,
+ pBuf,
+ pBssDescription->WscIeLen);
+ }
+
+ pBuf += (sizeof(pBssDescription->WscIeProbeRsp) +
+ sizeof(pBssDescription->WscIeLen) +
+ sizeof(pBssDescription->fProbeRsp) +
+ sizeof(tANI_U32));
+
+ len -= (sizeof(pBssDescription->WscIeProbeRsp) +
+ sizeof(pBssDescription->WscIeLen) +
+ sizeof(pBssDescription->fProbeRsp) +
+ sizeof(tANI_U32));
+
+ if (len)
+ {
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pBssDescription->ieFields,
+ pBuf,
+ len);
+ }
+
+ return eSIR_SUCCESS;
+} /*** end limGetBssDescription() ***/
+#endif
+
+
+
+/**
+ * limCopyBssDescription()
+ *
+ *FUNCTION:
+ * This function is called by various LIM functions to copy
+ * BSS description to a tANI_U8 buffer
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param *pBuf Pointer to the destination buffer
+ * @param pBssDescription Pointer to the BssDescription being copied
+ * @return Length of BSSdescription written
+ */
+
+tANI_U16
+limCopyBssDescription(tpAniSirGlobal pMac, tANI_U8 *pBuf, tSirBssDescription *pBssDescription)
+{
+ tANI_U16 len = 0;
+
+ limCopyU16(pBuf, pBssDescription->length);
+ pBuf += sizeof(tANI_U16);
+ len += sizeof(tANI_U16);
+
+ palCopyMemory( pMac->hHdd, pBuf,
+ (tANI_U8 *) pBssDescription->bssId,
+ sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ len += sizeof(tSirMacAddr);
+
+ PELOG3(limLog(pMac, LOG3,
+ FL("Copying BSSdescr:channel is %d, aniInd is %d, bssId is "),
+ pBssDescription->channelId, pBssDescription->aniIndicator);
+ limPrintMacAddr(pMac, pBssDescription->bssId, LOG3);)
+
+ palCopyMemory( pMac->hHdd, pBuf,
+ (tANI_U8 *) (&pBssDescription->scanSysTimeMsec),
+ sizeof(v_TIME_t));
+ pBuf += sizeof(v_TIME_t);
+ len += sizeof(v_TIME_t);
+
+ limCopyU32(pBuf, pBssDescription->timeStamp[0]);
+ pBuf += sizeof(tANI_U32);
+ len += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pBssDescription->timeStamp[1]);
+ pBuf += sizeof(tANI_U32);
+ len += sizeof(tANI_U32);
+
+ limCopyU16(pBuf, pBssDescription->beaconInterval);
+ pBuf += sizeof(tANI_U16);
+ len += sizeof(tANI_U16);
+
+ limCopyU16(pBuf, pBssDescription->capabilityInfo);
+ pBuf += sizeof(tANI_U16);
+ len += sizeof(tANI_U16);
+
+ limCopyU32(pBuf, pBssDescription->nwType);
+ pBuf += sizeof(tANI_U32);
+ len += sizeof(tANI_U32);
+
+ *pBuf++ = pBssDescription->aniIndicator;
+ len++;
+
+ *pBuf++ = pBssDescription->rssi;
+ len++;
+
+ *pBuf++ = pBssDescription->sinr;
+ len++;
+
+ *pBuf++ = pBssDescription->channelId;
+ len++;
+
+ palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pBssDescription->ieFields),
+ limGetIElenFromBssDescription(pBssDescription));
+
+ return (len + sizeof(tANI_U16));
+} /*** end limCopyBssDescription() ***/
+
+
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+/**
+ * limCopyLoad()
+ *
+ *fUNCTION:
+ * This function is called by various LIM functions to copy
+ * load information into a tANI_U8* buffer pointer
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param *pBuf Pointer to the destination buffer
+ * @param load load to be copied to destination buffer
+ *
+ * @return None
+ */
+
+static void
+limCopyLoad(tANI_U8 *pBuf, tSirLoad load)
+{
+ limCopyU16(pBuf, load.numStas);
+ pBuf += sizeof(tANI_U16);
+
+ limCopyU16(pBuf, load.channelUtilization);
+ pBuf += sizeof(tANI_U16);
+} /*** end limCopyLoad() ***/
+
+
+
+/**
+ * limGetLoad()
+ *
+ *FUNCTION:
+ * This function is called by various LIM functions to copy
+ * load information into a tANI_U8* buffer pointer
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param *pLoad Pointer to load being copied to
+ * @param *pBuf Pointer to the source buffer
+ *
+ * @return None
+ */
+
+static void
+limGetLoad(tSirLoad *pLoad, tANI_U8 *pBuf)
+{
+ pLoad->numStas = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ pLoad->channelUtilization = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+} /*** end limGetLoad() ***/
+
+
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+/**
+ * limCopyWdsInfo()
+ *
+ *FUNCTION:
+ * This function is called by various LIM functions to copy
+ * WdsInfo information into a tANI_U8* buffer pointer
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param *pBuf Pointer to the destination buffer
+ * @param wdsInfo WdsInfo to be copied to destination buffer
+ *
+ * @return Length of WDS info copied
+ */
+
+static tANI_U16
+limCopyWdsInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tpSirWdsInfo pWdsInfo)
+{
+ limCopyU16(pBuf, pWdsInfo->wdsLength);
+ pBuf += sizeof(tANI_U16);
+
+ palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) pWdsInfo->wdsBytes, pWdsInfo->wdsLength);
+ pBuf += pWdsInfo->wdsLength;
+
+ return ((tANI_U16) (sizeof(tANI_U16) + pWdsInfo->wdsLength));
+} /*** end limCopyWdsInfo() ***/
+
+
+
+/**
+ * limGetWdsInfo()
+ *
+ *FUNCTION:
+ * This function is called by various LIM functions to copy
+ * WdsInfo information from a tANI_U8* buffer pointer to tSirWdsInfo
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param wdsInfo Pointer to the WdsInfo to be copied
+ * @param *pBuf Pointer to the source buffer
+ *
+ * @return true when WDS info extracted successfully else false
+ */
+
+static tANI_U8
+limGetWdsInfo(tpAniSirGlobal pMac, tpSirWdsInfo pWdsInfo, tANI_U8 *pBuf)
+{
+ pWdsInfo->wdsLength = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ if (pWdsInfo->wdsLength > ANI_WDS_INFO_MAX_LENGTH)
+ return false;
+
+ palCopyMemory( pMac->hHdd, pWdsInfo->wdsBytes, pBuf, pWdsInfo->wdsLength);
+
+ return true;
+} /*** end limGetWdsInfo() ***/
+
+
+
+/**
+ * limGetAlternateRadioList()
+ *
+ *FUNCTION:
+ * This function is called by various LIM functions to copy
+ * alternateRadio information from a tANI_U8* buffer pointer to
+ * tSirAlternateRadioList
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pRadioList Pointer to the radioList to be copied
+ * @param *pBuf Pointer to the source buffer
+ *
+ * @return len Length of copied alternateRadioList
+ */
+
+static tANI_U16
+limGetAlternateRadioList(tpAniSirGlobal pMac, tpSirMultipleAlternateRadioInfo pRadioList,
+ tANI_U8 *pBuf)
+{
+ tANI_U8 i;
+ tANI_U16 len = sizeof(tANI_U8);
+ tpSirAlternateRadioInfo pRadioInfo;
+
+ pRadioList->numBss = *pBuf++;
+
+ if (pRadioList->numBss > SIR_MAX_NUM_ALTERNATE_RADIOS)
+ pRadioList->numBss = SIR_MAX_NUM_ALTERNATE_RADIOS;
+
+ pRadioInfo = pRadioList->alternateRadio;
+ for (i = 0; i < pRadioList->numBss; i++)
+ {
+ palCopyMemory( pMac->hHdd, pRadioInfo->bssId, pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ pRadioInfo->channelId = *pBuf++;
+ PELOG3(limLog(pMac, LOG3, FL("Alternate radio[%d] channelId=%d, BssId is \n"),
+ i, pRadioInfo->channelId);
+ limPrintMacAddr(pMac, pRadioInfo->bssId, LOG3);)
+
+ pRadioInfo++;
+ len += sizeof(tSirMacAddr) + sizeof(tANI_U8);
+ }
+
+ return len;
+} /*** end limGetAlternateRadioList() ***/
+#endif
+
+
+
+/**
+ * limCopyNeighborBssInfo()
+ *
+ *FUNCTION:
+ * This function is called by various LIM functions to copy
+ * Neighbor BSS info into a tANI_U8* buffer pointer
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param *pBuf Pointer to the destination buffer
+ * @param pBssInfo Pointer to neighbor BSS info be copied
+ * to destination buffer
+ *
+ * @return bssInfoLen Length of bssInfo copied
+ */
+
+tANI_U32
+limCopyNeighborBssInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tpSirNeighborBssInfo pBssInfo)
+{
+ tANI_U32 bssInfoLen = 0;
+
+ palCopyMemory( pMac->hHdd, pBuf,
+ (tANI_U8 *) pBssInfo->bssId,
+ sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ bssInfoLen += sizeof(tSirMacAddr);
+ PELOG3(limLog(pMac, LOG3,
+ FL("Copying new NeighborWds node:channel is %d, TITAN HT Caps are %1d, wniIndicator is %d, bssType is %d, bssId is "),
+ pBssInfo->channelId, pBssInfo->titanHtCaps, pBssInfo->wniIndicator,
+ pBssInfo->bssType);
+ limPrintMacAddr(pMac, pBssInfo->bssId, LOG3);)
+
+ *pBuf++ = pBssInfo->channelId;
+ bssInfoLen++;
+
+ *pBuf++ = pBssInfo->titanHtCaps;
+ bssInfoLen++;
+
+ limCopyU32(pBuf, pBssInfo->wniIndicator);
+ pBuf += sizeof(tANI_U32);
+ bssInfoLen += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pBssInfo->bssType);
+ pBuf += sizeof(tANI_U32);
+ bssInfoLen += sizeof(tANI_U32);
+
+ *pBuf++ = pBssInfo->sinr;
+ bssInfoLen++;
+ *pBuf++ = pBssInfo->rssi;
+ bssInfoLen++;
+
+ limCopyLoad(pBuf, pBssInfo->load);
+ pBuf += sizeof(tSirLoad);
+ bssInfoLen += sizeof(tSirLoad);
+
+ palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pBssInfo->ssId),
+ pBssInfo->ssId.length + 1);
+
+ bssInfoLen += pBssInfo->ssId.length + 1;
+ pBuf += pBssInfo->ssId.length + 1;
+
+ palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pBssInfo->apName),
+ pBssInfo->apName.length + 1);
+
+ bssInfoLen += pBssInfo->apName.length + 1;
+ pBuf += pBssInfo->apName.length + 1;
+
+ limCopyU16(pBuf, pBssInfo->rsnIE.length);
+ pBuf += sizeof(tANI_U16);
+ bssInfoLen += sizeof(tANI_U16);
+ palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pBssInfo->rsnIE.rsnIEdata),
+ pBssInfo->rsnIE.length);
+
+ bssInfoLen += pBssInfo->rsnIE.length;
+ pBuf += pBssInfo->rsnIE.length;
+
+ limCopyU32(pBuf, pBssInfo->nwType);
+ pBuf += sizeof(tANI_U32);
+ bssInfoLen += sizeof(tANI_U32);
+
+ // not sure we need to do a sirSwapU16ifNeeded ???
+ limCopyU16(pBuf, pBssInfo->capabilityInfo);
+ pBuf += sizeof(tANI_U16);
+ bssInfoLen += sizeof(tANI_U16);
+
+ palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pBssInfo->operationalRateSet),
+ pBssInfo->operationalRateSet.numRates + 1);
+ bssInfoLen += pBssInfo->operationalRateSet.numRates + 1;
+ pBuf += pBssInfo->operationalRateSet.numRates + 1;
+
+ palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pBssInfo->extendedRateSet),
+ pBssInfo->extendedRateSet.numRates + 1);
+ bssInfoLen += pBssInfo->extendedRateSet.numRates + 1;
+ pBuf += pBssInfo->extendedRateSet.numRates + 1;
+
+ limCopyU16(pBuf, pBssInfo->beaconInterval);
+ pBuf += sizeof(tANI_U16);
+ bssInfoLen += sizeof(tANI_U16);
+
+ *pBuf++ = pBssInfo->dtimPeriod;
+ bssInfoLen++;
+ *pBuf++ = pBssInfo->HTCapsPresent;
+ bssInfoLen++;
+ *pBuf++ = pBssInfo->HTInfoPresent;
+ bssInfoLen++;
+ *pBuf++ = pBssInfo->wmeInfoPresent;
+ bssInfoLen++;
+ *pBuf++ = pBssInfo->wmeEdcaPresent;
+ bssInfoLen++;
+ *pBuf++ = pBssInfo->wsmCapablePresent;
+ bssInfoLen++;
+ *pBuf++ = pBssInfo->hcfEnabled;
+ bssInfoLen++;
+
+ limCopyU16(pBuf, pBssInfo->propIECapability);
+ pBuf += sizeof(tANI_U16);
+ bssInfoLen += sizeof(tANI_U16);
+
+ limCopyU32(pBuf, pBssInfo->localPowerConstraints);
+ pBuf += sizeof(tANI_S32);
+ bssInfoLen += sizeof(tANI_S32);
+
+ limCopyU32(pBuf, pBssInfo->aggrRssi);
+ pBuf += sizeof(tANI_S32);
+ bssInfoLen += sizeof(tANI_S32);
+
+ limCopyU32(pBuf, pBssInfo->dataCount);
+ pBuf += sizeof(tANI_U32);
+ bssInfoLen += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pBssInfo->totalPackets);
+ pBuf += sizeof(tANI_U32);
+ bssInfoLen += sizeof(tANI_U32);
+
+ return bssInfoLen;
+} /*** end limCopyNeighborBssInfo() ***/
+
+
+/**
+ * limCopyNeighborList()
+ *
+ *FUNCTION:
+ * This function is called by various LIM functions to copy
+ * Neighbor BSS list into a tANI_U8* buffer pointer
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param *pBuf Pointer to the destination buffer
+ * @param neighborList Neighbor BSS list be copied to
+ * destination buffer
+ * @param numBss Number of Neighbor BSS list be copied
+ *
+ * @return listLen Length of Neighbor BSS list
+ */
+
+static tANI_U32
+limCopyNeighborList(tpAniSirGlobal pMac, tANI_U8 *pBuf, tpSirNeighborBssInfo pBssInfo, tANI_U32 numBss)
+{
+ tANI_U32 bssInfoLen = 0, listLen = 0;
+ tANI_U8 i;
+ tANI_U8 *pTemp = (tANI_U8 *) pBssInfo;
+
+ PELOG3(limLog(pMac, LOG3, FL("Going to copy BssInfoList:\n"));)
+ PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3,
+ pTemp, numBss*sizeof(tSirNeighborBssInfo));)
+
+ for (i = 0; i < numBss; i++, bssInfoLen = 0)
+ {
+ bssInfoLen = limCopyNeighborBssInfo(pMac,
+ pBuf,
+ (tpSirNeighborBssInfo) &pBssInfo[i]);
+
+ pBuf += bssInfoLen;
+ listLen += bssInfoLen;
+ }
+
+ return listLen;
+} /*** end limCopyNeighborList(pMac, ) ***/
+
+
+/**
+ * limGetNeighborBssInfo()
+ *
+ *FUNCTION:
+ * This function is called by various LIM functions to get
+ * Neighbor BSS info from a tANI_U8* buffer pointer
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pBssInfo Pointer to neighbor BSS info being copied
+ * @param *pBuf Pointer to the source buffer
+ *
+ * @return Size of NeighborBssInfo that is extracted
+ */
+
+tANI_U32
+limGetNeighborBssInfo(tpAniSirGlobal pMac, tpSirNeighborBssInfo pBssInfo, tANI_U8 *pBuf)
+{
+ tANI_U32 len = 0;
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pBssInfo->bssId,
+ pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ len += sizeof(tSirMacAddr);
+
+ pBssInfo->channelId = *pBuf++;
+ len++;
+
+ pBssInfo->wniIndicator = (tAniBool) limGetU32(pBuf);
+ pBuf += sizeof(tAniBool);
+ len += sizeof(tAniBool);
+
+ pBssInfo->bssType = (tSirBssType) limGetU32(pBuf);
+ pBuf += sizeof(tSirBssType);
+ len += sizeof(tSirBssType);
+
+ pBssInfo->sinr = *pBuf++;
+ len++;
+ pBssInfo->rssi = *pBuf++;
+ len++;
+
+ limGetLoad(&pBssInfo->load, pBuf);
+ pBuf += sizeof(tSirLoad);
+ len += sizeof(tSirLoad);
+
+ pBssInfo->ssId.length = *pBuf++;
+ palCopyMemory( pMac->hHdd, pBssInfo->ssId.ssId, pBuf, pBssInfo->ssId.length);
+ pBuf += pBssInfo->ssId.length;
+ len += pBssInfo->ssId.length + 1;
+
+ pBssInfo->apName.length = *pBuf++;
+ palCopyMemory( pMac->hHdd, pBssInfo->apName.name, pBuf, pBssInfo->apName.length);
+ pBuf += pBssInfo->apName.length;
+ len += pBssInfo->apName.length + 1;
+
+ pBssInfo->rsnIE.length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ palCopyMemory( pMac->hHdd, pBssInfo->rsnIE.rsnIEdata, pBuf,
+ pBssInfo->rsnIE.length);
+ pBuf += pBssInfo->rsnIE.length;
+ len += pBssInfo->rsnIE.length + 2;
+
+ PELOG2(limLog(pMac, LOG2, FL("BSS type %d channel %d wniInd %d RSN len %d\n"),
+ pBssInfo->bssType, pBssInfo->channelId, pBssInfo->wniIndicator,
+ pBssInfo->rsnIE.length);
+ limPrintMacAddr(pMac, pBssInfo->bssId, LOG2);)
+
+
+ pBssInfo->nwType = (tSirNwType) limGetU32(pBuf);
+ pBuf += sizeof(tSirNwType);
+ len += sizeof(tSirNwType);
+
+ pBssInfo->capabilityInfo = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len += sizeof(tANI_U16);
+
+ pBssInfo->operationalRateSet.numRates = *pBuf++;
+ palCopyMemory( pMac->hHdd, pBssInfo->operationalRateSet.rate, pBuf,
+ pBssInfo->operationalRateSet.numRates);
+ pBuf += pBssInfo->operationalRateSet.numRates;
+ len += pBssInfo->operationalRateSet.numRates + 1;
+
+ pBssInfo->extendedRateSet.numRates = *pBuf++;
+ palCopyMemory( pMac->hHdd, pBssInfo->extendedRateSet.rate, pBuf,
+ pBssInfo->extendedRateSet.numRates);
+ pBuf += pBssInfo->extendedRateSet.numRates;
+ len += pBssInfo->extendedRateSet.numRates + 1;
+
+ pBssInfo->beaconInterval = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len += sizeof(tANI_U16);
+
+ pBssInfo->dtimPeriod = *pBuf++;
+ pBssInfo->HTCapsPresent = *pBuf++;
+ pBssInfo->HTInfoPresent = *pBuf++;
+ pBssInfo->wmeInfoPresent = *pBuf++;
+ pBssInfo->wmeEdcaPresent = *pBuf++;
+ pBssInfo->wsmCapablePresent = *pBuf++;
+ pBssInfo->hcfEnabled = *pBuf++;
+ pBssInfo->propIECapability = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ pBssInfo->localPowerConstraints = limGetU32(pBuf);
+ pBuf += sizeof(tANI_U32);
+ len += 13;
+
+ PELOG2(limLog(pMac, LOG2, FL("rsnIELen %d operRateLen %d extendRateLen %d total %d\n"),
+ pBssInfo->rsnIE.length, pBssInfo->operationalRateSet.numRates,
+ pBssInfo->extendedRateSet.numRates, len);)
+
+
+ return len;
+} /*** end limGetNeighborBssInfo() ***/
+
+
+
+#if defined(ANI_PRODUCT_TYPE_AP)
+/**
+ * limGetNeighborBssList()
+ *
+ *FUNCTION:
+ * This function is called by various LIM functions to get
+ * Neighbor BSS list from a tANI_U8* buffer pointer
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param *pNeighborList Pointer to neighbor BSS list being copied to
+ * @param *pBuf Pointer to the source buffer
+ * @param rLen Remaining message length being extracted
+ * @return retCode Indicates whether message is successfully
+ * de-serialized (eSIR_SUCCESS) or
+ * failure (eSIR_FAILURE).
+ */
+
+static tSirRetStatus
+limGetNeighborBssList(tpAniSirGlobal pMac,
+ tSirNeighborBssList *pNeighborList,
+ tANI_S16 rLen, tANI_S16 *lenUsed, tANI_U8 *pBuf)
+{
+ tANI_U8 *pBssInfo = (tANI_U8 *) pNeighborList->bssList;
+ tANI_U32 i, bssInfoLen = 0, len = 0, numBss, numBssList;
+
+ numBssList = numBss = limGetU32(pBuf);
+
+ if (!numBss)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("No Neighbor BSS present in Neighbor list\n"));)
+
+ return eSIR_FAILURE;
+ }
+ PELOG2(limLog(pMac, LOG2,
+ FL("Num of Neighbor BSS present in Neighbor list is %d\n"),
+ numBss);)
+
+ pBuf += sizeof(tANI_U32);
+ len += sizeof(tANI_U32);
+ rLen -= sizeof(tANI_U32);
+ if (limCheckRemainingLength(pMac, rLen) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // First neighborInfo is the one we're attempting to join/reassoc
+ bssInfoLen = limGetNeighborBssInfo(pMac, (tSirNeighborBssInfo *) pBssInfo,
+ pBuf);
+ PELOG1(limLog(pMac, LOG1,
+ FL("BSSinfo len to be joined is %d rem %d, numBss = %d\n"),
+ bssInfoLen, rLen, numBss - 1);)
+ pBuf += bssInfoLen;
+ len += bssInfoLen;
+ rLen -= (tANI_S16) bssInfoLen;
+ numBss--;
+ numBssList--;
+
+ if (numBss > 0)
+ {
+ // Store remaining neighbor BSS info
+ if (numBss > SIR_MAX_NUM_NEIGHBOR_BSS)
+ {
+ // Store only MAX number of Neighbor BSS
+ PELOG2(limLog(pMac, LOG2,
+ FL("Pruning number of neighbors to %d from %d\n"),
+ SIR_MAX_NUM_NEIGHBOR_BSS, numBss);)
+ numBss = SIR_MAX_NUM_NEIGHBOR_BSS;
+ }
+
+ pBssInfo = (tANI_U8 *) pMac->lim.gLimNeighborBssList.bssList;
+ for (i = numBss; i > 0; i--)
+ {
+ PELOG3(limLog(pMac, LOG3, FL("pMac = %p, pBssInfo = %p, pBuf = %p\n"), pMac, pBssInfo, pBuf);)
+ bssInfoLen = limGetNeighborBssInfo(pMac,
+ (tSirNeighborBssInfo *) pBssInfo,
+ pBuf);
+
+ pBssInfo += sizeof(tSirNeighborBssInfo);
+ pBuf += bssInfoLen;
+ len += bssInfoLen;
+ rLen -= (tANI_S16) bssInfoLen;
+ numBssList--;
+
+ PELOG1(limLog(pMac, LOG1, FL("BSS info[%d] len %d rem %d\n"),
+ i, bssInfoLen, rLen);)
+ }
+
+ while (numBssList > 0)
+ {
+ tSirNeighborBssInfo pTemp;
+ bssInfoLen = limGetNeighborBssInfo(pMac, &pTemp, pBuf);
+ pBuf += bssInfoLen;
+ len += bssInfoLen;
+ rLen -= (tANI_S16) bssInfoLen;
+ numBssList--;
+ PELOG1(limLog(pMac, LOG1, FL("BSS info[%d] len %d rem %d\n"),
+ numBssList, bssInfoLen, rLen);)
+ }
+ }
+ *lenUsed = len;
+
+ pMac->lim.gLimNeighborBssList.numBss = pNeighborList->numBss
+ = numBss;
+
+ return eSIR_SUCCESS;
+} /*** end limGetNeighborBssList(pMac, ) ***/
+
+
+
+/**
+ * limCopyNeighborWdsInfo()
+ *
+ *FUNCTION:
+ * This function is called by various LIM functions to copy
+ * detected neighborBssWds info to a tANI_U8 buffer
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param *pBuf Pointer to the destination buffer
+ * @param *pInfo Pointer to the NeighborWdsInfo being copied
+ * @return Length of Matrix information copied
+ */
+
+static tANI_U16
+limCopyNeighborWdsInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tpSirNeighborBssWdsInfo pInfo)
+{
+ tANI_U16 len = 0;
+
+ len = (tANI_U16) limCopyNeighborBssInfo(pMac, pBuf, &pInfo->neighborBssInfo);
+ pBuf += len;
+ len += limCopyWdsInfo(pMac, pBuf, &pInfo->wdsInfo);
+
+ return len;
+} /*** end limCopyNeighborWdsInfo() ***/
+
+
+
+/**
+ * limCopyMeasMatrixInfo()
+ *
+ *FUNCTION:
+ * This function is called by various LIM functions to copy
+ * collected Measurement matrix info to a tANI_U8 buffer
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param *pBuf Pointer to the destination buffer
+ * @param *pInfo Pointer to the matrix info being copied
+ * @return Length of Matrix information copied
+ */
+
+static tANI_U16
+limCopyMeasMatrixInfo(tANI_U8 *pBuf, tpLimMeasMatrixNode pInfo)
+{
+ tANI_U16 len = 0;
+
+ *pBuf++ = pInfo->matrix.channelNumber;
+ len++;
+ *pBuf++ = pInfo->matrix.compositeRssi;
+ len++;
+ limCopyU32(pBuf, pInfo->matrix.aggrRssi);
+ pBuf += sizeof(tANI_S32);
+ len += sizeof(tANI_S32);
+ limCopyU32(pBuf, pInfo->matrix.totalPackets);
+ len += sizeof(tANI_U32);
+
+ return len;
+} /*** end limCopyMeasMatrixInfo() ***/
+
+
+
+/**
+ * limCopyMeasMatrixList()
+ *
+ *FUNCTION:
+ * This function is called by various LIM functions to copy
+ * collected Measurement matrix List to a tANI_U8 buffer
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param *pBuf - Pointer to the destination buffer
+ * @return Length of matrix list copied
+ */
+
+static tANI_U16
+limCopyMeasMatrixList(tpAniSirGlobal pMac, tANI_U8 *pBuf)
+{
+ tANI_U16 len = 0, nodeLen = 0;
+ tANI_U8 numNodes = pMac->lim.gpLimMeasData->numMatrixNodes;
+
+ *pBuf++ = numNodes;
+ len++;
+
+ if (numNodes)
+ {
+ tpLimMeasMatrixNode pInfo =
+ pMac->lim.gpLimMeasData->pMeasMatrixInfo;
+ while (numNodes-- && pInfo) //Safety measure, checking both
+ {
+ nodeLen = limCopyMeasMatrixInfo(pBuf, pInfo);
+ pBuf += nodeLen;
+ len += nodeLen;
+
+ if (pInfo->next)
+ pInfo = pInfo->next;
+ else
+ break;
+ }
+
+ return len;
+ }
+ else
+ {
+ *pBuf = 0;
+ return 1;
+ }
+} /*** end limCopyMeasMatrixList() ***/
+
+
+
+/**
+ * limCopyNeighborWdsList()
+ *
+ *FUNCTION:
+ * This function is called by various LIM functions to copy
+ * detected neighborBssWds List to a tANI_U8 buffer
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param *pBuf Pointer to the destination buffer
+ * @return Length of matrix list copied
+ */
+
+static tANI_U16
+limCopyNeighborWdsList(tpAniSirGlobal pMac, tANI_U8 *pBuf)
+{
+ tANI_U16 len = 0, nodeLen = 0;
+
+ if (pMac->lim.gpLimMeasData->numBssWds)
+ {
+ limCopyU32(pBuf, pMac->lim.gpLimMeasData->numBssWds);
+ pBuf += sizeof(tANI_U32);
+ len += sizeof(tANI_U32);
+
+ tpLimNeighborBssWdsNode pInfo =
+ pMac->lim.gpLimMeasData->pNeighborWdsInfo;
+ while (pInfo)
+ {
+ nodeLen = limCopyNeighborWdsInfo(pMac, pBuf, &pInfo->info);
+ pBuf += nodeLen;
+ len += nodeLen;
+
+ if (pInfo->next)
+ pInfo = pInfo->next;
+ else
+ break;
+ }
+
+ return len;
+ }
+ else
+ {
+ limCopyU32(pBuf, 0);
+ return (sizeof(tANI_U32));
+ }
+} /*** end limCopyNeighborWdsList() ***/
+#endif
+#endif
+
+
+/**
+ * limGetKeysInfo()
+ *
+ *FUNCTION:
+ * This function is called by various LIM functions to copy
+ * key information from a tANI_U8* buffer pointer to tSirKeys
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param *pKeyInfo Pointer to the keyInfo to be copied
+ * @param *pBuf Pointer to the source buffer
+ *
+ * @return Length of key info extracted
+ */
+
+static tANI_U32
+limGetKeysInfo(tpAniSirGlobal pMac, tpSirKeys pKeyInfo, tANI_U8 *pBuf)
+{
+ tANI_U32 len = 0;
+
+ pKeyInfo->keyId = *pBuf++;
+ len++;
+ pKeyInfo->unicast = *pBuf++;
+ len++;
+ pKeyInfo->keyDirection = (tAniKeyDirection) limGetU32(pBuf);
+ len += sizeof(tAniKeyDirection);
+ pBuf += sizeof(tAniKeyDirection);
+
+ palCopyMemory( pMac->hHdd, pKeyInfo->keyRsc, pBuf, WLAN_MAX_KEY_RSC_LEN);
+ pBuf += WLAN_MAX_KEY_RSC_LEN;
+ len += WLAN_MAX_KEY_RSC_LEN;
+
+ pKeyInfo->paeRole = *pBuf++;
+ len++;
+
+ pKeyInfo->keyLength = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len += sizeof(tANI_U16);
+ palCopyMemory( pMac->hHdd, pKeyInfo->key, pBuf, pKeyInfo->keyLength);
+ pBuf += pKeyInfo->keyLength;
+ len += pKeyInfo->keyLength;
+
+ PELOG3(limLog(pMac, LOG3,
+ FL("Extracted keyId=%d, keyLength=%d, Key is :\n"),
+ pKeyInfo->keyId, pKeyInfo->keyLength);
+ sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3,
+ pKeyInfo->key, pKeyInfo->keyLength);)
+
+ return len;
+} /*** end limGetKeysInfo() ***/
+
+
+
+/**
+ * limStartBssReqSerDes()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeMessages() upon receiving
+ * SME_START_BSS_REQ from host
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pStartBssReq Pointer to tSirSmeStartBssReq being extracted
+ * @param pBuf Pointer to serialized buffer
+ * @return retCode Indicates whether message is successfully
+ * de-serialized (eSIR_SUCCESS) or
+ * not (eSIR_FAILURE)
+ */
+
+tSirRetStatus
+limStartBssReqSerDes(tpAniSirGlobal pMac, tpSirSmeStartBssReq pStartBssReq, tANI_U8 *pBuf)
+{
+ tANI_S16 len = 0;
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+ tANI_U8 i;
+#endif
+
+#ifdef PE_DEBUG_LOG1
+ tANI_U8 *pTemp = pBuf;
+#endif
+
+ if (!pStartBssReq || !pBuf)
+ return eSIR_FAILURE;
+
+ pStartBssReq->messageType = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ len = pStartBssReq->length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ PELOG1(limLog(pMac, LOG1, FL("SME_START_BSS_REQ length %d bytes is:\n"), len);)
+ PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
+
+ if (len < (tANI_S16) sizeof(tANI_U32))
+ return eSIR_FAILURE;
+
+ len -= sizeof(tANI_U32); // skip message header
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract sessionId
+ pStartBssReq->sessionId = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract transactionId
+ pStartBssReq->transactionId = limGetU16( pBuf );
+ pBuf += sizeof( tANI_U16 );
+ len -= sizeof( tANI_U16 );
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract bssId
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pStartBssReq->bssId, pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ len -= sizeof(tSirMacAddr);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract selfMacAddr
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pStartBssReq->selfMacAddr, pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ len -= sizeof(tSirMacAddr);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract beaconInterval
+ pStartBssReq->beaconInterval = limGetU16( pBuf );
+ pBuf += sizeof( tANI_U16 );
+ len -= sizeof( tANI_U16 );
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract dot11Mode
+ pStartBssReq->dot11mode = *pBuf++;
+ len --;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract bssType
+ pStartBssReq->bssType = (tSirBssType) limGetU32(pBuf);
+ pBuf += sizeof(tANI_U32);
+ len -= sizeof(tANI_U32);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract ssId
+ if (*pBuf > SIR_MAC_MAX_SSID_LENGTH)
+ {
+ // SSID length is more than max allowed 32 bytes
+ PELOGW(limLog(pMac, LOGW, FL("Invalid SSID length, len=%d\n"), *pBuf);)
+ return eSIR_FAILURE;
+ }
+
+ pStartBssReq->ssId.length = *pBuf++;
+ len--;
+ if (len < pStartBssReq->ssId.length)
+ {
+ limLog(pMac, LOGW,
+ FL("SSID length is longer that the remaining length. SSID len=%d, remaining len=%d\n"),
+ pStartBssReq->ssId.length, len);
+ return eSIR_FAILURE;
+ }
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pStartBssReq->ssId.ssId,
+ pBuf,
+ pStartBssReq->ssId.length);
+ pBuf += pStartBssReq->ssId.length;
+ len -= pStartBssReq->ssId.length;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract channelId
+ pStartBssReq->channelId = *pBuf++;
+ len--;
+
+ // Extract CB secondary channel info
+ pStartBssReq->cbMode = (tAniCBSecondaryMode)limGetU32( pBuf );
+ pBuf += sizeof( tANI_U32 );
+ len -= sizeof( tANI_U32 );
+
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+ tANI_U16 paramLen = 0;
+
+ // Extract alternateRadioList
+ pStartBssReq->alternateRadioList.numBss = *pBuf;
+ paramLen = limGetAlternateRadioList(pMac,
+ &pMac->lim.gLimAlternateRadioList,
+ pBuf);
+ pBuf += paramLen;
+ len -= paramLen;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract powerLevel
+ pStartBssReq->powerLevel = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract wdsInfo
+ if (limGetWdsInfo(pMac, &pStartBssReq->wdsInfo, pBuf) == false)
+ {
+ limLog(pMac, LOGW, FL("Invalid WDS length %d in SME_START_BSS_REQ\n"),
+ pStartBssReq->wdsInfo.wdsLength);
+ return eSIR_FAILURE;
+ }
+
+ pBuf += sizeof(tANI_U16) + pStartBssReq->wdsInfo.wdsLength;
+ len -= (sizeof(tANI_U16) + pStartBssReq->wdsInfo.wdsLength);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE
+ // Extract privacy setting
+ pStartBssReq->privacy = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ //Extract Uapsd Enable
+ pStartBssReq->apUapsdEnable = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ //Extract SSID hidden
+ pStartBssReq->ssidHidden = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ pStartBssReq->fwdWPSPBCProbeReq = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ //Extract HT Protection Enable
+ pStartBssReq->protEnabled = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ //Extract OBSS Protection Enable
+ pStartBssReq->obssProtEnabled = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ pStartBssReq->ht_capab = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract AuthType
+ pStartBssReq->authType = (tSirBssType) limGetU32(pBuf);
+ pBuf += sizeof(tANI_U32);
+ len -= sizeof(tANI_U32);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract dtimPeriod
+ pStartBssReq->dtimPeriod = limGetU32(pBuf);
+ pBuf += sizeof(tANI_U32);
+ len -= sizeof(tANI_U32);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract wps state
+ pStartBssReq->wps_state = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+#endif
+ // Extract bssPersona
+ pStartBssReq->bssPersona = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract rsnIe
+ pStartBssReq->rsnIE.length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ // Check for RSN IE length (that includes length of type & length
+ if (pStartBssReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2)
+ {
+ limLog(pMac, LOGW,
+ FL("Invalid RSN IE length %d in SME_START_BSS_REQ\n"),
+ pStartBssReq->rsnIE.length);
+ return eSIR_FAILURE;
+ }
+
+ palCopyMemory( pMac->hHdd, pStartBssReq->rsnIE.rsnIEdata,
+ pBuf, pStartBssReq->rsnIE.length);
+
+ len -= (sizeof(tANI_U16) + pStartBssReq->rsnIE.length);
+ pBuf += pStartBssReq->rsnIE.length;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract nwType
+ pStartBssReq->nwType = (tSirNwType) limGetU32(pBuf);
+ pBuf += sizeof(tSirNwType);
+ len -= sizeof(tSirNwType);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract operationalRateSet
+ pStartBssReq->operationalRateSet.numRates = *pBuf++;
+
+ // Check for number of rates
+ if (pStartBssReq->operationalRateSet.numRates >
+ SIR_MAC_MAX_NUMBER_OF_RATES)
+ {
+ limLog(pMac, LOGW, FL("Invalid numRates %d in SME_START_BSS_REQ\n"),
+ pStartBssReq->operationalRateSet.numRates);
+ return eSIR_FAILURE;
+ }
+
+ len--;
+ if (len < pStartBssReq->operationalRateSet.numRates)
+ return eSIR_FAILURE;
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pStartBssReq->operationalRateSet.rate,
+ pBuf,
+ pStartBssReq->operationalRateSet.numRates);
+ pBuf += pStartBssReq->operationalRateSet.numRates;
+ len -= pStartBssReq->operationalRateSet.numRates;
+
+ // Extract extendedRateSet
+ if ((pStartBssReq->nwType == eSIR_11G_NW_TYPE) ||
+ (pStartBssReq->nwType == eSIR_11N_NW_TYPE ))
+ {
+ pStartBssReq->extendedRateSet.numRates = *pBuf++;
+ len--;
+ palCopyMemory( pMac->hHdd, pStartBssReq->extendedRateSet.rate,
+ pBuf, pStartBssReq->extendedRateSet.numRates);
+ pBuf += pStartBssReq->extendedRateSet.numRates;
+ len -= pStartBssReq->extendedRateSet.numRates;
+ }
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ limLog(pMac,
+ LOGW,
+ FL("Going to parse numSSID in the START_BSS_REQ, len=%d\n"), len);
+ if (len < 2)
+ {
+ // No numSSID parameter in the START_BSS_REQ
+ limLog(pMac,
+ LOGW,
+ FL("No numSSID in the START_BSS_REQ, len=%d\n"), len);
+ return eSIR_FAILURE;
+ }
+
+ // Extract numSSID
+ pStartBssReq->numSSID = *pBuf++;
+ len--;
+
+ // Extract ssIdList[]
+ for (i = 0; (i < pStartBssReq->numSSID) && len; i++)
+ {
+ pStartBssReq->ssIdList[i].length = *pBuf++;
+ len--;
+ if (len < pStartBssReq->ssIdList[i].length)
+ {
+ limLog(pMac, LOGW,
+ FL("SSID length[%d] is more than the rem length[%d]\n"),
+ pStartBssReq->ssIdList[i].length, len);
+ return eSIR_FAILURE;
+ }
+
+ if (pStartBssReq->ssIdList[i].length > SIR_MAC_MAX_SSID_LENGTH)
+ {
+ // SSID length is more than max allowed 32 bytes
+ limLog(pMac,
+ LOGW,
+ FL("Invalid SSID length in the list, len=%d\n"),
+ pStartBssReq->ssIdList[i].length);
+ return eSIR_FAILURE;
+ }
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pStartBssReq->ssIdList[i].ssId,
+ pBuf,
+ pStartBssReq->ssIdList[i].length);
+ pBuf += pStartBssReq->ssIdList[i].length;
+ len -= pStartBssReq->ssIdList[i].length;
+ }
+#endif
+
+ if (len)
+ {
+ limLog(pMac, LOGW, FL("Extra bytes left in SME_START_BSS_REQ, len=%d\n"), len);
+ }
+
+ return eSIR_SUCCESS;
+} /*** end limStartBssReqSerDes() ***/
+
+
+
+/**
+ * limStopBssReqSerDes()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeMessages() upon receiving
+ * SME_STOP_BSS_REQ from host
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pStopBssReq Pointer to tSirSmeStopBssReq being extracted
+ * @param pBuf Pointer to serialized buffer
+ * @return retCode Indicates whether message is successfully
+ * de-serialized (eSIR_SUCCESS) or
+ * not (eSIR_FAILURE)
+ */
+
+tSirRetStatus
+limStopBssReqSerDes(tpAniSirGlobal pMac, tpSirSmeStopBssReq pStopBssReq, tANI_U8 *pBuf)
+{
+ tANI_S16 len = 0;
+
+#ifdef PE_DEBUG_LOG1
+ tANI_U8 *pTemp = pBuf;
+#endif
+
+ pStopBssReq->messageType = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ len = pStopBssReq->length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ PELOG1(limLog(pMac, LOG1, FL("SME_STOP_BSS_REQ length %d bytes is:\n"), len);)
+ PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
+
+ if (len < (tANI_S16) sizeof(tANI_U32))
+ return eSIR_FAILURE;
+
+ len -= sizeof(tANI_U32); // skip message header
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract sessionId
+ pStopBssReq->sessionId = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract transactionId
+ pStopBssReq->transactionId = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+
+ // Extract reasonCode
+ pStopBssReq->reasonCode = (tSirResultCodes) limGetU32(pBuf);
+ pBuf += sizeof(tSirResultCodes);
+ len -= sizeof(tSirResultCodes);
+
+ // Extract bssId
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pStopBssReq->bssId, pBuf, sizeof(tSirMacAddr));
+ len -= sizeof(tSirMacAddr);
+
+ if (len)
+ return eSIR_FAILURE;
+ else
+ return eSIR_SUCCESS;
+
+} /*** end limStopBssReqSerDes() ***/
+
+
+
+/**
+ * limJoinReqSerDes()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeMessages() upon receiving
+ * SME_JOIN_REQ from host
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pJoinReq Pointer to tSirSmeJoinReq being extracted
+ * @param pBuf Pointer to serialized buffer
+ * @return retCode Indicates whether message is successfully
+ * de-serialized (eSIR_SUCCESS) or
+ * not (eSIR_FAILURE)
+ */
+
+tSirRetStatus
+limJoinReqSerDes(tpAniSirGlobal pMac, tpSirSmeJoinReq pJoinReq, tANI_U8 *pBuf)
+{
+ tANI_S16 len = 0;
+ tANI_S16 lenUsed = 0;
+
+#ifdef PE_DEBUG_LOG1
+ tANI_U8 *pTemp = pBuf;
+#endif
+
+ if (!pJoinReq || !pBuf)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("NULL ptr received\n"));)
+ return eSIR_FAILURE;
+ }
+
+ // Extract messageType
+ pJoinReq->messageType = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ // Extract length
+ len = pJoinReq->length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ if (pJoinReq->messageType == eWNI_SME_JOIN_REQ)
+ PELOG1(limLog(pMac, LOG3, FL("SME_JOIN_REQ length %d bytes is:\n"), len);)
+ else
+ PELOG1(limLog(pMac, LOG3, FL("SME_REASSOC_REQ length %d bytes is:\n"), len);)
+
+ PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
+
+ if (len < (tANI_S16) sizeof(tANI_U32))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("len too short %d\n"), len);)
+ return eSIR_FAILURE;
+ }
+
+ len -= sizeof(tANI_U32); // skip message header
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract sessionId
+ pJoinReq->sessionId = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract transactionId
+ pJoinReq->transactionId = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract ssId
+ pJoinReq->ssId.length = *pBuf++;
+ len--;
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->ssId.ssId, pBuf, pJoinReq->ssId.length);
+ pBuf += pJoinReq->ssId.length;
+ len -= pJoinReq->ssId.length;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract selfMacAddr
+ palCopyMemory( pMac->hHdd, pJoinReq->selfMacAddr, pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ len -= sizeof(tSirMacAddr);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract bsstype
+ pJoinReq->bsstype = (tSirBssType) limGetU32(pBuf);
+ pBuf += sizeof(tANI_U32);
+ len -= sizeof(tANI_U32);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract dot11mode
+ pJoinReq->dot11mode= *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract bssPersona
+ pJoinReq->staPersona = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract uapsdPerAcBitmask
+ pJoinReq->uapsdPerAcBitmask = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ // Extract assocType
+ pJoinReq->assocType = (tSirAssocType) limGetU32(pBuf);
+ pBuf += sizeof(tSirAssocType);
+ len -= sizeof(tSirAssocType);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+#endif
+
+ // Extract operationalRateSet
+ pJoinReq->operationalRateSet.numRates= *pBuf++;
+ len--;
+ if (pJoinReq->operationalRateSet.numRates)
+ {
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->operationalRateSet.rate, pBuf, pJoinReq->operationalRateSet.numRates);
+ pBuf += pJoinReq->operationalRateSet.numRates;
+ len -= pJoinReq->operationalRateSet.numRates;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+ }
+
+ // Extract extendedRateSet
+ pJoinReq->extendedRateSet.numRates = *pBuf++;
+ len--;
+ if (pJoinReq->extendedRateSet.numRates)
+ {
+ palCopyMemory( pMac->hHdd, pJoinReq->extendedRateSet.rate, pBuf, pJoinReq->extendedRateSet.numRates);
+ pBuf += pJoinReq->extendedRateSet.numRates;
+ len -= pJoinReq->extendedRateSet.numRates;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+ }
+
+ // Extract RSN IE
+ pJoinReq->rsnIE.length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+
+ if (pJoinReq->rsnIE.length)
+ {
+ // Check for RSN IE length (that includes length of type & length)
+ if ((pJoinReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2) ||
+ (pJoinReq->rsnIE.length != 2 + *(pBuf + 1)))
+ {
+ limLog(pMac, LOGW,
+ FL("Invalid RSN IE length %d in SME_JOIN_REQ\n"),
+ pJoinReq->rsnIE.length);
+ return eSIR_FAILURE;
+ }
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->rsnIE.rsnIEdata,
+ pBuf, pJoinReq->rsnIE.length);
+ pBuf += pJoinReq->rsnIE.length;
+ len -= pJoinReq->rsnIE.length; // skip RSN IE
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+ }
+
+#ifdef FEATURE_WLAN_CCX
+ // Extract CCKM IE
+ pJoinReq->cckmIE.length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+ if (pJoinReq->cckmIE.length)
+ {
+ // Check for CCKM IE length (that includes length of type & length)
+ if ((pJoinReq->cckmIE.length > SIR_MAC_MAX_IE_LENGTH) ||
+ (pJoinReq->cckmIE.length != (2 + *(pBuf + 1))))
+ {
+ limLog(pMac, LOGW,
+ FL("Invalid CCKM IE length %d/%d in SME_JOIN/REASSOC_REQ\n"),
+ pJoinReq->cckmIE.length, 2 + *(pBuf + 1));
+ return eSIR_FAILURE;
+ }
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->cckmIE.cckmIEdata,
+ pBuf, pJoinReq->cckmIE.length);
+ pBuf += pJoinReq->cckmIE.length;
+ len -= pJoinReq->cckmIE.length; // skip CCKM IE
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+ }
+#endif
+
+ // Extract Add IE for scan
+ pJoinReq->addIEScan.length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+
+ if (pJoinReq->addIEScan.length)
+ {
+ // Check for IE length (that includes length of type & length)
+ if (pJoinReq->addIEScan.length > SIR_MAC_MAX_IE_LENGTH + 2)
+ {
+ limLog(pMac, LOGE,
+ FL("Invalid addIE Scan length %d in SME_JOIN_REQ\n"),
+ pJoinReq->addIEScan.length);
+ return eSIR_FAILURE;
+ }
+ // Check for P2P IE length (that includes length of type & length)
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->addIEScan.addIEdata,
+ pBuf, pJoinReq->addIEScan.length);
+ pBuf += pJoinReq->addIEScan.length;
+ len -= pJoinReq->addIEScan.length; // skip add IE
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+ }
+
+ pJoinReq->addIEAssoc.length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+
+ // Extract Add IE for assoc
+ if (pJoinReq->addIEAssoc.length)
+ {
+ // Check for IE length (that includes length of type & length)
+ if (pJoinReq->addIEAssoc.length > SIR_MAC_MAX_IE_LENGTH + 2)
+ {
+ limLog(pMac, LOGE,
+ FL("Invalid addIE Assoc length %d in SME_JOIN_REQ\n"),
+ pJoinReq->addIEAssoc.length);
+ return eSIR_FAILURE;
+ }
+ // Check for P2P IE length (that includes length of type & length)
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->addIEAssoc.addIEdata,
+ pBuf, pJoinReq->addIEAssoc.length);
+ pBuf += pJoinReq->addIEAssoc.length;
+ len -= pJoinReq->addIEAssoc.length; // skip add IE
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+ }
+
+ pJoinReq->MCEncryptionType = limGetU32(pBuf);
+ pBuf += sizeof(tANI_U32);
+ len -= sizeof(tANI_U32);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ pJoinReq->UCEncryptionType = limGetU32(pBuf);
+ pBuf += sizeof(tANI_U32);
+ len -= sizeof(tANI_U32);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ //is11Rconnection;
+ pJoinReq->is11Rconnection = (tAniBool)limGetU32(pBuf);
+ pBuf += sizeof(tAniBool);
+ len -= sizeof(tAniBool);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+ //isCCXconnection;
+ pJoinReq->isCCXconnection = (tAniBool)limGetU32(pBuf);
+ pBuf += sizeof(tAniBool);
+ len -= sizeof(tAniBool);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // TSPEC information
+ pJoinReq->ccxTspecInfo.numTspecs = *pBuf++;
+ len -= sizeof(tANI_U8);
+ palCopyMemory(pMac->hHdd, (void*)&pJoinReq->ccxTspecInfo.tspec[0], pBuf, (sizeof(tTspecInfo)* pJoinReq->ccxTspecInfo.numTspecs));
+ pBuf += sizeof(tTspecInfo)*SIR_CCX_MAX_TSPEC_IES;
+ len -= sizeof(tTspecInfo)*SIR_CCX_MAX_TSPEC_IES;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX
+ //isFastTransitionEnabled;
+ pJoinReq->isFastTransitionEnabled = (tAniBool)limGetU32(pBuf);
+ pBuf += sizeof(tAniBool);
+ len -= sizeof(tAniBool);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+#endif
+
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+ // Extract BP Indicator
+ pJoinReq->bpIndicator = (tAniBool) limGetU32(pBuf);
+ pBuf += sizeof(tAniBool);
+ len -= sizeof(tAniBool);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract BP Type
+ pJoinReq->bpType = (tSirBpIndicatorType) limGetU32(pBuf);
+ pBuf += sizeof(tSirBpIndicatorType);
+ len -= sizeof(tSirBpIndicatorType);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract Neighbor BSS List
+ if (limGetNeighborBssList(pMac, &pJoinReq->neighborBssList,
+ len, &lenUsed, pBuf) == eSIR_FAILURE)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("get neighbor bss list failed\n"));)
+ return eSIR_FAILURE;
+ }
+ pBuf += lenUsed;
+ len -= lenUsed;
+ PELOG1(limLog(pMac, LOG1, FL("Assoc Type %d RSN len %d bp %d type %d bss RSN len %d\n"),
+ pJoinReq->assocType, pJoinReq->rsnIE.length, pJoinReq->bpIndicator,
+ pJoinReq->bpType, pJoinReq->neighborBssList.bssList->rsnIE.length);)
+#endif
+
+ // Extract Titan CB Neighbor BSS info
+ pJoinReq->cbNeighbors.cbBssFoundPri = *pBuf;
+ pBuf++;
+ pJoinReq->cbNeighbors.cbBssFoundSecUp = *pBuf;
+ pBuf++;
+ pJoinReq->cbNeighbors.cbBssFoundSecDown = *pBuf;
+ pBuf++;
+ len -= 3;
+
+ // Extract Spectrum Mgt Indicator
+ pJoinReq->spectrumMgtIndicator = (tAniBool) limGetU32(pBuf);
+ pBuf += sizeof(tAniBool);
+ len -= sizeof(tAniBool);
+
+ pJoinReq->powerCap.minTxPower = *pBuf++;
+ pJoinReq->powerCap.maxTxPower = *pBuf++;
+ len -=2;
+ limLog(pMac, LOGE, FL("Power Caps: Min power = %d, Max power = %d\n"), pJoinReq->powerCap.minTxPower, pJoinReq->powerCap.maxTxPower);
+
+ pJoinReq->supportedChannels.numChnl = *pBuf++;
+ len--;
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->supportedChannels.channelList,
+ pBuf, pJoinReq->supportedChannels.numChnl);
+ pBuf += pJoinReq->supportedChannels.numChnl;
+ len-= pJoinReq->supportedChannels.numChnl;
+
+ PELOG2(limLog(pMac, LOG2,
+ FL("spectrumInd ON: minPower %d, maxPower %d , numChnls %d\n"),
+ pJoinReq->powerCap.minTxPower,
+ pJoinReq->powerCap.maxTxPower,
+ pJoinReq->supportedChannels.numChnl);)
+
+ // Extract uapsdPerAcBitmask
+ pJoinReq->uapsdPerAcBitmask = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA)
+ //
+ // NOTE - tSirBssDescription is now moved to the end
+ // of tSirSmeJoinReq structure. This is to accomodate
+ // the variable length data member ieFields[1]
+ //
+ if (limGetBssDescription( pMac, &pJoinReq->bssDescription,
+ len, &lenUsed, pBuf) == eSIR_FAILURE)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("get bss description failed\n"));)
+ return eSIR_FAILURE;
+ }
+ PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, (tANI_U8 *) &(pJoinReq->bssDescription), pJoinReq->bssDescription.length + 2);)
+ pBuf += lenUsed;
+ len -= lenUsed;
+#endif
+
+ return eSIR_SUCCESS;
+} /*** end limJoinReqSerDes() ***/
+
+
+/**---------------------------------------------------------------
+\fn limAssocIndSerDes
+\brief This function is called by limProcessMlmAssocInd() to
+\ populate the SME_ASSOC_IND message based on the received
+\ MLM_ASSOC_IND.
+\
+\param pMac
+\param pAssocInd - Pointer to the received tLimMlmAssocInd
+\param pBuf - Pointer to serialized buffer
+\param psessionEntry - pointer to PE session entry
+\
+\return None
+------------------------------------------------------------------*/
+void
+limAssocIndSerDes(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd, tANI_U8 *pBuf, tpPESession psessionEntry)
+{
+ tANI_U8 *pLen = pBuf;
+ tANI_U16 mLen = 0;
+
+#ifdef PE_DEBUG_LOG1
+ tANI_U8 *pTemp = pBuf;
+#endif
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ tANI_U32 len = 0;
+#endif
+
+ mLen = sizeof(tANI_U32);
+ mLen += sizeof(tANI_U8);
+ pBuf += sizeof(tANI_U16);
+ *pBuf = psessionEntry->smeSessionId;
+ pBuf += sizeof(tANI_U8);
+
+ // Fill in peerMacAddr
+ palCopyMemory( pMac->hHdd, pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ mLen += sizeof(tSirMacAddr);
+
+ // Fill in aid
+ limCopyU16(pBuf, pAssocInd->aid);
+ pBuf += sizeof(tANI_U16);
+ mLen += sizeof(tANI_U16);
+
+ // Fill in bssId
+ palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ mLen += sizeof(tSirMacAddr);
+
+ // Fill in staId
+ limCopyU16(pBuf, psessionEntry->staId);
+ pBuf += sizeof(tANI_U16);
+ mLen += sizeof(tANI_U16);
+
+ // Fill in authType
+ limCopyU32(pBuf, pAssocInd->authType);
+ pBuf += sizeof(tANI_U32);
+ mLen += sizeof(tANI_U32);
+
+ // Fill in ssId
+ palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
+ pBuf += (1 + pAssocInd->ssId.length);
+ mLen += (1 + pAssocInd->ssId.length);
+
+ // Fill in rsnIE
+ limCopyU16(pBuf, pAssocInd->rsnIE.length);
+ pBuf += sizeof(tANI_U16);
+ mLen += sizeof(tANI_U16);
+ palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
+ pAssocInd->rsnIE.length);
+ pBuf += pAssocInd->rsnIE.length;
+ mLen += pAssocInd->rsnIE.length;
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+
+ limCopyU16(pBuf, pAssocInd->seqNum);
+ pBuf += sizeof(tANI_U16);
+ mLen += sizeof(tANI_U16);
+
+ limCopyU32(pBuf, pAssocInd->wniIndicator);
+ pBuf += sizeof(tAniBool);
+ mLen += sizeof(tAniBool);
+
+ limCopyU32(pBuf, pAssocInd->bpIndicator);
+ pBuf += sizeof(tAniBool);
+ mLen += sizeof(tAniBool);
+
+ limCopyU32(pBuf, pAssocInd->bpType);
+ pBuf += sizeof(tSirBpIndicatorType);
+ mLen += sizeof(tSirBpIndicatorType);
+
+ limCopyU32(pBuf, pAssocInd->assocType);
+ pBuf += sizeof(tANI_U32);
+ mLen += sizeof(tANI_U32);
+
+ limCopyLoad(pBuf, pAssocInd->load);
+ pBuf += sizeof(tSirLoad);
+ mLen += sizeof(tSirLoad);
+
+ limCopyU32(pBuf, pAssocInd->numBss);
+ pBuf += sizeof(tANI_U32);
+ mLen += sizeof(tANI_U32);
+
+ if (pAssocInd->numBss)
+ {
+ len = limCopyNeighborList(pMac,
+ pBuf,
+ pAssocInd->neighborList, pAssocInd->numBss);
+ pBuf += len;
+ mLen += (tANI_U16) len;
+ }
+
+ // place holder to capability and nwType
+
+ limCopyU16(pBuf, *(tANI_U16 *)&pAssocInd->capabilityInfo);
+ pBuf += sizeof(tANI_U16); // capabilityInfo
+ mLen += sizeof(tANI_U16);
+
+ limCopyU32(pBuf, *(tANI_U32 *)&pAssocInd->nwType);
+ pBuf += sizeof(tANI_U32); // nwType
+ mLen += sizeof(tANI_U32);
+
+#endif
+
+ // Copy the new TITAN capabilities
+ *pBuf = pAssocInd->titanHtCaps;
+ pBuf++;
+ mLen++;
+
+ limCopyU32(pBuf, pAssocInd->spectrumMgtIndicator);
+ pBuf += sizeof(tAniBool);
+ mLen += sizeof(tAniBool);
+
+ if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
+ {
+ *pBuf = pAssocInd->powerCap.minTxPower;
+ pBuf++;
+ *pBuf = pAssocInd->powerCap.maxTxPower;
+ pBuf++;
+ mLen += sizeof(tSirMacPowerCapInfo);
+
+ *pBuf = pAssocInd->supportedChannels.numChnl;
+ pBuf++;
+ mLen++;
+
+ palCopyMemory( pMac->hHdd, pBuf,
+ (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
+ pAssocInd->supportedChannels.numChnl);
+
+
+ pBuf += pAssocInd->supportedChannels.numChnl;
+ mLen += pAssocInd->supportedChannels.numChnl;
+ }
+#ifdef WLAN_SOFTAP_FEATURE
+ limCopyU32(pBuf, pAssocInd->WmmStaInfoPresent);
+ pBuf += sizeof(tANI_U32);
+ mLen += sizeof(tANI_U32);
+#endif
+ // Fill in length of SME_ASSOC_IND message
+ limCopyU16(pLen, mLen);
+
+ PELOG1(limLog(pMac, LOG1, FL("Sending SME_ASSOC_IND length %d bytes:\n"), mLen);)
+ PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
+} /*** end limAssocIndSerDes() ***/
+
+
+
+/**
+ * limAssocCnfSerDes()
+ *
+ *FUNCTION:
+ * This function is called by limProcessLmmMessages() when
+ * SME_ASSOC_CNF or SME_REASSOC_CNF message is received from
+ * upper layer software.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pAssocCnf Pointer to tSirSmeAssocCnf being extracted into
+ * @param pBuf Pointer to serialized buffer
+ * @return retCode Indicates whether message is successfully
+ * de-serialized (eSIR_SUCCESS) or
+ * not (eSIR_FAILURE)
+ */
+
+tSirRetStatus
+limAssocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeAssocCnf pAssocCnf, tANI_U8 *pBuf)
+{
+#ifdef PE_DEBUG_LOG1
+ tANI_U8 *pTemp = pBuf;
+#endif
+
+ if (!pAssocCnf || !pBuf)
+ return eSIR_FAILURE;
+
+ pAssocCnf->messageType = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ pAssocCnf->length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ if (pAssocCnf->messageType == eWNI_SME_ASSOC_CNF)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("SME_ASSOC_CNF length %d bytes is:\n"), pAssocCnf->length);)
+ }
+ else
+ {
+ PELOG1(limLog(pMac, LOG1, FL("SME_REASSOC_CNF length %d bytes is:\n"), pAssocCnf->length);)
+ }
+ PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pAssocCnf->length);)
+
+ // status code
+ pAssocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
+ pBuf += sizeof(tSirResultCodes);
+
+ // bssId
+ palCopyMemory( pMac->hHdd, pAssocCnf->bssId, pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+
+ // peerMacAddr
+ palCopyMemory( pMac->hHdd, pAssocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+
+
+ pAssocCnf->aid = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ // alternateBssId
+ palCopyMemory( pMac->hHdd, pAssocCnf->alternateBssId, pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+
+ // alternateChannelId
+ pAssocCnf->alternateChannelId = *pBuf;
+ pBuf++;
+
+ return eSIR_SUCCESS;
+} /*** end limAssocCnfSerDes() ***/
+
+
+
+/**
+ * limDisassocCnfSerDes()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeMessages() when
+ * SME_DISASSOC_CNF message is received from upper layer software.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pDisassocCnf Pointer to tSirSmeDisassocCnf being
+ * extracted into
+ * @param pBuf Pointer to serialized buffer
+ * @return retCode Indicates whether message is successfully
+ * de-serialized (eSIR_SUCCESS) or
+ * not (eSIR_FAILURE)
+ */
+
+tSirRetStatus
+limDisassocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeDisassocCnf pDisassocCnf, tANI_U8 *pBuf)
+{
+#ifdef PE_DEBUG_LOG1
+ tANI_U8 *pTemp = pBuf;
+#endif
+
+ if (!pDisassocCnf || !pBuf)
+ return eSIR_FAILURE;
+
+ pDisassocCnf->messageType = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ pDisassocCnf->length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_CNF length %d bytes is:\n"), pDisassocCnf->length);)
+ PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pDisassocCnf->length);)
+
+ pDisassocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
+ pBuf += sizeof(tSirResultCodes);
+
+ palCopyMemory( pMac->hHdd, pDisassocCnf->bssId, pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+
+ palCopyMemory( pMac->hHdd, pDisassocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
+
+#if defined(ANI_PRODUCT_TYPE_AP)
+ pBuf += sizeof(tSirMacAddr);
+ pDisassocCnf->aid = limGetU16(pBuf);
+#endif
+
+ return eSIR_SUCCESS;
+} /*** end limDisassocCnfSerDes() ***/
+
+
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+/**
+ * limMeasurementReqSerDes()
+ *
+ *FUNCTION:
+ * This function is called by limProcessLmmMessages() when
+ * SME_MEASUREMENT_REQ message is received from upper layer software.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMeasReq Pointer to tSirSmeMeasurement being
+ * extracted into
+ * @param pBuf Pointer to serialized buffer
+ * @return retCode Indicates whether message is successfully
+ * de-serialized (eSIR_SUCCESS) or
+ * not (eSIR_FAILURE)
+ */
+
+tSirRetStatus
+limMeasurementReqSerDes(tpAniSirGlobal pMac, tpSirSmeMeasurementReq pMeasReq, tANI_U8 *pBuf)
+{
+ tANI_S16 len = 0;
+ PELOG3(tANI_U8 *pTemp = pBuf;)
+
+ if (!pMeasReq || !pBuf)
+ return eSIR_FAILURE;
+
+ pMeasReq->messageType = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ len = pMeasReq->length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ PELOG3(limLog(pMac, LOG3, FL("SME_MEASUREMENT_REQ length %d bytes is:\n"), len);
+ sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
+
+ if (len < (tANI_S16) sizeof(tANI_U32))
+ return eSIR_FAILURE;
+
+ len -= sizeof(tANI_U32); // skip message header
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ pMeasReq->measControl.periodicMeasEnabled = (tAniBool)
+ limGetU32(pBuf);
+
+ pBuf += sizeof(tAniBool);
+ len -= sizeof(tAniBool);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ pMeasReq->measControl.involveSTAs = (tAniBool)
+ limGetU32(pBuf);
+ pBuf += sizeof(tAniBool);
+ len -= sizeof(tAniBool);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ pMeasReq->measControl.metricsType = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ pMeasReq->measControl.scanType = (tSirScanType)
+ limGetU32(pBuf);
+ pBuf += sizeof(tSirScanType);
+ len -= sizeof(tSirScanType);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ pMeasReq->measControl.longChannelScanPeriodicity = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ pMeasReq->measControl.cb11hEnabled = (tAniBool)limGetU32(pBuf);
+ pBuf += sizeof(tAniBool);
+ len -= sizeof(tAniBool);
+
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ pMeasReq->measDuration.shortTermPeriod = limGetU32(pBuf);
+ pBuf += sizeof(tANI_U32);
+
+ pMeasReq->measDuration.averagingPeriod = limGetU32(pBuf);
+ pBuf += sizeof(tANI_U32);
+
+ pMeasReq->measDuration.shortChannelScanDuration = limGetU32(pBuf);
+ pBuf += sizeof(tANI_U32);
+
+ pMeasReq->measDuration.longChannelScanDuration = limGetU32(pBuf);
+ pBuf += sizeof(tANI_U32);
+
+ len -= sizeof(tSirMeasDuration);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ pMeasReq->measIndPeriod = limGetU32(pBuf);
+
+ pBuf += sizeof(tANI_U32);
+ len -= sizeof(tANI_U32);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ pMeasReq->channelList.numChannels = *pBuf++;
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pMeasReq->channelList.channelNumber,
+ pBuf, pMeasReq->channelList.numChannels);
+
+ return eSIR_SUCCESS;
+} /*** end limMeasurementReqSerDes() ***/
+
+
+/**
+ * limWdsReqSerDes()
+ *
+ *FUNCTION:
+ * This function is called by limProcessLmmMessages() when
+ * SME_SET_WDS_INFO_REQ message is received from upper layer software.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pWdsInfo Pointer to tSirWdsInfo being extracted into
+ * @param pBuf Pointer to serialized buffer
+ * @return retCode Indicates whether message is successfully
+ * de-serialized (eSIR_SUCCESS) or
+ * not (eSIR_FAILURE)
+ */
+
+tSirRetStatus
+limWdsReqSerDes(tpAniSirGlobal pMac, tpSirSmeSetWdsInfoReq pWdsInfoReq, tANI_U8 *pBuf)
+{
+ tANI_S16 len = 0;
+ PELOG1(tANI_U8 *pTemp = pBuf;)
+
+ if (!pWdsInfoReq || !pBuf)
+ return eSIR_FAILURE;
+
+ // Extract messageType
+ pWdsInfoReq->messageType = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ // Extract length
+ len = pWdsInfoReq->length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ PELOG1(limLog(pMac, LOG1, FL("SME_SET_WDS_INFO_REQ length %d bytes is:\n"), len);)
+ PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
+
+ if (len < (tANI_S16) sizeof(tANI_U32))
+ return eSIR_FAILURE;
+
+ len -= sizeof(tANI_U32); // skip message header
+
+ // Extract transactionId
+ pWdsInfoReq->transactionId = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+
+ // Extract wdsInfo
+ pWdsInfoReq->wdsInfo.wdsLength = limGetU16(pBuf);
+ len -= sizeof(tANI_U16);
+ pBuf += sizeof(tANI_U16);
+
+ if (pWdsInfoReq->wdsInfo.wdsLength > ANI_WDS_INFO_MAX_LENGTH)
+ return eSIR_FAILURE;
+
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pWdsInfoReq->wdsInfo.wdsBytes,
+ pBuf,
+ pWdsInfoReq->wdsInfo.wdsLength);
+
+ return eSIR_SUCCESS;
+
+} /*** end limWdsReqSerDes() ***/
+
+
+/**
+ * limMeasurementIndSerDes()
+ *
+ *FUNCTION:
+ * This function is called by limSendMeasurementInd() while
+ * sending SME_MEASUREMENT_IND message to WSM.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pMeasInd - Pointer to prepared MEASUREMENT_IND message
+ * @return None
+ */
+
+void
+limMeasurementIndSerDes(tpAniSirGlobal pMac, tANI_U8 *pBuf)
+{
+ tANI_U8 *pLen;
+ tANI_U16 len = 0, infoLen = 0;
+ tSirLoad load;
+ PELOG3(tANI_U8 *pTemp = pBuf;)
+
+ limCopyU16(pBuf, eWNI_SME_MEASUREMENT_IND);
+ pBuf += sizeof(tANI_U16);
+
+ pLen = pBuf;
+ pBuf += sizeof(tANI_U16);
+
+ limCopyU32(pBuf, pMac->lim.gpLimMeasData->duration);
+ pBuf += sizeof(tANI_U32);
+ len += sizeof(tANI_U32);
+
+ load.numStas = pMac->lim.gLimNumOfCurrentSTAs;
+ load.channelUtilization =
+ pMac->lim.gpLimMeasData->avgChannelUtilization;
+ limCopyLoad(pBuf, load);
+ pBuf += sizeof(tSirLoad);
+ len += sizeof(tSirLoad);
+
+ infoLen = limCopyMeasMatrixList(pMac, pBuf);
+ pBuf += infoLen;
+ len += infoLen;
+
+ infoLen = limCopyNeighborWdsList(pMac, pBuf);
+ pBuf += infoLen;
+ len += infoLen;
+
+ limCopyU16(pLen, len+4);
+
+ PELOG3(limLog(pMac, LOG3, FL("Sending MEAS_IND length %d bytes:\n"), len);
+ sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
+} /*** end limMeasurementIndSerDes() ***/
+#endif
+
+
+/**---------------------------------------------------------------
+\fn limReassocIndSerDes
+\brief This function is called by limProcessMlmReassocInd() to
+\ populate the SME_REASSOC_IND message based on the received
+\ MLM_REASSOC_IND.
+\
+\param pMac
+\param pReassocInd - Pointer to the received tLimMlmReassocInd
+\param pBuf - Pointer to serialized buffer
+\param psessionEntry - pointer to PE session entry
+\
+\return None
+------------------------------------------------------------------*/
+void
+limReassocIndSerDes(tpAniSirGlobal pMac, tpLimMlmReassocInd pReassocInd, tANI_U8 *pBuf, tpPESession psessionEntry)
+{
+ tANI_U8 *pLen = pBuf;
+ tANI_U16 mLen = 0;
+
+#ifdef PE_DEBUG_LOG1
+ tANI_U8 *pTemp = pBuf;
+#endif
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ tANI_U32 len = 0;
+#endif
+
+ mLen = sizeof(tANI_U32);
+ pBuf += sizeof(tANI_U16);
+ *pBuf++ = psessionEntry->smeSessionId;
+ mLen += sizeof(tANI_U8);
+
+ // Fill in peerMacAddr
+ palCopyMemory( pMac->hHdd, pBuf, pReassocInd->peerMacAddr, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ mLen += sizeof(tSirMacAddr);
+
+ // Fill in oldMacAddr
+ palCopyMemory( pMac->hHdd, pBuf, pReassocInd->currentApAddr, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ mLen += sizeof(tSirMacAddr);
+
+ // Fill in aid
+ limCopyU16(pBuf, pReassocInd->aid);
+ pBuf += sizeof(tANI_U16);
+ mLen += sizeof(tANI_U16);
+
+ // Fill in bssId
+ palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ mLen += sizeof(tSirMacAddr);
+
+ // Fill in staId
+ limCopyU16(pBuf, psessionEntry->staId);
+ pBuf += sizeof(tANI_U16);
+ mLen += sizeof(tANI_U16);
+
+ // Fill in authType
+ limCopyU32(pBuf, pReassocInd->authType);
+ pBuf += sizeof(tAniAuthType);
+ mLen += sizeof(tAniAuthType);
+
+ // Fill in ssId
+ palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pReassocInd->ssId),
+ pReassocInd->ssId.length + 1);
+ pBuf += 1 + pReassocInd->ssId.length;
+ mLen += pReassocInd->ssId.length + 1;
+
+ // Fill in rsnIE
+ limCopyU16(pBuf, pReassocInd->rsnIE.length);
+ pBuf += sizeof(tANI_U16);
+ mLen += sizeof(tANI_U16);
+ palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pReassocInd->rsnIE.rsnIEdata),
+ pReassocInd->rsnIE.length);
+ pBuf += pReassocInd->rsnIE.length;
+ mLen += pReassocInd->rsnIE.length;
+
+ // Fill in addIE
+ limCopyU16(pBuf, pReassocInd->addIE.length);
+ pBuf += sizeof(tANI_U16);
+ mLen += sizeof(tANI_U16);
+ palCopyMemory( pMac->hHdd, pBuf, (tANI_U8*) &(pReassocInd->addIE.addIEdata),
+ pReassocInd->addIE.length);
+ pBuf += pReassocInd->addIE.length;
+ mLen += pReassocInd->addIE.length;
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+
+ limCopyU16(pBuf, pReassocInd->seqNum);
+ pBuf += sizeof(tANI_U16);
+ mLen += sizeof(tANI_U16);
+
+ limCopyU32(pBuf, pReassocInd->wniIndicator);
+ pBuf += sizeof(tAniBool);
+ mLen += sizeof(tAniBool);
+
+ limCopyU32(pBuf, pReassocInd->bpIndicator);
+ pBuf += sizeof(tAniBool);
+ mLen += sizeof(tAniBool);
+
+ limCopyU32(pBuf, pReassocInd->bpType);
+ pBuf += sizeof(tSirBpIndicatorType);
+ mLen += sizeof(tSirBpIndicatorType);
+
+ limCopyU32(pBuf, pReassocInd->reassocType);
+ pBuf += sizeof(tSirAssocType);
+ mLen += sizeof(tSirAssocType);
+
+ limCopyLoad(pBuf, pReassocInd->load);
+ pBuf += sizeof(tSirLoad);
+ mLen += sizeof(tSirLoad);
+
+ limCopyU32(pBuf, pReassocInd->numBss);
+ pBuf += sizeof(tANI_U32);
+ mLen += sizeof(tANI_U32);
+
+ if (pReassocInd->numBss)
+ {
+ len = limCopyNeighborList(pMac,
+ pBuf,
+ pReassocInd->neighborList, pReassocInd->numBss);
+ pBuf += len;
+ mLen += (tANI_U16) len;
+ }
+
+ // place holder to capability and nwType
+ limCopyU16(pBuf, *(tANI_U16 *)&pReassocInd->capabilityInfo);
+ pBuf += sizeof(tANI_U16); // capabilityInfo
+ mLen += sizeof(tANI_U16);
+
+ limCopyU32(pBuf, *(tANI_U32 *)&pReassocInd->nwType);
+ pBuf += sizeof(tANI_U32); // nwType
+ mLen += sizeof(tANI_U32);
+#endif
+
+ // Copy the new TITAN capabilities
+ *pBuf = pReassocInd->titanHtCaps;
+ pBuf++;
+ mLen++;
+
+ limCopyU32(pBuf, pReassocInd->spectrumMgtIndicator);
+ pBuf += sizeof(tAniBool);
+ mLen += sizeof(tAniBool);
+
+ if (pReassocInd->spectrumMgtIndicator == eSIR_TRUE)
+ {
+ *pBuf = pReassocInd->powerCap.minTxPower;
+ pBuf++;
+ *pBuf = pReassocInd->powerCap.maxTxPower;
+ pBuf++;
+ mLen += sizeof(tSirMacPowerCapInfo);
+
+ *pBuf = pReassocInd->supportedChannels.numChnl;
+ pBuf++;
+ mLen++;
+
+ palCopyMemory( pMac->hHdd, pBuf,
+ (tANI_U8 *) &(pReassocInd->supportedChannels.channelList),
+ pReassocInd->supportedChannels.numChnl);
+
+ pBuf += pReassocInd->supportedChannels.numChnl;
+ mLen += pReassocInd->supportedChannels.numChnl;
+ }
+#ifdef WLAN_SOFTAP_FEATURE
+ limCopyU32(pBuf, pReassocInd->WmmStaInfoPresent);
+ pBuf += sizeof(tANI_U32);
+ mLen += sizeof(tANI_U32);
+#endif
+
+ // Fill in length of SME_REASSOC_IND message
+ limCopyU16(pLen, mLen);
+
+ PELOG1(limLog(pMac, LOG1, FL("Sending SME_REASSOC_IND length %d bytes:\n"), mLen);)
+ PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
+} /*** end limReassocIndSerDes() ***/
+
+
+/**
+ * limAuthIndSerDes()
+ *
+ *FUNCTION:
+ * This function is called by limProcessMlmAuthInd() while sending
+ * SME_AUTH_IND to host
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pAuthInd Pointer to tSirSmeAuthInd being sent
+ * @param pBuf Pointer to serialized buffer
+ *
+ * @return None
+ */
+
+void
+limAuthIndSerDes(tpAniSirGlobal pMac, tpLimMlmAuthInd pAuthInd, tANI_U8 *pBuf)
+{
+ tANI_U8 *pLen = pBuf;
+ tANI_U16 mLen = 0;
+
+#ifdef PE_DEBUG_LOG1
+ tANI_U8 *pTemp = pBuf;
+#endif
+
+ mLen = sizeof(tANI_U32);
+ pBuf += sizeof(tANI_U16);
+ *pBuf++ = pAuthInd->sessionId;
+ mLen += sizeof(tANI_U8);
+
+ // BTAMP TODO: Fill in bssId
+ palZeroMemory(pMac->hHdd, pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ mLen += sizeof(tSirMacAddr);
+
+ palCopyMemory( pMac->hHdd, pBuf, pAuthInd->peerMacAddr, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ mLen += sizeof(tSirMacAddr);
+
+ limCopyU32(pBuf, pAuthInd->authType);
+ pBuf += sizeof(tAniAuthType);
+ mLen += sizeof(tAniAuthType);
+
+ limCopyU16(pLen, mLen);
+
+ PELOG1(limLog(pMac, LOG1, FL("Sending SME_AUTH_IND length %d bytes:\n"), mLen);)
+ PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
+} /*** end limAuthIndSerDes() ***/
+
+
+
+/**
+ * limSetContextReqSerDes()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeMessages() upon receiving
+ * SME_SETCONTEXT_REQ from host
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pSetContextReq Pointer to tSirSmeSetContextReq being
+ * extracted
+ * @param pBuf Pointer to serialized buffer
+ *
+ * @return retCode Indicates whether message is successfully
+ * de-serialized (eSIR_SUCCESS) or
+ * not (eSIR_FAILURE)
+ */
+
+tSirRetStatus
+limSetContextReqSerDes(tpAniSirGlobal pMac, tpSirSmeSetContextReq pSetContextReq, tANI_U8 *pBuf)
+{
+ tANI_S16 len = 0;
+ tANI_U16 totalKeySize = sizeof(tANI_U8); // initialized to sizeof numKeys
+ tANI_U8 numKeys;
+ tANI_U8 *pKeys;
+
+#ifdef PE_DEBUG_LOG1
+ tANI_U8 *pTemp = pBuf;
+#endif
+ if (!pSetContextReq || !pBuf)
+ return eSIR_FAILURE;
+
+ pSetContextReq->messageType = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ len = pSetContextReq->length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ PELOG1(limLog(pMac, LOG1, FL("SME_SETCONTEXT_REQ length %d bytes is:\n"), len);)
+ PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
+
+ if (len < (tANI_S16) sizeof(tANI_U32))
+ return eSIR_FAILURE;
+
+ len -= sizeof(tANI_U32); // skip message header
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract sessionId
+ pSetContextReq->sessionId = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract transactionId
+ pSetContextReq->transactionId = sirReadU16N(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pSetContextReq->peerMacAddr,
+ pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ len -= sizeof(tSirMacAddr);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+ palCopyMemory( pMac->hHdd, pSetContextReq->bssId, pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ len -= sizeof(tSirMacAddr);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+#if defined(ANI_PRODUCT_TYPE_AP)
+ pSetContextReq->aid = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+#endif
+
+// pSetContextReq->qosInfoPresent = limGetU32(pBuf);
+// pBuf += sizeof(tAniBool);
+
+// if (pSetContextReq->qosInfoPresent)
+// {
+// len = limGetQosInfo(&pSetContextReq->qos, pBuf);
+// pBuf += len;
+// }
+
+ pSetContextReq->keyMaterial.length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ pSetContextReq->keyMaterial.edType = (tAniEdType) limGetU32(pBuf);
+ pBuf += sizeof(tAniEdType);
+ len -= sizeof(tAniEdType);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ numKeys = pSetContextReq->keyMaterial.numKeys = *pBuf++;
+ len -= sizeof(numKeys);
+
+ if (numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
+ return eSIR_FAILURE;
+
+ /** Initialize the Default Keys if no Keys are being sent from the upper layer*/
+ if( limCheckRemainingLength(pMac, len) == eSIR_FAILURE) {
+ tpSirKeys pKeyinfo = pSetContextReq->keyMaterial.key;
+
+ pKeyinfo->keyId = 0;
+ pKeyinfo->keyDirection = eSIR_TX_RX;
+ pKeyinfo->keyLength = 0;
+
+ if (!limIsAddrBC(pSetContextReq->peerMacAddr))
+ pKeyinfo->unicast = 1;
+ else
+ pKeyinfo->unicast = 0;
+ }else {
+ pKeys = (tANI_U8 *) pSetContextReq->keyMaterial.key;
+ do {
+ tANI_U32 keySize = limGetKeysInfo(pMac, (tpSirKeys) pKeys,
+ pBuf);
+ pBuf += keySize;
+ pKeys += sizeof(tSirKeys);
+ totalKeySize += (tANI_U16) keySize;
+ if (numKeys == 0)
+ break;
+ numKeys--;
+ }while (numKeys);
+ }
+ return eSIR_SUCCESS;
+} /*** end limSetContextReqSerDes() ***/
+
+/**
+ * limRemoveKeyReqSerDes()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeMessages() upon receiving
+ * SME_REMOVEKEY_REQ from host
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pRemoveKeyReq Pointer to tSirSmeRemoveKeyReq being
+ * extracted
+ * @param pBuf Pointer to serialized buffer
+ *
+ * @return retCode Indicates whether message is successfully
+ * de-serialized (eSIR_SUCCESS) or
+ * not (eSIR_FAILURE)
+ */
+
+tSirRetStatus
+limRemoveKeyReqSerDes(tpAniSirGlobal pMac, tpSirSmeRemoveKeyReq pRemoveKeyReq, tANI_U8 *pBuf)
+{
+ tANI_S16 len = 0;
+
+#ifdef PE_DEBUG_LOG1
+ tANI_U8 *pTemp = pBuf;
+#endif
+ if (!pRemoveKeyReq || !pBuf)
+ return eSIR_FAILURE;
+
+ pRemoveKeyReq->messageType = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ len = pRemoveKeyReq->length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ PELOG1(limLog(pMac, LOG1, FL("SME_REMOVEKEY_REQ length %d bytes is:\n"), len);)
+ PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
+
+ if (len < (tANI_S16) sizeof(tANI_U32))
+ return eSIR_FAILURE;
+
+ len -= sizeof(tANI_U32); // skip message header
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pRemoveKeyReq->peerMacAddr,
+ pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ len -= sizeof(tSirMacAddr);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+#if defined(ANI_PRODUCT_TYPE_AP)
+ pRemoveKeyReq->aid = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+#endif
+
+ pRemoveKeyReq->edType = *pBuf;
+ pBuf += sizeof(tANI_U8);
+ len -= sizeof(tANI_U8);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ pRemoveKeyReq->wepType = *pBuf;
+
+ pBuf += sizeof(tANI_U8);
+ len -= sizeof(tANI_U8);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ pRemoveKeyReq->keyId = *pBuf;
+
+ pBuf += sizeof(tANI_U8);
+ len -= sizeof(tANI_U8);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ pRemoveKeyReq->unicast = *pBuf;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract bssId
+ palCopyMemory( pMac->hHdd, pRemoveKeyReq->bssId, pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ len -= sizeof(tSirMacAddr);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract sessionId
+ pRemoveKeyReq->sessionId = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract transactionId
+ pRemoveKeyReq->transactionId = sirReadU16N(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ return eSIR_SUCCESS;
+} /*** end limRemoveKeyReqSerDes() ***/
+
+
+
+/**
+ * limDisassocReqSerDes()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeMessages() upon receiving
+ * SME_DISASSOC_REQ from host
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pDisassocReq Pointer to tSirSmeDisassocReq being extracted
+ * @param pBuf Pointer to serialized buffer
+ *
+ * @return retCode Indicates whether message is successfully
+ * de-serialized (eSIR_SUCCESS) or
+ * not (eSIR_FAILURE)
+ */
+
+tSirRetStatus
+limDisassocReqSerDes(tpAniSirGlobal pMac, tSirSmeDisassocReq *pDisassocReq, tANI_U8 *pBuf)
+{
+ tANI_S16 len = 0;
+#ifdef PE_DEBUG_LOG1
+ tANI_U8 *pTemp = pBuf;
+#endif
+
+ if (!pDisassocReq || !pBuf)
+ return eSIR_FAILURE;
+
+ pDisassocReq->messageType = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ len = pDisassocReq->length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_REQ length %d bytes is:\n"), len);)
+ PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
+
+ if (len < (tANI_S16) sizeof(tANI_U32))
+ return eSIR_FAILURE;
+
+ len -= sizeof(tANI_U32); // skip message header
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract sessionID
+ pDisassocReq->sessionId = *pBuf;
+ pBuf += sizeof(tANI_U8);
+ len -= sizeof(tANI_U8);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract transactionid
+ pDisassocReq->transactionId = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract bssId
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pDisassocReq->bssId, pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ len -= sizeof(tSirMacAddr);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract peerMacAddr
+ palCopyMemory( pMac->hHdd, pDisassocReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ len -= sizeof(tSirMacAddr);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract reasonCode
+ pDisassocReq->reasonCode = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ pDisassocReq->doNotSendOverTheAir = *pBuf;
+ pBuf += sizeof(tANI_U8);
+ len -= sizeof(tANI_U8);
+
+#if defined(ANI_PRODUCT_TYPE_AP)
+ pDisassocReq->aid = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ pDisassocReq->seqNum = limGetU16(pBuf);
+#endif
+#endif
+
+ return eSIR_SUCCESS;
+} /*** end limDisassocReqSerDes() ***/
+
+
+
+/**
+ * limDeauthReqSerDes()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeMessages() upon receiving
+ * SME_DEAUTH_REQ from host
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pDeauthReq Pointer to tSirSmeDeauthReq being extracted
+ * @param pBuf Pointer to serialized buffer
+ *
+ * @return retCode Indicates whether message is successfully
+ * de-serialized (eSIR_SUCCESS) or
+ * not (eSIR_FAILURE)
+ */
+tSirRetStatus
+limDeauthReqSerDes(tpAniSirGlobal pMac, tSirSmeDeauthReq *pDeauthReq, tANI_U8 *pBuf)
+{
+ tANI_S16 len = 0;
+
+#ifdef PE_DEBUG_LOG1
+ tANI_U8 *pTemp = pBuf;
+#endif
+
+ if (!pDeauthReq || !pBuf)
+ return eSIR_FAILURE;
+
+ pDeauthReq->messageType = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ len = pDeauthReq->length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ PELOG1(limLog(pMac, LOG1, FL("SME_DEAUTH_REQ length %d bytes is:\n"), len);)
+ PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
+
+ if (len < (tANI_S16) sizeof(tANI_U32))
+ return eSIR_FAILURE;
+
+ len -= sizeof(tANI_U32); // skip message header
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract sessionId
+ pDeauthReq->sessionId = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract transactionId
+ pDeauthReq->transactionId = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract bssId
+ palCopyMemory( pMac->hHdd, pDeauthReq->bssId, pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ len -= sizeof(tSirMacAddr);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract peerMacAddr
+ palCopyMemory( pMac->hHdd, pDeauthReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ len -= sizeof(tSirMacAddr);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract reasonCode
+ pDeauthReq->reasonCode = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+
+#if defined(ANI_PRODUCT_TYPE_AP)
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+ pDeauthReq->aid = limGetU16(pBuf);
+#endif
+
+ return eSIR_SUCCESS;
+} /*** end limDisassocReqSerDes() ***/
+
+
+
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+/**
+ * limCopyNeighborInfoToCfg()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeMessages() upon receiving
+ * SME_JOIN_REQ/SME_REASSOC_REQ from WSM to convert neighborBssInfo
+ * that is being joined to bssDescription used by MLM
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param neighborBssInfo Neighbor BSS info to be converted
+ *
+ * @return None
+ */
+
+void
+limCopyNeighborInfoToCfg(tpAniSirGlobal pMac, tSirNeighborBssInfo neighborBssInfo, tpPESession psessionEntry)
+{
+ tANI_U32 localPowerConstraints = 0;
+ tANI_U16 caps;
+ tANI_U8 qosCap = 0;
+
+ if(psessionEntry)
+ {
+ psessionEntry->gLimPhyMode = neighborBssInfo.nwType;
+ }
+ else
+ {
+ pMac->lim.gLimPhyMode = neighborBssInfo.nwType;
+ }
+
+ cfgSetCapabilityInfo(pMac, neighborBssInfo.capabilityInfo);
+
+ if (cfgSetStr(pMac, WNI_CFG_SSID, (tANI_U8 *) &neighborBssInfo.ssId.ssId,
+ neighborBssInfo.ssId.length) != eSIR_SUCCESS)
+ {
+ /// Could not update SSID at CFG. Log error.
+ limLog(pMac, LOGP, FL("could not update SSID at CFG\n"));
+ }
+
+ #if 0
+ if (cfgSetStr(
+ pMac, WNI_CFG_OPERATIONAL_RATE_SET,
+ (tANI_U8 *) &neighborBssInfo.operationalRateSet.rate,
+ neighborBssInfo.operationalRateSet.numRates) != eSIR_SUCCESS)
+ {
+ /// Could not update Operational Rateset at CFG. Log error.
+ limLog(pMac, LOGP,
+ FL("could not update Operational Rateset at CFG\n"));
+ }
+ #endif // TO SUPPORT BT-AMP
+
+ if (neighborBssInfo.nwType == WNI_CFG_PHY_MODE_11G)
+ {
+ if (cfgSetStr(
+ pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
+ (tANI_U8 *) &neighborBssInfo.extendedRateSet.rate,
+ neighborBssInfo.extendedRateSet.numRates) != eSIR_SUCCESS)
+ {
+ /// Could not update Extended Rateset at CFG. Log error.
+ limLog(pMac, LOGP,
+ FL("could not update Extended Rateset at CFG\n"));
+ }
+ }
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ if (neighborBssInfo.hcfEnabled)
+ LIM_BSS_CAPS_SET(HCF, qosCap);
+#endif
+ if (neighborBssInfo.wmeInfoPresent || neighborBssInfo.wmeEdcaPresent)
+ LIM_BSS_CAPS_SET(WME, qosCap);
+ if (LIM_BSS_CAPS_GET(WME, qosCap) && neighborBssInfo.wsmCapablePresent)
+ LIM_BSS_CAPS_SET(WSM, qosCap);
+
+ pMac->lim.gLimCurrentBssQosCaps = qosCap;
+
+ if (neighborBssInfo.wniIndicator)
+ pMac->lim.gLimCurrentBssPropCap = neighborBssInfo.propIECapability;
+ else
+ pMac->lim.gLimCurrentBssPropCap = 0;
+
+ if (neighborBssInfo.HTCapsPresent)
+ pMac->lim.htCapabilityPresentInBeacon = 1;
+ else
+ pMac->lim.htCapabilityPresentInBeacon = 0;
+ if (neighborBssInfo.localPowerConstraints && pMac->lim.gLim11hEnable)
+ {
+ localPowerConstraints = neighborBssInfo.localPowerConstraints;
+ }
+ if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, localPowerConstraints) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Could not update local power constraint to cfg.\n"));
+ }
+} /*** end limCopyNeighborInfoToCfg() ***/
+#endif
+
+
+/**
+ * limStatSerDes()
+ *
+ *FUNCTION:
+ * This function is called by limSendSmeDisassocNtf() while sending
+ * SME_DISASSOC_IND/eWNI_SME_DISASSOC_RSP to host
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pAssocInd Pointer to tpAniStaStatStruct being sent
+ * @param pBuf Pointer to serialized buffer
+ *
+ * @return None
+ */
+
+void
+limStatSerDes(tpAniSirGlobal pMac, tpAniStaStatStruct pStat, tANI_U8 *pBuf)
+{
+#ifdef PE_DEBUG_LOG1
+ tANI_U8 *pTemp = pBuf;
+#endif
+
+ limCopyU32(pBuf, pStat->sentAesBlksUcastHi);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->sentAesBlksUcastLo);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->recvAesBlksUcastHi);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->recvAesBlksUcastLo);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->aesFormatErrorUcastCnts);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->aesReplaysUcast);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->aesDecryptErrUcast);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->singleRetryPkts);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->failedTxPkts);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->ackTimeouts);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->multiRetryPkts);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->fragTxCntsHi);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->fragTxCntsLo);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->transmittedPktsHi);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->transmittedPktsLo);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->phyStatHi);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->phyStatLo);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->uplinkRssi);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->uplinkSinr);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->uplinkRate);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->downlinkRssi);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->downlinkSinr);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->downlinkRate);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->nRcvBytes);
+ pBuf += sizeof(tANI_U32);
+
+ limCopyU32(pBuf, pStat->nXmitBytes);
+ pBuf += sizeof(tANI_U32);
+
+ PELOG1(limLog(pMac, LOG1, FL("STAT: length %d bytes is:\n"), sizeof(tAniStaStatStruct));)
+ PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, sizeof(tAniStaStatStruct));)
+
+} /*** end limStatSerDes() ***/
+
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+/**
+ * limSmeWmStatusChangeNtfSerDes()
+ *
+ *FUNCTION:
+ * This function is called by limSendSmeWmStatusChangeNtf()
+ * to serialize the header fields of SME WM Status Change
+ * Notification
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param statusChangeCode Status Change code
+ * @param pBuf Pointer to serialized buffer
+ * @param len Pointer to length actually used
+ * @param buflen Buffer length remaining
+ * @return retCode Indicates whether message is successfully
+ * serialized (eSIR_SUCCESS) or not (eSIR_FAILURE)
+ */
+
+tSirRetStatus
+limSmeWmStatusChangeHeaderSerDes(tpAniSirGlobal pMac,
+ tSirSmeStatusChangeCode statusChangeCode,
+ tANI_U8 *pBuf,
+ tANI_U16 *len,
+ tANI_U32 buflen,
+ tANI_U8 sessionId)
+{
+ if (buflen < ((sizeof(tANI_U16) * 2) + sizeof(tANI_U32)))
+ {
+ limLog(pMac, LOGE,
+ FL("limSmeWmStatusChangeHeaderSerDes: no enough space (buf %d) \n"), buflen);
+ return eSIR_FAILURE;
+ }
+
+ *len = 0;
+
+ limCopyU16(pBuf, eWNI_SME_WM_STATUS_CHANGE_NTF);
+ pBuf += sizeof(tANI_U16);
+ *len += sizeof(tANI_U16);
+
+ // Actual length value shall be filled later
+ pBuf += sizeof(tANI_U16);
+ *len += sizeof(tANI_U16);
+
+ *pBuf++ = sessionId;
+ *len += sizeof(tANI_U8);
+
+ limCopyU32(pBuf, statusChangeCode);
+ pBuf += sizeof(tANI_U32);
+ *len += sizeof(tANI_U32);
+
+ return eSIR_SUCCESS;
+} /*** end limSmeWmStatusChangeHeaderSerDes() ***/
+
+
+
+/**
+ * limRadioInfoSerDes()
+ *
+ *FUNCTION:
+ * This function is called by limSendSmeWmStatusChangeNtf()
+ * to serialize the radarInfo message
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pRadarInfo Pointer to tSirRadarInfo
+ * @param pBuf Pointer to serialized buffer
+ * @param len Pointer to length actually used by tSirRadarInfo
+ * @param buflen Length remaining
+ *
+ * @return retCode Indicates whether message is successfully
+ * serialized (eSIR_SUCCESS) or not (eSIR_FAILURE)
+ */
+
+tSirRetStatus
+limRadioInfoSerDes(tpAniSirGlobal pMac, tpSirRadarInfo pRadarInfo,
+ tANI_U8 *pBuf, tANI_U16 *len, tANI_U32 buflen)
+{
+
+ if (buflen < sizeof(tSirRadarInfo))
+ {
+ limLog(pMac, LOGE,
+ FL("no enough space (buf %d) \n"), buflen);
+ return eSIR_FAILURE;
+ }
+
+ *pBuf = pRadarInfo->channelNumber;
+ pBuf += sizeof(tANI_U8);
+ *len += sizeof(tANI_U8);
+
+ limCopyU16(pBuf, pRadarInfo->radarPulseWidth);
+ pBuf += sizeof(tANI_U16);
+ *len += sizeof(tANI_U16);
+
+ limCopyU16(pBuf, pRadarInfo->numRadarPulse);
+ pBuf += sizeof(tANI_U16);
+ *len += sizeof(tANI_U16);
+
+ return eSIR_SUCCESS;
+} /*** end limRadioInfoSerDes() ***/
+#endif
+
+
+/**
+ * limPackBkgndScanFailNotify()
+ *
+ *FUNCTION:
+ * This function is called by limSendSmeWmStatusChangeNtf()
+ * to pack the tSirBackgroundScanInfo message
+ *
+ */
+void
+limPackBkgndScanFailNotify(tpAniSirGlobal pMac,
+ tSirSmeStatusChangeCode statusChangeCode,
+ tpSirBackgroundScanInfo pScanInfo,
+ tSirSmeWmStatusChangeNtf *pSmeNtf,
+ tANI_U8 sessionId)
+{
+
+ tANI_U16 length = (sizeof(tANI_U16) * 2) + sizeof(tANI_U8) +
+ sizeof(tSirSmeStatusChangeCode) +
+ sizeof(tSirBackgroundScanInfo);
+
+#if defined (ANI_PRODUCT_TYPE_AP) && defined(ANI_LITTLE_BYTE_ENDIAN)
+ sirStoreU16N((tANI_U8*)&pSmeNtf->messageType, eWNI_SME_WM_STATUS_CHANGE_NTF );
+ sirStoreU16N((tANI_U8*)&pSmeNtf->length, length);
+ pSmeNtf->sessionId = sessionId;
+ sirStoreU32N((tANI_U8*)&pSmeNtf->statusChangeCode, statusChangeCode);
+
+ sirStoreU32N((tANI_U8*)&pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanSuccess,
+ pScanInfo->numOfScanSuccess);
+ sirStoreU32N((tANI_U8*)&pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanFailure,
+ pScanInfo->numOfScanFailure);
+ sirStoreU32N((tANI_U8*)&pSmeNtf->statusChangeInfo.bkgndScanInfo.reserved,
+ pScanInfo->reserved);
+#else
+ pSmeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF;
+ pSmeNtf->statusChangeCode = statusChangeCode;
+ pSmeNtf->length = length;
+ pSmeNtf->sessionId = sessionId;
+ pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanSuccess = pScanInfo->numOfScanSuccess;
+ pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanFailure = pScanInfo->numOfScanFailure;
+ pSmeNtf->statusChangeInfo.bkgndScanInfo.reserved = pScanInfo->reserved;
+#endif
+}
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+
+/**
+ * nonTitanBssFoundSerDes()
+ *
+ *FUNCTION:
+ * This function is called by limSendSmeWmStatusChangeNtf()
+ * to serialize the following message
+ * Mesg = eWNI_SME_WM_STATUS_CHANGE_NTF
+ * Change code = eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to the global pMAC structure
+ * @param pNewBssInfo Pointer to tpSirNeighborBssWdsInfo
+ * @param pBuf Send data buffer
+ * @param len Length of message
+ * @param buflen Length remaining
+ *
+ * @return retCode Indicates whether message is successfully
+ * serialized (eSIR_SUCCESS) or not (eSIR_FAILURE)
+ */
+
+tSirRetStatus nonTitanBssFoundSerDes( tpAniSirGlobal pMac,
+ tpSirNeighborBssWdsInfo pNewBssInfo,
+ tANI_U8 *pBuf,
+ tANI_U16 *len,
+ tANI_U8 sessionId )
+{
+tANI_U8 *pTemp = pBuf;
+tANI_U16 length = 0;
+tANI_U32 bufLen = sizeof( tSirSmeWmStatusChangeNtf );
+
+ // Serialize the header (length to be filled later)
+ if( eSIR_SUCCESS != limSmeWmStatusChangeHeaderSerDes(
+ pMac,
+ eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP,
+ pBuf,
+ &length,
+ bufLen,
+ sessionId))
+ {
+ limLog( pMac, LOGE,
+ FL("Header SerDes failed \n"));
+ return eSIR_FAILURE;
+ }
+ pBuf += length;
+ bufLen -= length;
+
+ // Serialize tSirNeighborBssWdsInfo
+ length = limCopyNeighborWdsInfo( pMac,
+ pBuf,
+ pNewBssInfo );
+ pBuf += length;
+ bufLen -= length;
+
+ // Update tSirSmeWmStatusChangeNtf.length
+ pBuf = pTemp;
+ pBuf += sizeof(tANI_U16);
+ limCopyU16(pBuf, length);
+
+ // Update the total length to be returned
+ *len = length;
+
+ return eSIR_SUCCESS;
+} /*** end nonTitanBssFoundSerDes() ***/
+
+/**
+ * limIsSmeSwitchChannelReqValid()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeReqMessages() upon
+ * receiving SME_SWITCH_CHL_REQ message from application.
+ *
+ *LOGIC:
+ * Message validity checks are performed in this function
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pBuf - Pointer to a serialized SME_SWITCH_CHL_REQ message
+ * @param pSmeMsg - Pointer to a tSirsmeSwitchChannelReq structure
+ * @return true if SME_SWITCH_CHL_REQ message is formatted correctly
+ * false otherwise
+ */
+
+tANI_BOOLEAN
+limIsSmeSwitchChannelReqValid(tpAniSirGlobal pMac,
+ tANI_U8 *pBuf,
+ tpSirSmeSwitchChannelReq pSmeMsg)
+{
+ pSmeMsg->messageType = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ pSmeMsg->length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ pSmeMsg->transactionId = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ pSmeMsg->channelId = *pBuf;
+ pBuf++;
+
+ pSmeMsg->cbMode = limGetU32(pBuf);
+ pBuf += sizeof(tANI_U32);
+
+ pSmeMsg->dtimFactor = limGetU32(pBuf);
+ pBuf += sizeof(tANI_U32);
+
+ if (pSmeMsg->length != SIR_SME_CHANNEL_SWITCH_SIZE)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Invalid length %d \n"), pSmeMsg->length);)
+ return eANI_BOOLEAN_FALSE;
+ }
+
+ // dtimFactor should not be too large
+ if (pSmeMsg->dtimFactor > SIR_MAX_DTIM_FACTOR)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Invalid dtimFactor %d \n"), pSmeMsg->dtimFactor);)
+ return eANI_BOOLEAN_FALSE;
+ }
+
+ return eANI_BOOLEAN_TRUE;
+}
+
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE
+/**
+ * limIsSmeGetAssocSTAsReqValid()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeReqMessages() upon
+ * receiving SME_GET_ASSOC_STAS_REQ message from application.
+ *
+ *LOGIC:
+ * Message validity checks are performed in this function
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pBuf - Pointer to a serialized SME_GET_ASSOC_STAS_REQ message
+ * @param pSmeMsg - Pointer to a tSirSmeGetAssocSTAsReq structure
+ * @return true if SME_GET_ASSOC_STAS_REQ message is formatted correctly
+ * false otherwise
+ */
+tANI_BOOLEAN
+limIsSmeGetAssocSTAsReqValid(tpAniSirGlobal pMac, tpSirSmeGetAssocSTAsReq pGetAssocSTAsReq, tANI_U8 *pBuf)
+{
+ tANI_S16 len = 0;
+
+ pGetAssocSTAsReq->messageType = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ len = pGetAssocSTAsReq->length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ if (len < (tANI_S16) sizeof(tANI_U32))
+ return eSIR_FAILURE;
+
+ len -= sizeof(tANI_U32); // skip message header
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract bssId
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pGetAssocSTAsReq->bssId, pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ len -= sizeof(tSirMacAddr);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract modId
+ pGetAssocSTAsReq->modId = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract pUsrContext
+ pGetAssocSTAsReq->pUsrContext = (void *)limGetU32(pBuf);
+ pBuf += sizeof(tANI_U32);
+ len -= sizeof(tANI_U32);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract pSapEventCallback
+ pGetAssocSTAsReq->pSapEventCallback = (void *)limGetU32(pBuf);
+ pBuf += sizeof(tANI_U32);
+ len -= sizeof(tANI_U32);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract pAssocStasArray
+ pGetAssocSTAsReq->pAssocStasArray = (void *)limGetU32(pBuf);
+ pBuf += sizeof(tANI_U32);
+ len -= sizeof(tANI_U32);
+
+ PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes \n"), len);)
+
+ if (len < 0)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("SME_GET_ASSOC_STAS_REQ invalid length\n"));)
+ return eANI_BOOLEAN_FALSE;
+ }
+
+ return eANI_BOOLEAN_TRUE;
+}
+
+/**
+ * limTkipCntrMeasReqSerDes()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeMessages() upon receiving
+ * eWNI_SME_TKIP_CNTR_MEAS_REQ from host HDD
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param tpSirSmeTkipCntrMeasReq Pointer to tSirSmeTkipCntrMeasReq being extracted
+ * @param pBuf Pointer to serialized buffer
+ * @return retCode Indicates whether message is successfully
+ * de-serialized (eSIR_SUCCESS) or
+ * not (eSIR_FAILURE)
+ */
+tSirRetStatus
+limTkipCntrMeasReqSerDes(tpAniSirGlobal pMac, tpSirSmeTkipCntrMeasReq pTkipCntrMeasReq, tANI_U8 *pBuf)
+{
+ tANI_S16 len = 0;
+
+#ifdef PE_DEBUG_LOG1
+ tANI_U8 *pTemp = pBuf;
+#endif
+
+ pTkipCntrMeasReq->messageType = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ len = pTkipCntrMeasReq->length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length %d bytes is:\n"), len);)
+ PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
+
+ if (len < (tANI_S16) sizeof(tANI_U32))
+ return eSIR_FAILURE;
+
+ len -= sizeof(tANI_U32); // skip message header
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract sessionId
+ pTkipCntrMeasReq->sessionId = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract transactionId
+ pTkipCntrMeasReq->transactionId = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof(tANI_U16);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract bssId
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pTkipCntrMeasReq->bssId, pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ len -= sizeof(tSirMacAddr);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract bEnable
+ pTkipCntrMeasReq->bEnable = *pBuf++;
+ len --;
+
+ PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length consumed %d bytes \n"), len);)
+
+ if (len)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("SME_TKIP_CNTR_MEAS_REQ invalid \n"));)
+ return eSIR_FAILURE;
+ }
+ else
+ return eSIR_SUCCESS;
+}
+
+/**
+ * limIsSmeGetWPSPBCSessionsReqValid()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeGetWPSPBCSessions() upon
+ * receiving query WPS PBC overlap information message from application.
+ *
+ *LOGIC:
+ * Message validity checks are performed in this function
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pBuf - Pointer to a serialized SME_GET_WPSPBC_SESSION_REQ message
+ * @param pGetWPSPBCSessionsReq - Pointer to a tSirSmeGetWPSPBCSessionsReq structure
+ * @return true if SME_GET_WPSPBC_SESSION_REQ message is formatted correctly
+ * false otherwise
+ */
+
+tSirRetStatus
+limIsSmeGetWPSPBCSessionsReqValid(tpAniSirGlobal pMac, tSirSmeGetWPSPBCSessionsReq *pGetWPSPBCSessionsReq, tANI_U8 *pBuf)
+{
+ tANI_S16 len = 0;
+
+ PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirSmeGetWPSPBCSessionsReq));)
+
+ pGetWPSPBCSessionsReq->messageType = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ len = pGetWPSPBCSessionsReq->length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ if (len < (tANI_S16) sizeof(tANI_U32))
+ return eSIR_FAILURE;
+
+ len -= sizeof(tANI_U32); // skip message header
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract pUsrContext
+ pGetWPSPBCSessionsReq->pUsrContext = (void *)limGetU32(pBuf);
+ pBuf += sizeof(tANI_U32);
+ len -= sizeof(tANI_U32);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract pSapEventCallback
+ pGetWPSPBCSessionsReq->pSapEventCallback = (void *)limGetU32(pBuf);
+ pBuf += sizeof(tANI_U32);
+ len -= sizeof(tANI_U32);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract bssId
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pGetWPSPBCSessionsReq->bssId, pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ len -= sizeof(tSirMacAddr);
+
+ // Extract MAC address of Station to be removed
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pGetWPSPBCSessionsReq->pRemoveMac, pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ len -= sizeof(tSirMacAddr);
+
+ PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes \n"), len);)
+
+ if (len < 0)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length\n"));)
+ return eSIR_FAILURE;
+ }
+
+ return eSIR_SUCCESS;
+}
+
+#endif
+
+/**---------------------------------------------------------------
+\fn limGetSessionInfo
+\brief This function returns the sessionId and transactionId
+\ of a message. This assumes that the message structure
+\ is of format:
+\ tANI_U16 messageType
+\ tANI_U16 messageLength
+\ tANI_U8 sessionId
+\ tANI_U16 transactionId
+\param pMac - pMac global structure
+\param *pBuf - pointer to the message buffer
+\param sessionId - returned session id value
+\param transactionId - returned transaction ID value
+\return None
+------------------------------------------------------------------*/
+void
+limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U8 *sessionId, tANI_U16 *transactionId)
+{
+ if (!pBuf)
+ {
+ limLog(pMac, LOGE, FL("NULL ptr received. \n"));
+ return;
+ }
+
+ pBuf += sizeof(tANI_U16); // skip message type
+ pBuf += sizeof(tANI_U16); // skip message length
+
+ *sessionId = *pBuf; // get sessionId
+ pBuf++;
+ *transactionId = limGetU16(pBuf); // get transactionId
+
+ return;
+}
+
+#ifdef WLAN_SOFTAP_FEATURE
+
+/**
+ * limUpdateAPWPSIEsReqSerDes()
+ *
+ *FUNCTION:
+ * This function is to deserialize UpdateAPWPSIEs message
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pUpdateAPWPSIEsReq Pointer to tSirUpdateAPWPSIEsReq being
+ * extracted
+ * @param pBuf Pointer to serialized buffer
+ *
+ * @return retCode Indicates whether message is successfully
+ * de-serialized (eSIR_SUCCESS) or
+ * not (eSIR_FAILURE)
+ */
+
+tSirRetStatus
+limUpdateAPWPSIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq, tANI_U8 *pBuf)
+{
+ tANI_S16 len = 0;
+
+ PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPSIEsReq));)
+
+ if (!pUpdateAPWPSIEsReq || !pBuf)
+ return eSIR_FAILURE;
+
+ pUpdateAPWPSIEsReq->messageType = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ len = pUpdateAPWPSIEsReq->length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ if (len < (tANI_S16) sizeof(tANI_U32))
+ return eSIR_FAILURE;
+
+ len -= sizeof(tANI_U32); // skip message header
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract transactionId
+ pUpdateAPWPSIEsReq->transactionId = limGetU16( pBuf );
+ pBuf += sizeof( tANI_U16 );
+ len -= sizeof( tANI_U16 );
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract bssId
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pUpdateAPWPSIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ len -= sizeof(tSirMacAddr);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract sessionId
+ pUpdateAPWPSIEsReq->sessionId = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract APWPSIEs
+ palCopyMemory( pMac->hHdd, (tSirAPWPSIEs *) &pUpdateAPWPSIEsReq->APWPSIEs, pBuf, sizeof(tSirAPWPSIEs));
+ pBuf += sizeof(tSirAPWPSIEs);
+ len -= sizeof(tSirAPWPSIEs);
+
+ PELOG1(limLog(pMac, LOG1, FL("SME_UPDATE_APWPSIE_REQ length consumed %d bytes \n"), len);)
+
+ if (len < 0)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("SME_UPDATE_APWPSIE_REQ invalid length\n"));)
+ return eSIR_FAILURE;
+ }
+
+ return eSIR_SUCCESS;
+} /*** end limSetContextReqSerDes() ***/
+
+/**
+ * limUpdateAPWPARSNIEsReqSerDes ()
+ *
+ *FUNCTION:
+ * This function is to deserialize UpdateAPWPSIEs message
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pUpdateAPWPARSNIEsReq Pointer to tpSirUpdateAPWPARSNIEsReq being
+ * extracted
+ * @param pBuf Pointer to serialized buffer
+ *
+ * @return retCode Indicates whether message is successfully
+ * de-serialized (eSIR_SUCCESS) or
+ * not (eSIR_FAILURE)
+ */
+
+tSirRetStatus
+limUpdateAPWPARSNIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq, tANI_U8 *pBuf)
+{
+ tANI_S16 len = 0;
+
+ PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPARSNIEsReq));)
+
+ if (!pUpdateAPWPARSNIEsReq || !pBuf)
+ return eSIR_FAILURE;
+
+ pUpdateAPWPARSNIEsReq->messageType = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ len = pUpdateAPWPARSNIEsReq->length = limGetU16(pBuf);
+ pBuf += sizeof(tANI_U16);
+
+ if (len < (tANI_S16) sizeof(tANI_U32))
+ return eSIR_FAILURE;
+
+ len -= sizeof(tANI_U32); // skip message header
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract transactionId
+ pUpdateAPWPARSNIEsReq->transactionId = limGetU16( pBuf );
+ pBuf += sizeof(tANI_U16);
+ len -= sizeof( tANI_U16 );
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract bssId
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) pUpdateAPWPARSNIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
+ pBuf += sizeof(tSirMacAddr);
+ len -= sizeof(tSirMacAddr);
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract sessionId
+ pUpdateAPWPARSNIEsReq->sessionId = *pBuf++;
+ len--;
+ if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+ return eSIR_FAILURE;
+
+ // Extract APWPARSNIEs
+ palCopyMemory( pMac->hHdd, (tSirRSNie *) &pUpdateAPWPARSNIEsReq->APWPARSNIEs, pBuf, sizeof(tSirRSNie));
+ pBuf += sizeof(tSirRSNie);
+ len -= sizeof(tSirRSNie);
+
+ if (len < 0)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length\n"));)
+ return eSIR_FAILURE;
+ }
+
+ return eSIR_SUCCESS;
+} /*** end limUpdateAPWPARSNIEsReqSerDes() ***/
+
+#endif
diff --git a/CORE/MAC/src/pe/lim/limSerDesUtils.h b/CORE/MAC/src/pe/lim/limSerDesUtils.h
new file mode 100644
index 0000000..6de920b
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limSerDesUtils.h
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limSerDesUtils.h contains the utility definitions
+ * LIM uses while processing messages from upper layer software
+ * modules
+ * Author: Chandra Modumudi
+ * Date: 10/20/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+#ifndef __LIM_SERDES_UTILS_H
+#define __LIM_SERDES_UTILS_H
+
+#include "sirApi.h"
+#include "aniSystemDefs.h"
+#include "sirMacProtDef.h"
+#include "utilsApi.h"
+#include "limTypes.h"
+#include "limPropExtsUtils.h"
+
+tSirRetStatus limStartBssReqSerDes(tpAniSirGlobal, tpSirSmeStartBssReq, tANI_U8 *);
+tSirRetStatus limStopBssReqSerDes(tpAniSirGlobal, tpSirSmeStopBssReq, tANI_U8 *);
+tSirRetStatus limJoinReqSerDes(tpAniSirGlobal, tpSirSmeJoinReq, tANI_U8 *);
+void limAssocIndSerDes(tpAniSirGlobal, tpLimMlmAssocInd, tANI_U8 *, tpPESession);
+void limReassocIndSerDes(tpAniSirGlobal, tpLimMlmReassocInd, tANI_U8 *, tpPESession psessionEntry);
+tSirRetStatus limAssocCnfSerDes(tpAniSirGlobal, tpSirSmeAssocCnf, tANI_U8 *);
+tSirRetStatus limDisassocCnfSerDes(tpAniSirGlobal, tpSirSmeDisassocCnf, tANI_U8 *);
+tSirRetStatus limSetContextReqSerDes(tpAniSirGlobal, tpSirSmeSetContextReq, tANI_U8 *);
+tSirRetStatus limDisassocReqSerDes(tpAniSirGlobal, tSirSmeDisassocReq *, tANI_U8 *);
+tSirRetStatus limDeauthReqSerDes(tpAniSirGlobal, tSirSmeDeauthReq *, tANI_U8 *);
+void limAuthIndSerDes(tpAniSirGlobal, tpLimMlmAuthInd, tANI_U8 *);
+void limStatSerDes(tpAniSirGlobal, tpAniStaStatStruct, tANI_U8 *);
+void limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *, tANI_U8 *, tANI_U16 *);
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+tSirRetStatus limMeasurementReqSerDes(tpAniSirGlobal, tpSirSmeMeasurementReq, tANI_U8 *);
+void limMeasurementIndSerDes(tpAniSirGlobal, tANI_U8 *);
+void limCopyNeighborInfoToCfg(tpAniSirGlobal, tSirNeighborBssInfo);
+tSirRetStatus limWdsReqSerDes(tpAniSirGlobal, tpSirSmeSetWdsInfoReq, tANI_U8 *);
+tSirRetStatus limRadioInfoSerDes(tpAniSirGlobal, tpSirRadarInfo, tANI_U8 *, tANI_U16 *, tANI_U32);
+tSirRetStatus limSmeWmStatusChangeHeaderSerDes(tpAniSirGlobal, tSirSmeStatusChangeCode, tANI_U8 *, tANI_U16 *, tANI_U32, tANI_U8);
+tSirRetStatus nonTitanBssFoundSerDes( tpAniSirGlobal, tpSirNeighborBssWdsInfo, tANI_U8 *, tANI_U16 *, tANI_U8 );
+#endif
+
+void limPackBkgndScanFailNotify(tpAniSirGlobal, tSirSmeStatusChangeCode,
+ tpSirBackgroundScanInfo, tSirSmeWmStatusChangeNtf *, tANI_U8);
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+tANI_U32 limCopyNeighborBssInfo(tpAniSirGlobal, tANI_U8 *, tpSirNeighborBssInfo);
+tANI_U32 limGetNeighborBssInfo(tpAniSirGlobal, tpSirNeighborBssInfo, tANI_U8 *);
+#endif
+
+tSirRetStatus limRemoveKeyReqSerDes(tpAniSirGlobal pMac, tpSirSmeRemoveKeyReq pRemoveKeyReq, tANI_U8 * pBuf);
+
+#ifdef WLAN_SOFTAP_FEATURE
+tANI_BOOLEAN limIsSmeGetAssocSTAsReqValid(tpAniSirGlobal pMac, tpSirSmeGetAssocSTAsReq pGetAssocSTAsReq, tANI_U8 *pBuf);
+tSirRetStatus limTkipCntrMeasReqSerDes(tpAniSirGlobal pMac, tpSirSmeTkipCntrMeasReq ptkipCntrMeasReq, tANI_U8 *pBuf);
+
+tSirRetStatus limUpdateAPWPSIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq, tANI_U8 *pBuf);
+tSirRetStatus limUpdateAPWPARSNIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq, tANI_U8 *pBuf);
+#endif
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+tANI_BOOLEAN limIsSmeSwitchChannelReqValid(tpAniSirGlobal, tANI_U8 *, tpSirSmeSwitchChannelReq);
+#endif
+
+// Byte String <--> tANI_U16/tANI_U32 copy functions
+static inline void limCopyU16(tANI_U8 *ptr, tANI_U16 u16Val)
+{
+#if defined(ANI_PRODUCT_TYPE_AP)
+ *ptr++ = (tANI_U8) ((u16Val >> 8) & 0xff);
+ *ptr = (tANI_U8) (u16Val & 0xff);
+#elif ((defined(ANI_OS_TYPE_OSX) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
+ (defined(ANI_OS_TYPE_WINDOWS) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
+ (defined(ANI_OS_TYPE_AMSS) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
+ (defined(ANI_OS_TYPE_ANDROID) && defined(ANI_LITTLE_BYTE_ENDIAN)))
+ *ptr++ = (tANI_U8) (u16Val & 0xff);
+ *ptr = (tANI_U8) ((u16Val >> 8) & 0xff);
+#else
+#error "Unknown combination of OS Type and endianess"
+#endif
+}
+
+static inline tANI_U16 limGetU16(tANI_U8 *ptr)
+{
+#if defined(ANI_PRODUCT_TYPE_AP)
+ return (((tANI_U16) (*ptr << 8)) |
+ ((tANI_U16) (*(ptr+1))));
+#elif ((defined(ANI_OS_TYPE_OSX) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
+ (defined(ANI_OS_TYPE_WINDOWS) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
+ (defined(ANI_OS_TYPE_AMSS) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
+ (defined(ANI_OS_TYPE_ANDROID) && defined(ANI_LITTLE_BYTE_ENDIAN)))
+ return (((tANI_U16) (*(ptr+1) << 8)) |
+ ((tANI_U16) (*ptr)));
+#else
+#error "Unknown combination of OS Type and endianess"
+#endif
+}
+
+static inline void limCopyU32(tANI_U8 *ptr, tANI_U32 u32Val)
+{
+#if defined(ANI_PRODUCT_TYPE_AP)
+ *ptr++ = (tANI_U8) ((u32Val >> 24) & 0xff);
+ *ptr++ = (tANI_U8) ((u32Val >> 16) & 0xff);
+ *ptr++ = (tANI_U8) ((u32Val >> 8) & 0xff);
+ *ptr = (tANI_U8) (u32Val & 0xff);
+#elif ((defined(ANI_OS_TYPE_OSX) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
+ (defined(ANI_OS_TYPE_WINDOWS) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
+ (defined(ANI_OS_TYPE_AMSS) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
+ (defined(ANI_OS_TYPE_ANDROID) && defined(ANI_LITTLE_BYTE_ENDIAN)))
+ *ptr++ = (tANI_U8) (u32Val & 0xff);
+ *ptr++ = (tANI_U8) ((u32Val >> 8) & 0xff);
+ *ptr++ = (tANI_U8) ((u32Val >> 16) & 0xff);
+ *ptr = (tANI_U8) ((u32Val >> 24) & 0xff);
+#else
+#error "Unknown combination of OS Type and endianess"
+#endif
+}
+
+static inline tANI_U32 limGetU32(tANI_U8 *ptr)
+{
+#if defined(ANI_PRODUCT_TYPE_AP)
+ return ((*(ptr) << 24) |
+ (*(ptr+1) << 16) |
+ (*(ptr+2) << 8) |
+ (*(ptr+3)));
+#elif ((defined(ANI_OS_TYPE_OSX) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
+ (defined(ANI_OS_TYPE_WINDOWS) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
+ (defined(ANI_OS_TYPE_AMSS) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
+ (defined(ANI_OS_TYPE_ANDROID) && defined(ANI_LITTLE_BYTE_ENDIAN)))
+ return ((*(ptr+3) << 24) |
+ (*(ptr+2) << 16) |
+ (*(ptr+1) << 8) |
+ (*(ptr)));
+#else
+#error "Unknown combination of OS Type and endianess"
+#endif
+}
+
+#endif /* __LIM_SERDES_UTILS_H */
+
diff --git a/CORE/MAC/src/pe/lim/limSession.c b/CORE/MAC/src/pe/lim/limSession.c
new file mode 100644
index 0000000..e3d665f
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limSession.c
@@ -0,0 +1,415 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * */
+/**=========================================================================
+
+ \file limSession.c
+
+ \brief implementation for lim Session related APIs
+
+ \author Sunit Bhatia
+
+ Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
+
+ Qualcomm Confidential and Proprietary.
+
+ ========================================================================*/
+
+
+/*--------------------------------------------------------------------------
+ Include Files
+ ------------------------------------------------------------------------*/
+#include "aniGlobal.h"
+#include "limDebug.h"
+#include "limSession.h"
+#include "limUtils.h"
+#ifdef FEATURE_WLAN_CCX
+#include "ccxApi.h"
+#endif
+
+/*--------------------------------------------------------------------------
+
+ \brief peInitBeaconParams() - Initialize the beaconParams structure
+
+
+ \param tpPESession - pointer to the session context or NULL if session can not be created.
+ \return void
+ \sa
+
+ --------------------------------------------------------------------------*/
+
+void peInitBeaconParams(tpAniSirGlobal pMac, tpPESession psessionEntry)
+{
+ psessionEntry->beaconParams.beaconInterval = 0;
+ psessionEntry->beaconParams.fShortPreamble = 0;
+ psessionEntry->beaconParams.llaCoexist = 0;
+ psessionEntry->beaconParams.llbCoexist = 0;
+ psessionEntry->beaconParams.llgCoexist = 0;
+ psessionEntry->beaconParams.ht20Coexist = 0;
+ psessionEntry->beaconParams.llnNonGFCoexist = 0;
+ psessionEntry->beaconParams.fRIFSMode = 0;
+ psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = 0;
+ psessionEntry->beaconParams.gHTObssMode = 0;
+
+ // Number of legacy STAs associated
+ palZeroMemory(pMac->hHdd, (void*)&psessionEntry->gLim11bParams, sizeof(tLimProtStaParams));
+ palZeroMemory(pMac->hHdd, (void*)&psessionEntry->gLim11aParams, sizeof(tLimProtStaParams));
+ palZeroMemory(pMac->hHdd, (void*)&psessionEntry->gLim11gParams, sizeof(tLimProtStaParams));
+ palZeroMemory(pMac->hHdd, (void*)&psessionEntry->gLimNonGfParams, sizeof(tLimProtStaParams));
+ palZeroMemory(pMac->hHdd, (void*)&psessionEntry->gLimHt20Params, sizeof(tLimProtStaParams));
+ palZeroMemory(pMac->hHdd, (void*)&psessionEntry->gLimLsigTxopParams, sizeof(tLimProtStaParams));
+ palZeroMemory(pMac->hHdd, (void*)&psessionEntry->gLimOlbcParams, sizeof(tLimProtStaParams));
+}
+
+/*--------------------------------------------------------------------------
+
+ \brief peCreateSession() - creates a new PE session given the BSSID
+
+ This function returns the session context and the session ID if the session
+ corresponding to the passed BSSID is found in the PE session table.
+
+ \param pMac - pointer to global adapter context
+ \param bssid - BSSID of the new session
+ \param sessionId -session ID is returned here, if session is created.
+
+ \return tpPESession - pointer to the session context or NULL if session can not be created.
+
+ \sa
+
+ --------------------------------------------------------------------------*/
+tpPESession peCreateSession(tpAniSirGlobal pMac, tANI_U8 *bssid , tANI_U8* sessionId, tANI_U16 numSta)
+{
+ tANI_U8 i;
+ for(i =0; i < pMac->lim.maxBssId; i++)
+ {
+ /* Find first free room in session table */
+ if(pMac->lim.gpSession[i].valid == FALSE)
+ {
+ palZeroMemory(pMac, (void*)&pMac->lim.gpSession[i], sizeof(tPESession));
+
+ //Allocate space for Station Table for this session.
+ if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
+ (void **) &pMac->lim.gpSession[i].dph.dphHashTable.pHashTable, sizeof(tpDphHashNode)*numSta))
+ {
+ limLog(pMac, LOGE, FL("memory allocate failed!\n"));
+ return NULL;
+ }
+
+ if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
+ (void **) &pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray, sizeof(tDphHashNode)*numSta))
+ {
+ limLog(pMac, LOGE, FL("memory allocate failed!\n"));
+ palFreeMemory(pMac->hHdd,pMac->lim.gpSession[i].dph.dphHashTable.pHashTable);
+ return NULL;
+ }
+ pMac->lim.gpSession[i].dph.dphHashTable.size = numSta;
+
+ dphHashTableClassInit(pMac,
+ &pMac->lim.gpSession[i].dph.dphHashTable);
+
+ /* Copy the BSSID to the session table */
+ sirCopyMacAddr(pMac->lim.gpSession[i].bssId, bssid);
+ pMac->lim.gpSession[i].valid = TRUE;
+
+ /* Intialize the SME and MLM states to IDLE */
+ pMac->lim.gpSession[i].limMlmState = eLIM_MLM_IDLE_STATE;
+ pMac->lim.gpSession[i].limSmeState = eLIM_SME_IDLE_STATE;
+ pMac->lim.gpSession[i].limCurrentAuthType = eSIR_OPEN_SYSTEM;
+ peInitBeaconParams(pMac, &pMac->lim.gpSession[i]);
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ pMac->lim.gpSession[i].is11Rconnection = FALSE;
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+ pMac->lim.gpSession[i].isCCXconnection = FALSE;
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX
+ pMac->lim.gpSession[i].isFastTransitionEnabled = FALSE;
+#endif
+ *sessionId = i;
+
+ pMac->lim.gpSession[i].gLimPhyMode = WNI_CFG_PHY_MODE_11G; //TODO :Check with the team what should be default mode
+ return(&pMac->lim.gpSession[i]);
+ }
+ }
+ limLog(pMac, LOGE, FL("Session can not be created.. Reached Max permitted sessions \n "));
+ return NULL;
+}
+
+
+/*--------------------------------------------------------------------------
+ \brief peFindSessionByBssid() - looks up the PE session given the BSSID.
+
+ This function returns the session context and the session ID if the session
+ corresponding to the given BSSID is found in the PE session table.
+
+ \param pMac - pointer to global adapter context
+ \param bssid - BSSID of the session
+ \param sessionId -session ID is returned here, if session is found.
+
+ \return tpPESession - pointer to the session context or NULL if session is not found.
+
+ \sa
+ --------------------------------------------------------------------------*/
+tpPESession peFindSessionByBssid(tpAniSirGlobal pMac, tANI_U8* bssid, tANI_U8* sessionId)
+{
+ tANI_U8 i;
+
+ for(i =0; i < pMac->lim.maxBssId; i++)
+ {
+ /* If BSSID matches return corresponding tables address*/
+ if( (pMac->lim.gpSession[i].valid) && (sirCompareMacAddr(pMac->lim.gpSession[i].bssId, bssid)))
+ {
+ *sessionId = i;
+ return(&pMac->lim.gpSession[i]);
+ }
+ }
+
+ limLog(pMac, LOG4, FL("Session lookup fails for BSSID: \n "));
+ limPrintMacAddr(pMac, bssid, LOG4);
+ return(NULL);
+
+}
+
+
+
+/*--------------------------------------------------------------------------
+ \brief peFindSessionBySessionId() - looks up the PE session given the session ID.
+
+ This function returns the session context if the session
+ corresponding to the given session ID is found in the PE session table.
+
+ \param pMac - pointer to global adapter context
+ \param sessionId -session ID for which session context needs to be looked up.
+
+ \return tpPESession - pointer to the session context or NULL if session is not found.
+
+ \sa
+ --------------------------------------------------------------------------*/
+ tpPESession peFindSessionBySessionId(tpAniSirGlobal pMac , tANI_U8 sessionId)
+{
+ if(sessionId >= pMac->lim.maxBssId)
+ {
+ limLog(pMac, LOGE, FL("Invalid sessionId: %d \n "), sessionId);
+ return(NULL);
+ }
+ if((pMac->lim.gpSession[sessionId].valid == TRUE))
+ {
+ return(&pMac->lim.gpSession[sessionId]);
+ }
+ limLog(pMac, LOG1, FL("Session %d not active\n "), sessionId);
+ return(NULL);
+
+}
+
+
+/*--------------------------------------------------------------------------
+ \brief peFindSessionByStaId() - looks up the PE session given staid.
+
+ This function returns the session context and the session ID if the session
+ corresponding to the given StaId is found in the PE session table.
+
+ \param pMac - pointer to global adapter context
+ \param staid - StaId of the session
+ \param sessionId -session ID is returned here, if session is found.
+
+ \return tpPESession - pointer to the session context or NULL if session is not found.
+
+ \sa
+ --------------------------------------------------------------------------*/
+tpPESession peFindSessionByStaId(tpAniSirGlobal pMac, tANI_U8 staid, tANI_U8* sessionId)
+{
+ tANI_U8 i, j;
+
+ for(i =0; i < pMac->lim.maxBssId; i++)
+ {
+ if(pMac->lim.gpSession[i].valid)
+ {
+ for(j = 0; j < pMac->lim.gpSession[i].dph.dphHashTable.size; j++)
+ {
+ if((pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray[j].valid) &&
+ (pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray[j].added) &&
+ (staid == pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray[j].staIndex))
+ {
+ *sessionId = i;
+ return(&pMac->lim.gpSession[i]);
+ }
+ }
+ }
+ }
+
+ limLog(pMac, LOG4, FL("Session lookup fails for StaId: \n "));
+ return(NULL);
+}
+
+
+
+/*--------------------------------------------------------------------------
+ \brief peDeleteSession() - deletes the PE session given the session ID.
+
+
+ \param pMac - pointer to global adapter context
+ \param sessionId -session ID of the session which needs to be deleted.
+
+ \sa
+ --------------------------------------------------------------------------*/
+void peDeleteSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
+{
+ tANI_U16 i = 0;
+
+ limLog(pMac, LOGW, FL("Trying to delete a session %d.\n "), psessionEntry->peSessionId);
+
+ if(psessionEntry->pLimStartBssReq != NULL)
+ {
+ palFreeMemory( pMac->hHdd, psessionEntry->pLimStartBssReq );
+ psessionEntry->pLimStartBssReq = NULL;
+ }
+
+ if(psessionEntry->pLimJoinReq != NULL)
+ {
+ palFreeMemory( pMac->hHdd, psessionEntry->pLimJoinReq );
+ psessionEntry->pLimJoinReq = NULL;
+ }
+
+ if(psessionEntry->pLimReAssocReq != NULL)
+ {
+ palFreeMemory( pMac->hHdd, psessionEntry->pLimReAssocReq );
+ psessionEntry->pLimReAssocReq = NULL;
+ }
+
+ if(psessionEntry->pLimMlmJoinReq != NULL)
+ {
+ palFreeMemory( pMac->hHdd, psessionEntry->pLimMlmJoinReq );
+ psessionEntry->pLimMlmJoinReq = NULL;
+ }
+
+ if(psessionEntry->dph.dphHashTable.pHashTable != NULL)
+ {
+ palFreeMemory(pMac->hHdd, psessionEntry->dph.dphHashTable.pHashTable);
+ psessionEntry->dph.dphHashTable.pHashTable = NULL;
+ }
+
+ if(psessionEntry->dph.dphHashTable.pDphNodeArray != NULL)
+ {
+ palFreeMemory(pMac->hHdd, psessionEntry->dph.dphHashTable.pDphNodeArray);
+ psessionEntry->dph.dphHashTable.pDphNodeArray = NULL;
+ }
+
+ if(psessionEntry->beacon != NULL)
+ {
+ palFreeMemory( pMac->hHdd, psessionEntry->beacon);
+ psessionEntry->beacon = NULL;
+ }
+
+ if(psessionEntry->assocReq != NULL)
+ {
+ palFreeMemory( pMac->hHdd, psessionEntry->assocReq);
+ psessionEntry->assocReq = NULL;
+ }
+
+ if(psessionEntry->assocRsp != NULL)
+ {
+ palFreeMemory( pMac->hHdd, psessionEntry->assocRsp);
+ psessionEntry->assocRsp = NULL;
+ }
+
+
+ if(psessionEntry->parsedAssocReq != NULL)
+ {
+ // Cleanup the individual allocation first
+ for (i=0; i < psessionEntry->dph.dphHashTable.size; i++)
+ {
+ if ( psessionEntry->parsedAssocReq[i] != NULL )
+ {
+ if( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrame )
+ {
+ palFreeMemory(pMac->hHdd,
+ ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrame);
+ ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrame = NULL;
+ ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrameLength = 0;
+ }
+ palFreeMemory(pMac->hHdd, (void *)psessionEntry->parsedAssocReq[i]);
+ psessionEntry->parsedAssocReq[i] = NULL;
+ }
+ }
+ // Cleanup the whole block
+ palFreeMemory(pMac->hHdd, (void *)psessionEntry->parsedAssocReq);
+ psessionEntry->parsedAssocReq = NULL;
+ }
+
+#ifdef FEATURE_WLAN_CCX
+ limCleanupCcxCtxt(pMac, psessionEntry);
+#endif
+
+ psessionEntry->valid = FALSE;
+ return;
+}
+
+
+/*--------------------------------------------------------------------------
+ \brief peFindSessionByPeerSta() - looks up the PE session given the Station Address.
+
+ This function returns the session context and the session ID if the session
+ corresponding to the given station address is found in the PE session table.
+
+ \param pMac - pointer to global adapter context
+ \param sa - Peer STA Address of the session
+ \param sessionId -session ID is returned here, if session is found.
+
+ \return tpPESession - pointer to the session context or NULL if session is not found.
+
+ \sa
+ --------------------------------------------------------------------------*/
+
+
+tpPESession peFindSessionByPeerSta(tpAniSirGlobal pMac, tANI_U8* sa, tANI_U8* sessionId)
+{
+ tANI_U8 i;
+ tpDphHashNode pSta;
+ tANI_U16 aid;
+
+ for(i =0; i < pMac->lim.maxBssId; i++)
+ {
+ if( (pMac->lim.gpSession[i].valid))
+ {
+ pSta = dphLookupHashEntry(pMac, sa, &aid, &pMac->lim.gpSession[i].dph.dphHashTable);
+ if (pSta != NULL)
+ {
+ *sessionId = i;
+ return &pMac->lim.gpSession[i];
+ }
+ }
+ }
+
+ return NULL;
+}
+
+
+
+
+
+
+
+
+
diff --git a/CORE/MAC/src/pe/lim/limSessionUtils.c b/CORE/MAC/src/pe/lim/limSessionUtils.c
new file mode 100644
index 0000000..a07d0c9
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limSessionUtils.c
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**=========================================================================
+
+ \file limSessionUtils.c
+
+ \brief implementation for lim Session Utility APIs
+
+ \author Sunit Bhatia
+
+ Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
+ ========================================================================*/
+
+
+/*--------------------------------------------------------------------------
+ Include Files
+ ------------------------------------------------------------------------*/
+#include "aniGlobal.h"
+#include "limDebug.h"
+#include "limSession.h"
+#include "limSessionUtils.h"
+#include "limUtils.h"
+
+
+/*--------------------------------------------------------------------------
+ \brief peValidateJoinReq() - validates the Join request .
+
+ This function is called to validate the Join Request for a BT-AMP station. If start BSS session is present
+ this function returns TRUE else returns FALSE.
+ PE will force SME to first issue ''START_BSS' request for BTAMP_STA, before sending a JOIN request.
+
+ \param pMac - pointer to global adapter context
+ \return - return TRUE if start BSS session is present else return FALSE.
+
+ \sa
+ --------------------------------------------------------------------------*/
+
+tANI_U8 peValidateBtJoinRequest(tpAniSirGlobal pMac)
+{
+
+ tANI_U8 i;
+ for(i =0; i < pMac->lim.maxBssId; i++)
+ {
+ if( (pMac->lim.gpSession[i].valid) &&
+ (pMac->lim.gpSession[i].bssType == eSIR_BTAMP_STA_MODE) &&
+ (pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF))
+ {
+ return(TRUE);
+ }
+
+ }
+ return(FALSE);
+
+}
+
+/*--------------------------------------------------------------------------
+ \brief peGetValidPowerSaveSession() - Fetches the valid session for powersave .
+
+ This function is called to check the valid session for power save, if more than one session is active , this function
+ it returns NULL.
+ if there is only one valid "infrastructure" session present in "linkestablished" state this function returns sessionentry.
+ For all other cases it returns NULL.
+
+ \param pMac - pointer to global adapter context
+ \return - return session is address if valid session is present else return NULL.
+
+ \sa
+ --------------------------------------------------------------------------*/
+
+
+tpPESession peGetValidPowerSaveSession(tpAniSirGlobal pMac)
+{
+ tANI_U8 i;
+ tANI_U8 sessioncount = 0;
+ tANI_U8 sessionId = 0;
+
+ for(i = 0; i < pMac->lim.maxBssId; i++)
+ {
+ if( (pMac->lim.gpSession[i].valid == TRUE)&&
+ (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE)&&
+ (pMac->lim.gpSession[i].limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)) {
+ sessioncount++;
+ sessionId = i;
+
+ if(sessioncount > 1)
+ {
+ return(NULL);
+ }
+ }
+
+ }
+
+ if( (pMac->lim.gpSession[sessionId].valid == TRUE)&&
+ (pMac->lim.gpSession[sessionId].limSystemRole == eLIM_STA_ROLE)&&
+ (pMac->lim.gpSession[sessionId].limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE))
+
+ {
+ return(&pMac->lim.gpSession[sessionId]);
+ }
+ return(NULL);
+
+}
+/*--------------------------------------------------------------------------
+ \brief peIsAnySessionActive() - checks for the active session presence .
+
+ This function returns TRUE if atleast one valid session is present else it returns FALSE
+
+ \param pMac - pointer to global adapter context
+ \return - return TRUE if atleast one session is active else return FALSE.
+
+ \sa
+ --------------------------------------------------------------------------*/
+
+
+tANI_U8 peIsAnySessionActive(tpAniSirGlobal pMac)
+{
+ tANI_U8 i;
+ for(i =0; i < pMac->lim.maxBssId; i++)
+ {
+ if(pMac->lim.gpSession[i].valid == TRUE)
+ {
+ return(TRUE);
+ }
+
+ }
+ return(FALSE);
+
+}
+
+/*--------------------------------------------------------------------------
+ \brief isLimSessionOffChannel() - Determines if the there is any other off channel
+ session.
+
+ This function returns TRUE if the session Id passed needs to be on a different
+ channel than atleast one session already active.
+
+ \param pMac - pointer to global adapter context
+ \param sessionId - session ID of the session to be verified.
+
+ \return tANI_U8 - Boolean value for off-channel operation.
+
+ \sa
+ --------------------------------------------------------------------------*/
+
+tANI_U8
+isLimSessionOffChannel(tpAniSirGlobal pMac, tANI_U8 sessionId)
+{
+ tANI_U8 i;
+
+ if(sessionId >= pMac->lim.maxBssId)
+ {
+ limLog(pMac, LOGE, FL("Invalid sessionId: %d \n "), sessionId);
+ return FALSE;
+ }
+
+ for(i =0; i < pMac->lim.maxBssId; i++)
+ {
+ if( i == sessionId )
+ {
+ //Skip the sessionId that is to be joined.
+ continue;
+ }
+ //if snother ession is valid and it is on different channel
+ //it is an off channel operation.
+ if( (pMac->lim.gpSession[i].valid) &&
+ (pMac->lim.gpSession[i].currentOperChannel !=
+ pMac->lim.gpSession[sessionId].currentOperChannel) )
+ {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+
+}
+
+tANI_U8
+peGetActiveSessionChannel (tpAniSirGlobal pMac)
+{
+ tANI_U8 i;
+
+ for(i =0; i < pMac->lim.maxBssId; i++)
+ {
+ //if snother ession is valid and it is on different channel
+ //it is an off channel operation.
+ if(pMac->lim.gpSession[i].valid)
+ {
+ return pMac->lim.gpSession[i].currentOperChannel;
+ }
+ }
+
+ return 0;
+
+}
+
diff --git a/CORE/MAC/src/pe/lim/limSessionUtils.h b/CORE/MAC/src/pe/lim/limSessionUtils.h
new file mode 100644
index 0000000..4127827
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limSessionUtils.h
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+#if!defined( __LIM_SESSION_UTILS_H )
+#define __LIM_SESSION_UTILS_H
+
+
+/**=========================================================================
+
+ \file limSessionUtils.h
+
+ \brief prototype for lim Session Utility related APIs
+
+ \author Sunit Bhatia
+
+ Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
+
+ Qualcomm Confidential and Proprietary.
+
+ ========================================================================*/
+
+
+/*--------------------------------------------------------------------------
+ Include Files
+ ------------------------------------------------------------------------*/
+
+
+
+/*--------------------------------------------------------------------------
+ Preprocessor definitions and constants
+ ------------------------------------------------------------------------*/
+
+
+/*--------------------------------------------------------------------------
+ Type declarations
+ ------------------------------------------------------------------------*/
+
+
+/*-------------------------------------------------------------------------
+ Function declarations and documenation
+ ------------------------------------------------------------------------*/
+
+
+/*--------------------------------------------------------------------------
+ \brief peValidateJoinReq() - validates the Join request .
+
+ This function is called to validate the Join Request for a BT-AMP station. If start BSS session is present
+ this function returns TRUE else returns FALSE.
+
+ \param pMac - pointer to global adapter context
+ \return - return TRUE if start BSS session is present else return FALSE.
+
+ \sa
+ --------------------------------------------------------------------------*/
+tANI_U8 peValidateBtJoinRequest(tpAniSirGlobal pMac);
+
+/* --------------------------------------------------------------------------*/
+
+
+/*--------------------------------------------------------------------------
+ \brief peGetValidPowerSaveSession() - Fetches the valid session for powersave .
+
+ This function is called to check the valid session for power save, if more than one session is active , this function
+ it returns NULL.
+ if there is only one valid "infrastructure" session present in "linkestablished" state this function returns sessionentry.
+ For all other cases it returns NULL.
+
+ \param pMac - pointer to global adapter context
+ \return - return session is address if valid session is present else return NULL.
+
+ \sa
+ --------------------------------------------------------------------------*/
+
+
+tpPESession peGetValidPowerSaveSession(tpAniSirGlobal pMac);
+
+/* --------------------------------------------------------------------------*/
+
+
+/*--------------------------------------------------------------------------
+ \brief peIsAnySessionActive() - checks for the active session presence .
+
+ This function returns TRUE if atleast one valid session is present else it returns FALSE
+
+ \param pMac - pointer to global adapter context
+ \return - return TRUE if atleast one session is active else return FALSE.
+
+ \sa
+ --------------------------------------------------------------------------*/
+
+tANI_U8 peIsAnySessionActive(tpAniSirGlobal pMac);
+/* --------------------------------------------------------------------------*/
+
+
+
+/*--------------------------------------------------------------------------
+ \brief isLimSessionOffChannel() - Determines if the session is
+ off channel.
+
+ This function returns TRUE if the session Id passed needs to be on a different
+ channel than atleast one session already active.
+
+ \param pMac - pointer to global adapter context
+ \param sessionId - session ID of the session to be verified.
+
+ \return tANI_U8 - Boolean value for off-channel operation.
+
+ \sa
+ --------------------------------------------------------------------------*/
+tANI_U8
+isLimSessionOffChannel(tpAniSirGlobal pMac, tANI_U8 sessionId);
+/* --------------------------------------------------------------------------*/
+
+tANI_U8
+peGetActiveSessionChannel( tpAniSirGlobal pMac );
+#endif //#if !defined( __LIM_SESSION_UTILS_H )
+
diff --git a/CORE/MAC/src/pe/lim/limSmeReqUtils.c b/CORE/MAC/src/pe/lim/limSmeReqUtils.c
new file mode 100644
index 0000000..f0a687e
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limSmeReqUtils.c
@@ -0,0 +1,1274 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limSmeReqUtils.cc contains the utility functions
+ * for processing SME request messages.
+ * Author: Chandra Modumudi
+ * Date: 02/11/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ * 05/26/10 js WPA handling in (Re)Assoc frames
+ *
+ */
+
+#include "wniApi.h"
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+#include "wniCfgAp.h"
+#else
+#include "wniCfgSta.h"
+#endif
+#include "cfgApi.h"
+#include "sirApi.h"
+#include "schApi.h"
+#include "utilsApi.h"
+#include "limTypes.h"
+#include "limUtils.h"
+#include "limAssocUtils.h"
+#include "limSecurityUtils.h"
+#include "limSerDesUtils.h"
+
+
+
+/**
+ * limIsRSNieValidInSmeReqMessage()
+ *
+ *FUNCTION:
+ * This function is called to verify if the RSN IE
+ * received in various SME_REQ messages is valid or not
+ *
+ *LOGIC:
+ * RSN IE validity checks are performed in this function
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pRSNie Pointer to received RSN IE
+ * @return true when RSN IE is valid, false otherwise
+ */
+
+static tANI_U8
+limIsRSNieValidInSmeReqMessage(tpAniSirGlobal pMac, tpSirRSNie pRSNie)
+{
+ tANI_U8 startPos = 0;
+ tANI_U32 privacy, val;
+ int len;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED,
+ &privacy) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP,
+ FL("Unable to retrieve POI from CFG\n"));
+ }
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_RSN_ENABLED,
+ &val) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP,
+ FL("Unable to retrieve RSN_ENABLED from CFG\n"));
+ }
+
+ if (pRSNie->length && (!privacy || !val))
+ {
+ // Privacy & RSN not enabled in CFG.
+ /**
+ * In order to allow mixed mode for Guest access
+ * allow BSS creation/join with no Privacy capability
+ * yet advertising WPA IE
+ */
+ PELOG1(limLog(pMac, LOG1, FL("RSN ie len %d but PRIVACY %d RSN %d\n"),
+ pRSNie->length, privacy, val);)
+ }
+
+ if (pRSNie->length)
+ {
+ if ((pRSNie->rsnIEdata[0] != DOT11F_EID_RSN) &&
+ (pRSNie->rsnIEdata[0] != DOT11F_EID_WPA)
+#ifdef FEATURE_WLAN_WAPI
+ && (pRSNie->rsnIEdata[0] != DOT11F_EID_WAPI)
+#endif
+ )
+ {
+ limLog(pMac, LOGE, FL("RSN/WPA/WAPI EID %d not [%d || %d]\n"),
+ pRSNie->rsnIEdata[0], DOT11F_EID_RSN,
+ DOT11F_EID_WPA);
+ return false;
+ }
+
+ len = pRSNie->length;
+ startPos = 0;
+ while(len > 0)
+ {
+ // Check validity of RSN IE
+ if (pRSNie->rsnIEdata[startPos] == DOT11F_EID_RSN)
+ {
+ if((pRSNie->rsnIEdata[startPos+1] > DOT11F_IE_RSN_MAX_LEN) ||
+ (pRSNie->rsnIEdata[startPos+1] < DOT11F_IE_RSN_MIN_LEN))
+ {
+ limLog(pMac, LOGE, FL("RSN IE len %d not [%d,%d]\n"),
+ pRSNie->rsnIEdata[startPos+1], DOT11F_IE_RSN_MIN_LEN,
+ DOT11F_IE_RSN_MAX_LEN);
+ return false;
+ }
+ }
+ else if(pRSNie->rsnIEdata[startPos] == DOT11F_EID_WPA)
+ {
+ // Check validity of WPA IE
+ val = sirReadU32((tANI_U8 *) &pRSNie->rsnIEdata[startPos + 2]);
+ if((pRSNie->rsnIEdata[startPos + 1] < DOT11F_IE_WPA_MIN_LEN) ||
+ (pRSNie->rsnIEdata[startPos + 1] > DOT11F_IE_WPA_MAX_LEN) ||
+ (SIR_MAC_WPA_OUI != val))
+ {
+ limLog(pMac, LOGE,
+ FL("WPA IE len %d not [%d,%d] OR data 0x%x not 0x%x\n"),
+ pRSNie->rsnIEdata[startPos+1], DOT11F_IE_WPA_MIN_LEN,
+ DOT11F_IE_WPA_MAX_LEN, val, SIR_MAC_WPA_OUI);
+
+ return false;
+ }
+ }
+#ifdef FEATURE_WLAN_WAPI
+ else if(pRSNie->rsnIEdata[startPos] == DOT11F_EID_WAPI)
+ {
+ if((pRSNie->rsnIEdata[startPos+1] > DOT11F_IE_WAPI_MAX_LEN) ||
+ (pRSNie->rsnIEdata[startPos+1] < DOT11F_IE_WAPI_MIN_LEN))
+ {
+ limLog(pMac, LOGE,
+ FL("WAPI IE len %d not [%d,%d]\n"),
+ pRSNie->rsnIEdata[startPos+1], DOT11F_IE_WAPI_MIN_LEN,
+ DOT11F_IE_WAPI_MAX_LEN);
+
+ return false;
+ }
+ }
+#endif
+ else
+ {
+ //we will never be here, simply for completeness
+ return false;
+ }
+ startPos += 2 + pRSNie->rsnIEdata[startPos+1]; //EID + length field + length
+ len -= startPos;
+ }//while
+
+ }
+
+ return true;
+} /*** end limIsRSNieValidInSmeReqMessage() ***/
+
+/**
+ * limIsAddieValidInSmeReqMessage()
+ *
+ *FUNCTION:
+ * This function is called to verify if the Add IE
+ * received in various SME_REQ messages is valid or not
+ *
+ *LOGIC:
+ * Add IE validity checks are performed on only length
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pWSCie Pointer to received WSC IE
+ * @return true when WSC IE is valid, false otherwise
+ */
+
+static tANI_U8
+limIsAddieValidInSmeReqMessage(tpAniSirGlobal pMac, tpSirAddie pAddie)
+{
+ int left = pAddie->length;
+ tANI_U8 *ptr = pAddie->addIEdata;
+ tANI_U8 elem_id, elem_len;
+
+ if (left == 0)
+ return true;
+
+ while(left >= 2)
+ {
+ elem_id = ptr[0];
+ elem_len = ptr[1];
+ left -= 2;
+ if(elem_len > left)
+ {
+ limLog( pMac, LOGE,
+ FL("****Invalid Add IEs eid = %d elem_len=%d left=%d*****\n"),
+ elem_id,elem_len,left);
+ return false;
+ }
+
+ left -= elem_len;
+ ptr += (elem_len + 2);
+ }
+ // there shouldn't be any left byte
+
+
+ return true;
+} /*** end limIsAddieValidInSmeReqMessage() ***/
+
+#ifdef WLAN_SOFTAP_FEATURE
+/**
+ * limSetRSNieWPAiefromSmeStartBSSReqMessage()
+ *
+ *FUNCTION:
+ * This function is called to verify if the RSN IE
+ * received in various SME_REQ messages is valid or not
+ *
+ *LOGIC:
+ * RSN IE validity checks are performed in this function
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pRSNie Pointer to received RSN IE
+ * @return true when RSN IE is valid, false otherwise
+ */
+
+tANI_U8
+limSetRSNieWPAiefromSmeStartBSSReqMessage(tpAniSirGlobal pMac,
+ tpSirRSNie pRSNie,
+ tpPESession pSessionEntry)
+{
+ tANI_U8 wpaIndex = 0;
+ tANI_U32 privacy, val;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED,
+ &privacy) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP,
+ FL("Unable to retrieve POI from CFG\n"));
+ }
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_RSN_ENABLED,
+ &val) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP,
+ FL("Unable to retrieve RSN_ENABLED from CFG\n"));
+ }
+
+ if (pRSNie->length && (!privacy || !val))
+ {
+ // Privacy & RSN not enabled in CFG.
+ /**
+ * In order to allow mixed mode for Guest access
+ * allow BSS creation/join with no Privacy capability
+ * yet advertising WPA IE
+ */
+ PELOG1(limLog(pMac, LOG1, FL("RSN ie len %d but PRIVACY %d RSN %d\n"),
+ pRSNie->length, privacy, val);)
+ }
+
+ if (pRSNie->length)
+ {
+ if ((pRSNie->rsnIEdata[0] != SIR_MAC_RSN_EID) &&
+ (pRSNie->rsnIEdata[0] != SIR_MAC_WPA_EID))
+ {
+ limLog(pMac, LOGE, FL("RSN/WPA EID %d not [%d || %d]\n"),
+ pRSNie->rsnIEdata[0], SIR_MAC_RSN_EID,
+ SIR_MAC_WPA_EID);
+ return false;
+ }
+
+ // Check validity of RSN IE
+ if ((pRSNie->rsnIEdata[0] == SIR_MAC_RSN_EID) &&
+#if 0 // Comparison always false
+ (pRSNie->rsnIEdata[1] > SIR_MAC_RSN_IE_MAX_LENGTH) ||
+#endif
+ (pRSNie->rsnIEdata[1] < SIR_MAC_RSN_IE_MIN_LENGTH))
+ {
+ limLog(pMac, LOGE, FL("RSN IE len %d not [%d,%d]\n"),
+ pRSNie->rsnIEdata[1], SIR_MAC_RSN_IE_MIN_LENGTH,
+ SIR_MAC_RSN_IE_MAX_LENGTH);
+ return false;
+ }
+
+ if (pRSNie->length > pRSNie->rsnIEdata[1] + 2)
+ {
+ if (pRSNie->rsnIEdata[0] != SIR_MAC_RSN_EID)
+ {
+ limLog(pMac,
+ LOGE,
+ FL("First byte[%d] in rsnIEdata is not RSN_EID\n"),
+ pRSNie->rsnIEdata[1]);
+ return false;
+ }
+
+ limLog(pMac,
+ LOG1,
+ FL("WPA IE is present along with WPA2 IE\n"));
+ wpaIndex = 2 + pRSNie->rsnIEdata[1];
+ }
+ else if ((pRSNie->length == pRSNie->rsnIEdata[1] + 2) &&
+ (pRSNie->rsnIEdata[0] == SIR_MAC_RSN_EID))
+ {
+ limLog(pMac,
+ LOG1,
+ FL("Only RSN IE is present\n"));
+ dot11fUnpackIeRSN(pMac,&pRSNie->rsnIEdata[2],
+ (tANI_U8)pRSNie->length,&pSessionEntry->gStartBssRSNIe);
+ }
+ else if ((pRSNie->length == pRSNie->rsnIEdata[1] + 2) &&
+ (pRSNie->rsnIEdata[0] == SIR_MAC_WPA_EID))
+ {
+ limLog(pMac,
+ LOG1,
+ FL("Only WPA IE is present\n"));
+
+ dot11fUnpackIeWPA(pMac,&pRSNie->rsnIEdata[6],(tANI_U8)pRSNie->length-4,
+ &pSessionEntry->gStartBssWPAIe);
+ }
+
+ // Check validity of WPA IE
+ val = sirReadU32((tANI_U8 *) &pRSNie->rsnIEdata[wpaIndex + 2]);
+
+ if ((pRSNie->rsnIEdata[wpaIndex] == SIR_MAC_WPA_EID) &&
+#if 0 // Comparison always false
+ (pRSNie->rsnIEdata[wpaIndex + 1] > SIR_MAC_WPA_IE_MAX_LENGTH) ||
+#endif
+ ((pRSNie->rsnIEdata[wpaIndex + 1] < SIR_MAC_WPA_IE_MIN_LENGTH) ||
+ (SIR_MAC_WPA_OUI != val)))
+ {
+ limLog(pMac, LOGE,
+ FL("WPA IE len %d not [%d,%d] OR data 0x%x not 0x%x\n"),
+ pRSNie->rsnIEdata[1], SIR_MAC_RSN_IE_MIN_LENGTH,
+ SIR_MAC_RSN_IE_MAX_LENGTH, val, SIR_MAC_WPA_OUI);
+
+ return false;
+ }
+ else
+ {
+ /* Both RSN and WPA IEs are present */
+ dot11fUnpackIeRSN(pMac,&pRSNie->rsnIEdata[2],
+ (tANI_U8)pRSNie->length,&pSessionEntry->gStartBssRSNIe);
+
+ dot11fUnpackIeWPA(pMac,&pRSNie->rsnIEdata[wpaIndex + 6],
+ pRSNie->rsnIEdata[wpaIndex + 1]-4,
+ &pSessionEntry->gStartBssWPAIe);
+
+ }
+ }
+
+ return true;
+} /*** end limSetRSNieWPAiefromSmeStartBSSReqMessage() ***/
+#endif
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+/**
+ * limIsBssInfoValidInSmeReqMessage()
+ *
+ *FUNCTION:
+ * This function is called to verify if the BSS info
+ * received in various SME_REQ messages is valid or not
+ *
+ *LOGIC:
+ * BSS info validity checks are performed in this function
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pBssInfo Pointer to received Bss Information
+ * @return true when BSS info is valid, false otherwise
+ */
+
+static tANI_U8
+limIsBssInfoValidInSmeReqMessage(tpAniSirGlobal pMac,
+ tpSirNeighborBssInfo pBssInfo)
+{
+ tANI_U8 valid = true;
+
+ if ((pBssInfo->bssType != eSIR_INFRASTRUCTURE_MODE) ||
+ limIsGroupAddr(pBssInfo->bssId) ||
+ !pBssInfo->channelId ||
+ !pBssInfo->ssId.length ||
+ (pBssInfo->ssId.length > SIR_MAC_MAX_SSID_LENGTH) ||
+ !limIsRSNieValidInSmeReqMessage(pMac, &pBssInfo->rsnIE))
+ {
+ valid = false;
+ goto end;
+ }
+
+end:
+ return valid;
+} /*** end limIsBssInfoValidInSmeReqMessage() ***/
+#else
+
+
+
+/**
+ * limIsBssDescrValidInSmeReqMessage()
+ *
+ *FUNCTION:
+ * This function is called to verify if the BSS Descr
+ * received in various SME_REQ messages is valid or not
+ *
+ *LOGIC:
+ * BSS Descritipion validity checks are performed in this function
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pBssDescr Pointer to received Bss Descritipion
+ * @return true when BSS description is valid, false otherwise
+ */
+
+static tANI_U8
+limIsBssDescrValidInSmeReqMessage(tpAniSirGlobal pMac,
+ tpSirBssDescription pBssDescr)
+{
+ tANI_U8 valid = true;
+
+ if (limIsAddrBC(pBssDescr->bssId) ||
+ !pBssDescr->channelId)
+ {
+ valid = false;
+ goto end;
+ }
+
+end:
+ return valid;
+} /*** end limIsBssDescrValidInSmeReqMessage() ***/
+#endif
+
+
+
+/**
+ * limIsSmeStartReqValid()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeReqMessages() upon
+ * receiving SME_START_REQ message from application.
+ *
+ *LOGIC:
+ * Message validity checks are performed in this function
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMsg - Pointer to received SME_START_BSS_REQ message
+ * @return true when received SME_START_REQ is formatted correctly
+ * false otherwise
+ */
+
+tANI_U8
+limIsSmeStartReqValid(tpAniSirGlobal pMac, tANI_U32 *pMsg)
+{
+ tANI_U8 valid = true;
+
+ if (((tpSirSmeStartReq) pMsg)->length != sizeof(tSirSmeStartReq))
+ {
+ /**
+ * Invalid length in START_REQ message
+ * Log error.
+ */
+ limLog(pMac, LOGW,
+ FL("Invalid length %d in eWNI_SME_START_REQ\n"),
+ ((tpSirSmeStartReq) pMsg)->length);
+
+ valid = false;
+ goto end;
+ }
+
+end:
+ return valid;
+} /*** end limIsSmeStartReqValid() ***/
+
+
+
+/**
+ * limIsSmeStartBssReqValid()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeReqMessages() upon
+ * receiving SME_START_BSS_REQ message from application.
+ *
+ *LOGIC:
+ * Message validity checks are performed in this function
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pStartBssReq Pointer to received SME_START_BSS_REQ message
+ * @return true when received SME_START_BSS_REQ is formatted correctly
+ * false otherwise
+ */
+
+tANI_U8
+limIsSmeStartBssReqValid(tpAniSirGlobal pMac,
+ tpSirSmeStartBssReq pStartBssReq)
+{
+ tANI_U8 i = 0;
+ tANI_U8 valid = true;
+
+ PELOG1(limLog(pMac, LOG1,
+ FL("Parsed START_BSS_REQ fields are bssType=%d, channelId=%d, SSID len=%d, rsnIE len=%d, nwType=%d, rateset len=%d\n"),
+ pStartBssReq->bssType,
+ pStartBssReq->channelId,
+ pStartBssReq->ssId.length,
+ pStartBssReq->rsnIE.length,
+ pStartBssReq->nwType,
+ pStartBssReq->operationalRateSet.numRates);)
+
+ switch (pStartBssReq->bssType)
+ {
+ case eSIR_INFRASTRUCTURE_MODE:
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ /* Check for the AP Role/Station role here and act accordingly.
+ * Currently assuming this as AP and breaks TODO */
+ break;
+#endif
+ /**
+ * Should not have received start BSS req with bssType
+ * Infrastructure on STA.
+ * Log error.
+ */
+ limLog(pMac, LOGE, FL("Invalid bssType %d in eWNI_SME_START_BSS_REQ\n"),pStartBssReq->bssType);
+ valid = false;
+ goto end;
+ break;
+
+ case eSIR_IBSS_MODE:
+ break;
+
+ /* Added for BT AMP support */
+ case eSIR_BTAMP_STA_MODE:
+ break;
+
+ /* Added for BT AMP support */
+ case eSIR_BTAMP_AP_MODE:
+ break;
+
+#ifdef WLAN_SOFTAP_FEATURE
+ /* Added for SoftAP support */
+ case eSIR_INFRA_AP_MODE:
+ break;
+#endif
+
+ default:
+ /**
+ * Should not have received start BSS req with bssType
+ * other than Infrastructure/IBSS.
+ * Log error
+ */
+ limLog(pMac, LOGW,
+ FL("Invalid bssType %d in eWNI_SME_START_BSS_REQ\n"),
+ pStartBssReq->bssType);
+
+ valid = false;
+ goto end;
+ }
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+
+ /* Assumed as AP again, need to check the role and change accordingly */
+ if (pStartBssReq->bssType == eSIR_INFRASTRUCTURE_MODE)
+ {
+ if ((pStartBssReq->numSSID == 1) && pStartBssReq->ssId.length &&
+ ((pStartBssReq->ssId.length != pStartBssReq->ssIdList[0].length) ||
+ ( !palEqualMemory( pMac->hHdd,pStartBssReq->ssId.ssId,
+ pStartBssReq->ssIdList[0].ssId,
+ pStartBssReq->ssId.length) )))
+ {
+ /**
+ * Invalid combination of ssID length
+ * and number of SSIDs present.
+ * Reject START_BSS_REQ.
+ */
+ limLog(pMac, LOGW,
+ FL("Mismatch in SSID length & numSSID in SME_START_BSS_REQ\n"));
+
+ valid = false;
+ goto end;
+ }
+
+ if (!pStartBssReq->numSSID ||
+ (pStartBssReq->ssId.length && (pStartBssReq->numSSID != 1)))
+ {
+ /**
+ * Invalid combination of ssID length
+ * and number of SSIDs present.
+ * Reject START_BSS_REQ.
+ */
+ limLog(pMac, LOGW,
+ FL("Mismatch in SSID length[%d] & numSSID[%d] in SME_START_BSS_REQ\n"),
+ pStartBssReq->ssId.length, pStartBssReq->numSSID);
+
+ valid = false;
+ goto end;
+ }
+ }
+#endif
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ /* This below code is client specific code. TODO */
+ if (pStartBssReq->bssType == eSIR_IBSS_MODE)
+ {
+ if (!pStartBssReq->ssId.length ||
+ (pStartBssReq->ssId.length > SIR_MAC_MAX_SSID_LENGTH))
+ {
+ // Invalid length for SSID.
+ // Reject START_BSS_REQ
+ limLog(pMac, LOGW,
+ FL("Invalid SSID length in eWNI_SME_START_BSS_REQ\n"));
+
+ valid = false;
+ goto end;
+ }
+ }
+#endif
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+ /* Assumed as AP TODO */
+ if (pStartBssReq->bssType == eSIR_INFRASTRUCTURE_MODE)
+ {
+ tpSirAlternateRadioInfo pRadioInfo;
+
+ pRadioInfo = pStartBssReq->alternateRadioList.alternateRadio;
+ for (i = 0; i < pStartBssReq->alternateRadioList.numBss; i++)
+ {
+ if (limIsGroupAddr(pRadioInfo->bssId))
+ {
+ // Invalid mate BSSID.
+ // Reject START_BSS_REQ
+ limLog(pMac, LOGW,
+ FL("Invalid mate BSSID in eWNI_SME_START_BSS_REQ\n"));
+
+ valid = false;
+ goto end;
+ }
+ pRadioInfo += sizeof(tSirAlternateRadioInfo);
+ }
+
+ /*
+ ** check WDS info length
+ **/
+ if (pStartBssReq->wdsInfo.wdsLength > ANI_WDS_INFO_MAX_LENGTH)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Illegal WDS info length\n"));)
+ valid = false;
+ goto end;
+ }
+ }
+#endif
+
+ if (!limIsRSNieValidInSmeReqMessage(pMac, &pStartBssReq->rsnIE))
+ {
+ valid = false;
+ goto end;
+ }
+
+ if (pStartBssReq->nwType != eSIR_11A_NW_TYPE &&
+ pStartBssReq->nwType != eSIR_11B_NW_TYPE &&
+ pStartBssReq->nwType != eSIR_11G_NW_TYPE)
+ {
+ valid = false;
+ goto end;
+ }
+
+ if (pStartBssReq->nwType == eSIR_11A_NW_TYPE)
+ {
+ for (i = 0; i < pStartBssReq->operationalRateSet.numRates; i++)
+ if (!sirIsArate(pStartBssReq->operationalRateSet.rate[i] & 0x7F))
+ {
+ // Invalid Operational rates
+ // Reject START_BSS_REQ
+ limLog(pMac, LOGW,
+ FL("Invalid operational rates in eWNI_SME_START_BSS_REQ\n"));
+ sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOGW,
+ pStartBssReq->operationalRateSet.rate,
+ pStartBssReq->operationalRateSet.numRates);
+
+ valid = false;
+ goto end;
+ }
+ }
+ // check if all the rates in the operatioal rate set are legal 11G rates
+ else if (pStartBssReq->nwType == eSIR_11G_NW_TYPE)
+ {
+ for (i = 0; i < pStartBssReq->operationalRateSet.numRates; i++)
+ if (!sirIsGrate(pStartBssReq->operationalRateSet.rate[i] & 0x7F))
+ {
+ // Invalid Operational rates
+ // Reject START_BSS_REQ
+ limLog(pMac, LOGW,
+ FL("Invalid operational rates in eWNI_SME_START_BSS_REQ\n"));
+ sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOGW,
+ pStartBssReq->operationalRateSet.rate,
+ pStartBssReq->operationalRateSet.numRates);
+
+ valid = false;
+ goto end;
+ }
+ }
+ else
+ {
+ for (i = 0; i < pStartBssReq->operationalRateSet.numRates; i++)
+ if (!sirIsBrate(pStartBssReq->operationalRateSet.rate[i] & 0x7F))
+ {
+ // Invalid Operational rates
+ // Reject START_BSS_REQ
+ limLog(pMac, LOGW,
+ FL("Invalid operational rates in eWNI_SME_START_BSS_REQ\n"));
+ sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOGW,
+ pStartBssReq->operationalRateSet.rate,
+ pStartBssReq->operationalRateSet.numRates);
+
+ valid = false;
+ goto end;
+ }
+ }
+
+end:
+ return valid;
+} /*** end limIsSmeStartBssReqValid() ***/
+
+
+
+/**
+ * limIsSmeJoinReqValid()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeReqMessages() upon
+ * receiving SME_JOIN_REQ message from application.
+ *
+ *LOGIC:
+ * Message validity checks are performed in this function
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pJoinReq Pointer to received SME_JOIN_REQ message
+ * @return true when received SME_JOIN_REQ is formatted correctly
+ * false otherwise
+ */
+
+tANI_U8
+limIsSmeJoinReqValid(tpAniSirGlobal pMac, tpSirSmeJoinReq pJoinReq)
+{
+ tANI_U8 valid = true;
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ if (pJoinReq->assocType > eSIR_TRANSFERRED)
+ {
+ /// Received eWNI_SME_JOIN_REQ with invalid assocType
+ // Log the event
+ limLog(pMac, LOGW,
+ FL("received SME_JOIN_REQ with invalid assocType\n"));
+
+ valid = false;
+ goto end;
+ }
+#endif
+
+ if (!limIsRSNieValidInSmeReqMessage(pMac, &pJoinReq->rsnIE))
+ {
+ limLog(pMac, LOGE,
+ FL("received SME_JOIN_REQ with invalid RSNIE\n"));
+ valid = false;
+ goto end;
+ }
+
+ if (!limIsAddieValidInSmeReqMessage(pMac, &pJoinReq->addIEScan))
+ {
+ limLog(pMac, LOGE,
+ FL("received SME_JOIN_REQ with invalid additional IE for scan\n"));
+ valid = false;
+ goto end;
+ }
+
+ if (!limIsAddieValidInSmeReqMessage(pMac, &pJoinReq->addIEAssoc))
+ {
+ limLog(pMac, LOGE,
+ FL("received SME_JOIN_REQ with invalid additional IE for assoc\n"));
+ valid = false;
+ goto end;
+ }
+
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+ if (!limIsBssInfoValidInSmeReqMessage(
+ pMac,
+ pJoinReq->neighborBssList.bssList))
+#else
+ if (!limIsBssDescrValidInSmeReqMessage(pMac,
+ &pJoinReq->bssDescription))
+#endif
+ {
+ /// Received eWNI_SME_JOIN_REQ with invalid BSS Info
+ // Log the event
+ limLog(pMac, LOGE,
+ FL("received SME_JOIN_REQ with invalid bssInfo\n"));
+
+ valid = false;
+ goto end;
+ }
+
+end:
+ return valid;
+} /*** end limIsSmeJoinReqValid() ***/
+
+
+
+/**
+ * limIsSmeDisassocReqValid()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeReqMessages() upon
+ * receiving SME_DISASSOC_REQ message from application.
+ *
+ *LOGIC:
+ * Message validity checks are performed in this function
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pDisassocReq Pointer to received SME_DISASSOC_REQ message
+ * @return true When received SME_DISASSOC_REQ is formatted
+ * correctly
+ * false otherwise
+ */
+
+tANI_U8
+limIsSmeDisassocReqValid(tpAniSirGlobal pMac,
+ tpSirSmeDisassocReq pDisassocReq, tpPESession psessionEntry)
+{
+ if (limIsGroupAddr(pDisassocReq->peerMacAddr) &&
+ !limIsAddrBC(pDisassocReq->peerMacAddr))
+ return false;
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ if (((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
+ ((pDisassocReq->aid < 2) || (pDisassocReq->aid > 2007))) ||
+ ((psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
+ (pDisassocReq->aid != 1)))
+ return false;
+#endif
+
+ return true;
+} /*** end limIsSmeDisassocReqValid() ***/
+
+
+
+/**
+ * limIsSmeDisassocCnfValid()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeReqMessages() upon
+ * receiving SME_DISASSOC_CNF message from application.
+ *
+ *LOGIC:
+ * Message validity checks are performed in this function
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pDisassocCnf Pointer to received SME_DISASSOC_REQ message
+ * @return true When received SME_DISASSOC_CNF is formatted
+ * correctly
+ * false otherwise
+ */
+
+tANI_U8
+limIsSmeDisassocCnfValid(tpAniSirGlobal pMac,
+ tpSirSmeDisassocCnf pDisassocCnf, tpPESession psessionEntry)
+{
+ if (limIsGroupAddr(pDisassocCnf->peerMacAddr))
+ return false;
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ if (((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
+ ((pDisassocCnf->aid < 2) || (pDisassocCnf->aid > 2007))) ||
+ ((psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
+ (pDisassocCnf->aid != 1)))
+ return false;
+#endif
+ return true;
+} /*** end limIsSmeDisassocCnfValid() ***/
+
+
+
+/**
+ * limIsSmeDeauthReqValid()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeReqMessages() upon
+ * receiving SME_DEAUTH_REQ message from application.
+ *
+ *LOGIC:
+ * Message validity checks are performed in this function
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param pDeauthReq Pointer to received SME_DEAUTH_REQ message
+ * @return true When received SME_DEAUTH_REQ is formatted correctly
+ * false otherwise
+ */
+
+tANI_U8
+limIsSmeDeauthReqValid(tpAniSirGlobal pMac, tpSirSmeDeauthReq pDeauthReq, tpPESession psessionEntry)
+{
+ if (limIsGroupAddr(pDeauthReq->peerMacAddr) &&
+ !limIsAddrBC(pDeauthReq->peerMacAddr))
+ return false;
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ if (((psessionEntryp->limSystemRole == eLIM_AP_ROLE) &&
+ ((pDeauthReq->aid < 2) || (pDeauthReq->aid > 2007))) ||
+ ((psessionEntryp->limSystemRole == eLIM_STA_ROLE) &&
+ (pDeauthReq->aid != 1)))
+ return false;
+#endif
+ return true;
+} /*** end limIsSmeDeauthReqValid() ***/
+
+
+
+/**
+ * limIsSmeScanReqValid()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeReqMessages() upon
+ * receiving SME_SCAN_REQ message from application.
+ *
+ *LOGIC:
+ * Message validity checks are performed in this function
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pScanReq Pointer to received SME_SCAN_REQ message
+ * @return true when received SME_SCAN_REQ is formatted correctly
+ * false otherwise
+ */
+
+tANI_U8
+limIsSmeScanReqValid(tpAniSirGlobal pMac, tpSirSmeScanReq pScanReq)
+{
+ tANI_U8 valid = true;
+ tANI_U8 i = 0;
+
+ for (i = 0; i < pScanReq->numSsid; i++)
+ {
+ if (pScanReq->ssId[i].length > SIR_MAC_MAX_SSID_LENGTH)
+ {
+ valid = false;
+ goto end;
+ }
+ }
+ if ((pScanReq->bssType > eSIR_AUTO_MODE) ||
+ (limIsGroupAddr(pScanReq->bssId) && !limIsAddrBC(pScanReq->bssId)) ||
+ (!(pScanReq->scanType == eSIR_PASSIVE_SCAN || pScanReq->scanType == eSIR_ACTIVE_SCAN)) ||
+ (pScanReq->channelList.numChannels > SIR_MAX_NUM_CHANNELS))
+ {
+ valid = false;
+ goto end;
+ }
+
+ /*
+ ** check min/max channelTime range
+ **/
+
+ if ((pScanReq->scanType == eSIR_ACTIVE_SCAN) &&
+ (pScanReq->maxChannelTime < pScanReq->minChannelTime))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Max Channel Time < Min Channel Time\n"));)
+ valid = false;
+ goto end;
+ }
+
+end:
+ return valid;
+} /*** end limIsSmeScanReqValid() ***/
+
+
+
+/**
+ * limIsSmeAuthReqValid()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeReqMessages() upon
+ * receiving SME_AUTH_REQ message from application.
+ *
+ *LOGIC:
+ * Message validity checks are performed in this function
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pAuthReq Pointer to received SME_AUTH_REQ message
+ * @return true when received SME_AUTH_REQ is formatted correctly
+ * false otherwise
+ */
+
+tANI_U8
+limIsSmeAuthReqValid(tpSirSmeAuthReq pAuthReq)
+{
+ tANI_U8 valid = true;
+
+ if (limIsGroupAddr(pAuthReq->peerMacAddr) ||
+ (pAuthReq->authType > eSIR_AUTO_SWITCH) ||
+ !pAuthReq->channelNumber)
+ {
+ valid = false;
+ goto end;
+ }
+
+end:
+ return valid;
+} /*** end limIsSmeAuthReqValid() ***/
+
+
+
+/**
+ * limIsSmeSetContextReqValid()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeReqMessages() upon
+ * receiving SME_SET_CONTEXT_REQ message from application.
+ *
+ *LOGIC:
+ * Message validity checks are performed in this function
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMsg - Pointer to received SME_SET_CONTEXT_REQ message
+ * @return true when received SME_SET_CONTEXT_REQ is formatted correctly
+ * false otherwise
+ */
+
+tANI_U8
+limIsSmeSetContextReqValid(tpAniSirGlobal pMac, tpSirSmeSetContextReq pSetContextReq)
+{
+ tANI_U8 i = 0;
+ tANI_U8 valid = true;
+ tpSirKeys pKey = pSetContextReq->keyMaterial.key;
+
+ if ((pSetContextReq->keyMaterial.edType != eSIR_ED_WEP40) &&
+ (pSetContextReq->keyMaterial.edType != eSIR_ED_WEP104) &&
+ (pSetContextReq->keyMaterial.edType != eSIR_ED_NONE) &&
+#ifdef FEATURE_WLAN_WAPI
+ (pSetContextReq->keyMaterial.edType != eSIR_ED_WPI) &&
+#endif
+ !pSetContextReq->keyMaterial.numKeys)
+ {
+ /**
+ * No keys present in case of TKIP or CCMP
+ * Log error.
+ */
+ limLog(pMac, LOGW,
+ FL("No keys present in SME_SETCONTEXT_REQ for edType=%d\n"),
+ pSetContextReq->keyMaterial.edType);
+
+ valid = false;
+ goto end;
+ }
+
+ if (pSetContextReq->keyMaterial.numKeys &&
+ (pSetContextReq->keyMaterial.edType == eSIR_ED_NONE))
+ {
+ /**
+ * Keys present in case of no ED policy
+ * Log error.
+ */
+ limLog(pMac, LOGW,
+ FL("Keys present in SME_SETCONTEXT_REQ for edType=%d\n"),
+ pSetContextReq->keyMaterial.edType);
+
+ valid = false;
+ goto end;
+ }
+
+ if (pSetContextReq->keyMaterial.edType >= eSIR_ED_NOT_IMPLEMENTED)
+ {
+ /**
+ * Invalid edType in the message
+ * Log error.
+ */
+ limLog(pMac, LOGW,
+ FL("Invalid edType=%d in SME_SETCONTEXT_REQ\n"),
+ pSetContextReq->keyMaterial.edType);
+
+ valid = false;
+ goto end;
+ }
+ else if (pSetContextReq->keyMaterial.edType > eSIR_ED_NONE)
+ {
+ tANI_U32 poi;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED,
+ &poi) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP,
+ FL("Unable to retrieve POI from CFG\n"));
+ }
+
+ if (!poi)
+ {
+ /**
+ * Privacy is not enabled
+ * In order to allow mixed mode for Guest access
+ * allow BSS creation/join with no Privacy capability
+ * yet advertising WPA IE
+ */
+ PELOG1(limLog(pMac, LOG1,
+ FL("Privacy is not enabled, yet non-None EDtype=%d in SME_SETCONTEXT_REQ\n"),
+ pSetContextReq->keyMaterial.edType);)
+ }
+ }
+
+ for (i = 0; i < pSetContextReq->keyMaterial.numKeys; i++)
+ {
+ if (((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) &&
+ (pKey->keyLength != 5)) ||
+ ((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104) &&
+ (pKey->keyLength != 13)) ||
+ ((pSetContextReq->keyMaterial.edType == eSIR_ED_TKIP) &&
+ (pKey->keyLength != 32)) ||
+#ifdef FEATURE_WLAN_WAPI
+ ((pSetContextReq->keyMaterial.edType == eSIR_ED_WPI) &&
+ (pKey->keyLength != 32)) ||
+#endif
+ ((pSetContextReq->keyMaterial.edType == eSIR_ED_CCMP) &&
+ (pKey->keyLength != 16)))
+ {
+ /**
+ * Invalid key length for a given ED type
+ * Log error.
+ */
+ limLog(pMac, LOGW,
+ FL("Invalid keyLength =%d for edType=%d in SME_SETCONTEXT_REQ\n"),
+ pKey->keyLength, pSetContextReq->keyMaterial.edType);
+
+ valid = false;
+ goto end;
+ }
+ pKey++;
+ }
+
+end:
+ return valid;
+} /*** end limIsSmeSetContextReqValid() ***/
+
+
+
+/**
+ * limIsSmeStopBssReqValid()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeReqMessages() upon
+ * receiving SME_STOP_BSS_REQ message from application.
+ *
+ *LOGIC:
+ * Message validity checks are performed in this function
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMsg - Pointer to received SME_STOP_BSS_REQ message
+ * @return true when received SME_STOP_BSS_REQ is formatted correctly
+ * false otherwise
+ */
+
+tANI_U8
+limIsSmeStopBssReqValid(tANI_U32 *pMsg)
+{
+ tANI_U8 valid = true;
+
+ return valid;
+} /*** end limIsSmeStopBssReqValid() ***/
+
+
+/**
+ * limGetBssIdFromSmeJoinReqMsg()
+ *
+ *FUNCTION:
+ * This function is called in various places to get BSSID
+ * from BSS description/Neighbor BSS Info in the SME_JOIN_REQ/
+ * SME_REASSOC_REQ message.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pBuf - Pointer to received SME_JOIN/SME_REASSOC_REQ
+ * message
+ * @return pBssId - Pointer to BSSID
+ */
+
+tANI_U8*
+limGetBssIdFromSmeJoinReqMsg(tANI_U8 *pBuf)
+{
+ if (!pBuf)
+ return NULL;
+
+ pBuf += sizeof(tANI_U32); // skip message header
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ pBuf += sizeof(tSirAssocType); // skip assocType
+#endif
+
+ pBuf += limGetU16(pBuf) + sizeof(tANI_U16); // skip RSN IE
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
+ pBuf += sizeof(tAniBool); // skip BP indicator
+ pBuf += sizeof(tSirBpIndicatorType); // skip BP indicator type
+ pBuf += sizeof(tANI_U32); // skip number of neighbor BSS
+#else
+ pBuf += sizeof(tANI_U16); // skip length of BSS description
+#endif
+
+ return (pBuf);
+} /*** end limGetBssIdFromSmeJoinReqMsg() ***/
+
+
diff --git a/CORE/MAC/src/pe/lim/limSmeReqUtils.h b/CORE/MAC/src/pe/lim/limSmeReqUtils.h
new file mode 100644
index 0000000..91edf54
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limSmeReqUtils.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limSmeReqUtils.h contains the utility definitions
+ * LIM uses while processing SME request messsages.
+ * Author: Chandra Modumudi
+ * Date: 02/13/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+#ifndef __LIM_SME_REQ_UTILS_H
+#define __LIM_SME_REQ_UTILS_H
+
+#include "sirApi.h"
+#include "limTypes.h"
+
+
+// LIM SME requst messages related utilility functions
+tANI_U8 limIsSmeStartReqValid(tpAniSirGlobal, tANI_U32 *);
+tANI_U8 limIsSmeStartBssReqValid(tpAniSirGlobal, tpSirSmeStartBssReq);
+tANI_U8 limSetRSNieWPAiefromSmeStartBSSReqMessage(tpAniSirGlobal,
+ tpSirRSNie,
+ tpPESession);
+tANI_U8 limIsSmeScanReqValid(tpAniSirGlobal, tpSirSmeScanReq);
+tANI_U8 limIsSmeJoinReqValid(tpAniSirGlobal, tpSirSmeJoinReq);
+tANI_U8 limIsSmeAuthReqValid(tpSirSmeAuthReq);
+tANI_U8 limIsSmeDisassocReqValid(tpAniSirGlobal, tpSirSmeDisassocReq, tpPESession);
+tANI_U8 limIsSmeDeauthReqValid(tpAniSirGlobal, tpSirSmeDeauthReq, tpPESession);
+tANI_U8 limIsSmeSetContextReqValid(tpAniSirGlobal, tpSirSmeSetContextReq);
+tANI_U8 limIsSmeStopBssReqValid(tANI_U32 *);
+tANI_U8* limGetBssIdFromSmeJoinReqMsg(tANI_U8 *);
+tANI_U8 limIsSmeDisassocCnfValid(tpAniSirGlobal, tpSirSmeDisassocCnf, tpPESession);
+
+#endif /* __LIM_SME_REQ_UTILS_H */
diff --git a/CORE/MAC/src/pe/lim/limStaHashApi.c b/CORE/MAC/src/pe/lim/limStaHashApi.c
new file mode 100644
index 0000000..27a4078
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limStaHashApi.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * limStaHashApi.c: Provides access functions to get/set values of station hash entry fields.
+ * Author: Sunit Bhatia
+ * Date: 09/19/2006
+ * History:-
+ * Date Modified by Modification Information
+ *
+ * --------------------------------------------------------------------------
+ *
+ */
+
+#include "limStaHashApi.h"
+
+
+/**
+ * limGetStaHashBssidx()
+ *
+ *FUNCTION:
+ * This function is called to Get the Bss Index of the currently associated Station.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac pointer to Global Mac structure.
+ * @param assocId AssocID of the Station.
+ * @param bssidx pointer to the bss index, which will be returned by the function.
+ *
+ * @return success if GET operation is ok, else Failure.
+ */
+
+tSirRetStatus limGetStaHashBssidx(tpAniSirGlobal pMac, tANI_U16 assocId, tANI_U8 *bssidx, tpPESession psessionEntry)
+{
+ tpDphHashNode pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
+
+ if (pSta == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("invalid STA %d\n"), assocId);)
+ return eSIR_LIM_INVALID_STA;
+ }
+
+ *bssidx = (tANI_U8)pSta->bssId;
+ return eSIR_SUCCESS;
+}
+
+
+
diff --git a/CORE/MAC/src/pe/lim/limStaHashApi.h b/CORE/MAC/src/pe/lim/limStaHashApi.h
new file mode 100644
index 0000000..9b9a6be
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limStaHashApi.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limStaHashApi.h contains the
+ * function prototypes for accessing station hash entry fields.
+ *
+ * Author: Sunit Bhatia
+ * Date: 09/19/2006
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#ifndef __LIM_STA_HASH_API_H__
+#define __LIM_STA_HASH_API_H__
+
+
+#include "aniGlobal.h"
+#include "limTypes.h"
+
+tSirRetStatus limGetStaHashBssidx(tpAniSirGlobal pMac, tANI_U16 assocId, tANI_U8 *bssidx,tpPESession psessionEntry);
+
+#endif
+
+
+
+
diff --git a/CORE/MAC/src/pe/lim/limTimerUtils.c b/CORE/MAC/src/pe/lim/limTimerUtils.c
new file mode 100644
index 0000000..fd0b2a5
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limTimerUtils.c
@@ -0,0 +1,2206 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limTimerUtils.cc contains the utility functions
+ * LIM uses for handling various timers.
+ * Author: Chandra Modumudi
+ * Date: 02/13/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+
+#include "limTypes.h"
+#include "limUtils.h"
+#include "limAssocUtils.h"
+#include "limSecurityUtils.h"
+#include "pmmApi.h"
+
+
+// default value 5000 ms for background scan period when it is disabled
+#define LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS 5000
+// channel Switch Timer in ticks
+#define LIM_CHANNEL_SWITCH_TIMER_TICKS 1
+// Lim Quite timer in ticks
+#define LIM_QUIET_TIMER_TICKS 100
+// Lim Quite BSS timer inteval in ticks
+#define LIM_QUIET_BSS_TIMER_TICK 100
+// Lim KeepAlive timer default (3000)ms
+#define LIM_KEEPALIVE_TIMER_MS 3000
+
+//default beacon interval value used in HB timer interval calculation
+#define LIM_HB_TIMER_BEACON_INTERVAL 100
+/**
+ * limCreateTimers()
+ *
+ *FUNCTION:
+ * This function is called upon receiving
+ * 1. SME_START_REQ for STA in ESS role
+ * 2. SME_START_BSS_REQ for AP role & STA in IBSS role
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ *
+ * @return None
+ */
+
+void
+limCreateTimers(tpAniSirGlobal pMac)
+{
+ tANI_U32 cfgValue, i;
+
+ PELOG1(limLog(pMac, LOG1, FL("Creating Timers used by LIM module in Role %d\n"), pMac->lim.gLimSystemRole);)
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME,
+ &cfgValue) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get MinChannelTimeout value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP, FL("could not retrieve MinChannelTimeout value\n"));
+ }
+ cfgValue = SYS_MS_TO_TICKS(cfgValue);
+
+ // Create MIN/MAX channel timers and activate them later
+ if (tx_timer_create(&pMac->lim.limTimers.gLimMinChannelTimer,
+ "MIN CHANNEL TIMEOUT",
+ limTimerHandler, SIR_LIM_MIN_CHANNEL_TIMEOUT,
+ cfgValue, 0,
+ TX_NO_ACTIVATE) != TX_SUCCESS)
+ {
+ /// Could not start min channel timer.
+ // Log error
+ limLog(pMac, LOGP, FL("could not create MIN channel timer\n"));
+
+ return;
+ }
+#if defined(ANI_OS_TYPE_RTAI_LINUX)
+ tx_timer_set_expiry_list(
+ &pMac->lim.limTimers.gLimMinChannelTimer, LIM_TIMER_EXPIRY_LIST);
+#endif
+
+ PELOG2(limLog(pMac, LOG2, FL("Created MinChannelTimer\n"));)
+
+ /* Periodic probe request timer value is half of the Min channel
+ * timer. Probe request sends periodically till min/max channel
+ * timer expires
+ */
+
+ cfgValue = cfgValue/2 ;
+ if( cfgValue >= 1)
+ {
+ // Create periodic probe request timer and activate them later
+ if (tx_timer_create(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer,
+ "Periodic Probe Request Timer",
+ limTimerHandler, SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT,
+ cfgValue, 0,
+ TX_NO_ACTIVATE) != TX_SUCCESS)
+ {
+ /// Could not start Periodic Probe Req timer.
+ // Log error
+ limLog(pMac, LOGP, FL("could not create periodic probe timer\n"));
+ return;
+ }
+ }
+
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME,
+ &cfgValue) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get MAXChannelTimeout value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve MAXChannelTimeout value\n"));
+ }
+ cfgValue = SYS_MS_TO_TICKS(cfgValue);
+
+ if (tx_timer_create(&pMac->lim.limTimers.gLimMaxChannelTimer,
+ "MAX CHANNEL TIMEOUT",
+ limTimerHandler, SIR_LIM_MAX_CHANNEL_TIMEOUT,
+ cfgValue, 0,
+ TX_NO_ACTIVATE) != TX_SUCCESS)
+ {
+ /// Could not start max channel timer.
+ // Log error
+ limLog(pMac, LOGP, FL("could not create MAX channel timer\n"));
+
+ return;
+ }
+
+#if defined(ANI_OS_TYPE_RTAI_LINUX)
+ tx_timer_set_expiry_list(
+ &pMac->lim.limTimers.gLimMaxChannelTimer, LIM_TIMER_EXPIRY_LIST);
+#endif
+
+ PELOG2(limLog(pMac, LOG2, FL("Created MaxChannelTimer\n"));)
+
+ if (pMac->lim.gLimSystemRole != eLIM_AP_ROLE)
+ {
+ // Create Channel Switch Timer
+ if (tx_timer_create(&pMac->lim.limTimers.gLimChannelSwitchTimer,
+ "CHANNEL SWITCH TIMER",
+ limChannelSwitchTimerHandler,
+ 0, // expiration_input
+ LIM_CHANNEL_SWITCH_TIMER_TICKS, // initial_ticks
+ 0, // reschedule_ticks
+ TX_NO_ACTIVATE) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("failed to create Channel Switch timer\n"));
+ return;
+ }
+
+ //
+ // Create Quiet Timer
+ // This is used on the STA to go and shut-off
+ // Tx/Rx "after" the specified quiteInterval
+ //
+ if (tx_timer_create(&pMac->lim.limTimers.gLimQuietTimer,
+ "QUIET TIMER",
+ limQuietTimerHandler,
+ SIR_LIM_QUIET_TIMEOUT, // expiration_input
+ LIM_QUIET_TIMER_TICKS, // initial_ticks
+ 0, // reschedule_ticks
+ TX_NO_ACTIVATE) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("failed to create Quiet Begin Timer\n"));
+ return;
+ }
+
+ //
+ // Create Quiet BSS Timer
+ // After the specified quiteInterval, determined by
+ // gLimQuietTimer, this timer, gLimQuietBssTimer,
+ // trigger and put the STA to sleep for the specified
+ // gLimQuietDuration
+ //
+ if (tx_timer_create(&pMac->lim.limTimers.gLimQuietBssTimer,
+ "QUIET BSS TIMER",
+ limQuietBssTimerHandler,
+ SIR_LIM_QUIET_BSS_TIMEOUT, // expiration_input
+ LIM_QUIET_BSS_TIMER_TICK, // initial_ticks
+ 0, // reschedule_ticks
+ TX_NO_ACTIVATE) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("failed to create Quiet Begin Timer\n"));
+ return;
+ }
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT,
+ &cfgValue) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get JoinFailureTimeout value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve JoinFailureTimeout value\n"));
+ }
+ cfgValue = SYS_MS_TO_TICKS(cfgValue);
+
+ // Create Join failure timer and activate it later
+ if (tx_timer_create(&pMac->lim.limTimers.gLimJoinFailureTimer,
+ "JOIN FAILURE TIMEOUT",
+ limTimerHandler, SIR_LIM_JOIN_FAIL_TIMEOUT,
+ cfgValue, 0,
+ TX_NO_ACTIVATE) != TX_SUCCESS)
+ {
+ /// Could not create Join failure timer.
+ // Log error
+ limLog(pMac, LOGP, FL("could not create Join failure timer\n"));
+
+ return;
+ }
+#if defined(ANI_OS_TYPE_RTAI_LINUX)
+ tx_timer_set_expiry_list(&pMac->lim.limTimers.gLimJoinFailureTimer,
+ LIM_TIMER_EXPIRY_LIST);
+#endif
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
+ &cfgValue) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get AssocFailureTimeout value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve AssocFailureTimeout value\n"));
+ }
+ cfgValue = SYS_MS_TO_TICKS(cfgValue);
+
+ // Create Association failure timer and activate it later
+ if (tx_timer_create(&pMac->lim.limTimers.gLimAssocFailureTimer,
+ "ASSOC FAILURE TIMEOUT",
+ limAssocFailureTimerHandler, LIM_ASSOC,
+ cfgValue, 0,
+ TX_NO_ACTIVATE) != TX_SUCCESS)
+ {
+ /// Could not create Assoc failure timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("could not create Association failure timer\n"));
+
+ return;
+ }
+ if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
+ &cfgValue) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get ReassocFailureTimeout value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve ReassocFailureTimeout value\n"));
+ }
+ cfgValue = SYS_MS_TO_TICKS(cfgValue);
+
+ // Create Association failure timer and activate it later
+ if (tx_timer_create(&pMac->lim.limTimers.gLimReassocFailureTimer,
+ "REASSOC FAILURE TIMEOUT",
+ limAssocFailureTimerHandler, LIM_REASSOC,
+ cfgValue, 0,
+ TX_NO_ACTIVATE) != TX_SUCCESS)
+ {
+ /// Could not create Reassoc failure timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("could not create Reassociation failure timer\n"));
+
+ return;
+ }
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &cfgValue) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("Fail to get WNI_CFG_ADDTS_RSP_TIMEOUT \n"));
+
+ cfgValue = SYS_MS_TO_TICKS(cfgValue);
+
+ // Create Addts response timer and activate it later
+ if (tx_timer_create(&pMac->lim.limTimers.gLimAddtsRspTimer,
+ "ADDTS RSP TIMEOUT",
+ limAddtsResponseTimerHandler,
+ SIR_LIM_ADDTS_RSP_TIMEOUT,
+ cfgValue, 0,
+ TX_NO_ACTIVATE) != TX_SUCCESS)
+ {
+ /// Could not create Auth failure timer.
+ // Log error
+ limLog(pMac, LOGP, FL("could not create Addts response timer\n"));
+
+ return;
+ }
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
+ &cfgValue) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get AuthFailureTimeout value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve AuthFailureTimeout value\n"));
+ }
+ cfgValue = SYS_MS_TO_TICKS(cfgValue);
+
+ // Create Auth failure timer and activate it later
+ if (tx_timer_create(&pMac->lim.limTimers.gLimAuthFailureTimer,
+ "AUTH FAILURE TIMEOUT",
+ limTimerHandler,
+ SIR_LIM_AUTH_FAIL_TIMEOUT,
+ cfgValue, 0,
+ TX_NO_ACTIVATE) != TX_SUCCESS)
+ {
+ /// Could not create Auth failure timer.
+ // Log error
+ limLog(pMac, LOGP, FL("could not create Auth failure timer\n"));
+
+ return;
+ }
+#if defined(ANI_OS_TYPE_RTAI_LINUX)
+ tx_timer_set_expiry_list(&pMac->lim.limTimers.gLimAuthFailureTimer,
+ LIM_TIMER_EXPIRY_LIST);
+#endif
+ if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL,
+ &cfgValue) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get BEACON_INTERVAL value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve BEACON_INTERVAL value\n"));
+ }
+ cfgValue = SYS_MS_TO_TICKS(cfgValue);
+
+ if (tx_timer_create(&pMac->lim.limTimers.gLimHeartBeatTimer,
+ "Heartbeat TIMEOUT",
+ limTimerHandler,
+ SIR_LIM_HEART_BEAT_TIMEOUT,
+ cfgValue,
+ 0,
+ TX_NO_ACTIVATE) != TX_SUCCESS)
+ {
+ /// Could not start Heartbeat timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to create heartbeat timer failed\n"));
+ }
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT,
+ &cfgValue) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get PROBE_AFTER_HB_FAILURE
+ * value from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve PROBE_AFTER_HB_FAIL_TIMEOUT value\n"));
+ }
+
+ // Change timer to reactivate it in future
+ cfgValue = SYS_MS_TO_TICKS(cfgValue);
+
+ if (tx_timer_create(&pMac->lim.limTimers.gLimProbeAfterHBTimer,
+ "Probe after Heartbeat TIMEOUT",
+ limTimerHandler,
+ SIR_LIM_PROBE_HB_FAILURE_TIMEOUT,
+ cfgValue,
+ 0,
+ TX_NO_ACTIVATE) != TX_SUCCESS)
+ {
+ // Could not creat wt-probe-after-HeartBeat-failure timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("unable to create ProbeAfterHBTimer\n"));
+ }
+
+#if defined(ANI_OS_TYPE_RTAI_LINUX)
+ tx_timer_set_expiry_list(&pMac->lim.limTimers.gLimProbeAfterHBTimer,
+ LIM_TIMER_EXPIRY_LIST);
+#endif
+
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ if (wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
+ &cfgValue) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get Background scan period value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve Background scan period value\n"));
+ }
+
+ /*
+ * setting period to zero means disabling background scans when associated
+ * the way we do this is to set a flag indicating this and keeping
+ * the timer running, since it will be used for PDU leak workarounds
+ * as well as background scanning during SME idle states
+ */
+ if (cfgValue == 0)
+ {
+ cfgValue = LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS;
+ pMac->lim.gLimBackgroundScanDisable = true;
+ }
+ else
+ pMac->lim.gLimBackgroundScanDisable = false;
+
+ cfgValue = SYS_MS_TO_TICKS(cfgValue);
+
+ if (tx_timer_create(&pMac->lim.limTimers.gLimBackgroundScanTimer,
+ "Background scan TIMEOUT",
+ limTimerHandler,
+ SIR_LIM_CHANNEL_SCAN_TIMEOUT,
+ cfgValue,
+ cfgValue,
+ TX_NO_ACTIVATE) != TX_SUCCESS)
+ {
+ /// Could not start background scan timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to create background scan timer failed\n"));
+ }
+#endif
+ }
+
+
+ cfgValue = SYS_MS_TO_TICKS(LIM_HASH_MISS_TIMER_MS);
+
+ if (tx_timer_create(
+ &pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer,
+ "Disassoc throttle TIMEOUT",
+ limSendDisassocFrameThresholdHandler,
+ SIR_LIM_HASH_MISS_THRES_TIMEOUT,
+ cfgValue,
+ cfgValue,
+ TX_AUTO_ACTIVATE) != TX_SUCCESS)
+ {
+ /// Could not start Send Disassociate Frame Threshold timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("create Disassociate throttle timer failed\n"));
+ }
+#if defined(ANI_OS_TYPE_RTAI_LINUX)
+ tx_timer_set_expiry_list(
+ &pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer,
+ LIM_TIMER_EXPIRY_LIST);
+#endif
+ PELOG1(limLog(pMac, LOG1,
+ FL("Created Disassociate throttle timer \n"));)
+
+ /**
+ * Create keepalive timer and activate it right away for AP role
+ */
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_KEEPALIVE_TIMEOUT,
+ &cfgValue) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get keepalive timeout value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve keepalive timeout value\n"));
+ }
+
+ // A value of zero implies keep alive should be disabled
+ if (cfgValue == 0)
+ {
+ cfgValue = LIM_KEEPALIVE_TIMER_MS;
+ pMac->sch.keepAlive = 0;
+ } else
+ pMac->sch.keepAlive = 1;
+
+
+ cfgValue = SYS_MS_TO_TICKS(cfgValue + SYS_TICK_DUR_MS - 1);
+
+ if (tx_timer_create(&pMac->lim.limTimers.gLimKeepaliveTimer,
+ "KEEPALIVE_TIMEOUT",
+ limKeepaliveTmerHandler,
+ 0,
+ cfgValue,
+ cfgValue,
+ (pMac->lim.gLimSystemRole == eLIM_AP_ROLE) ?
+ TX_AUTO_ACTIVATE : TX_NO_ACTIVATE)
+ != TX_SUCCESS)
+ {
+ // Cannot create keepalive timer. Log error.
+ limLog(pMac, LOGP, FL("Cannot create keepalive timer.\n"));
+ }
+
+ /**
+ * Create all CNF_WAIT Timers upfront
+ */
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_WT_CNF_TIMEOUT,
+ &cfgValue) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get CNF_WAIT timeout value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve CNF timeout value\n"));
+ }
+ cfgValue = SYS_MS_TO_TICKS(cfgValue);
+
+ for (i=0; i<pMac->lim.maxStation; i++)
+ {
+ if (tx_timer_create(&pMac->lim.limTimers.gpLimCnfWaitTimer[i],
+ "CNF_MISS_TIMEOUT",
+ limCnfWaitTmerHandler,
+ (tANI_U32)i,
+ cfgValue,
+ 0,
+ TX_NO_ACTIVATE) != TX_SUCCESS)
+ {
+ // Cannot create timer. Log error.
+ limLog(pMac, LOGP, FL("Cannot create CNF wait timer.\n"));
+ }
+ }
+
+ /*
+ ** Alloc and init table for the preAuth timer list
+ **
+ **/
+
+ // get max number of Preauthentication
+ if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_NUM_PRE_AUTH,
+ &cfgValue) != eSIR_SUCCESS)
+ {
+ /*
+ ** Could not get max preauth value
+ ** from CFG. Log error.
+ **/
+ limLog(pMac, LOGP,
+ FL("could not retrieve mac preauth value\n"));
+ }
+#ifdef ANI_AP_SDK_OPT
+ if(cfgValue > SIR_SDK_OPT_MAX_NUM_PRE_AUTH)
+ cfgValue = SIR_SDK_OPT_MAX_NUM_PRE_AUTH;
+#endif // ANI_AP_SDK_OPT
+ pMac->lim.gLimPreAuthTimerTable.numEntry = cfgValue;
+ if (palAllocateMemory(pMac->hHdd, (void **) &pMac->lim.gLimPreAuthTimerTable.pTable,
+ cfgValue*sizeof(tLimPreAuthNode)) != eHAL_STATUS_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("palAllocateMemory failed!\n"));
+ return;
+ }
+
+ limInitPreAuthTimerTable(pMac, &pMac->lim.gLimPreAuthTimerTable);
+ PELOG1(limLog(pMac, LOG1, FL("alloc and init table for preAuth timers\n"));)
+
+
+#ifdef WLAN_SOFTAP_FEATURE
+ {
+ /**
+ * Create OLBC cache aging timer
+ */
+ if (wlan_cfgGetInt(pMac, WNI_CFG_OLBC_DETECT_TIMEOUT,
+ &cfgValue) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get OLBC detect timeout value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve OLBD detect timeout value\n"));
+ }
+
+ cfgValue = SYS_MS_TO_TICKS(cfgValue);
+
+ if (tx_timer_create(
+ &pMac->lim.limTimers.gLimUpdateOlbcCacheTimer,
+ "OLBC UPDATE CACHE TIMEOUT",
+ limUpdateOlbcCacheTimerHandler,
+ SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT,
+ cfgValue,
+ cfgValue,
+ TX_AUTO_ACTIVATE) != TX_SUCCESS)
+ {
+ // Cannot create update OLBC cache timer
+ // Log error
+ limLog(pMac, LOGP, FL("Cannot create update OLBC cache timer\n"));
+ }
+ }
+#endif
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ // In future we need to use the auth timer, cause
+ // the pre auth session will be introduced before sending
+ // Auth frame.
+ // We need to go off channel and come back to home channel
+ cfgValue = 1000;
+ cfgValue = SYS_MS_TO_TICKS(cfgValue);
+
+ if (tx_timer_create(&pMac->lim.limTimers.gLimFTPreAuthRspTimer,
+ "FT PREAUTH RSP TIMEOUT",
+ limTimerHandler, SIR_LIM_FT_PREAUTH_RSP_TIMEOUT,
+ cfgValue, 0,
+ TX_NO_ACTIVATE) != TX_SUCCESS)
+ {
+ // Could not create Join failure timer.
+ // Log error
+ limLog(pMac, LOGP, FL("could not create Join failure timer\n"));
+ return;
+ }
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+ cfgValue = 5000;
+ cfgValue = SYS_MS_TO_TICKS(cfgValue);
+
+ if (tx_timer_create(&pMac->lim.limTimers.gLimCcxTsmTimer,
+ "CCX TSM Stats TIMEOUT",
+ limTimerHandler, SIR_LIM_CCX_TSM_TIMEOUT,
+ cfgValue, 0,
+ TX_NO_ACTIVATE) != TX_SUCCESS)
+ {
+ // Could not create Join failure timer.
+ // Log error
+ limLog(pMac, LOGP, FL("could not create Join failure timer\n"));
+ return;
+ }
+#endif
+
+#ifdef WLAN_FEATURE_P2P
+ cfgValue = 1000;
+ cfgValue = SYS_MS_TO_TICKS(cfgValue);
+ if (tx_timer_create(&pMac->lim.limTimers.gLimRemainOnChannelTimer,
+ "FT PREAUTH RSP TIMEOUT",
+ limTimerHandler, SIR_LIM_REMAIN_CHN_TIMEOUT,
+ cfgValue, 0,
+ TX_NO_ACTIVATE) != TX_SUCCESS)
+ {
+ // Could not create Join failure timer.
+ // Log error
+ limLog(pMac, LOGP, FL("could not create Join failure timer\n"));
+ return;
+ }
+
+#endif
+ pMac->lim.gLimTimersCreated = 1;
+} /****** end limCreateTimers() ******/
+
+
+
+/**
+ * limTimerHandler()
+ *
+ *FUNCTION:
+ * This function is called upon
+ * 1. MIN_CHANNEL, MAX_CHANNEL timer expiration during scanning
+ * 2. JOIN_FAILURE timer expiration while joining a BSS
+ * 3. AUTH_FAILURE timer expiration while authenticating with a peer
+ * 4. Heartbeat timer expiration on STA
+ * 5. Background scan timer expiration on STA
+ * 6. AID release, Pre-auth cleanup and Link monitoring timer
+ * expiration on AP
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param param - Message corresponding to the timer that expired
+ *
+ * @return None
+ */
+
+void
+limTimerHandler(void *pMacGlobal, tANI_U32 param)
+{
+ tANI_U32 statusCode;
+ tSirMsgQ msg;
+ tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
+
+ // Prepare and post message to LIM Message Queue
+
+ msg.type = (tANI_U16) param;
+ msg.bodyptr = NULL;
+ msg.bodyval = 0;
+
+ if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
+ limLog(pMac, LOGE,
+ FL("posting message %X to LIM failed, reason=%d\n"),
+ msg.type, statusCode);
+} /****** end limTimerHandler() ******/
+
+
+/**
+ * limAddtsResponseTimerHandler()
+ *
+ *FUNCTION:
+ * This function is called upon Addts response timer expiration on sta
+ *
+ *LOGIC:
+ * Message SIR_LIM_ADDTS_RSP_TIMEOUT is posted to gSirLimMsgQ
+ * when this function is executed.
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param param - pointer to pre-auth node
+ *
+ * @return None
+ */
+
+void
+limAddtsResponseTimerHandler(void *pMacGlobal, tANI_U32 param)
+{
+ tSirMsgQ msg;
+ tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
+
+ // Prepare and post message to LIM Message Queue
+
+ msg.type = SIR_LIM_ADDTS_RSP_TIMEOUT;
+ msg.bodyval = param;
+ msg.bodyptr = NULL;
+
+ limPostMsgApi(pMac, &msg);
+} /****** end limAuthResponseTimerHandler() ******/
+
+
+/**
+ * limAuthResponseTimerHandler()
+ *
+ *FUNCTION:
+ * This function is called upon Auth response timer expiration on AP
+ *
+ *LOGIC:
+ * Message SIR_LIM_AUTH_RSP_TIMEOUT is posted to gSirLimMsgQ
+ * when this function is executed.
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param param - pointer to pre-auth node
+ *
+ * @return None
+ */
+
+void
+limAuthResponseTimerHandler(void *pMacGlobal, tANI_U32 param)
+{
+ tSirMsgQ msg;
+ tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
+
+ // Prepare and post message to LIM Message Queue
+
+ msg.type = SIR_LIM_AUTH_RSP_TIMEOUT;
+ msg.bodyptr = NULL;
+ msg.bodyval = (tANI_U32)param;
+
+ limPostMsgApi(pMac, &msg);
+} /****** end limAuthResponseTimerHandler() ******/
+
+
+
+/**
+ * limAssocFailureTimerHandler()
+ *
+ *FUNCTION:
+ * This function is called upon Re/Assoc failure timer expiration
+ * on STA
+ *
+ *LOGIC:
+ * Message SIR_LIM_ASSOC_FAIL_TIMEOUT is posted to gSirLimMsgQ
+ * when this function is executed.
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param param - Indicates whether this is assoc or reassoc
+ * failure timeout
+ * @return None
+ */
+
+void
+limAssocFailureTimerHandler(void *pMacGlobal, tANI_U32 param)
+{
+ tSirMsgQ msg;
+ tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
+
+ // Prepare and post message to LIM Message Queue
+
+ msg.type = SIR_LIM_ASSOC_FAIL_TIMEOUT;
+ msg.bodyval = (tANI_U32)param;
+ msg.bodyptr = NULL;
+
+ limPostMsgApi(pMac, &msg);
+} /****** end limAssocFailureTimerHandler() ******/
+
+
+/**
+ * limUpdateOlbcCacheTimerHandler()
+ *
+ *FUNCTION:
+ * This function is called upon update olbc cache timer expiration
+ * on STA
+ *
+ *LOGIC:
+ * Message SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT is posted to gSirLimMsgQ
+ * when this function is executed.
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param
+ *
+ * @return None
+ */
+#ifdef WLAN_SOFTAP_FEATURE
+void
+limUpdateOlbcCacheTimerHandler(void *pMacGlobal, tANI_U32 param)
+{
+ tSirMsgQ msg;
+ tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
+
+ // Prepare and post message to LIM Message Queue
+
+ msg.type = SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT;
+ msg.bodyval = 0;
+ msg.bodyptr = NULL;
+
+ limPostMsgApi(pMac, &msg);
+} /****** end limUpdateOlbcCacheTimerHandler() ******/
+#endif
+
+/**
+ * limDeactivateAndChangeTimer()
+ *
+ *FUNCTION:
+ * This function is called to deactivate and change a timer
+ * for future re-activation
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param timerId - enum of timer to be deactivated and changed
+ * This enum is defined in limUtils.h file
+ *
+ * @return None
+ */
+
+void
+limDeactivateAndChangeTimer(tpAniSirGlobal pMac, tANI_U32 timerId)
+{
+ tANI_U32 val=0, val1=0;
+
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, timerId));
+
+ switch (timerId)
+ {
+ case eLIM_ADDTS_RSP_TIMER:
+ pMac->lim.gLimAddtsRspTimerCount++;
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
+ {
+ // Could not deactivate AddtsRsp Timer
+ // Log error
+ limLog(pMac, LOGP,
+ FL("Unable to deactivate AddtsRsp timer\n"));
+ }
+ break;
+
+ case eLIM_MIN_CHANNEL_TIMER:
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer)
+ != TX_SUCCESS)
+ {
+ // Could not deactivate min channel timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("Unable to deactivate min channel timer\n"));
+ }
+
+ // If a background was triggered via Quiet BSS,
+ // then we need to adjust the MIN and MAX channel
+ // timer's accordingly to the Quiet duration that
+ // was specified
+ if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
+ pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
+ {
+ // gLimQuietDuration is already cached in units of
+ // system ticks. No conversion is reqd...
+ val = pMac->lim.gLimSpecMgmt.quietDuration;
+ }
+ else
+ {
+ if(pMac->lim.gpLimMlmScanReq)
+ {
+ val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime);
+ }
+ else
+ {
+ limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
+ //No need to change min timer. This is not a scan
+ break;
+ }
+ }
+
+ if (tx_timer_change(&pMac->lim.limTimers.gLimMinChannelTimer,
+ val, 0) != TX_SUCCESS)
+ {
+ // Could not change min channel timer.
+ // Log error
+ limLog(pMac, LOGP, FL("Unable to change min channel timer\n"));
+ }
+
+ break;
+
+ case eLIM_PERIODIC_PROBE_REQ_TIMER:
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer)
+ != TX_SUCCESS)
+ {
+ // Could not deactivate min channel timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("Unable to deactivate periodic timer\n"));
+ }
+
+ val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime)/2;
+ if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer,
+ val, 0) != TX_SUCCESS)
+ {
+ // Could not change min channel timer.
+ // Log error
+ limLog(pMac, LOGP, FL("Unable to change periodic timer\n"));
+ }
+
+ break;
+
+ case eLIM_MAX_CHANNEL_TIMER:
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer)
+ != TX_SUCCESS)
+ {
+ // Could not deactivate max channel timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("Unable to deactivate max channel timer\n"));
+ }
+
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ // If a background was triggered via Quiet BSS,
+ // then we need to adjust the MIN and MAX channel
+ // timer's accordingly to the Quiet duration that
+ // was specified
+ if (pMac->lim.gLimSystemRole != eLIM_AP_ROLE)
+ {
+
+ if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
+ pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
+ {
+ // gLimQuietDuration is already cached in units of
+ // system ticks. No conversion is reqd...
+ val = pMac->lim.gLimSpecMgmt.quietDuration;
+ }
+ else
+ {
+ if(pMac->lim.gpLimMlmScanReq)
+ {
+ val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTime);
+ }
+ else
+ {
+ limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
+ //No need to change max timer. This is not a scan
+ break;
+ }
+ }
+ }
+#endif
+#if defined(ANI_PRODUCT_TYPE_AP)
+ if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
+ {
+ if (wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME,
+ &val) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get max channel value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve max channel value\n"));
+ }
+ val = SYS_MS_TO_TICKS(val);
+ }
+#endif
+
+ if (tx_timer_change(&pMac->lim.limTimers.gLimMaxChannelTimer,
+ val, 0) != TX_SUCCESS)
+ {
+ // Could not change max channel timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("Unable to change max channel timer\n"));
+ }
+
+ break;
+
+ case eLIM_JOIN_FAIL_TIMER:
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer)
+ != TX_SUCCESS)
+ {
+ /**
+ * Could not deactivate Join Failure
+ * timer. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("Unable to deactivate Join Failure timer\n"));
+ }
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT,
+ &val) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get JoinFailureTimeout value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve JoinFailureTimeout value\n"));
+ }
+ val = SYS_MS_TO_TICKS(val);
+
+ if (tx_timer_change(&pMac->lim.limTimers.gLimJoinFailureTimer,
+ val, 0) != TX_SUCCESS)
+ {
+ /**
+ * Could not change Join Failure
+ * timer. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("Unable to change Join Failure timer\n"));
+ }
+
+ break;
+
+ case eLIM_AUTH_FAIL_TIMER:
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer)
+ != TX_SUCCESS)
+ {
+ // Could not deactivate Auth failure timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("Unable to deactivate auth failure timer\n"));
+ }
+
+ // Change timer to reactivate it in future
+ if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
+ &val) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get AuthFailureTimeout value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve AuthFailureTimeout value\n"));
+ }
+ val = SYS_MS_TO_TICKS(val);
+
+ if (tx_timer_change(&pMac->lim.limTimers.gLimAuthFailureTimer,
+ val, 0) != TX_SUCCESS)
+ {
+ // Could not change Authentication failure timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("unable to change Auth failure timer\n"));
+ }
+
+ break;
+
+ case eLIM_ASSOC_FAIL_TIMER:
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer) !=
+ TX_SUCCESS)
+ {
+ // Could not deactivate Association failure timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("unable to deactivate Association failure timer\n"));
+ }
+
+ // Change timer to reactivate it in future
+ if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
+ &val) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get AssocFailureTimeout value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve AssocFailureTimeout value\n"));
+ }
+ val = SYS_MS_TO_TICKS(val);
+
+ if (tx_timer_change(&pMac->lim.limTimers.gLimAssocFailureTimer,
+ val, 0) != TX_SUCCESS)
+ {
+ // Could not change Association failure timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("unable to change Assoc failure timer\n"));
+ }
+
+ break;
+
+ case eLIM_REASSOC_FAIL_TIMER:
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
+ TX_SUCCESS)
+ {
+ // Could not deactivate Reassociation failure timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("unable to deactivate Reassoc failure timer\n"));
+ }
+
+ // Change timer to reactivate it in future
+ if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
+ &val) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get ReassocFailureTimeout value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve ReassocFailureTimeout value\n"));
+ }
+ val = SYS_MS_TO_TICKS(val);
+
+ if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
+ val, 0) != TX_SUCCESS)
+ {
+ // Could not change Reassociation failure timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("unable to change Reassociation failure timer\n"));
+ }
+
+ break;
+
+ case eLIM_HEART_BEAT_TIMER:
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer) !=
+ TX_SUCCESS)
+ {
+ // Could not deactivate Heartbeat timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("unable to deactivate Heartbeat timer\n"));
+ }
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL,
+ &val) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get BEACON_INTERVAL value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve BEACON_INTERVAL value\n"));
+ }
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
+ eSIR_SUCCESS)
+ limLog(pMac, LOGP,
+ FL("could not retrieve heartbeat failure value\n"));
+
+ // Change timer to reactivate it in future
+ val = SYS_MS_TO_TICKS(val * val1);
+
+ if (tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer,
+ val, 0) != TX_SUCCESS)
+ {
+ // Could not change HeartBeat timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("unable to change HeartBeat timer\n"));
+ }
+
+ break;
+
+ case eLIM_PROBE_AFTER_HB_TIMER:
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) !=
+ TX_SUCCESS)
+ {
+ // Could not deactivate Heartbeat timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("unable to deactivate probeAfterHBTimer\n"));
+ }
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT,
+ &val) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get PROBE_AFTER_HB_FAILURE
+ * value from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve PROBE_AFTER_HB_FAIL_TIMEOUT value\n"));
+ }
+
+ // Change timer to reactivate it in future
+ val = SYS_MS_TO_TICKS(val);
+
+ if (tx_timer_change(&pMac->lim.limTimers.gLimProbeAfterHBTimer,
+ val, 0) != TX_SUCCESS)
+ {
+ // Could not change HeartBeat timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("unable to change ProbeAfterHBTimer\n"));
+ }
+
+ break;
+
+ case eLIM_KEEPALIVE_TIMER:
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer)
+ != TX_SUCCESS)
+ {
+ // Could not deactivate Keepalive timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("unable to deactivate KeepaliveTimer timer\n"));
+ }
+
+ // Change timer to reactivate it in future
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_KEEPALIVE_TIMEOUT,
+ &val) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get keepalive timeout value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve keepalive timeout value\n"));
+ }
+ if (val == 0)
+ {
+ val = 3000;
+ pMac->sch.keepAlive = 0;
+ } else
+ pMac->sch.keepAlive = 1;
+
+
+
+ val = SYS_MS_TO_TICKS(val + SYS_TICK_DUR_MS - 1);
+
+ if (tx_timer_change(&pMac->lim.limTimers.gLimKeepaliveTimer,
+ val, val) != TX_SUCCESS)
+ {
+ // Could not change KeepaliveTimer timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("unable to change KeepaliveTimer timer\n"));
+ }
+
+ break;
+
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ case eLIM_BACKGROUND_SCAN_TIMER:
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer)
+ != TX_SUCCESS)
+ {
+ // Could not deactivate BackgroundScanTimer timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("unable to deactivate BackgroundScanTimer timer\n"));
+ }
+
+ // Change timer to reactivate it in future
+ if (wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
+ &val) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get Background scan period value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve Background scan period value\n"));
+ }
+ if (val == 0)
+ {
+ val = LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS;
+ pMac->lim.gLimBackgroundScanDisable = true;
+ }
+ else
+ pMac->lim.gLimBackgroundScanDisable = false;
+
+ val = SYS_MS_TO_TICKS(val);
+
+ if (tx_timer_change(&pMac->lim.limTimers.gLimBackgroundScanTimer,
+ val, val) != TX_SUCCESS)
+ {
+ // Could not change BackgroundScanTimer timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("unable to change BackgroundScanTimer timer\n"));
+ }
+
+ break;
+#endif
+
+#ifdef ANI_PRODUCT_TYPE_AP
+ case eLIM_PRE_AUTH_CLEANUP_TIMER:
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer) !=
+ TX_SUCCESS)
+ {
+ // Could not deactivate Pre-auth cleanup timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("unable to deactivate Pre-auth cleanup timer\n"));
+ }
+
+ // Change timer to reactivate it in future
+ if (wlan_cfgGetInt(pMac, WNI_CFG_PREAUTH_CLNUP_TIMEOUT,
+ &val) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get pre-auth cleanup value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve pre-auth cleanup value\n"));
+ }
+ val = SYS_MS_TO_TICKS(val);
+
+ if (tx_timer_change(&pMac->lim.limTimers.gLimPreAuthClnupTimer,
+ val, val) != TX_SUCCESS)
+ {
+ // Could not change pre-auth cleanup timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("unable to change pre-auth cleanup timer\n"));
+ }
+
+ break;
+
+ case eLIM_LEARN_INTERVAL_TIMER:
+ {
+ // Restart Learn Interval timer
+ tANI_U32 learnInterval =
+ pMac->lim.gpLimMeasReq->measDuration.shortTermPeriod /
+ pMac->lim.gpLimMeasReq->channelList.numChannels;
+
+ if (tx_timer_deactivate(
+ &pMac->lim.gLimMeasParams.learnIntervalTimer) != TX_SUCCESS)
+ {
+ // Could not deactivate Learn Interval timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("Unable to deactivate Learn Interval timer\n"));
+ }
+
+ if (tx_timer_change(
+ &pMac->lim.gLimMeasParams.learnIntervalTimer,
+ SYS_MS_TO_TICKS(learnInterval), 0) != TX_SUCCESS)
+ {
+ // Could not change Learn Interval timer.
+ // Log error
+ limLog(pMac, LOGP, FL("Unable to change Learn Interval timer\n"));
+
+ return;
+ }
+
+ limLog( pMac, LOG3,
+ FL("Setting the Learn Interval TIMER to %d ticks\n"),
+ SYS_MS_TO_TICKS(learnInterval));
+ }
+ break;
+
+#endif
+ case eLIM_CHANNEL_SWITCH_TIMER:
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("tx_timer_deactivate failed!\n"));
+ return;
+ }
+
+ if (tx_timer_change(&pMac->lim.limTimers.gLimChannelSwitchTimer,
+ pMac->lim.gLimChannelSwitch.switchTimeoutValue,
+ 0) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("tx_timer_change failed \n"));
+ return;
+ }
+ break;
+
+ case eLIM_LEARN_DURATION_TIMER:
+#ifdef ANI_PRODUCT_TYPE_AP
+ if (tx_timer_deactivate(&pMac->lim.gLimMeasParams.learnDurationTimer) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Could not deactivate learn duration timer\n"));
+ return;
+ }
+
+ if (pMac->lim.gpLimMeasReq->measControl.longChannelScanPeriodicity &&
+ (pMac->lim.gLimMeasParams.shortDurationCount ==
+ pMac->lim.gpLimMeasReq->measControl.longChannelScanPeriodicity))
+ {
+#ifdef ANI_AP_SDK
+ val = pMac->lim.gLimScanDurationConvert.longChannelScanDuration_tick;
+#else
+ val = SYS_MS_TO_TICKS(pMac->lim.gpLimMeasReq->measDuration.longChannelScanDuration
+ + SYS_TICK_DUR_MS - 1);
+ if(val > 1)
+ val--;
+#endif /* ANI_AP_SDK */
+ // Time to perform measurements for longer term
+ if (tx_timer_change(&pMac->lim.gLimMeasParams.learnDurationTimer,
+ val, 0) != TX_SUCCESS)
+ {
+ // Could not change Learn duration timer.
+ // Log error
+ limLog(pMac, LOGP, FL("Unable to change Learn duration timer\n"));
+ return;
+ }
+ pMac->lim.gLimMeasParams.shortDurationCount = 0;
+ }
+ else
+ {
+#ifdef ANI_AP_SDK
+ val = pMac->lim.gLimScanDurationConvert.shortChannelScanDuration_tick;
+#else
+ val = SYS_MS_TO_TICKS(pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration
+ + SYS_TICK_DUR_MS - 1);
+ if(val > 1)
+ val--;
+#endif /* ANI_AP_SDK */
+ if (tx_timer_change(&pMac->lim.gLimMeasParams.learnDurationTimer,
+ val, 0) != TX_SUCCESS)
+ {
+ // Could not change Learn duration timer.
+ // Log error
+ limLog(pMac, LOGP, FL("Unable to change Learn duration timer\n"));
+ }
+ }
+ pMac->lim.gpLimMeasData->duration = val * SYS_TICK_DUR_MS;
+#endif
+ break;
+
+ case eLIM_QUIET_BSS_TIMER:
+ if (TX_SUCCESS !=
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
+ {
+ limLog( pMac, LOGE,
+ FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway...\n"));
+ }
+
+ // gLimQuietDuration appears to be in units of ticks
+ // Use it as is
+ if (TX_SUCCESS !=
+ tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
+ pMac->lim.gLimSpecMgmt.quietDuration,
+ 0))
+ {
+ limLog( pMac, LOGE,
+ FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway...\n"));
+ }
+ break;
+
+ case eLIM_QUIET_TIMER:
+ if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
+ {
+ limLog( pMac, LOGE,
+ FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway...\n" ));
+ }
+
+ // Set the NEW timeout value, in ticks
+ if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
+ SYS_MS_TO_TICKS(pMac->lim.gLimSpecMgmt.quietTimeoutValue), 0))
+ {
+ limLog( pMac, LOGE,
+ FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway...\n" ));
+ }
+ break;
+
+
+#ifdef WLAN_SOFTAP_FEATURE
+#if 0
+ case eLIM_WPS_OVERLAP_TIMER:
+ {
+ // Restart Learn Interval timer
+
+ tANI_U32 WPSOverlapTimer = SYS_MS_TO_TICKS(LIM_WPS_OVERLAP_TIMER_MS);
+
+ if (tx_timer_deactivate(
+ &pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
+ {
+ // Could not deactivate Learn Interval timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("Unable to deactivate WPS overlap timer\n"));
+ }
+
+ if (tx_timer_change(
+ &pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer,
+ WPSOverlapTimer, 0) != TX_SUCCESS)
+ {
+ // Could not change Learn Interval timer.
+ // Log error
+ limLog(pMac, LOGP, FL("Unable to change WPS overlap timer\n"));
+
+ return;
+ }
+
+ limLog( pMac, LOGE,
+ FL("Setting WPS overlap TIMER to %d ticks\n"),
+ WPSOverlapTimer);
+ }
+ break;
+#endif
+#endif
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ case eLIM_FT_PREAUTH_RSP_TIMER:
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer) != TX_SUCCESS)
+ {
+ /**
+ ** Could not deactivate Join Failure
+ ** timer. Log error.
+ **/
+ limLog(pMac, LOGP, FL("Unable to deactivate Preauth response Failure timer\n"));
+ }
+ val = 1000;
+ val = SYS_MS_TO_TICKS(val);
+ if (tx_timer_change(&pMac->lim.limTimers.gLimFTPreAuthRspTimer,
+ val, 0) != TX_SUCCESS)
+ {
+ /**
+ * Could not change Join Failure
+ * timer. Log error.
+ */
+ limLog(pMac, LOGP, FL("Unable to change Join Failure timer\n"));
+ }
+ break;
+#endif
+#ifdef FEATURE_WLAN_CCX
+ case eLIM_TSM_TIMER:
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimCcxTsmTimer)
+ != TX_SUCCESS)
+ {
+ limLog(pMac, LOGE, FL("Unable to deactivate TSM timer\n"));
+ }
+ break;
+#endif
+#ifdef WLAN_FEATURE_P2P
+ case eLIM_REMAIN_CHN_TIMER:
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer) != TX_SUCCESS)
+ {
+ /**
+ ** Could not deactivate Join Failure
+ ** timer. Log error.
+ **/
+ limLog(pMac, LOGP, FL("Unable to deactivate Remain on Chn timer\n"));
+ }
+ val = 1000;
+ val = SYS_MS_TO_TICKS(val);
+ if (tx_timer_change(&pMac->lim.limTimers.gLimRemainOnChannelTimer,
+ val, 0) != TX_SUCCESS)
+ {
+ /**
+ * Could not change Join Failure
+ * timer. Log error.
+ */
+ limLog(pMac, LOGP, FL("Unable to change timer\n"));
+ }
+ break;
+#endif
+
+ default:
+ // Invalid timerId. Log error
+ break;
+ }
+} /****** end limDeactivateAndChangeTimer() ******/
+
+
+
+/**---------------------------------------------------------------
+\fn limHeartBeatDeactivateAndChangeTimer
+\brief This function deactivates and changes the heart beat
+\ timer, eLIM_HEART_BEAT_TIMER.
+\
+\param pMac
+\param psessionEntry
+\return None
+------------------------------------------------------------------*/
+void
+limHeartBeatDeactivateAndChangeTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
+{
+ tANI_U32 val, val1;
+
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
+
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer) != TX_SUCCESS)
+ limLog(pMac, LOGP, FL("Fail to deactivate HeartBeatTimer \n"));
+
+ /* HB Timer sessionisation: In case of 2 or more sessions, the HB interval keeps
+ changing. to avoid this problem, HeartBeat interval is made constant, by
+ fixing beacon interval to 100ms immaterial of the beacon interval of the session */
+
+ //val = psessionEntry->beaconParams.beaconInterval;
+ val = LIM_HB_TIMER_BEACON_INTERVAL;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("Fail to get WNI_CFG_HEART_BEAT_THRESHOLD \n"));
+
+ PELOGW(limLog(pMac,LOGW,
+ FL("HB Timer Int.=100ms * %d, Beacon Int.=%dms,Session Id=%d \n"),
+ val1, psessionEntry->beaconParams.beaconInterval,
+ psessionEntry->peSessionId);)
+
+ // Change timer to reactivate it in future
+ val = SYS_MS_TO_TICKS(val * val1);
+
+ if (tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer, val, 0) != TX_SUCCESS)
+ limLog(pMac, LOGP, FL("Fail to change HeartBeatTimer\n"));
+
+} /****** end limHeartBeatDeactivateAndChangeTimer() ******/
+
+
+/**---------------------------------------------------------------
+\fn limReactivateHeartBeatTimer
+\brief This function s called to deactivate, change and
+\ activate a timer.
+\
+\param pMac - Pointer to Global MAC structure
+\param psessionEntry
+\return None
+------------------------------------------------------------------*/
+void
+limReactivateHeartBeatTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
+{
+ PELOG3(limLog(pMac, LOG3, FL("Rxed Heartbeat. Count=%d\n"), psessionEntry->LimRxedBeaconCntDuringHB);)
+
+ limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
+
+ //only start the hearbeat-timer if the timeout value is non-zero
+ if(pMac->lim.limTimers.gLimHeartBeatTimer.initScheduleTimeInMsecs > 0) {
+ if (tx_timer_activate(&pMac->lim.limTimers.gLimHeartBeatTimer)!= TX_SUCCESS)
+ {
+ limLog(pMac, LOGP,FL("could not activate Heartbeat timer\n"));
+ }
+ limResetHBPktCount(psessionEntry);
+ }
+
+} /****** end limReactivateHeartBeatTimer() ******/
+
+#if 0
+/******
+ * Note: Use this code once you have converted all
+ * limReactivateHeartBeatTimer() calls to
+ * limReactivateTimer() calls.
+ *
+ ******/
+
+Now, in dev/btamp2,
+here are all the references to limReactivateHeartBeatTimer().
+
+C symbol: limReactivateHeartBeatTimer
+
+ File Function Line
+0 limTimerUtils.h <global> 55 void limReactivateHeartBeatTimer(tpAniSirGlobal , tpPESession);
+1 limIbssPeerMgmt.c limIbssHeartBeatHandle 1282 limReactivateHeartBeatTimer(pMac, psessionEntry);
+2 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 395 limReactivateHeartBeatTimer(pMac, psessionEntry);
+3 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 410 limReactivateHeartBeatTimer(pMac, psessionEntry);
+4 limProcessMlmRspMessages. limProcessStaMlmAddStaRsp 2111 limReactivateHeartBeatTimer(pMac, psessionEntry);
+5 limProcessMlmRspMessages_ limProcessStaMlmAddStaRsp 2350 limReactivateHeartBeatTimer(pMac, psessionEntry);
+6 limProcessMlmRspMessages_ limProcessStaMlmAddStaRsp 2111 limReactivateHeartBeatTimer(pMac, psessionEntry);
+7 limTimerUtils.c limReactivateHeartBeatTim 1473 limReactivateHeartBeatTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
+8 limUtils.c limHandleHeartBeatFailure 6743 limReactivateHeartBeatTimer(pMac, psessionEntry);
+9 limUtils.c limHandleHeartBeatFailure 6751 limReactivateHeartBeatTimer(pMac, psessionEntry);
+
+Now, in main/latest, on the other hand,
+here are all the references to limReactivateTimer().
+
+C symbol: limReactivateTimer
+
+ File Function Line
+0 limTimerUtils.h <global> 54 void limReactivateTimer(tpAniSirGlobal, tANI_U32);
+1 limIbssPeerMgmt.c limIbssHeartBeatHandle 1183 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
+2 limIbssPeerMgmt.c limIbssHeartBeatHandle 1246 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
+3 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 283 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
+4 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 320 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
+5 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 335 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
+6 limProcessMessageQueue.c limProcessMessages 1210 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
+7 limProcessMessageQueue.c limProcessMessages 1218 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
+8 limProcessMlmRspMessages. limProcessStaMlmAddStaRsp 1726 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
+9 limTimerUtils.c limReactivateTimer 1451 limReactivateTimer(tpAniSirGlobal pMac, tANI_U32 timerId)
+
+
+/**
+ * limReactivateTimer()
+ *
+ *FUNCTION:
+ * This function is called to deactivate, change and
+ * activate a timer
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param timerId - enum of timer to be deactivated and changed
+ * This enum is defined in limUtils.h file
+ *
+ * @return None
+ */
+
+void
+limReactivateTimer(tpAniSirGlobal pMac, tANI_U32 timerId)
+{
+ if (timerId == eLIM_HEART_BEAT_TIMER)
+ {
+ PELOG3(limLog(pMac, LOG3, FL("Rxed Heartbeat. Count=%d\n"),
+ pMac->lim.gLimRxedBeaconCntDuringHB);)
+ limDeactivateAndChangeTimer(pMac, eLIM_HEART_BEAT_TIMER);
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
+ if (limActivateHearBeatTimer(pMac) != TX_SUCCESS)
+ {
+ /// Could not activate Heartbeat timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("could not activate Heartbeat timer\n"));
+ }
+ limResetHBPktCount(pMac);
+ }
+} /****** end limReactivateTimer() ******/
+#endif
+
+
+/**
+ * limActivateHearBeatTimer()
+ *
+ *
+ * @brief: This function is called to activate heartbeat timer
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ * @note staId for eLIM_AUTH_RSP_TIMER is auth Node Index.
+ *
+ * @param pMac - Pointer to Global MAC structure
+ *
+ * @return TX_SUCCESS - timer is activated
+ * errors - fail to start the timer
+ */
+v_UINT_t limActivateHearBeatTimer(tpAniSirGlobal pMac)
+{
+ v_UINT_t status = TX_TIMER_ERROR;
+
+ if(TX_AIRGO_TMR_SIGNATURE == pMac->lim.limTimers.gLimHeartBeatTimer.tmrSignature)
+ {
+ //consider 0 interval a ok case
+ if( pMac->lim.limTimers.gLimHeartBeatTimer.initScheduleTimeInMsecs )
+ {
+ status = tx_timer_activate(&pMac->lim.limTimers.gLimHeartBeatTimer);
+ if( TX_SUCCESS != status )
+ {
+ PELOGE(limLog(pMac, LOGE,
+ FL("could not activate Heartbeat timer status(%d)\n"), status);)
+ }
+ }
+ else
+ {
+ status = TX_SUCCESS;
+ }
+ }
+
+ return (status);
+}
+
+
+
+/**
+ * limDeactivateAndChangePerStaIdTimer()
+ *
+ *
+ * @brief: This function is called to deactivate and change a per STA timer
+ * for future re-activation
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ * @note staId for eLIM_AUTH_RSP_TIMER is auth Node Index.
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param timerId - enum of timer to be deactivated and changed
+ * This enum is defined in limUtils.h file
+ * @param staId - staId
+ *
+ * @return None
+ */
+
+void
+limDeactivateAndChangePerStaIdTimer(tpAniSirGlobal pMac, tANI_U32 timerId, tANI_U16 staId)
+{
+ tANI_U32 val;
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, timerId));
+
+ switch (timerId)
+ {
+ case eLIM_CNF_WAIT_TIMER:
+
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId])
+ != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP,
+ FL("unable to deactivate CNF wait timer\n"));
+
+ }
+
+ // Change timer to reactivate it in future
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_WT_CNF_TIMEOUT,
+ &val) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get cnf timeout value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve cnf timeout value\n"));
+ }
+ val = SYS_MS_TO_TICKS(val);
+
+ if (tx_timer_change(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId],
+ val, val) != TX_SUCCESS)
+ {
+ // Could not change cnf timer.
+ // Log error
+ limLog(pMac, LOGP, FL("unable to change cnf wait timer\n"));
+ }
+
+ break;
+
+ case eLIM_AUTH_RSP_TIMER:
+ {
+ tLimPreAuthNode *pAuthNode;
+
+ pAuthNode = limGetPreAuthNodeFromIndex(pMac, &pMac->lim.gLimPreAuthTimerTable, staId);
+
+ if (pAuthNode == NULL)
+ {
+ limLog(pMac, LOGP, FL("Invalid Pre Auth Index passed :%d\n"), staId);
+ break;
+ }
+
+ if (tx_timer_deactivate(&pAuthNode->timer) != TX_SUCCESS)
+ {
+ // Could not deactivate auth response timer.
+ // Log error
+ limLog(pMac, LOGP, FL("unable to deactivate auth response timer\n"));
+ }
+
+ // Change timer to reactivate it in future
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_RSP_TIMEOUT, &val) != eSIR_SUCCESS)
+ {
+ /**
+ * Could not get auth rsp timeout value
+ * from CFG. Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve auth response timeout value\n"));
+ }
+
+ val = SYS_MS_TO_TICKS(val);
+
+ if (tx_timer_change(&pAuthNode->timer, val, 0) != TX_SUCCESS)
+ {
+ // Could not change auth rsp timer.
+ // Log error
+ limLog(pMac, LOGP, FL("unable to change auth rsp timer\n"));
+ }
+ }
+ break;
+
+#if (defined(ANI_PRODUCT_TYPE_AP) ||defined(ANI_PRODUCT_TYPE_AP_SDK))
+ case eLIM_LEARN_INTERVAL_TIMER:
+ {
+ // Restart Learn Interval timer
+ tANI_U32 learnInterval =
+ pMac->lim.gpLimMeasReq->measDuration.shortTermPeriod /
+ pMac->lim.gpLimMeasReq->channelList.numChannels;
+
+ if (tx_timer_deactivate(
+ &pMac->lim.gLimMeasParams.learnIntervalTimer) != TX_SUCCESS)
+ {
+ // Could not deactivate Learn Interval timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("Unable to deactivate Learn Interval timer\n"));
+ }
+
+ if (tx_timer_change(
+ &pMac->lim.gLimMeasParams.learnIntervalTimer,
+ SYS_MS_TO_TICKS(learnInterval), 0) != TX_SUCCESS)
+ {
+ // Could not change Learn Interval timer.
+ // Log error
+ limLog(pMac, LOGP, FL("Unable to change Learn Interval timer\n"));
+
+ return;
+ }
+
+ limLog( pMac, LOG3,
+ FL("Setting the Learn Interval TIMER to %d ticks\n"),
+ SYS_MS_TO_TICKS(learnInterval) );
+ }
+ break;
+#endif //#if (defined(ANI_PRODUCT_TYPE_AP) ||defined(ANI_PRODUCT_TYPE_AP_SDK))
+
+ default:
+ // Invalid timerId. Log error
+ break;
+
+ }
+}
+
+
+/**
+ * limActivateCnfTimer()
+ *
+ *FUNCTION:
+ * This function is called to activate a per STA timer
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param StaId - staId
+ *
+ * @return None
+ */
+
+void limActivateCnfTimer(tpAniSirGlobal pMac, tANI_U16 staId, tpPESession psessionEntry)
+{
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_CNF_WAIT_TIMER));
+ pMac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId = psessionEntry->peSessionId;
+ if (tx_timer_activate(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId])
+ != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP,
+ FL("could not activate cnf wait timer\n"));
+ }
+}
+
+/**
+ * limActivateAuthRspTimer()
+ *
+ *FUNCTION:
+ * This function is called to activate a per STA timer
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param id - id
+ *
+ * @return None
+ */
+
+void limActivateAuthRspTimer(tpAniSirGlobal pMac, tLimPreAuthNode *pAuthNode)
+{
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_AUTH_RESP_TIMER));
+ if (tx_timer_activate(&pAuthNode->timer) != TX_SUCCESS)
+ {
+ /// Could not activate auth rsp timer.
+ // Log error
+ limLog(pMac, LOGP,
+ FL("could not activate auth rsp timer\n"));
+ }
+}
+
+
+/**
+ * limSendDisassocFrameThresholdHandler()
+ *
+ *FUNCTION:
+ * This function reloads the credit to the send disassociate frame bucket
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ * NA
+ *
+ * @param
+ *
+ * @return None
+ */
+
+void
+limSendDisassocFrameThresholdHandler(void *pMacGlobal, tANI_U32 param)
+{
+ tSirMsgQ msg;
+ tANI_U32 statusCode;
+ tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
+
+ msg.type = SIR_LIM_HASH_MISS_THRES_TIMEOUT;
+ msg.bodyval = 0;
+ msg.bodyptr = NULL;
+
+ if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
+ limLog(pMac, LOGE,
+ FL("posting to LIM failed, reason=%d\n"), statusCode);
+
+}
+
+/**
+ * limAssocCnfWaitTmerHandler()
+ *
+ *FUNCTION:
+ * This function post a message to send a disassociate frame out.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ * NA
+ *
+ * @param
+ *
+ * @return None
+ */
+
+void
+limCnfWaitTmerHandler(void *pMacGlobal, tANI_U32 param)
+{
+ tSirMsgQ msg;
+ tANI_U32 statusCode;
+ tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
+
+ msg.type = SIR_LIM_CNF_WAIT_TIMEOUT;
+ msg.bodyval = (tANI_U32)param;
+ msg.bodyptr = NULL;
+
+ if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
+ limLog(pMac, LOGE,
+ FL("posting to LIM failed, reason=%d\n"), statusCode);
+
+}
+
+/**
+ * limKeepaliveTmerHandler()
+ *
+ *FUNCTION:
+ * This function post a message to send a NULL data frame.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ * NA
+ *
+ * @param
+ *
+ * @return None
+ */
+
+void
+limKeepaliveTmerHandler(void *pMacGlobal, tANI_U32 param)
+{
+ tSirMsgQ msg;
+ tANI_U32 statusCode;
+ tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
+
+ msg.type = SIR_LIM_KEEPALIVE_TIMEOUT;
+ msg.bodyval = (tANI_U32)param;
+ msg.bodyptr = NULL;
+
+ if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
+ limLog(pMac, LOGE,
+ FL("posting to LIM failed, reason=%d\n"), statusCode);
+
+}
+
+void
+limChannelSwitchTimerHandler(void *pMacGlobal, tANI_U32 param)
+{
+ tSirMsgQ msg;
+ tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
+
+ PELOG1(limLog(pMac, LOG1,
+ FL("ChannelSwitch Timer expired. Posting msg to LIM \n"));)
+
+ msg.type = SIR_LIM_CHANNEL_SWITCH_TIMEOUT;
+ msg.bodyval = (tANI_U32)param;
+ msg.bodyptr = NULL;
+
+ limPostMsgApi(pMac, &msg);
+}
+
+void
+limQuietTimerHandler(void *pMacGlobal, tANI_U32 param)
+{
+ tSirMsgQ msg;
+ tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
+
+ msg.type = SIR_LIM_QUIET_TIMEOUT;
+ msg.bodyval = (tANI_U32)param;
+ msg.bodyptr = NULL;
+
+ PELOG1(limLog(pMac, LOG1,
+ FL("Post SIR_LIM_QUIET_TIMEOUT msg. \n"));)
+ limPostMsgApi(pMac, &msg);
+}
+
+void
+limQuietBssTimerHandler(void *pMacGlobal, tANI_U32 param)
+{
+ tSirMsgQ msg;
+ tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
+
+ msg.type = SIR_LIM_QUIET_BSS_TIMEOUT;
+ msg.bodyval = (tANI_U32)param;
+ msg.bodyptr = NULL;
+ PELOG1(limLog(pMac, LOG1,
+ FL("Post SIR_LIM_QUIET_BSS_TIMEOUT msg. \n"));)
+ limPostMsgApi(pMac, &msg);
+}
+#ifdef WLAN_SOFTAP_FEATURE
+#if 0
+void
+limWPSOverlapTimerHandler(void *pMacGlobal, tANI_U32 param)
+{
+ tSirMsgQ msg;
+ tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
+
+ msg.type = SIR_LIM_WPS_OVERLAP_TIMEOUT;
+ msg.bodyval = (tANI_U32)param;
+ msg.bodyptr = NULL;
+ PELOG1(limLog(pMac, LOG1,
+ FL("Post SIR_LIM_WPS_OVERLAP_TIMEOUT msg. \n"));)
+ limPostMsgApi(pMac, &msg);
+}
+#endif
+#endif
diff --git a/CORE/MAC/src/pe/lim/limTimerUtils.h b/CORE/MAC/src/pe/lim/limTimerUtils.h
new file mode 100644
index 0000000..1719977
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limTimerUtils.h
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limTimerUtils.h contains the utility definitions
+ * LIM uses for timer handling.
+ * Author: Chandra Modumudi
+ * Date: 02/13/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+#ifndef __LIM_TIMER_UTILS_H
+#define __LIM_TIMER_UTILS_H
+
+#include "limTypes.h"
+
+
+// Timer related functions
+enum
+{
+ eLIM_MIN_CHANNEL_TIMER,
+ eLIM_MAX_CHANNEL_TIMER,
+ eLIM_JOIN_FAIL_TIMER,
+ eLIM_AUTH_FAIL_TIMER,
+ eLIM_AUTH_RESP_TIMER,
+ eLIM_ASSOC_FAIL_TIMER,
+ eLIM_REASSOC_FAIL_TIMER,
+ eLIM_PRE_AUTH_CLEANUP_TIMER,
+ eLIM_HEART_BEAT_TIMER,
+ eLIM_BACKGROUND_SCAN_TIMER,
+#ifdef ANI_PRODUCT_TYPE_AP
+ eLIM_LEARN_INTERVAL_TIMER,
+#endif
+ eLIM_KEEPALIVE_TIMER,
+ eLIM_CNF_WAIT_TIMER,
+ eLIM_AUTH_RSP_TIMER,
+ eLIM_UPDATE_OLBC_CACHE_TIMER,
+ eLIM_PROBE_AFTER_HB_TIMER,
+ eLIM_ADDTS_RSP_TIMER,
+ eLIM_CHANNEL_SWITCH_TIMER,
+ eLIM_LEARN_DURATION_TIMER,
+ eLIM_QUIET_TIMER,
+ eLIM_QUIET_BSS_TIMER,
+#ifdef WLAN_SOFTAP_FEATURE
+ eLIM_WPS_OVERLAP_TIMER,
+#endif
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ eLIM_FT_PREAUTH_RSP_TIMER,
+#endif
+#ifdef WLAN_FEATURE_P2P
+ eLIM_REMAIN_CHN_TIMER,
+#endif
+ eLIM_PERIODIC_PROBE_REQ_TIMER,
+#ifdef FEATURE_WLAN_CCX
+ eLIM_TSM_TIMER,
+#endif
+};
+
+// Timer Handler functions
+void limCreateTimers(tpAniSirGlobal);
+void limTimerHandler(void *, tANI_U32);
+void limAuthResponseTimerHandler(void *, tANI_U32);
+void limAssocFailureTimerHandler(void *, tANI_U32);
+void limReassocFailureTimerHandler(void *, tANI_U32);
+
+void limDeactivateAndChangeTimer(tpAniSirGlobal, tANI_U32);
+void limHeartBeatDeactivateAndChangeTimer(tpAniSirGlobal, tpPESession);
+void limReactivateHeartBeatTimer(tpAniSirGlobal, tpPESession);
+void limDummyPktExpTimerHandler(void *, tANI_U32);
+void limSendDisassocFrameThresholdHandler(void *, tANI_U32);
+void limCnfWaitTmerHandler(void *, tANI_U32);
+void limKeepaliveTmerHandler(void *, tANI_U32);
+void limDeactivateAndChangePerStaIdTimer(tpAniSirGlobal, tANI_U32, tANI_U16);
+void limActivateCnfTimer(tpAniSirGlobal, tANI_U16, tpPESession);
+void limActivateAuthRspTimer(tpAniSirGlobal, tLimPreAuthNode *);
+#ifdef WLAN_SOFTAP_FEATURE
+void limUpdateOlbcCacheTimerHandler(void *, tANI_U32);
+#endif
+void limAddtsResponseTimerHandler(void *, tANI_U32);
+void limChannelSwitchTimerHandler(void *, tANI_U32);
+void limQuietTimerHandler(void *, tANI_U32);
+void limQuietBssTimerHandler(void *, tANI_U32);
+void limCBScanIntervalTimerHandler(void *, tANI_U32);
+void limCBScanDurationTimerHandler(void *, tANI_U32);
+/**
+ * limActivateHearBeatTimer()
+ *
+ *
+ * @brief: This function is called to activate heartbeat timer
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ * @note staId for eLIM_AUTH_RSP_TIMER is auth Node Index.
+ *
+ * @param pMac - Pointer to Global MAC structure
+ *
+ * @return TX_SUCCESS - timer is activated
+ * errors - fail to start the timer
+ */
+v_UINT_t limActivateHearBeatTimer(tpAniSirGlobal pMac);
+
+#ifdef WLAN_SOFTAP_FEATURE
+#if 0
+void limWPSOverlapTimerHandler(void *pMacGlobal, tANI_U32 param);
+#endif
+#endif
+#endif /* __LIM_TIMER_UTILS_H */
diff --git a/CORE/MAC/src/pe/lim/limTrace.c b/CORE/MAC/src/pe/lim/limTrace.c
new file mode 100644
index 0000000..8e13a02
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limTrace.c
@@ -0,0 +1,418 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**=========================================================================
+
+ \file limTrace.c
+
+ \brief implementation for trace related APIs
+
+ \author Sunit Bhatia
+
+ Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
+
+ Qualcomm Confidential and Proprietary.
+
+ ========================================================================*/
+
+
+/*--------------------------------------------------------------------------
+ Include Files
+ ------------------------------------------------------------------------*/
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#include "aniGlobal.h" //for tpAniSirGlobal
+#endif
+
+#include "limTrace.h"
+#include "limTimerUtils.h"
+
+
+#ifdef LIM_TRACE_RECORD
+tANI_U32 gMgmtFrameStats[14];
+
+
+
+static tANI_U8* __limTraceGetTimerString( tANI_U16 timerId )
+{
+ switch( timerId )
+ {
+ CASE_RETURN_STRING(eLIM_MIN_CHANNEL_TIMER);
+ CASE_RETURN_STRING(eLIM_MAX_CHANNEL_TIMER);
+ CASE_RETURN_STRING(eLIM_JOIN_FAIL_TIMER);
+ CASE_RETURN_STRING(eLIM_AUTH_FAIL_TIMER);
+ CASE_RETURN_STRING(eLIM_AUTH_RESP_TIMER);
+ CASE_RETURN_STRING(eLIM_ASSOC_FAIL_TIMER);
+ CASE_RETURN_STRING(eLIM_REASSOC_FAIL_TIMER);
+ CASE_RETURN_STRING(eLIM_PRE_AUTH_CLEANUP_TIMER);
+ CASE_RETURN_STRING(eLIM_HEART_BEAT_TIMER);
+ CASE_RETURN_STRING(eLIM_BACKGROUND_SCAN_TIMER);
+#ifdef ANI_PRODUCT_TYPE_AP
+ CASE_RETURN_STRING(eLIM_LEARN_INTERVAL_TIMER);
+#endif
+ CASE_RETURN_STRING(eLIM_KEEPALIVE_TIMER);
+ CASE_RETURN_STRING(eLIM_CNF_WAIT_TIMER);
+ CASE_RETURN_STRING(eLIM_AUTH_RSP_TIMER);
+ CASE_RETURN_STRING(eLIM_UPDATE_OLBC_CACHE_TIMER);
+ CASE_RETURN_STRING(eLIM_PROBE_AFTER_HB_TIMER);
+ CASE_RETURN_STRING(eLIM_ADDTS_RSP_TIMER);
+ CASE_RETURN_STRING(eLIM_CHANNEL_SWITCH_TIMER);
+ CASE_RETURN_STRING(eLIM_LEARN_DURATION_TIMER);
+ CASE_RETURN_STRING(eLIM_QUIET_TIMER);
+ CASE_RETURN_STRING(eLIM_QUIET_BSS_TIMER);
+ default:
+ return( "UNKNOWN" );
+ break;
+ }
+}
+
+
+static tANI_U8* __limTraceGetMgmtDropReasonString( tANI_U16 dropReason )
+{
+
+ switch( dropReason )
+ {
+ CASE_RETURN_STRING(eMGMT_DROP_INFRA_BCN_IN_IBSS);
+ CASE_RETURN_STRING(eMGMT_DROP_INVALID_SIZE);
+ CASE_RETURN_STRING(eMGMT_DROP_NON_SCAN_MODE_FRAME);
+ CASE_RETURN_STRING(eMGMT_DROP_NOT_LAST_IBSS_BCN);
+ CASE_RETURN_STRING(eMGMT_DROP_NO_DROP);
+ CASE_RETURN_STRING(eMGMT_DROP_SCAN_MODE_FRAME);
+
+ default:
+ return( "UNKNOWN" );
+ break;
+ }
+}
+
+
+
+void limTraceInit(tpAniSirGlobal pMac)
+{
+ macTraceRegister(pMac, VOS_MODULE_ID_PE, limTraceDump);
+}
+
+
+
+
+void limTraceDump(tpAniSirGlobal pMac, tpTraceRecord pRecord, tANI_U16 recIndex)
+{
+
+ static char *frameSubtypeStr[14] =
+ {
+ "Association request",
+ "Association response",
+ "Reassociation request",
+ "Reassociation response",
+ "Probe request",
+ "Probe response",
+ NULL,
+ NULL,
+ "Beacon",
+ "ATIM",
+ "Disassocation",
+ "Authentication",
+ "Deauthentication",
+ "Action"
+ };
+
+ switch (pRecord->code) {
+ case TRACE_CODE_MLM_STATE:
+ limLog(pMac, LOGE, "%04d %012u S%d %-14s %-30s(0x%x) \n", recIndex, pRecord->time, pRecord->session,
+ "MLM State:", limTraceGetMlmStateString((tANI_U16)pRecord->data), pRecord->data );
+ break;
+ case TRACE_CODE_SME_STATE:
+ limLog(pMac, LOGE, "%04d %012u S%d %-14s %-30s(0x%x) \n", recIndex, pRecord->time, pRecord->session,
+ "SME State:", limTraceGetSmeStateString((tANI_U16)pRecord->data), pRecord->data );
+ break;
+ case TRACE_CODE_TX_MGMT:
+ limLog(pMac, LOGE, "%04d %012u S%d %-14s %-30s(0x%x) \n", recIndex, pRecord->time, pRecord->session,
+ "TX Mgmt:", frameSubtypeStr[pRecord->data], pRecord->data );
+ break;
+
+ case TRACE_CODE_RX_MGMT:
+ limLog(pMac, LOGE, "%04d %012u S%d %-14s %-30s(%d) SN: %d \n", recIndex, pRecord->time, pRecord->session,
+ "RX Mgmt:", frameSubtypeStr[LIM_TRACE_GET_SUBTYPE(pRecord->data)],
+ LIM_TRACE_GET_SUBTYPE(pRecord->data),
+ LIM_TRACE_GET_SSN(pRecord->data) );
+ break;
+ case TRACE_CODE_RX_MGMT_DROP:
+ limLog(pMac, LOGE, "%04d %012u S%d %-14s %-30s(%d) \n", recIndex, pRecord->time, pRecord->session,
+ "Drop RX Mgmt:", __limTraceGetMgmtDropReasonString((tANI_U16)pRecord->data), pRecord->data);
+ break;
+
+
+ case TRACE_CODE_RX_MGMT_TSF:
+ limLog(pMac, LOGE, "%04d %012u S%d %-14s %-30s0x%x(%d) \n", recIndex, pRecord->time, pRecord->session,
+ "RX Mgmt TSF:", " ", pRecord->data, pRecord->data );
+ break;
+
+ case TRACE_CODE_TX_COMPLETE:
+ limLog(pMac, LOGE, "%04d %012u S%d %-14s \n", recIndex, pRecord->time, pRecord->session,
+ "TX Complete" );
+ break;
+
+ case TRACE_CODE_TX_SME_MSG:
+ limLog(pMac, LOGE, "%04d %012u S%d %-14s %-30s(0x%x) \n", recIndex, pRecord->time, pRecord->session,
+ "TX SME Msg:", macTraceGetSmeMsgString((tANI_U16)pRecord->data), pRecord->data );
+ break;
+ case TRACE_CODE_RX_SME_MSG:
+ limLog(pMac, LOGE, "%04d %012u S%d %-14s %-30s(0x%x) \n", recIndex, pRecord->time, pRecord->session,
+ LIM_TRACE_GET_DEFRD_OR_DROPPED(pRecord->data) ? "Def/Drp LIM Msg:": "RX Sme Msg:",
+ macTraceGetSmeMsgString((tANI_U16)pRecord->data), pRecord->data );
+ break;
+
+ case TRACE_CODE_TX_HAL_MSG:
+ limLog(pMac, LOGE, "%04d %012u S%d %-14s %-30s(0x%x) \n", recIndex, pRecord->time, pRecord->session,
+ "TX HAL Msg:", macTraceGetHalMsgString((tANI_U16)pRecord->data), pRecord->data );
+ break;
+
+ case TRACE_CODE_RX_HAL_MSG:
+ limLog(pMac, LOGE, "%04d %012u S%d %-14s %-30s(0x%x) \n", recIndex, pRecord->time, pRecord->session,
+ LIM_TRACE_GET_DEFRD_OR_DROPPED(pRecord->data) ? "Def/Drp LIM Msg:": "RX HAL Msg:",
+ macTraceGetHalMsgString((tANI_U16)pRecord->data), pRecord->data );
+ break;
+
+ case TRACE_CODE_TX_LIM_MSG:
+ limLog(pMac, LOGE, "%04d %012u S%d %-14s %-30s(0x%x) \n", recIndex, pRecord->time, pRecord->session,
+ "TX LIM Msg:", macTraceGetLimMsgString((tANI_U16)pRecord->data), pRecord->data );
+ break;
+ case TRACE_CODE_RX_LIM_MSG:
+ limLog(pMac, LOGE, "%04d %012u S%d %-14s %-30s(0x%x) \n", recIndex, pRecord->time, pRecord->session,
+ LIM_TRACE_GET_DEFRD_OR_DROPPED(pRecord->data) ? "Def/Drp LIM Msg:": "RX LIM Msg",
+ macTraceGetLimMsgString((tANI_U16)pRecord->data), pRecord->data );
+ break;
+ case TRACE_CODE_TX_CFG_MSG:
+ limLog(pMac, LOGE, "%04d %012u S%d %-14s %-30s(0x%x) \n", recIndex, pRecord->time, pRecord->session,
+ "TX CFG Msg:", macTraceGetCfgMsgString((tANI_U16)pRecord->data), pRecord->data );
+ break;
+ case TRACE_CODE_RX_CFG_MSG:
+ limLog(pMac, LOGE, "%04d %012u S%d %-14s %-30s(0x%x) \n", recIndex, pRecord->time, pRecord->session,
+ LIM_TRACE_GET_DEFRD_OR_DROPPED(pRecord->data) ? "Def/Drp LIM Msg:": "RX CFG Msg:",
+ macTraceGetCfgMsgString((tANI_U16)MAC_TRACE_GET_MSG_ID(pRecord->data)),
+ pRecord->data );
+ break;
+
+ case TRACE_CODE_TIMER_ACTIVATE:
+ limLog(pMac, LOGE, "%04d %012u S%d %-14s %-30s(0x%x) \n", recIndex, pRecord->time, pRecord->session,
+ "Timer Actvtd", __limTraceGetTimerString((tANI_U16)pRecord->data), pRecord->data );
+ break;
+ case TRACE_CODE_TIMER_DEACTIVATE:
+ limLog(pMac, LOGE, "%04d %012u S%d %-14s %-30s(0x%x) \n", recIndex, pRecord->time, pRecord->session,
+ "Timer DeActvtd", __limTraceGetTimerString((tANI_U16)pRecord->data), pRecord->data );
+ break;
+
+ default :
+ limLog(pMac, LOGE, "%04d %012u S%d %-14s(%d) (0x%x) \n", recIndex, pRecord->time, pRecord->session,
+ "Unknown Code", pRecord->code, pRecord->data );
+ break;
+ }
+}
+
+
+void macTraceMsgTx(tpAniSirGlobal pMac, tANI_U8 session, tANI_U32 data)
+{
+
+ tANI_U16 msgId = (tANI_U16)MAC_TRACE_GET_MSG_ID(data);
+ tANI_U8 moduleId = (tANI_U8)MAC_TRACE_GET_MODULE_ID(data);
+
+ switch(moduleId)
+ {
+ case SIR_LIM_MODULE_ID:
+ if(msgId >= SIR_LIM_ITC_MSG_TYPES_BEGIN)
+ macTrace(pMac, TRACE_CODE_TX_LIM_MSG, session, data);
+ else
+ macTrace(pMac, TRACE_CODE_TX_SME_MSG, session, data);
+ break;
+ case SIR_WDA_MODULE_ID:
+ macTrace(pMac, TRACE_CODE_TX_HAL_MSG, session, data);
+ break;
+ case SIR_CFG_MODULE_ID:
+ macTrace(pMac, TRACE_CODE_TX_CFG_MSG, session, data);
+ break;
+ }
+}
+
+
+void macTraceMsgTxNew(tpAniSirGlobal pMac, tANI_U8 module, tANI_U8 session, tANI_U32 data)
+{
+ tANI_U16 msgId = (tANI_U16)MAC_TRACE_GET_MSG_ID(data);
+ tANI_U8 moduleId = (tANI_U8)MAC_TRACE_GET_MODULE_ID(data);
+
+ switch(moduleId)
+ {
+ case SIR_LIM_MODULE_ID:
+ if(msgId >= SIR_LIM_ITC_MSG_TYPES_BEGIN)
+ macTraceNew(pMac, module, TRACE_CODE_TX_LIM_MSG, session, data);
+ else
+ macTraceNew(pMac, module, TRACE_CODE_TX_SME_MSG, session, data);
+ break;
+ case SIR_WDA_MODULE_ID:
+ macTraceNew(pMac, module, TRACE_CODE_TX_HAL_MSG, session, data);
+ break;
+ case SIR_CFG_MODULE_ID:
+ macTraceNew(pMac, module, TRACE_CODE_TX_CFG_MSG, session, data);
+ break;
+ }
+}
+
+/*
+* bit31: Rx message defferred or not
+* bit 0-15: message ID:
+*/
+void macTraceMsgRx(tpAniSirGlobal pMac, tANI_U8 session, tANI_U32 data)
+{
+ tANI_U16 msgId = (tANI_U16)MAC_TRACE_GET_MSG_ID(data);
+ tANI_U8 moduleId = (tANI_U8)MAC_TRACE_GET_MODULE_ID(data);
+
+
+ switch(moduleId)
+ {
+ case SIR_LIM_MODULE_ID:
+ if(msgId >= SIR_LIM_ITC_MSG_TYPES_BEGIN)
+ macTrace(pMac, TRACE_CODE_RX_LIM_MSG, session, data);
+ else
+ macTrace(pMac, TRACE_CODE_RX_SME_MSG, session, data);
+ break;
+ case SIR_WDA_MODULE_ID:
+ macTrace(pMac, TRACE_CODE_RX_HAL_MSG, session, data);
+ break;
+ case SIR_CFG_MODULE_ID:
+ macTrace(pMac, TRACE_CODE_RX_CFG_MSG, session, data);
+ break;
+ }
+}
+
+
+
+/*
+* bit31: Rx message defferred or not
+* bit 0-15: message ID:
+*/
+void macTraceMsgRxNew(tpAniSirGlobal pMac, tANI_U8 module, tANI_U8 session, tANI_U32 data)
+{
+ tANI_U16 msgId = (tANI_U16)MAC_TRACE_GET_MSG_ID(data);
+ tANI_U8 moduleId = (tANI_U8)MAC_TRACE_GET_MODULE_ID(data);
+
+
+ switch(moduleId)
+ {
+ case SIR_LIM_MODULE_ID:
+ if(msgId >= SIR_LIM_ITC_MSG_TYPES_BEGIN)
+ macTraceNew(pMac, module, TRACE_CODE_RX_LIM_MSG, session, data);
+ else
+ macTraceNew(pMac, module, TRACE_CODE_RX_SME_MSG, session, data);
+ break;
+ case SIR_WDA_MODULE_ID:
+ macTraceNew(pMac, module, TRACE_CODE_RX_HAL_MSG, session, data);
+ break;
+ case SIR_CFG_MODULE_ID:
+ macTraceNew(pMac, module, TRACE_CODE_RX_CFG_MSG, session, data);
+ break;
+ }
+}
+
+
+
+tANI_U8* limTraceGetMlmStateString( tANI_U32 mlmState )
+{
+ switch( mlmState )
+ {
+ CASE_RETURN_STRING( eLIM_MLM_OFFLINE_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_IDLE_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_PROBE_RESP_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_PASSIVE_SCAN_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_JOIN_BEACON_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_JOINED_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_BSS_STARTED_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_AUTH_FRAME2_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_AUTH_FRAME3_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_AUTH_FRAME4_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_AUTH_RSP_TIMEOUT_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_AUTHENTICATED_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_ASSOC_RSP_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_REASSOC_RSP_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_ASSOCIATED_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_REASSOCIATED_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_LINK_ESTABLISHED_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_ASSOC_CNF_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_LEARN_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_ADD_BSS_RSP_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_DEL_BSS_RSP_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_ADD_STA_RSP_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_DEL_STA_RSP_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_SET_BSS_KEY_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_SET_STA_KEY_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_SET_STA_BCASTKEY_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_ADDBA_RSP_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_REMOVE_STA_KEY_STATE);
+ CASE_RETURN_STRING( eLIM_MLM_WT_SET_MIMOPS_STATE);
+ default:
+ return( "UNKNOWN" );
+ break;
+ }
+}
+
+
+tANI_U8* limTraceGetSmeStateString( tANI_U32 smeState )
+{
+ switch( smeState )
+ {
+
+ CASE_RETURN_STRING(eLIM_SME_OFFLINE_STATE);
+ CASE_RETURN_STRING(eLIM_SME_IDLE_STATE);
+ CASE_RETURN_STRING(eLIM_SME_SUSPEND_STATE);
+ CASE_RETURN_STRING(eLIM_SME_WT_SCAN_STATE);
+ CASE_RETURN_STRING(eLIM_SME_WT_JOIN_STATE);
+ CASE_RETURN_STRING(eLIM_SME_WT_AUTH_STATE);
+ CASE_RETURN_STRING(eLIM_SME_WT_ASSOC_STATE);
+ CASE_RETURN_STRING(eLIM_SME_WT_REASSOC_STATE);
+ CASE_RETURN_STRING(eLIM_SME_WT_REASSOC_LINK_FAIL_STATE);
+ CASE_RETURN_STRING(eLIM_SME_JOIN_FAILURE_STATE);
+ CASE_RETURN_STRING(eLIM_SME_ASSOCIATED_STATE);
+ CASE_RETURN_STRING(eLIM_SME_REASSOCIATED_STATE);
+ CASE_RETURN_STRING(eLIM_SME_LINK_EST_STATE);
+ CASE_RETURN_STRING(eLIM_SME_LINK_EST_WT_SCAN_STATE);
+ CASE_RETURN_STRING(eLIM_SME_WT_PRE_AUTH_STATE);
+ CASE_RETURN_STRING(eLIM_SME_WT_DISASSOC_STATE);
+ CASE_RETURN_STRING(eLIM_SME_WT_DEAUTH_STATE);
+ CASE_RETURN_STRING(eLIM_SME_WT_START_BSS_STATE);
+ CASE_RETURN_STRING(eLIM_SME_WT_STOP_BSS_STATE);
+ CASE_RETURN_STRING(eLIM_SME_NORMAL_STATE);
+ CASE_RETURN_STRING(eLIM_SME_CHANNEL_SCAN_STATE);
+ CASE_RETURN_STRING(eLIM_SME_NORMAL_CHANNEL_SCAN_STATE);
+ default:
+ return( "UNKNOWN" );
+ break;
+ }
+}
+
+
+
+
+
+
+#endif
diff --git a/CORE/MAC/src/pe/lim/limTypes.h b/CORE/MAC/src/pe/lim/limTypes.h
new file mode 100644
index 0000000..cebffee
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limTypes.h
@@ -0,0 +1,1087 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limTypes.h contains the definitions used by all
+ * all LIM modules.
+ * Author: Chandra Modumudi
+ * Date: 02/11/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+#ifndef __LIM_TYPES_H
+#define __LIM_TYPES_H
+
+#include "wniApi.h"
+#include "sirApi.h"
+#include "sirCommon.h"
+#include "sirMacProtDef.h"
+#include "utilsApi.h"
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halCommonApi.h"
+#endif
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#include "wlan_qct_wdi_ds.h"
+#endif
+
+#include "limApi.h"
+#include "limDebug.h"
+#include "limSendSmeRspMessages.h"
+#include "sysGlobal.h"
+#include "dphGlobal.h"
+#include "parserApi.h"
+
+#define LINK_TEST_DEFER 1
+
+#define TRACE_EVENT_CNF_TIMER_DEACT 0x6600
+#define TRACE_EVENT_CNF_TIMER_ACT 0x6601
+#define TRACE_EVENT_AUTH_RSP_TIMER_DEACT 0x6602
+#define TRACE_EVENT_AUTH_RSP_TIMER_ACT 0x6603
+
+// MLM message types
+#define LIM_MLM_MSG_START 1000
+#define LIM_MLM_SCAN_REQ LIM_MLM_MSG_START
+#define LIM_MLM_SCAN_CNF LIM_MLM_MSG_START + 1
+#define LIM_MLM_START_REQ LIM_MLM_MSG_START + 2
+#define LIM_MLM_START_CNF LIM_MLM_MSG_START + 3
+#define LIM_MLM_JOIN_REQ LIM_MLM_MSG_START + 4
+#define LIM_MLM_JOIN_CNF LIM_MLM_MSG_START + 5
+#define LIM_MLM_AUTH_REQ LIM_MLM_MSG_START + 6
+#define LIM_MLM_AUTH_CNF LIM_MLM_MSG_START + 7
+#define LIM_MLM_AUTH_IND LIM_MLM_MSG_START + 8
+#define LIM_MLM_ASSOC_REQ LIM_MLM_MSG_START + 9
+#define LIM_MLM_ASSOC_CNF LIM_MLM_MSG_START + 10
+#define LIM_MLM_ASSOC_IND LIM_MLM_MSG_START + 11
+#define LIM_MLM_DISASSOC_REQ LIM_MLM_MSG_START + 12
+#define LIM_MLM_DISASSOC_CNF LIM_MLM_MSG_START + 13
+#define LIM_MLM_DISASSOC_IND LIM_MLM_MSG_START + 14
+#define LIM_MLM_REASSOC_REQ LIM_MLM_MSG_START + 15
+#define LIM_MLM_REASSOC_CNF LIM_MLM_MSG_START + 16
+#define LIM_MLM_REASSOC_IND LIM_MLM_MSG_START + 17
+#define LIM_MLM_DEAUTH_REQ LIM_MLM_MSG_START + 18
+#define LIM_MLM_DEAUTH_CNF LIM_MLM_MSG_START + 19
+#define LIM_MLM_DEAUTH_IND LIM_MLM_MSG_START + 20
+#define LIM_MLM_TSPEC_REQ LIM_MLM_MSG_START + 21
+#define LIM_MLM_TSPEC_CNF LIM_MLM_MSG_START + 22
+#define LIM_MLM_TSPEC_IND LIM_MLM_MSG_START + 23
+#define LIM_MLM_SETKEYS_REQ LIM_MLM_MSG_START + 24
+#define LIM_MLM_SETKEYS_CNF LIM_MLM_MSG_START + 25
+#define LIM_MLM_LINK_TEST_STOP_REQ LIM_MLM_MSG_START + 30
+#define LIM_MLM_PURGE_STA_IND LIM_MLM_MSG_START + 31
+#define LIM_MLM_ADDBA_REQ LIM_MLM_MSG_START + 32
+#define LIM_MLM_ADDBA_CNF LIM_MLM_MSG_START + 33
+#define LIM_MLM_ADDBA_IND LIM_MLM_MSG_START + 34
+#define LIM_MLM_ADDBA_RSP LIM_MLM_MSG_START + 35
+#define LIM_MLM_DELBA_REQ LIM_MLM_MSG_START + 36
+#define LIM_MLM_DELBA_CNF LIM_MLM_MSG_START + 37
+#define LIM_MLM_DELBA_IND LIM_MLM_MSG_START + 38
+#define LIM_MLM_REMOVEKEY_REQ LIM_MLM_MSG_START + 39
+#define LIM_MLM_REMOVEKEY_CNF LIM_MLM_MSG_START + 40
+
+
+#define LIM_HASH_ADD 0
+#define LIM_HASH_UPDATE 1
+
+#define LIM_WEP_IN_FC 1
+#define LIM_NO_WEP_IN_FC 0
+
+#define LIM_DECRYPT_ICV_FAIL 1
+
+/// Definitions to distinquish between Association/Reassociaton
+#define LIM_ASSOC 0
+#define LIM_REASSOC 1
+
+/// Minimum Memory blocks require for different scenario
+#define LIM_MIN_MEM_ASSOC 4
+
+/// Verifies whether given mac addr matches the CURRENT Bssid
+#define IS_CURRENT_BSSID(pMac, addr,psessionEntry) (palEqualMemory(pMac->hHdd, addr, \
+ psessionEntry->bssId, \
+ sizeof(psessionEntry->bssId)))
+/// Verifies whether given addr matches the REASSOC Bssid
+#define IS_REASSOC_BSSID(pMac, addr,psessionEntry) (palEqualMemory(pMac->hHdd, addr, \
+ psessionEntry->limReAssocbssId, \
+ sizeof(psessionEntry->limReAssocbssId)))
+
+#define REQ_TYPE_REGISTRAR (0x2)
+#define REQ_TYPE_WLAN_MANAGER_REGISTRAR (0x3)
+
+#define RESP_TYPE_REGISTRAR (0x2)
+#define RESP_TYPE_ENROLLEE_INFO_ONLY (0x0)
+#define RESP_TYPE_ENROLLEE_OPEN_8021X (0x1)
+#define RESP_TYPE_AP (0x3)
+#define LIM_TX_FRAMES_THRESHOLD_ON_CHIP 300
+
+
+// enums used by LIM are as follows
+
+enum eLimDisassocTrigger
+{
+ eLIM_HOST_DISASSOC,
+ eLIM_PEER_ENTITY_DISASSOC,
+ eLIM_LINK_MONITORING_DISASSOC,
+ eLIM_PROMISCUOUS_MODE_DISASSOC,
+ eLIM_HOST_DEAUTH,
+ eLIM_PEER_ENTITY_DEAUTH,
+ eLIM_LINK_MONITORING_DEAUTH,
+ eLIM_JOIN_FAILURE,
+ eLIM_REASSOC_REJECT
+};
+
+/* Reason code to determine the channel change context while sending
+ * WDA_CHNL_SWITCH_REQ message to HAL
+ */
+enum eChannelChangeReasonCodes
+{
+ LIM_SWITCH_CHANNEL_REASSOC,
+ LIM_SWITCH_CHANNEL_JOIN,
+ LIM_SWITCH_CHANNEL_OPERATION, // Generic change channel
+};
+
+typedef struct sLimAuthRspTimeout
+{
+ tSirMacAddr peerMacAddr;
+} tLimAuthRspTimeout;
+
+typedef struct sLimMlmStartReq
+{
+ tSirMacSSid ssId;
+ tSirBssType bssType;
+ tSirMacAddr bssId;
+ tSirMacBeaconInterval beaconPeriod;
+ tANI_U8 dtimPeriod;
+ tSirMacCfParamSet cfParamSet;
+ tSirMacChanNum channelNumber;
+ tAniCBSecondaryMode cbMode;
+ tANI_U16 atimWindow;
+ tSirMacRateSet rateSet;
+ tANI_U8 sessionId; //Added For BT-AMP Support
+
+ // Parameters reqd for new HAL (message) interface
+ tSirNwType nwType;
+ tANI_U8 htCapable;
+ tSirMacHTOperatingMode htOperMode;
+ tANI_U8 dualCTSProtection;
+ tANI_U8 txChannelWidthSet;
+#ifdef WLAN_SOFTAP_FEATURE
+ tANI_U8 ssidHidden;
+ tANI_U8 wps_state;
+ tANI_U8 obssProtEnabled;
+#endif
+} tLimMlmStartReq, *tpLimMlmStartReq;
+
+typedef struct sLimMlmStartCnf
+{
+ tSirResultCodes resultCode;
+ tANI_U8 sessionId;
+} tLimMlmStartCnf, *tpLimMlmStartCnf;
+
+typedef struct sLimMlmScanCnf
+{
+ tSirResultCodes resultCode;
+ tANI_U16 scanResultLength;
+ tSirBssDescription bssDescription[1];
+ tANI_U8 sessionId;
+} tLimMlmScanCnf, *tpLimMlmScanCnf;
+
+typedef struct sLimScanResult
+{
+ tANI_U16 numBssDescriptions;
+ tSirBssDescription bssDescription[1];
+} tLimScanResult;
+
+typedef struct sLimMlmJoinCnf
+{
+ tSirResultCodes resultCode;
+ tANI_U16 protStatusCode;
+ tANI_U8 sessionId;
+} tLimMlmJoinCnf, *tpLimMlmJoinCnf;
+
+typedef struct sLimMlmAssocReq
+{
+ tSirMacAddr peerMacAddr;
+ tANI_U32 assocFailureTimeout;
+ tANI_U16 capabilityInfo;
+ tSirMacListenInterval listenInterval;
+ tANI_U8 sessionId;
+} tLimMlmAssocReq, *tpLimMlmAssocReq;
+
+typedef struct sLimMlmAssocCnf
+{
+ tSirResultCodes resultCode; //Internal status code.
+ tANI_U16 protStatusCode; //Protocol Status code.
+ tANI_U8 sessionId;
+} tLimMlmAssocCnf, *tpLimMlmAssocCnf;
+
+typedef struct sLimMlmAssocInd
+{
+ tSirMacAddr peerMacAddr;
+ tANI_U16 aid;
+ tAniAuthType authType;
+ tAniSSID ssId;
+ tSirRSNie rsnIE;
+ tSirAddie addIE; // additional IE recevied from the peer, which possibly includes WSC IE and/or P2P IE.
+ tSirMacCapabilityInfo capabilityInfo;
+ tAniTitanHtCapabilityInfo titanHtCaps;
+
+ tAniBool spectrumMgtIndicator;
+ tSirMacPowerCapInfo powerCap;
+ tSirSupChnl supportedChannels;
+ tANI_U8 sessionId;
+
+
+#ifdef WLAN_SOFTAP_FEATURE
+ tAniBool WmmStaInfoPresent;
+#endif
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ tANI_U16 seqNum;
+ tAniBool wniIndicator;
+ tAniBool bpIndicator;
+ tSirBpIndicatorType bpType;
+ tSirNwType nwType;
+ tSirAssocType assocType; // Indicates whether STA is LB'ed or not
+ tSirLoad load; // Current load on the radio for LB
+ tANI_U32 numBss; // List received from STA
+ tSirNeighborBssInfo neighborList[1]; // List received from STA
+#endif
+ // Required for indicating the frames to upper layer
+ tANI_U32 beaconLength;
+ tANI_U8* beaconPtr;
+ tANI_U32 assocReqLength;
+ tANI_U8* assocReqPtr;
+} tLimMlmAssocInd, *tpLimMlmAssocInd;
+
+typedef struct sLimMlmReassocReq
+{
+ tSirMacAddr peerMacAddr;
+ tANI_U32 reassocFailureTimeout;
+ tANI_U16 capabilityInfo;
+ tSirMacListenInterval listenInterval;
+ tANI_U8 sessionId;
+} tLimMlmReassocReq, *tpLimMlmReassocReq;
+
+typedef struct sLimMlmReassocCnf
+{
+ tSirResultCodes resultCode;
+ tANI_U16 protStatusCode; //Protocol Status code.
+ tANI_U8 sessionId;
+} tLimMlmReassocCnf, *tpLimMlmReassocCnf;
+
+typedef struct sLimMlmReassocInd
+{
+ tSirMacAddr peerMacAddr;
+ tSirMacAddr currentApAddr;
+ tANI_U16 aid;
+ tAniAuthType authType;
+ tAniSSID ssId;
+ tSirRSNie rsnIE;
+ tSirAddie addIE; // additional IE recevied from the peer, which can be WSC IE and/or P2P IE.
+ tSirMacCapabilityInfo capabilityInfo;
+ tAniTitanHtCapabilityInfo titanHtCaps;
+
+ tAniBool spectrumMgtIndicator;
+ tSirMacPowerCapInfo powerCap;
+ tSirSupChnl supportedChannels;
+
+#ifdef WLAN_SOFTAP_FEATURE
+ tAniBool WmmStaInfoPresent;
+#endif
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ tANI_U16 seqNum;
+ tAniBool wniIndicator;
+ tAniBool bpIndicator;
+ tSirBpIndicatorType bpType;
+ tSirNwType nwType;
+ tSirAssocType reassocType; // Indicates whether STA is LB'ed or not
+ tSirLoad load; // Current load on the radio for LB
+ tANI_U32 numBss; // List received from STA
+ tSirNeighborBssInfo neighborList[1]; // List received from STA
+#endif
+ // Required for indicating the frames to upper layer
+ tANI_U32 beaconLength;
+ tANI_U8* beaconPtr;
+ tANI_U32 assocReqLength;
+ tANI_U8* assocReqPtr;
+} tLimMlmReassocInd, *tpLimMlmReassocInd;
+
+typedef struct sLimMlmAuthCnf
+{
+ tSirMacAddr peerMacAddr;
+ tAniAuthType authType;
+ tSirResultCodes resultCode;
+ tANI_U16 protStatusCode;
+ tANI_U8 sessionId;
+} tLimMlmAuthCnf, *tpLimMlmAuthCnf;
+
+typedef struct sLimMlmAuthInd
+{
+ tSirMacAddr peerMacAddr;
+ tAniAuthType authType;
+ tANI_U8 sessionId;
+} tLimMlmAuthInd, *tpLimMlmAuthInd;
+
+typedef struct sLimMlmDeauthReq
+{
+ tSirMacAddr peerMacAddr;
+ tANI_U16 reasonCode;
+ tANI_U16 deauthTrigger;
+ tANI_U16 aid;
+ tANI_U8 sessionId; //Added for BT-AMP SUPPORT
+
+} tLimMlmDeauthReq, *tpLimMlmDeauthReq;
+
+typedef struct sLimMlmDeauthCnf
+{
+ tSirMacAddr peerMacAddr;
+ tSirResultCodes resultCode;
+ tANI_U16 deauthTrigger;
+ tANI_U16 aid;
+ tANI_U8 sessionId;
+} tLimMlmDeauthCnf, *tpLimMLmDeauthCnf;
+
+typedef struct sLimMlmDeauthInd
+{
+ tSirMacAddr peerMacAddr;
+ tANI_U16 reasonCode;
+ tANI_U16 deauthTrigger;
+ tANI_U16 aid;
+} tLimMlmDeauthInd, *tpLimMlmDeauthInd;
+
+typedef struct sLimMlmDisassocReq
+{
+ tSirMacAddr peerMacAddr;
+ tANI_U16 reasonCode;
+ tANI_U16 disassocTrigger;
+ tANI_U16 aid;
+ tANI_U8 sessionId;
+} tLimMlmDisassocReq, *tpLimMlmDisassocReq;
+
+typedef struct sLimMlmDisassocCnf
+{
+ tSirMacAddr peerMacAddr;
+ tSirResultCodes resultCode;
+ tANI_U16 disassocTrigger;
+ tANI_U16 aid;
+ tANI_U8 sessionId;
+} tLimMlmDisassocCnf, *tpLimMlmDisassocCnf;
+
+typedef struct sLimMlmDisassocInd
+{
+ tSirMacAddr peerMacAddr;
+ tANI_U16 reasonCode;
+ tANI_U16 disassocTrigger;
+ tANI_U16 aid;
+ tANI_U8 sessionId;
+} tLimMlmDisassocInd, *tpLimMlmDisassocInd;
+
+typedef struct sLimMlmPurgeStaReq
+{
+ tSirMacAddr peerMacAddr;
+ tANI_U16 aid;
+ tANI_U8 sessionId;//Added For BT-AMP Support
+} tLimMlmPurgeStaReq, *tpLimMlmPurgeStaReq;
+
+typedef struct sLimMlmPurgeStaInd
+{
+ tSirMacAddr peerMacAddr;
+ tANI_U16 reasonCode;
+ tANI_U16 purgeTrigger;
+ tANI_U16 aid;
+ tANI_U8 sessionId;
+} tLimMlmPurgeStaInd, *tpLimMlmPurgeStaInd;
+
+typedef struct sLimMlmSetKeysReq
+{
+ tSirMacAddr peerMacAddr;
+ tANI_U8 sessionId; //Added For BT-AMP Support
+ tANI_U16 aid;
+ tAniEdType edType; // Encryption/Decryption type
+ tANI_U8 numKeys;
+ tSirKeys key[SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS];
+} tLimMlmSetKeysReq, *tpLimMlmSetKeysReq;
+
+typedef struct sLimMlmSetKeysCnf
+{
+ tSirMacAddr peerMacAddr;
+ tANI_U16 resultCode;
+ tANI_U16 aid;
+ tANI_U8 sessionId;
+} tLimMlmSetKeysCnf, *tpLimMlmSetKeysCnf;
+
+typedef struct sLimMlmRemoveKeyReq
+{
+ tSirMacAddr peerMacAddr;
+ tANI_U8 sessionId; //Added FOr BT-AMP Support
+ tAniEdType edType; // Encryption/Decryption type
+ tANI_U8 wepType; //STATIC / DYNAMIC specifier
+ tANI_U8 keyId; //Key Id To be removed.
+ tANI_BOOLEAN unicast;
+} tLimMlmRemoveKeyReq, *tpLimMlmRemoveKeyReq;
+
+typedef struct sLimMlmRemoveKeyCnf
+{
+ tSirMacAddr peerMacAddr;
+ tANI_U16 resultCode;
+ tANI_U8 sessionId;
+} tLimMlmRemoveKeyCnf, *tpLimMlmRemoveKeyCnf;
+
+
+typedef struct sLimMlmResetReq
+{
+ tSirMacAddr macAddr;
+ tANI_U8 performCleanup;
+ tANI_U8 sessionId;
+} tLimMlmResetReq, *tpLimMlmResetReq;
+
+typedef struct sLimMlmResetCnf
+{
+ tSirMacAddr macAddr;
+ tSirResultCodes resultCode;
+ tANI_U8 sessionId;
+} tLimMlmResetCnf, *tpLimMlmResetCnf;
+
+
+typedef struct sLimMlmLinkTestStopReq
+{
+ tSirMacAddr peerMacAddr;
+ tANI_U8 sessionId;
+#ifdef ANI_PRODUCT_TYPE_AP
+ tANI_U16 aid;
+#endif
+} tLimMlmLinkTestStopReq, *tpLimMlmLinkTestStopReq;
+
+
+//
+// Block ACK related MLME data structures
+//
+
+typedef struct sLimMlmAddBAReq
+{
+
+ // ADDBA recipient
+ tSirMacAddr peerMacAddr;
+
+ // ADDBA Action Frame dialog token
+ tANI_U8 baDialogToken;
+
+ // ADDBA requested for TID
+ tANI_U8 baTID;
+
+ // BA policy
+ // 0 - Delayed BA (Not supported)
+ // 1 - Immediate BA
+ tANI_U8 baPolicy;
+
+ // BA buffer size - (0..127) max size MSDU's
+ tANI_U16 baBufferSize;
+
+ // BA timeout in TU's
+ // 0 means no timeout will occur
+ tANI_U16 baTimeout;
+
+ // ADDBA failure timeout in TU's
+ // Greater than or equal to 1
+ tANI_U16 addBAFailureTimeout;
+
+ // BA Starting Sequence Number
+ tANI_U16 baSSN;
+
+ tANI_U8 sessionId;
+
+} tLimMlmAddBAReq, *tpLimMlmAddBAReq;
+
+typedef struct sLimMlmAddBACnf
+{
+
+ // ADDBA recipient
+ tSirMacAddr peerMacAddr;
+
+ // ADDBA Action Frame dialog token
+ tANI_U8 baDialogToken;
+
+ // ADDBA requested for TID
+ tANI_U8 baTID;
+
+ // BA status code
+ tSirMacStatusCodes addBAResultCode;
+
+ // BA policy
+ // 0 - Delayed BA (Not supported)
+ // 1 - Immediate BA
+ tANI_U8 baPolicy;
+
+ // BA buffer size - (0..127) max size MSDU's
+ tANI_U16 baBufferSize;
+
+ // BA timeout in TU's
+ // 0 means no timeout will occur
+ tANI_U16 baTimeout;
+
+ // ADDBA direction
+ // 1 - Originator
+ // 0 - Recipient
+ tANI_U8 baDirection;
+ tANI_U8 sessionId;
+
+
+} tLimMlmAddBACnf, *tpLimMlmAddBACnf;
+
+typedef struct sLimMlmAddBAInd
+{
+
+ // ADDBA recipient
+ tSirMacAddr peerMacAddr;
+
+ // ADDBA Action Frame dialog token
+ tANI_U8 baDialogToken;
+
+ // ADDBA requested for TID
+ tANI_U8 baTID;
+
+ // BA policy
+ // 0 - Delayed BA (Not supported)
+ // 1 - Immediate BA
+ tANI_U8 baPolicy;
+
+ // BA buffer size - (0..127) max size MSDU's
+ tANI_U16 baBufferSize;
+
+ // BA timeout in TU's
+ // 0 means no timeout will occur
+ tANI_U16 baTimeout;
+
+} tLimMlmAddBAInd, *tpLimMlmAddBAInd;
+
+typedef struct sLimMlmAddBARsp
+{
+
+ // ADDBA recipient
+ tSirMacAddr peerMacAddr;
+
+ // ADDBA Action Frame dialog token
+ tANI_U8 baDialogToken;
+
+ // ADDBA requested for TID
+ tANI_U8 baTID;
+
+ // BA status code
+ tSirMacStatusCodes addBAResultCode;
+
+ // BA policy
+ // 0 - Delayed BA (Not supported)
+ // 1 - Immediate BA
+ tANI_U8 baPolicy;
+
+ // BA buffer size - (0..127) max size MSDU's
+ tANI_U16 baBufferSize;
+
+ // BA timeout in TU's
+ // 0 means no timeout will occur
+ tANI_U16 baTimeout;
+
+ //reserved for alignment
+ tANI_U8 rsvd[2];
+
+ /* PE session id*/
+ tANI_U8 sessionId;
+
+ } tLimMlmAddBARsp, *tpLimMlmAddBARsp;
+
+//
+// NOTE - Overloading DELBA IND and DELBA CNF
+// to use the same data structure as DELBA REQ
+// as the parameters do not vary too much.
+//
+typedef struct sLimMlmDelBAReq
+{
+
+ // ADDBA recipient
+ tSirMacAddr peerMacAddr;
+
+ // DELBA direction
+ // 1 - Originator
+ // 0 - Recipient
+ tANI_U8 baDirection;
+
+ // DELBA requested for TID
+ tANI_U8 baTID;
+
+ // DELBA reason code
+ tSirMacReasonCodes delBAReasonCode;
+
+ tANI_U8 sessionId;
+
+} tLimMlmDelBAReq, *tpLimMlmDelBAReq, tLimMlmDelBAInd, *tpLimMlmDelBAInd, tLimMlmDelBACnf, *tpLimMlmDelBACnf;
+
+// Function templates
+
+tANI_BOOLEAN limProcessSmeReqMessages(tpAniSirGlobal, tpSirMsgQ);
+void limProcessMlmReqMessages(tpAniSirGlobal, tpSirMsgQ);
+void limProcessMlmRspMessages(tpAniSirGlobal, tANI_U32, tANI_U32 *);
+void limProcessLmmMessages(tpAniSirGlobal, tANI_U32, tANI_U32 *);
+void limProcessSmeDelBssRsp( tpAniSirGlobal , tANI_U32,tpPESession);
+
+void limGetRandomBssid(tpAniSirGlobal pMac ,tANI_U8 *data);
+
+// Function to handle CB CFG parameter updates
+void handleCBCFGChange( tpAniSirGlobal pMac, tANI_U32 cfgId );
+
+// Function to handle HT and HT IE CFG parameter intializations
+void handleHTCapabilityandHTInfo(struct sAniSirGlobal *pMac);
+
+// Function to handle CFG parameter updates
+void limHandleCFGparamUpdate(tpAniSirGlobal, tANI_U32);
+
+// Function to apply CFG parameters before join/reassoc/start BSS
+void limApplyConfiguration(tpAniSirGlobal,tpPESession);
+
+#ifdef WLAN_SOFTAP_FEATURE
+void limSetCfgProtection(tpAniSirGlobal pMac, tpPESession pesessionEntry);
+#else
+void limSetCfgProtection(tpAniSirGlobal pMac);
+#endif
+
+
+// Function to Initialize MLM state machine on STA
+void limInitMlm(tpAniSirGlobal);
+
+// Function to cleanup MLM state machine
+void limCleanupMlm(tpAniSirGlobal);
+
+// Function to cleanup LMM state machine
+void limCleanupLmm(tpAniSirGlobal);
+
+
+// Management frame handling functions
+void limProcessBeaconFrame(tpAniSirGlobal, tANI_U8 *,tpPESession);
+void limProcessBeaconFrameNoSession(tpAniSirGlobal, tANI_U8 *);
+void limProcessProbeReqFrame(tpAniSirGlobal, tANI_U8 *, tpPESession);
+void limProcessProbeRspFrame(tpAniSirGlobal, tANI_U8 *, tpPESession);
+void limProcessProbeRspFrameNoSession(tpAniSirGlobal, tANI_U8 *);
+void limProcessProbeReqFrame_multiple_BSS(tpAniSirGlobal, tANI_U8 *,tpPESession);
+
+
+// Process Auth frame when we have a session in progress.
+void limProcessAuthFrame(tpAniSirGlobal, tANI_U8 *,tpPESession);
+#ifdef WLAN_FEATURE_VOWIFI_11R
+int limProcessAuthFrameNoSession(tpAniSirGlobal pMac, tANI_U8 *, void *body);
+#endif
+
+void limProcessAssocReqFrame(tpAniSirGlobal, tANI_U8 *, tANI_U8, tpPESession);
+void limSendMlmAssocInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry);
+
+
+void limProcessAssocRspFrame(tpAniSirGlobal, tANI_U8 *, tANI_U8,tpPESession);
+void limProcessDisassocFrame(tpAniSirGlobal, tANI_U8 *,tpPESession);
+void limProcessDeauthFrame(tpAniSirGlobal, tANI_U8 *,tpPESession);
+void limProcessActionFrame(tpAniSirGlobal, tANI_U8 *,tpPESession);
+#if defined WLAN_FEATURE_P2P
+void limProcessActionFrameNoSession(tpAniSirGlobal pMac, tANI_U8 *pRxMetaInfo);
+#endif
+
+
+tSirRetStatus limPopulateMacHeader(tpAniSirGlobal, tANI_U8*, tANI_U8, tANI_U8, tSirMacAddr,tSirMacAddr);
+tSirRetStatus limSendProbeReqMgmtFrame(tpAniSirGlobal, tSirMacSSid *, tSirMacAddr, tANI_U8, tSirMacAddr, tANI_U32, tANI_U32, tANI_U8 *);
+void limSendProbeRspMgmtFrame(tpAniSirGlobal, tSirMacAddr, tpAniSSID, short, tANI_U8, tpPESession, tANI_U8);
+void limSendAuthMgmtFrame(tpAniSirGlobal, tSirMacAuthFrameBody *, tSirMacAddr, tANI_U8,tpPESession);
+void limSendAssocReqMgmtFrame(tpAniSirGlobal, tLimMlmAssocReq *,tpPESession);
+void limSendReassocReqMgmtFrame(tpAniSirGlobal, tLimMlmReassocReq *,tpPESession);
+#ifdef WLAN_FEATURE_VOWIFI_11R
+void limSendReassocReqWithFTIEsMgmtFrame(tpAniSirGlobal pMac,
+ tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry);
+#endif
+void limSendDeltsReqActionFrame(tpAniSirGlobal pMac, tSirMacAddr peer,
+ tANI_U8 wmmTspecPresent, tSirMacTSInfo *pTsinfo,
+ tSirMacTspecIE *pTspecIe, tpPESession psessionEntry);
+void limSendAddtsReqActionFrame(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
+ tSirAddtsReqInfo *addts,tpPESession);
+void limSendAddtsRspActionFrame(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
+ tANI_U16 statusCode, tSirAddtsReqInfo *addts, tSirMacScheduleIE *pSchedule,tpPESession);
+
+#ifdef ANI_PRODUCT_TYPE_AP
+void limSendAssocRspMgmtFrame(tpAniSirGlobal, tANI_U16, tANI_U16, tSirMacAddr, tANI_U8, tpDphHashNode pSta,tpPESession);
+#endif
+void limSendAssocRspMgmtFrame(tpAniSirGlobal, tANI_U16, tANI_U16, tSirMacAddr, tANI_U8, tpDphHashNode pSta,tpPESession);
+
+void limSendNullDataFrame(tpAniSirGlobal, tpDphHashNode);
+void limSendDisassocMgmtFrame(tpAniSirGlobal, tANI_U16, tSirMacAddr,tpPESession);
+void limSendDeauthMgmtFrame(tpAniSirGlobal, tANI_U16, tSirMacAddr,tpPESession);
+
+void limContinueChannelScan(tpAniSirGlobal);
+tSirResultCodes limMlmAddBss(tpAniSirGlobal, tLimMlmStartReq *,tpPESession psessionEntry);
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+tSirRetStatus limSendChannelSwitchMgmtFrame(tpAniSirGlobal, tSirMacAddr, tANI_U8, tANI_U8, tANI_U8);
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI
+tSirRetStatus limSendNeighborReportRequestFrame(tpAniSirGlobal, tpSirMacNeighborReportReq, tSirMacAddr, tpPESession);
+tSirRetStatus limSendLinkReportActionFrame(tpAniSirGlobal, tpSirMacLinkReport, tSirMacAddr, tpPESession );
+tSirRetStatus limSendRadioMeasureReportActionFrame(tpAniSirGlobal, tANI_U8, tANI_U8, tpSirMacRadioMeasureReport, tSirMacAddr, tpPESession);
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+void limProcessIappFrame(tpAniSirGlobal, tANI_U8 *,tpPESession);
+#endif
+
+// Algorithms & Link Monitoring related functions
+tSirBackgroundScanMode limSelectsBackgroundScanMode(tpAniSirGlobal);
+void limTriggerBackgroundScan(tpAniSirGlobal);
+void limAbortBackgroundScan(tpAniSirGlobal);
+
+/// Function that handles heartbeat failure
+void limHandleHeartBeatFailure(tpAniSirGlobal,tpPESession);
+
+/// Function that triggers link tear down with AP upon HB failure
+void limTearDownLinkWithAp(tpAniSirGlobal,tANI_U8, tSirMacReasonCodes);
+
+#ifdef ANI_PRODUCT_TYPE_AP
+/// Function that performs periodic release of AIDs
+void limReleaseAIDHandler(tpAniSirGlobal);
+
+/// Function that performs periodic cleanup of Pre-auth contexts
+void limPreAuthClnupHandler(tpAniSirGlobal);
+
+/// Function that processes CF-poll response message from SCH
+void limHandleCFpollRsp(tANI_U32);
+
+/// Function that processes PS-poll message from PMM
+void limHandlePSpoll(tANI_U32);
+#endif
+
+/// Function that sends keep alive message to peer(s)
+void limSendKeepAliveToPeer(tpAniSirGlobal);
+
+/// Function that processes Max retries interrupt from TFP
+void limHandleMaxRetriesInterrupt(tANI_U32);
+
+/// Function that processes messages deferred during Learn mode
+void limProcessDeferredMessageQueue(tpAniSirGlobal);
+
+/// Function that defers the messages received
+tANI_U32 limDeferMsg(tpAniSirGlobal, tSirMsgQ *);
+
+/// Function that sets system into scan mode
+void limSetScanMode(tpAniSirGlobal pMac);
+
+/// Function that Switches the Channel and sets the CB Mode
+void limSetChannel(tpAniSirGlobal pMac, tANI_U32 titanHtcap, tANI_U8 channel, tPowerdBm maxTxPower, tANI_U8 peSessionId);
+
+/// Function that completes channel scan
+void limCompleteMlmScan(tpAniSirGlobal, tSirResultCodes);
+
+
+#ifdef ANI_SUPPORT_11H
+/// Function that sends Measurement Report action frame
+tSirRetStatus limSendMeasReportFrame(tpAniSirGlobal, tpSirMacMeasReqActionFrame, tSirMacAddr);
+
+/// Function that sends TPC Report action frame
+tSirRetStatus limSendTpcReportFrame(tpAniSirGlobal, tpSirMacTpcReqActionFrame, tSirMacAddr);
+#endif
+
+/// Function that sends TPC Request action frame
+void limSendTpcRequestFrame(tpAniSirGlobal, tSirMacAddr);
+
+// Function(s) to handle responses received from HAL
+void limProcessMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ );
+void limProcessMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQt,tpPESession psessionEntry);
+void limProcessMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ );
+void limProcessMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession);
+#ifdef ANI_PRODUCT_TYPE_AP
+void limProcessApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ );
+void limProcessApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ );
+void limProcessApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ );
+#endif
+void limProcessStaMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry);
+void limProcessStaMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry);
+void limProcessStaMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry);
+void limProcessMlmSetStaKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ );
+void limProcessMlmSetBssKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ );
+
+
+
+#ifdef GEN4_SCAN
+// Function to process WDA_INIT_SCAN_RSP message
+void limProcessInitScanRsp(tpAniSirGlobal, void * );
+
+// Function to process WDA_START_SCAN_RSP message
+void limProcessStartScanRsp(tpAniSirGlobal, void * );
+
+// Function to process WDA_END_SCAN_RSP message
+void limProcessEndScanRsp(tpAniSirGlobal, void * );
+
+// Function to process WDA_FINISH_SCAN_RSP message
+void limProcessFinishScanRsp(tpAniSirGlobal, void * );
+
+// Function to process WDA_SWITCH_CHANNEL_RSP message
+void limProcessSwitchChannelRsp(tpAniSirGlobal pMac, void * );
+
+void limSendHalInitScanReq( tpAniSirGlobal, tLimLimHalScanState, tSirLinkTrafficCheck);
+void limSendHalStartScanReq( tpAniSirGlobal, tANI_U8, tLimLimHalScanState);
+void limSendHalEndScanReq( tpAniSirGlobal, tANI_U8, tLimLimHalScanState);
+void limSendHalFinishScanReq( tpAniSirGlobal, tLimLimHalScanState);
+
+void limContinuePostChannelScan(tpAniSirGlobal pMac);
+void limContinueChannelLearn( tpAniSirGlobal );
+//WLAN_SUSPEND_LINK Related
+tANI_U8 limIsLinkSuspended(tpAniSirGlobal pMac);
+void limSuspendLink(tpAniSirGlobal, tSirLinkTrafficCheck, SUSPEND_RESUME_LINK_CALLBACK, tANI_U32*);
+void limResumeLink(tpAniSirGlobal, SUSPEND_RESUME_LINK_CALLBACK, tANI_U32*);
+//end WLAN_SUSPEND_LINK Related
+#endif // GEN4_SCAN
+
+tSirRetStatus limSendAddBAReq( tpAniSirGlobal pMac,
+ tpLimMlmAddBAReq pMlmAddBAReq,tpPESession);
+
+tSirRetStatus limSendAddBARsp( tpAniSirGlobal pMac,
+ tpLimMlmAddBARsp pMlmAddBARsp,tpPESession);
+
+tSirRetStatus limSendDelBAInd( tpAniSirGlobal pMac,
+ tpLimMlmDelBAReq pMlmDelBAReq ,tpPESession psessionEntry);
+#if 0
+tSirRetStatus limSendSMPowerStateFrame( tpAniSirGlobal pMac,
+ tSirMacAddr peer, tSirMacHTMIMOPowerSaveState State );
+#endif
+
+void limProcessMlmHalAddBARsp( tpAniSirGlobal pMac,
+ tpSirMsgQ limMsgQ );
+
+void limProcessMlmHalBADeleteInd( tpAniSirGlobal pMac,
+ tpSirMsgQ limMsgQ );
+
+void limProcessMlmRemoveKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ );
+
+void limProcessLearnIntervalTimeout(tpAniSirGlobal pMac);
+#ifdef WLAN_FEATURE_11W
+//11w SA query request action frame handler
+tSirRetStatus limSendSaQueryResponseFrame( tpAniSirGlobal pMac,
+ tANI_U16 transId, tSirMacAddr peer,tpPESession psessionEntry);
+#endif
+// Inline functions
+
+/**
+ * limPostSmeMessage()
+ *
+ *FUNCTION:
+ * This function is called by limProcessMlmMessages(). In this
+ * function MLM sub-module invokes MLM ind/cnf primitives.
+ *
+ *LOGIC:
+ * Initially MLM makes an SME function call to invoke MLM ind/cnf
+ * primitive. In future this can be enhanced to 'post' messages to SME.
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param msgType Indicates the MLM primitive message type
+ * @param *pMsgBuf A pointer to the MLM message buffer
+ *
+ * @return None
+ */
+static inline void
+limPostSmeMessage(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
+{
+ tSirMsgQ msg;
+
+ if(pMsgBuf == NULL)
+ {
+ limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
+ return;
+ }
+
+ msg.type = (tANI_U16)msgType;
+ msg.bodyptr = pMsgBuf;
+ msg.bodyval = 0;
+ if (msgType > eWNI_SME_MSG_TYPES_BEGIN)
+ limProcessSmeReqMessages(pMac, &msg);
+ else
+ limProcessMlmRspMessages(pMac, msgType, pMsgBuf);
+} /*** end limPostSmeMessage() ***/
+
+/**
+ * limPostMlmMessage()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeMessages(). In this
+ * function SME invokes MLME primitives.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ * Initially SME makes an MLM function call to invoke MLM primitive.
+ * In future this can be enhanced to 'post' messages to MLM.
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param msgType Indicates the MLM primitive message type
+ * @param *pMsgBuf A pointer to the MLM message buffer
+ *
+ * @return None
+ */
+static inline void
+limPostMlmMessage(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
+{
+
+ tSirMsgQ msg;
+ if(pMsgBuf == NULL)
+ {
+ limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
+ return;
+ }
+ msg.type = (tANI_U16) msgType;
+ msg.bodyptr = pMsgBuf;
+ msg.bodyval = 0;
+ limProcessMlmReqMessages(pMac, &msg);
+} /*** end limPostMlmMessage() ***/
+
+
+
+/**
+ * limGetCurrentScanChannel()
+ *
+ *FUNCTION:
+ * This function is called in various places to get current channel
+ * number being scanned.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return Channel number
+ */
+static inline tANI_U8
+limGetCurrentScanChannel(tpAniSirGlobal pMac)
+{
+ tANI_U8 *pChanNum = pMac->lim.gpLimMlmScanReq->channelList.channelNumber;
+
+ return (*(pChanNum + pMac->lim.gLimCurrentScanChannelId));
+} /*** end limGetCurrentScanChannel() ***/
+
+
+
+/**
+ * limGetIElenFromBssDescription()
+ *
+ *FUNCTION:
+ * This function is called in various places to get IE length
+ * from tSirBssDescription structure
+ * number being scanned.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pBssDescr
+ * @return Total IE length
+ */
+
+static inline tANI_U16
+limGetIElenFromBssDescription(tpSirBssDescription pBssDescr)
+{
+ if (!pBssDescr)
+ return 0;
+
+ return ((tANI_U16) (pBssDescr->length + sizeof(tANI_U16) +
+ sizeof(tANI_U32) - sizeof(tSirBssDescription)));
+} /*** end limGetIElenFromBssDescription() ***/
+
+#ifdef WLAN_SOFTAP_FEATURE
+/**
+ * limSendBeaconInd()
+ *
+ *FUNCTION:
+ * This function is called to send the beacon indication
+ * number being scanned.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+*/
+
+void
+limSendBeaconInd(tpAniSirGlobal pMac, tpPESession psessionEntry);
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE
+
+void limGetWPSPBCSessions(tpAniSirGlobal pMac, tANI_U8 *addr, tANI_U8 *uuid_e, eWPSPBCOverlap *overlap, tpPESession psessionEntry);
+void limWPSPBCTimeout(tpAniSirGlobal pMac, tpPESession psessionEntry);
+void limWPSPBCClose(tpAniSirGlobal pMac, tpPESession psessionEntry);
+void limRemovePBCSessions(tpAniSirGlobal pMac, tSirMacAddr pRemoveMac,tpPESession psessionEntry);
+
+
+tSirRetStatus
+limIsSmeGetWPSPBCSessionsReqValid(tpAniSirGlobal pMac, tSirSmeGetWPSPBCSessionsReq *pGetWPSPBCSessionsReq, tANI_U8 *pBuf);
+
+#define LIM_WPS_OVERLAP_TIMER_MS 10000
+#endif
+
+void
+limSuspendLink(tpAniSirGlobal pMac, tSirLinkTrafficCheck trafficCheck, SUSPEND_RESUME_LINK_CALLBACK callback, tANI_U32 *data);
+void
+limResumeLink(tpAniSirGlobal pMac, SUSPEND_RESUME_LINK_CALLBACK callback, tANI_U32 *data);
+
+void
+limChangeChannelWithCallback(tpAniSirGlobal pMac, tANI_U8 newChannel,
+ CHANGE_CHANNEL_CALLBACK callback, tANI_U32 *cbdata, tpPESession psessionEntry);
+
+#ifdef WLAN_FEATURE_P2P
+void limSendSmeMgmtFrameInd(
+ tpAniSirGlobal pMac, tANI_U8 frameType,
+ tANI_U8 *frame, tANI_U32 frameLen, tANI_U16 sessionId,
+ tANI_U32 rxChan);
+void limProcessRemainOnChnTimeout(tpAniSirGlobal pMac);
+void limSendP2PActionFrame(tpAniSirGlobal pMac, tpSirMsgQ pMsg);
+void limAbortRemainOnChan(tpAniSirGlobal pMac);
+tSirRetStatus __limProcessSmeNoAUpdate(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf);
+#endif
+#endif /* __LIM_TYPES_H */
+
diff --git a/CORE/MAC/src/pe/lim/limUtils.c b/CORE/MAC/src/pe/lim/limUtils.c
new file mode 100644
index 0000000..976eb3a
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limUtils.c
@@ -0,0 +1,8039 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limUtils.cc contains the utility functions
+ * LIM uses.
+ * Author: Chandra Modumudi
+ * Date: 02/13/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+
+#include "schApi.h"
+#include "limUtils.h"
+#include "limTypes.h"
+#include "limSecurityUtils.h"
+#include "limPropExtsUtils.h"
+#include "limSendMessages.h"
+#include "limSerDesUtils.h"
+#include "limAdmitControl.h"
+#include "limStaHashApi.h"
+#include "dot11f.h"
+#include "wmmApsd.h"
+#include "limTrace.h"
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+#include "vos_diag_core_event.h"
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+#include "limIbssPeerMgmt.h"
+#include "limSessionUtils.h"
+#include "limSession.h"
+#include "vos_nvitem.h"
+
+/* Static global used to mark situations where pMac->lim.gLimTriggerBackgroundScanDuringQuietBss is SET
+ * and limTriggerBackgroundScanDuringQuietBss() returned failure. In this case, we will stop data
+ * traffic instead of going into scan. The recover function limProcessQuietBssTimeout() needs to have
+ * this information. */
+static tAniBool glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
+
+/* 11A Channel list to decode RX BD channel information */
+static const tANI_U8 abChannel[]= {36,40,44,48,52,56,60,64,100,104,108,112,116,
+ 120,124,128,132,136,140,149,153,157,161,165};
+
+//#define LIM_MAX_ACTIVE_SESSIONS 3 //defined temporarily for BT-AMP SUPPORT
+#define SUCCESS 1 //defined temporarily for BT-AMP
+
+/** -------------------------------------------------------------
+\fn limAssignDialogueToken
+\brief Assigns dialogue token.
+\param tpAniSirGlobal pMac
+\return tpDialogueToken - dialogueToken data structure.
+ -------------------------------------------------------------*/
+
+tpDialogueToken
+limAssignDialogueToken(tpAniSirGlobal pMac)
+{
+ static tANI_U8 token = 0;
+ tpDialogueToken pCurrNode;
+ if(eHAL_STATUS_SUCCESS !=
+ palAllocateMemory(pMac->hHdd, (void **) &pCurrNode, sizeof(tDialogueToken)))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory failed\n"));)
+ return NULL;
+ }
+
+ palZeroMemory(pMac->hHdd, (void *) pCurrNode, sizeof(tDialogueToken));
+ //first node in the list is being added.
+ if(NULL == pMac->lim.pDialogueTokenHead)
+ {
+ pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenTail = pCurrNode;
+ }
+ else
+ {
+ pMac->lim.pDialogueTokenTail->next = pCurrNode;
+ pMac->lim.pDialogueTokenTail = pCurrNode;
+ }
+ //assocId and tid of the node will be filled in by caller.
+ pCurrNode->next = NULL;
+ pCurrNode->token = token++;
+ PELOG4(limLog(pMac, LOG4, FL("token assigned = %d\n"), token);)
+ return pCurrNode;
+}
+
+/** -------------------------------------------------------------
+\fn limSearchAndDeleteDialogueToken
+\brief search dialogue token in the list and deletes it if found. returns failure if not found.
+\param tpAniSirGlobal pMac
+\param tANI_U8 token
+\param tANI_U16 assocId
+\param tANI_U16 tid
+\return eSirRetStatus - status of the search
+ -------------------------------------------------------------*/
+
+
+tSirRetStatus
+limSearchAndDeleteDialogueToken(tpAniSirGlobal pMac, tANI_U8 token, tANI_U16 assocId, tANI_U16 tid)
+{
+ tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
+ tpDialogueToken pPrevNode = pMac->lim.pDialogueTokenHead;
+
+ //if the list is empty
+ if(NULL == pCurrNode)
+ return eSIR_FAILURE;
+
+ // if the matching node is the first node.
+ if(pCurrNode &&
+ (assocId == pCurrNode->assocId) &&
+ (tid == pCurrNode->tid))
+ {
+ pMac->lim.pDialogueTokenHead = pCurrNode->next;
+ //there was only one node in the list. So tail pointer also needs to be adjusted.
+ if(NULL == pMac->lim.pDialogueTokenHead)
+ pMac->lim.pDialogueTokenTail = NULL;
+ palFreeMemory(pMac->hHdd, (void *) pCurrNode);
+ return eSIR_SUCCESS;
+ }
+
+ //first node did not match. so move to the next one.
+ pCurrNode = pCurrNode->next;
+ while(NULL != pCurrNode )
+ {
+ if(token == pCurrNode->token)
+ {
+ break;
+ }
+
+ pPrevNode = pCurrNode;
+ pCurrNode = pCurrNode->next;
+ }
+
+ if(pCurrNode &&
+ (assocId == pCurrNode->assocId) &&
+ (tid == pCurrNode->tid))
+ {
+ pPrevNode->next = pCurrNode->next;
+ //if the node being deleted is the last one then we also need to move the tail pointer to the prevNode.
+ if(NULL == pCurrNode->next)
+ pMac->lim.pDialogueTokenTail = pPrevNode;
+ return eSIR_SUCCESS;
+ }
+
+ PELOGW(limLog(pMac, LOGW, FL("LIM does not have matching dialogue token node\n"));)
+ return eSIR_FAILURE;
+
+}
+
+
+/** -------------------------------------------------------------
+\fn limDeleteDialogueTokenList
+\brief deletes the complete lim dialogue token linked list.
+\param tpAniSirGlobal pMac
+\return None
+ -------------------------------------------------------------*/
+void
+limDeleteDialogueTokenList(tpAniSirGlobal pMac)
+{
+ tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
+
+ while(NULL != pMac->lim.pDialogueTokenHead)
+ {
+ pCurrNode = pMac->lim.pDialogueTokenHead;
+ pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenHead->next;
+ palFreeMemory(pMac->hHdd, (void *) pCurrNode);
+ pCurrNode = NULL;
+ }
+ pMac->lim.pDialogueTokenTail = NULL;
+}
+
+void
+limGetBssidFromBD(tpAniSirGlobal pMac, tANI_U8 * pRxPacketInfo, tANI_U8 *bssId, tANI_U32 *pIgnore)
+{
+ tpSirMacDataHdr3a pMh = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
+ *pIgnore = 0;
+
+ if (pMh->fc.toDS == 1 && pMh->fc.fromDS == 0)
+ {
+ palCopyMemory( pMac->hHdd, bssId, pMh->addr1, 6);
+ *pIgnore = 1;
+ }
+ else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 1)
+ {
+ palCopyMemory( pMac->hHdd, bssId, pMh->addr2, 6);
+ *pIgnore = 1;
+ }
+ else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 0)
+ {
+ palCopyMemory( pMac->hHdd, bssId, pMh->addr3, 6);
+ *pIgnore = 0;
+ }
+ else
+ {
+ palCopyMemory( pMac->hHdd, bssId, pMh->addr1, 6);
+ *pIgnore = 1;
+ }
+}
+
+char *
+limMlmStateStr(tLimMlmStates state)
+{
+
+#ifdef FIXME_GEN6
+ switch (state)
+ {
+ case eLIM_MLM_OFFLINE_STATE:
+ return "eLIM_MLM_OFFLINE_STATE\n";
+ case eLIM_MLM_IDLE_STATE:
+ return "eLIM_MLM_IDLE_STATE\n";
+ case eLIM_MLM_WT_PROBE_RESP_STATE:
+ return "eLIM_MLM_WT_PROBE_RESP_STATE\n";
+ case eLIM_MLM_PASSIVE_SCAN_STATE:
+ return "eLIM_MLM_PASSIVE_SCAN_STATE\n";
+ case eLIM_MLM_WT_JOIN_BEACON_STATE:
+ return "eLIM_MLM_WT_JOIN_BEACON_STATE\n";
+ case eLIM_MLM_JOINED_STATE:
+ return "eLIM_MLM_JOINED_STATE\n";
+ case eLIM_MLM_BSS_STARTED_STATE:
+ return "eLIM_MLM_BSS_STARTED_STATE\n";
+ case eLIM_MLM_WT_AUTH_FRAME2_STATE:
+ return "eLIM_MLM_WT_AUTH_FRAME2_STATE\n";
+ case eLIM_MLM_WT_AUTH_FRAME3_STATE:
+ return "eLIM_MLM_WT_AUTH_FRAME3_STATE\n";
+ case eLIM_MLM_WT_AUTH_FRAME4_STATE:
+ return "eLIM_MLM_WT_AUTH_FRAME4_STATE\n";
+ case eLIM_MLM_AUTH_RSP_TIMEOUT_STATE:
+ return "eLIM_MLM_AUTH_RSP_TIMEOUT_STATE\n";
+ case eLIM_MLM_AUTHENTICATED_STATE:
+ return "eLIM_MLM_AUTHENTICATED_STATE\n";
+ case eLIM_MLM_WT_ASSOC_RSP_STATE:
+ return "eLIM_MLM_WT_ASSOC_RSP_STATE\n";
+ case eLIM_MLM_WT_REASSOC_RSP_STATE:
+ return "eLIM_MLM_WT_REASSOC_RSP_STATE\n";
+ case eLIM_MLM_WT_FT_REASSOC_RSP_STATE:
+ return "eLIM_MLM_WT_FT_REASSOC_RSP_STATE";
+ case eLIM_MLM_WT_DEL_STA_RSP_STATE:
+ return "eLIM_MLM_WT_DEL_STA_RSP_STATE\n";
+ case eLIM_MLM_WT_DEL_BSS_RSP_STATE:
+ return "eLIM_MLM_WT_DEL_BSS_RSP_STATE\n";
+ case eLIM_MLM_WT_ADD_STA_RSP_STATE:
+ return "eLIM_MLM_WT_ADD_STA_RSP_STATE\n";
+ case eLIM_MLM_WT_ADD_BSS_RSP_STATE:
+ return "eLIM_MLM_WT_ADD_BSS_RSP_STATE\n";
+ case eLIM_MLM_REASSOCIATED_STATE:
+ return "eLIM_MLM_REASSOCIATED_STATE\n";
+ case eLIM_MLM_LINK_ESTABLISHED_STATE:
+ return "eLIM_MLM_LINK_ESTABLISHED_STATE\n";
+ case eLIM_MLM_WT_ASSOC_CNF_STATE:
+ return "eLIM_MLM_WT_ASSOC_CNF_STATE\n";
+ case eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE:
+ return "eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE\n";
+ case eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE:
+ return "eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE\n";
+ case eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE:
+ return "eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE";
+ case eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE:
+ return "eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE\n";
+ case eLIM_MLM_WT_SET_BSS_KEY_STATE:
+ return "eLIM_MLM_WT_SET_BSS_KEY_STATE\n";
+ case eLIM_MLM_WT_SET_STA_KEY_STATE:
+ return "eLIM_MLM_WT_SET_STA_KEY_STATE\n";
+ default:
+ return "INVALID MLM state\n";
+ }
+#endif
+return "";
+}
+
+void
+limPrintMlmState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimMlmStates state)
+{
+ limLog(pMac, logLevel, limMlmStateStr(state));
+}
+
+char *
+limSmeStateStr(tLimSmeStates state)
+{
+#ifdef FIXME_GEN6
+ switch (state)
+ {
+ case eLIM_SME_OFFLINE_STATE:
+ return "eLIM_SME_OFFLINE_STATE\n";
+ case eLIM_SME_IDLE_STATE:
+ return "eLIM_SME_IDLE_STATE\n";
+ case eLIM_SME_SUSPEND_STATE:
+ return "eLIM_SME_SUSPEND_STATE\n";
+ case eLIM_SME_WT_SCAN_STATE:
+ return "eLIM_SME_WT_SCAN_STATE\n";
+ case eLIM_SME_WT_JOIN_STATE:
+ return "eLIM_SME_WT_JOIN_STATE\n";
+ case eLIM_SME_WT_AUTH_STATE:
+ return "eLIM_SME_WT_AUTH_STATE\n";
+ case eLIM_SME_WT_ASSOC_STATE:
+ return "eLIM_SME_WT_ASSOC_STATE\n";
+ case eLIM_SME_WT_REASSOC_STATE:
+ return "eLIM_SME_WT_REASSOC_STATE\n";
+ case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
+ return "eLIM_SME_WT_REASSOC_LINK_FAIL_STATE\n";
+ case eLIM_SME_JOIN_FAILURE_STATE:
+ return "eLIM_SME_JOIN_FAILURE_STATE\n";
+ case eLIM_SME_ASSOCIATED_STATE:
+ return "eLIM_SME_ASSOCIATED_STATE\n";
+ case eLIM_SME_REASSOCIATED_STATE:
+ return "eLIM_SME_REASSOCIATED_STATE\n";
+ case eLIM_SME_LINK_EST_STATE:
+ return "eLIM_SME_LINK_EST_STATE\n";
+ case eLIM_SME_LINK_EST_WT_SCAN_STATE:
+ return "eLIM_SME_LINK_EST_WT_SCAN_STATE\n";
+ case eLIM_SME_WT_PRE_AUTH_STATE:
+ return "eLIM_SME_WT_PRE_AUTH_STATE\n";
+ case eLIM_SME_WT_DISASSOC_STATE:
+ return "eLIM_SME_WT_DISASSOC_STATE\n";
+ case eLIM_SME_WT_DEAUTH_STATE:
+ return "eLIM_SME_WT_DEAUTH_STATE\n";
+ case eLIM_SME_WT_START_BSS_STATE:
+ return "eLIM_SME_WT_START_BSS_STATE\n";
+ case eLIM_SME_WT_STOP_BSS_STATE:
+ return "eLIM_SME_WT_STOP_BSS_STATE\n";
+ case eLIM_SME_NORMAL_STATE:
+ return "eLIM_SME_NORMAL_STATE\n";
+ case eLIM_SME_CHANNEL_SCAN_STATE:
+ return "eLIM_SME_CHANNEL_SCAN_STATE\n";
+ case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
+ return "eLIM_SME_NORMAL_CHANNEL_SCAN_STATE\n";
+ default:
+ return "INVALID SME state\n";
+ }
+#endif
+return "";
+}
+
+
+char* limDot11ModeStr(tpAniSirGlobal pMac, tANI_U8 dot11Mode)
+{
+#ifdef FIXME_GEN6
+
+ switch(dot11Mode)
+ {
+ case WNI_CFG_DOT11_MODE_ALL:
+ return "ALL\n";
+ case WNI_CFG_DOT11_MODE_11A:
+ return "11A\n";
+ case WNI_CFG_DOT11_MODE_11B:
+ return "11B\n";
+ case WNI_CFG_DOT11_MODE_11G:
+ return "11G\n";
+ case WNI_CFG_DOT11_MODE_11N:
+ return "11N\n";
+ case WNI_CFG_DOT11_MODE_POLARIS:
+ return "Polaris\n";
+ case WNI_CFG_DOT11_MODE_TITAN:
+ return "Titan\n";
+ case WNI_CFG_DOT11_MODE_TAURUS:
+ return "Taurus\n";
+ default:
+ return "Invalid Dot11 Mode\n";
+ }
+#endif
+return "";
+}
+
+
+char* limStaOpRateModeStr(tStaRateMode opRateMode)
+{
+#ifdef FIXME_GEN6
+
+ switch(opRateMode)
+ {
+ case eSTA_TAURUS:
+ return "Taurus\n";
+ case eSTA_11a:
+ return "11A\n";
+ case eSTA_11b:
+ return "11B\n";
+ case eSTA_11bg:
+ return "11G\n";
+ case eSTA_11n:
+ return "11N\n";
+ case eSTA_POLARIS:
+ return "Polaris\n";
+ case eSTA_TITAN:
+ return "Titan\n";
+ default:
+ return "Invalid Dot11 Mode\n";
+ }
+#endif
+return "";
+}
+
+char* limBssTypeStr(tSirBssType bssType)
+{
+ switch(bssType)
+ {
+ case eSIR_INFRASTRUCTURE_MODE:
+ return "eSIR_INFRASTRUCTURE_MODE";
+ case eSIR_IBSS_MODE:
+ return "eSIR_IBSS_MODE";
+ case eSIR_BTAMP_STA_MODE:
+ return "eSIR_BTAMP_STA_MODE";
+ case eSIR_BTAMP_AP_MODE:
+ return "eSIR_BTAMP_AP_MODE";
+ case eSIR_AUTO_MODE:
+ return "eSIR_AUTO_MODE";
+ default:
+ return "Invalid BSS Type";
+ }
+}
+
+void
+limPrintSmeState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimSmeStates state)
+{
+ limLog(pMac, logLevel, limSmeStateStr(state));
+}
+
+char *limMsgStr(tANI_U32 msgType)
+{
+#ifdef FIXME_GEN6
+ switch (msgType)
+ {
+ case eWNI_SME_START_REQ:
+ return "eWNI_SME_START_REQ\n";
+ case eWNI_SME_START_RSP:
+ return "eWNI_SME_START_RSP\n";
+ case eWNI_SME_SYS_READY_IND:
+ return "eWNI_SME_SYS_READY_IND\n";
+ case eWNI_SME_SCAN_REQ:
+ return "eWNI_SME_SCAN_REQ\n";
+ case eWNI_SME_SCAN_RSP:
+ return "eWNI_SME_SCAN_RSP\n";
+ case eWNI_SME_JOIN_REQ:
+ return "eWNI_SME_JOIN_REQ\n";
+ case eWNI_SME_JOIN_RSP:
+ return "eWNI_SME_JOIN_RSP\n";
+ case eWNI_SME_SETCONTEXT_REQ:
+ return "eWNI_SME_SETCONTEXT_REQ\n";
+ case eWNI_SME_SETCONTEXT_RSP:
+ return "eWNI_SME_SETCONTEXT_RSP\n";
+ case eWNI_SME_REASSOC_REQ:
+ return "eWNI_SME_REASSOC_REQ\n";
+ case eWNI_SME_REASSOC_RSP:
+ return "eWNI_SME_REASSOC_RSP\n";
+ case eWNI_SME_AUTH_REQ:
+ return "eWNI_SME_AUTH_REQ\n";
+ case eWNI_SME_AUTH_RSP:
+ return "eWNI_SME_AUTH_RSP\n";
+ case eWNI_SME_DISASSOC_REQ:
+ return "eWNI_SME_DISASSOC_REQ\n";
+ case eWNI_SME_DISASSOC_RSP:
+ return "eWNI_SME_DISASSOC_RSP\n";
+ case eWNI_SME_DISASSOC_IND:
+ return "eWNI_SME_DISASSOC_IND\n";
+ case eWNI_SME_DISASSOC_CNF:
+ return "eWNI_SME_DISASSOC_CNF\n";
+ case eWNI_SME_DEAUTH_REQ:
+ return "eWNI_SME_DEAUTH_REQ\n";
+ case eWNI_SME_DEAUTH_RSP:
+ return "eWNI_SME_DEAUTH_RSP\n";
+ case eWNI_SME_DEAUTH_IND:
+ return "eWNI_SME_DEAUTH_IND\n";
+ case eWNI_SME_WM_STATUS_CHANGE_NTF:
+ return "eWNI_SME_WM_STATUS_CHANGE_NTF\n";
+ case eWNI_SME_START_BSS_REQ:
+ return "eWNI_SME_START_BSS_REQ\n";
+ case eWNI_SME_START_BSS_RSP:
+ return "eWNI_SME_START_BSS_RSP\n";
+ case eWNI_SME_AUTH_IND:
+ return "eWNI_SME_AUTH_IND\n";
+ case eWNI_SME_ASSOC_IND:
+ return "eWNI_SME_ASSOC_IND\n";
+ case eWNI_SME_ASSOC_CNF:
+ return "eWNI_SME_ASSOC_CNF\n";
+ case eWNI_SME_REASSOC_IND:
+ return "eWNI_SME_REASSOC_IND\n";
+ case eWNI_SME_REASSOC_CNF:
+ return "eWNI_SME_REASSOC_CNF\n";
+ case eWNI_SME_SWITCH_CHL_REQ:
+ return "eWNI_SME_SWITCH_CHL_REQ\n";
+ case eWNI_SME_SWITCH_CHL_RSP:
+ return "eWNI_SME_SWITCH_CHL_RSP\n";
+ case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
+ return "eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ\n";
+ case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
+ return "eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ\n";
+ case eWNI_SME_STOP_BSS_REQ:
+ return "eWNI_SME_STOP_BSS_REQ\n";
+ case eWNI_SME_STOP_BSS_RSP:
+ return "eWNI_SME_STOP_BSS_RSP\n";
+ case eWNI_SME_PROMISCUOUS_MODE_REQ:
+ return "eWNI_SME_PROMISCUOUS_MODE_REQ\n";
+ case eWNI_SME_PROMISCUOUS_MODE_RSP:
+ return "eWNI_SME_PROMISCUOUS_MODE_RSP\n";
+ case eWNI_SME_NEIGHBOR_BSS_IND:
+ return "eWNI_SME_NEIGHBOR_BSS_IND\n";
+ case eWNI_SME_MEASUREMENT_REQ:
+ return "eWNI_SME_MEASUREMENT_REQ\n";
+ case eWNI_SME_MEASUREMENT_RSP:
+ return "eWNI_SME_MEASUREMENT_RSP\n";
+ case eWNI_SME_MEASUREMENT_IND:
+ return "eWNI_SME_MEASUREMENT_IND\n";
+ case eWNI_SME_SET_WDS_INFO_REQ:
+ return "eWNI_SME_SET_WDS_INFO_REQ\n";
+ case eWNI_SME_SET_WDS_INFO_RSP:
+ return "eWNI_SME_SET_WDS_INFO_RSP\n";
+ case eWNI_SME_WDS_INFO_IND:
+ return "eWNI_SME_WDS_INFO_IND\n";
+ case eWNI_SME_DEAUTH_CNF:
+ return "eWNI_SME_DEAUTH_CNF\n";
+ case eWNI_SME_MIC_FAILURE_IND:
+ return "eWNI_SME_MIC_FAILURE_IND\n";
+ case eWNI_SME_ADDTS_REQ:
+ return "eWNI_SME_ADDTS_REQ\n";
+ case eWNI_SME_ADDTS_RSP:
+ return "eWNI_SME_ADDTS_RSP\n";
+ case eWNI_SME_ADDTS_CNF:
+ return "eWNI_SME_ADDTS_CNF\n";
+ case eWNI_SME_ADDTS_IND:
+ return "eWNI_SME_ADDTS_IND\n";
+ case eWNI_SME_DELTS_REQ:
+ return "eWNI_SME_DELTS_REQ\n";
+ case eWNI_SME_DELTS_RSP:
+ return "eWNI_SME_DELTS_RSP\n";
+ case eWNI_SME_DELTS_IND:
+ return "eWNI_SME_DELTS_IND\n";
+
+ case SIR_LIM_RESUME_ACTIVITY_NTF:
+ return "SIR_LIM_RESUME_ACTIVITY_NTF\n";
+ case SIR_LIM_SUSPEND_ACTIVITY_REQ:
+ return "SIR_LIM_SUSPEND_ACTIVITY_REQ\n";
+ case WDA_SUSPEND_ACTIVITY_RSP:
+ return "WDA_SUSPEND_ACTIVITY_RSP\n";
+ case SIR_LIM_RETRY_INTERRUPT_MSG:
+ return "SIR_LIM_RETRY_INTERRUPT_MSG\n";
+ case SIR_BB_XPORT_MGMT_MSG:
+ return "SIR_BB_XPORT_MGMT_MSG\n";
+ case SIR_LIM_INV_KEY_INTERRUPT_MSG:
+ return "SIR_LIM_INV_KEY_INTERRUPT_MSG\n";
+ case SIR_LIM_KEY_ID_INTERRUPT_MSG:
+ return "SIR_LIM_KEY_ID_INTERRUPT_MSG\n";
+ case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
+ return "SIR_LIM_REPLAY_THRES_INTERRUPT_MSG\n";
+ case SIR_LIM_MIN_CHANNEL_TIMEOUT:
+ return "SIR_LIM_MIN_CHANNEL_TIMEOUT\n";
+ case SIR_LIM_MAX_CHANNEL_TIMEOUT:
+ return "SIR_LIM_MAX_CHANNEL_TIMEOUT\n";
+ case SIR_LIM_JOIN_FAIL_TIMEOUT:
+ return "SIR_LIM_JOIN_FAIL_TIMEOUT\n";
+ case SIR_LIM_AUTH_FAIL_TIMEOUT:
+ return "SIR_LIM_AUTH_FAIL_TIMEOUT\n";
+ case SIR_LIM_AUTH_RSP_TIMEOUT:
+ return "SIR_LIM_AUTH_RSP_TIMEOUT\n";
+ case SIR_LIM_ASSOC_FAIL_TIMEOUT:
+ return "SIR_LIM_ASSOC_FAIL_TIMEOUT\n";
+ case SIR_LIM_REASSOC_FAIL_TIMEOUT:
+ return "SIR_LIM_REASSOC_FAIL_TIMEOUT\n";
+ case SIR_LIM_HEART_BEAT_TIMEOUT:
+ return "SIR_LIM_HEART_BEAT_TIMEOUT\n";
+#ifdef ANI_PRODUCT_TYPE_AP
+ case SIR_LIM_PREAUTH_CLNUP_TIMEOUT:
+ return "SIR_LIM_PREAUTH_CLNUP_TIMEOUT\n";
+#endif
+ case SIR_LIM_ADDTS_RSP_TIMEOUT:
+ return "SIR_LIM_ADDTS_RSP_TIMEOUT\n";
+ case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
+ return "SIR_LIM_CHANNEL_SCAN_TIMEOUT\n";
+#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+ case SIR_LIM_MEASUREMENT_IND_TIMEOUT:
+ return "SIR_LIM_MEASUREMENT_IND_TIMEOUT\n";
+ case SIR_LIM_LEARN_INTERVAL_TIMEOUT:
+ return "SIR_LIM_LEARN_INTERVAL_TIMEOUT\n";
+ case SIR_LIM_LEARN_DURATION_TIMEOUT:
+ return "SIR_LIM_LEARN_DURATION_TIMEOUT\n";
+#endif
+ case SIR_LIM_LINK_TEST_DURATION_TIMEOUT:
+ return "SIR_LIM_LINK_TEST_DURATION_TIMEOUT\n";
+ case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
+ return "SIR_LIM_HASH_MISS_THRES_TIMEOUT\n";
+ case SIR_LIM_KEEPALIVE_TIMEOUT:
+ return "SIR_LIM_KEEPALIVE_TIMEOUT\n";
+ case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
+ return "SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT\n";
+ case SIR_LIM_CNF_WAIT_TIMEOUT:
+ return "SIR_LIM_CNF_WAIT_TIMEOUT\n";
+ case SIR_LIM_RADAR_DETECT_IND:
+ return "SIR_LIM_RADAR_DETECT_IND\n";
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
+ return "SIR_LIM_FT_PREAUTH_RSP_TIMEOUT\n";
+#endif
+
+ case SIR_HAL_APP_SETUP_NTF:
+ return "SIR_HAL_APP_SETUP_NTF\n";
+ case SIR_HAL_INITIAL_CAL_FAILED_NTF:
+ return "SIR_HAL_INITIAL_CAL_FAILED_NTF\n";
+ case SIR_HAL_NIC_OPER_NTF:
+ return "SIR_HAL_NIC_OPER_NTF\n";
+ case SIR_HAL_INIT_START_REQ:
+ return "SIR_HAL_INIT_START_REQ\n";
+ case SIR_HAL_SHUTDOWN_REQ:
+ return "SIR_HAL_SHUTDOWN_REQ\n";
+ case SIR_HAL_SHUTDOWN_CNF:
+ return "SIR_HAL_SHUTDOWN_CNF\n";
+ case SIR_HAL_RESET_REQ:
+ return "SIR_HAL_RESET_REQ\n";
+ case SIR_HAL_RESET_CNF:
+ return "SIR_HAL_RESET_CNF\n";
+ case SIR_WRITE_TO_TD:
+ return "SIR_WRITE_TO_TD\n";
+
+ case WNI_CFG_PARAM_UPDATE_IND:
+ return "WNI_CFG_PARAM_UPDATE_IND\n";
+ case WNI_CFG_DNLD_REQ:
+ return "WNI_CFG_DNLD_REQ\n";
+ case WNI_CFG_DNLD_CNF:
+ return "WNI_CFG_DNLD_CNF\n";
+ case WNI_CFG_GET_RSP:
+ return "WNI_CFG_GET_RSP\n";
+ case WNI_CFG_SET_CNF:
+ return "WNI_CFG_SET_CNF\n";
+ case WNI_CFG_GET_ATTRIB_RSP:
+ return "WNI_CFG_GET_ATTRIB_RSP\n";
+ case WNI_CFG_ADD_GRP_ADDR_CNF:
+ return "WNI_CFG_ADD_GRP_ADDR_CNF\n";
+ case WNI_CFG_DEL_GRP_ADDR_CNF:
+ return "WNI_CFG_DEL_GRP_ADDR_CNF\n";
+ case ANI_CFG_GET_RADIO_STAT_RSP:
+ return "ANI_CFG_GET_RADIO_STAT_RSP\n";
+ case ANI_CFG_GET_PER_STA_STAT_RSP:
+ return "ANI_CFG_GET_PER_STA_STAT_RSP\n";
+ case ANI_CFG_GET_AGG_STA_STAT_RSP:
+ return "ANI_CFG_GET_AGG_STA_STAT_RSP\n";
+ case ANI_CFG_CLEAR_STAT_RSP:
+ return "ANI_CFG_CLEAR_STAT_RSP\n";
+ case WNI_CFG_DNLD_RSP:
+ return "WNI_CFG_DNLD_RSP\n";
+ case WNI_CFG_GET_REQ:
+ return "WNI_CFG_GET_REQ\n";
+ case WNI_CFG_SET_REQ:
+ return "WNI_CFG_SET_REQ\n";
+ case WNI_CFG_SET_REQ_NO_RSP:
+ return "WNI_CFG_SET_REQ_NO_RSP\n";
+ case eWNI_PMC_ENTER_IMPS_RSP:
+ return "eWNI_PMC_ENTER_IMPS_RSP\n";
+ case eWNI_PMC_EXIT_IMPS_RSP:
+ return "eWNI_PMC_EXIT_IMPS_RSP\n";
+ case eWNI_PMC_ENTER_BMPS_RSP:
+ return "eWNI_PMC_ENTER_BMPS_RSP\n";
+ case eWNI_PMC_EXIT_BMPS_RSP:
+ return "eWNI_PMC_EXIT_BMPS_RSP\n";
+ case eWNI_PMC_EXIT_BMPS_IND:
+ return "eWNI_PMC_EXIT_BMPS_IND\n";
+ default:
+ return "INVALID SME message\n";
+ }
+#endif
+return "";
+}
+
+
+
+char *limResultCodeStr(tSirResultCodes resultCode)
+{
+#ifdef FIXME_GEN6
+ switch (resultCode)
+ {
+ case eSIR_SME_SUCCESS:
+ return "eSIR_SME_SUCCESS\n";
+ case eSIR_EOF_SOF_EXCEPTION:
+ return "eSIR_EOF_SOF_EXCEPTION\n";
+ case eSIR_BMU_EXCEPTION:
+ return "eSIR_BMU_EXCEPTION\n";
+ case eSIR_LOW_PDU_EXCEPTION:
+ return "eSIR_LOW_PDU_EXCEPTION\n";
+ case eSIR_USER_TRIG_RESET:
+ return"eSIR_USER_TRIG_RESET\n";
+ case eSIR_LOGP_EXCEPTION:
+ return "eSIR_LOGP_EXCEPTION\n";
+ case eSIR_CP_EXCEPTION:
+ return "eSIR_CP_EXCEPTION\n";
+ case eSIR_STOP_BSS:
+ return "eSIR_STOP_BSS\n";
+ case eSIR_AHB_HANG_EXCEPTION:
+ return "eSIR_AHB_HANG_EXCEPTION\n";
+ case eSIR_DPU_EXCEPTION:
+ return "eSIR_DPU_EXCEPTION\n";
+ case eSIR_RXP_EXCEPTION:
+ return "eSIR_RXP_EXCEPTION\n";
+ case eSIR_MCPU_EXCEPTION:
+ return "eSIR_MCPU_EXCEPTION\n";
+ case eSIR_MCU_EXCEPTION:
+ return "eSIR_MCU_EXCEPTION\n";
+ case eSIR_MTU_EXCEPTION:
+ return "eSIR_MTU_EXCEPTION\n";
+ case eSIR_MIF_EXCEPTION:
+ return "eSIR_MIF_EXCEPTION\n";
+ case eSIR_FW_EXCEPTION:
+ return "eSIR_FW_EXCEPTION\n";
+ case eSIR_MAILBOX_SANITY_CHK_FAILED:
+ return "eSIR_MAILBOX_SANITY_CHK_FAILED\n";
+ case eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF:
+ return "eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF\n";
+ case eSIR_CFB_FLAG_STUCK_EXCEPTION:
+ return "eSIR_CFB_FLAG_STUCK_EXCEPTION\n";
+ case eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS:
+ return "eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS\n";
+ case eSIR_SME_INVALID_PARAMETERS:
+ return "eSIR_SME_INVALID_PARAMETERS\n";
+ case eSIR_SME_UNEXPECTED_REQ_RESULT_CODE:
+ return "eSIR_SME_UNEXPECTED_REQ_RESULT_CODE\n";
+ case eSIR_SME_RESOURCES_UNAVAILABLE:
+ return "eSIR_SME_RESOURCES_UNAVAILABLE\n";
+ case eSIR_SME_SCAN_FAILED:
+ return "eSIR_SME_SCAN_FAILED\n";
+ case eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED:
+ return "eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED\n";
+ case eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE:
+ return "eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE\n";
+ case eSIR_SME_REFUSED:
+ return "eSIR_SME_REFUSED\n";
+ case eSIR_SME_JOIN_TIMEOUT_RESULT_CODE:
+ return "eSIR_SME_JOIN_TIMEOUT_RESULT_CODE\n";
+ case eSIR_SME_AUTH_TIMEOUT_RESULT_CODE:
+ return "eSIR_SME_AUTH_TIMEOUT_RESULT_CODE\n";
+ case eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE:
+ return "eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE\n";
+ case eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE:
+ return "eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE\n";
+ case eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED:
+ return "eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED\n";
+ case eSIR_SME_AUTH_REFUSED:
+ return "eSIR_SME_AUTH_REFUSED\n";
+ case eSIR_SME_INVALID_WEP_DEFAULT_KEY:
+ return "eSIR_SME_INVALID_WEP_DEFAULT_KEY\n";
+ case eSIR_SME_ASSOC_REFUSED:
+ return "eSIR_SME_ASSOC_REFUSED\n";
+ case eSIR_SME_REASSOC_REFUSED:
+ return "eSIR_SME_REASSOC_REFUSED\n";
+ case eSIR_SME_STA_NOT_AUTHENTICATED:
+ return "eSIR_SME_STA_NOT_AUTHENTICATED\n";
+ case eSIR_SME_STA_NOT_ASSOCIATED:
+ return "eSIR_SME_STA_NOT_ASSOCIATED\n";
+ case eSIR_SME_STA_DISASSOCIATED:
+ return "eSIR_SME_STA_DISASSOCIATED\n";
+ case eSIR_SME_ALREADY_JOINED_A_BSS:
+ return "eSIR_SME_ALREADY_JOINED_A_BSS\n";
+ case eSIR_ULA_COMPLETED:
+ return "eSIR_ULA_COMPLETED\n";
+ case eSIR_ULA_FAILURE:
+ return "eSIR_ULA_FAILURE\n";
+ case eSIR_SME_LINK_ESTABLISHED:
+ return "eSIR_SME_LINK_ESTABLISHED\n";
+ case eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS:
+ return "eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS\n";
+ case eSIR_SME_UNABLE_TO_PERFORM_DFS:
+ return "eSIR_SME_UNABLE_TO_PERFORM_DFS\n";
+ case eSIR_SME_DFS_FAILED:
+ return "eSIR_SME_DFS_FAILED\n";
+ case eSIR_SME_TRANSFER_STA:
+ return "eSIR_SME_TRANSFER_STA\n";
+ case eSIR_SME_INVALID_LINK_TEST_PARAMETERS:
+ return "eSIR_SME_INVALID_LINK_TEST_PARAMETERS\n";
+ case eSIR_SME_LINK_TEST_MAX_EXCEEDED:
+ return "eSIR_SME_LINK_TEST_MAX_EXCEEDED\n";
+ case eSIR_SME_UNSUPPORTED_RATE:
+ return "eSIR_SME_UNSUPPORTED_RATE\n";
+ case eSIR_SME_LINK_TEST_TIMEOUT:
+ return "eSIR_SME_LINK_TEST_TIMEOUT\n";
+ case eSIR_SME_LINK_TEST_COMPLETE:
+ return "eSIR_SME_LINK_TEST_COMPLETE\n";
+ case eSIR_SME_LINK_TEST_INVALID_STATE:
+ return "eSIR_SME_LINK_TEST_INVALID_STATE\n";
+ case eSIR_SME_LINK_TEST_INVALID_ADDRESS:
+ return "eSIR_SME_LINK_TEST_INVALID_ADDRESS\n";
+ case eSIR_SME_POLARIS_RESET:
+ return "eSIR_SME_POLARIS_RESET\n";
+ case eSIR_SME_SETCONTEXT_FAILED:
+ return "eSIR_SME_SETCONTEXT_FAILED\n";
+ case eSIR_SME_BSS_RESTART:
+ return "eSIR_SME_BSS_RESTART\n";
+ case eSIR_SME_MORE_SCAN_RESULTS_FOLLOW:
+ return "eSIR_SME_MORE_SCAN_RESULTS_FOLLOW\n";
+ case eSIR_SME_INVALID_ASSOC_RSP_RXED:
+ return "eSIR_SME_INVALID_ASSOC_RSP_RXED\n";
+ case eSIR_SME_MIC_COUNTER_MEASURES:
+ return "eSIR_SME_MIC_COUNTER_MEASURES\n";
+ case eSIR_SME_ADDTS_RSP_TIMEOUT:
+ return "eSIR_SME_ADDTS_RSP_TIMEOUT\n";
+ case eSIR_SME_RECEIVED:
+ return "eSIR_SME_RECEIVED\n";
+ case eSIR_SME_CHANNEL_SWITCH_FAIL:
+ return "eSIR_SME_CHANNEL_SWITCH_FAIL\n";
+#ifdef GEN4_SCAN
+ case eSIR_SME_CHANNEL_SWITCH_DISABLED:
+ return "eSIR_SME_CHANNEL_SWITCH_DISABLED\n";
+ case eSIR_SME_HAL_SCAN_INIT_FAILED:
+ return "eSIR_SME_HAL_SCAN_INIT_FAILED\n";
+ case eSIR_SME_HAL_SCAN_START_FAILED:
+ return "eSIR_SME_HAL_SCAN_START_FAILED\n";
+ case eSIR_SME_HAL_SCAN_END_FAILED:
+ return "eSIR_SME_HAL_SCAN_END_FAILED\n";
+ case eSIR_SME_HAL_SCAN_FINISH_FAILED:
+ return "eSIR_SME_HAL_SCAN_FINISH_FAILED\n";
+ case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
+ return "eSIR_SME_HAL_SEND_MESSAGE_FAIL\n";
+#else // GEN4_SCAN
+ case eSIR_SME_CHANNEL_SWITCH_DISABLED:
+ return "eSIR_SME_CHANNEL_SWITCH_DISABLED\n";
+ case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
+ return "eSIR_SME_HAL_SEND_MESSAGE_FAIL\n";
+#endif // GEN4_SCAN
+
+ default:
+ return "INVALID resultCode\n";
+ }
+#endif
+return "";
+}
+
+void
+limPrintMsgName(tpAniSirGlobal pMac, tANI_U16 logLevel, tANI_U32 msgType)
+{
+ limLog(pMac, logLevel, limMsgStr(msgType));
+}
+
+
+#if defined(ANI_MIPS) || defined(ANI_ARM)
+#define LINK 0
+#else
+#define LINK 1
+#endif
+
+void
+limPrintMsgInfo(tpAniSirGlobal pMac, tANI_U16 logLevel, tSirMsgQ *msg)
+{
+ //tSirMacFrameCtl fc; // FIXME_GEN4 - ASAP!!
+#if defined (ANI_OS_TYPE_LINUX) || defined (ANI_OS_TYPE_OSX)
+ tANI_U32 *pRxPacketInfo;
+#endif
+ if (logLevel <= pMac->utils.gLogDbgLevel[SIR_LIM_MODULE_ID - LOG_FIRST_MODULE_ID])
+ {
+ switch (msg->type)
+ {
+ case SIR_BB_XPORT_MGMT_MSG:
+#if defined (ANI_OS_TYPE_LINUX) || defined (ANI_OS_TYPE_OSX)
+#ifndef GEN6_ONWARDS //PAL does not provide this API GEN6 onwards.
+ palGetPacketDataPtr( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, (void *) msg->bodyptr, (void **) &pRxPacketInfo );
+#endif //GEN6_ONWARDS
+#else
+ limPrintMsgName(pMac, logLevel,msg->type);
+#endif
+ break;
+ default:
+ limPrintMsgName(pMac, logLevel,msg->type);
+ break;
+ }
+ }
+}
+
+/**
+ * limInitMlm()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeMessages() to
+ * initialize MLM state machine on STA
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return None
+ */
+void
+limInitMlm(tpAniSirGlobal pMac)
+{
+ MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+ /// Initialize scan result hash table
+ limReInitScanResults(pMac); //sep26th review
+
+
+ /// Initialize number of pre-auth contexts
+ pMac->lim.gLimNumPreAuthContexts = 0;
+
+ /// Initialize MAC based Authentication STA list
+ limInitPreAuthList(pMac);
+
+ //pMac->lim.gpLimMlmJoinReq = NULL;
+
+ if (pMac->lim.gLimTimersCreated)
+ return;
+
+ // Create timers used by LIM
+ limCreateTimers(pMac);
+
+ pMac->lim.gLimTimersCreated = 1;
+} /*** end limInitMlm() ***/
+
+
+
+/**
+ * limCleanupMlm()
+ *
+ *FUNCTION:
+ * This function is called to cleanup any resources
+ * allocated by the MLM state machine.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * It is assumed that BSS is already informed that we're leaving it
+ * before this function is called.
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param None
+ * @return None
+ */
+void
+limCleanupMlm(tpAniSirGlobal pMac)
+{
+ tANI_U32 n;
+ tLimPreAuthNode *pAuthNode;
+
+ if (pMac->lim.gLimTimersCreated == 1)
+ {
+ // Deactivate and delete MIN/MAX channel timers.
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
+
+
+ // Deactivate and delete channel switch timer.
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
+
+
+ // Deactivate and delete addts response timer.
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
+
+ // Deactivate and delete Join failure timer.
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
+
+ // Deactivate and delete Association failure timer.
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
+
+ // Deactivate and delete Reassociation failure timer.
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
+
+ // Deactivate and delete Authentication failure timer.
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
+
+ // Deactivate and delete Heartbeat timer.
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
+
+ // Deactivate and delete wait-for-probe-after-Heartbeat timer.
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
+
+ // Deactivate and delete Quiet timer.
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
+
+ // Deactivate and delete Quiet BSS timer.
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
+
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ // Deactivate and delete LIM background scan timer.
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
+#endif
+
+
+ // Deactivate and delete cnf wait timer
+ for (n = 0; n < pMac->lim.maxStation; n++)
+ {
+ tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
+ tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
+ }
+
+ // Deactivate and delete keepalive timer
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
+
+ pAuthNode = pMac->lim.gLimPreAuthTimerTable.pTable;
+
+ //Deactivate any Authentication response timers
+ limDeletePreAuthList(pMac);
+
+ for (n = 0; n < pMac->lim.gLimPreAuthTimerTable.numEntry; n++,pAuthNode++)
+ {
+ // Delete any Authentication response
+ // timers, which might have been started.
+ tx_timer_delete(&pAuthNode->timer);
+ }
+
+#ifdef ANI_PRODUCT_TYPE_AP
+
+ if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
+ {
+ // Deactivate and cleanup the periodic pre-auth
+ // cleanup timer
+
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
+
+ /// Deactivate and delete OLBC cache update timeout
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
+
+ }
+#endif
+
+
+ // Deactivate and delete Hash Miss throttle timer
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer);
+
+#ifdef WLAN_SOFTAP_FEATURE
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
+
+#if 0 // The WPS PBC clean up timer is disabled
+ if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
+ {
+ if(pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated == eANI_BOOLEAN_TRUE)
+ {
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
+ pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated = eANI_BOOLEAN_FALSE;
+ }
+ }
+#endif
+#endif
+#ifdef WLAN_FEATURE_VOWIFI_11R
+ // Deactivate and delete FT Preauth response timer
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
+#endif
+
+#ifdef WLAN_FEATURE_P2P
+ // Deactivate and delete remain on channel timer
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+ // Deactivate and delete TSM
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimCcxTsmTimer);
+ tx_timer_delete(&pMac->lim.limTimers.gLimCcxTsmTimer);
+#endif
+
+ pMac->lim.gLimTimersCreated = 0;
+ }
+
+ /// Cleanup cached scan list
+ limReInitScanResults(pMac);
+
+} /*** end limCleanupMlm() ***/
+
+
+
+/**
+ * limCleanupLmm()
+ *
+ *FUNCTION:
+ * This function is called to cleanup any resources
+ * allocated by LMM sub-module.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return None
+ */
+
+void
+limCleanupLmm(tpAniSirGlobal pMac)
+{
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined (ANI_PRODUCT_TYPE_AP)
+ limCleanupMeasResources(pMac);
+ pMac->sys.gSysEnableLearnMode = eANI_BOOLEAN_FALSE;
+#endif
+} /*** end limCleanupLmm() ***/
+
+
+
+/**
+ * limIsAddrBC()
+ *
+ *FUNCTION:
+ * This function is called in various places within LIM code
+ * to determine whether passed MAC address is a broadcast or not
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param macAddr Indicates MAC address that need to be determined
+ * whether it is Broadcast address or not
+ *
+ * @return true if passed address is Broadcast address else false
+ */
+
+tANI_U8
+limIsAddrBC(tSirMacAddr macAddr)
+{
+ int i;
+ for (i = 0; i < 6; i++)
+ {
+ if ((macAddr[i] & 0xFF) != 0xFF)
+ return false;
+ }
+
+ return true;
+} /****** end limIsAddrBC() ******/
+
+
+
+/**
+ * limIsGroupAddr()
+ *
+ *FUNCTION:
+ * This function is called in various places within LIM code
+ * to determine whether passed MAC address is a group address or not
+ *
+ *LOGIC:
+ * If least significant bit of first octet of the MAC address is
+ * set to 1, it is a Group address.
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param macAddr Indicates MAC address that need to be determined
+ * whether it is Group address or not
+ *
+ * @return true if passed address is Group address else false
+ */
+
+tANI_U8
+limIsGroupAddr(tSirMacAddr macAddr)
+{
+ if ((macAddr[0] & 0x01) == 0x01)
+ return true;
+ else
+ return false;
+} /****** end limIsGroupAddr() ******/
+
+/**
+ * limPostMsgApiNoWait()
+ *
+ *FUNCTION:
+ * This function is called from other thread while posting a
+ * message to LIM message Queue gSirLimMsgQ with NO_WAIT option
+ *
+ *LOGIC:
+ * NA
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMsg - Pointer to the Global MAC structure
+ * @param pMsg - Pointer to the message structure
+ * @return None
+ */
+
+tANI_U32
+limPostMsgApiNoWait(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
+{
+#ifdef ANI_OS_TYPE_WINDOWS
+ tANI_U32 retCode;
+
+ if ((retCode = tx_queue_send(&pMac->sys.gSirLimMsgQ, pMsg, TX_NO_WAIT))
+ != TX_SUCCESS)
+ {
+ // Failure in sending DFS duration timeout indication
+ // to LIM thread
+
+ // Log error
+ limLog(pMac, LOGP,
+ FL("could not post a message %X to LIM msgq, status=%d\n"),
+ pMsg->type, retCode);
+ }
+
+ return retCode;
+#else
+ limProcessMessages(pMac, pMsg);
+ return TX_SUCCESS;
+#endif
+} /*** end limPostMsgApiNoWait() ***/
+
+
+
+/**
+ * limPrintMacAddr()
+ *
+ *FUNCTION:
+ * This function is called to print passed MAC address
+ * in : format.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * @param macAddr - MacAddr to be printed
+ * @param logLevel - Loglevel to be used
+ *
+ * @return None.
+ */
+
+void
+limPrintMacAddr(tpAniSirGlobal pMac, tSirMacAddr macAddr, tANI_U8 logLevel)
+{
+ limLog(pMac, logLevel,
+ FL("%X:%X:%X:%X:%X:%X\n"),
+ macAddr[0], macAddr[1], macAddr[2], macAddr[3], macAddr[4],
+ macAddr[5]);
+} /****** end limPrintMacAddr() ******/
+
+
+
+
+
+
+/*
+ * limResetDeferredMsgQ()
+ *
+ *FUNCTION:
+ * This function resets the deferred message queue parameters.
+ *
+ *PARAMS:
+ * @param pMac - Pointer to Global MAC structure
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ *RETURNS:
+ * None
+ */
+
+void limResetDeferredMsgQ(tpAniSirGlobal pMac)
+{
+ pMac->lim.gLimDeferredMsgQ.size =
+ pMac->lim.gLimDeferredMsgQ.write =
+ pMac->lim.gLimDeferredMsgQ.read = 0;
+
+}
+
+
+#define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2)
+#define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2)
+
+/*
+ * limWriteDeferredMsgQ()
+ *
+ *FUNCTION:
+ * This function queues up a deferred message for later processing on the
+ * STA side.
+ *
+ *PARAMS:
+ * @param pMac - Pointer to Global MAC structure
+ * @param limMsg - a LIM message
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ *RETURNS:
+ * None
+ */
+
+tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
+{
+ PELOG1(limLog(pMac, LOG1,
+ FL("** Queue a deferred message (size %d, write %d) - type 0x%x **\n"),
+ pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.write,
+ limMsg->type);)
+
+ /*
+ ** check if the deferred message queue is full
+ **/
+ if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Deferred Message Queue is full. Msg: %d\n"), limMsg->type);)
+ return TX_QUEUE_FULL;
+ }
+
+ /*
+ ** In the application, there should not be more than 1 message get
+ ** queued up. If happens, flags a warning. In the future, this can
+ ** happen.
+ **/
+ if (pMac->lim.gLimDeferredMsgQ.size > 0)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("%d Deferred messages (type 0x%x, scan %d, sme %d, mlme %d, addts %d)\n"),
+ pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
+ limIsSystemInScanState(pMac),
+ pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
+ pMac->lim.gLimAddtsSent);)
+ }
+
+ /*
+ ** To prevent the deferred Q is full of management frames, only give them certain space
+ **/
+ if( SIR_BB_XPORT_MGMT_MSG == limMsg->type )
+ {
+ if( LIM_DEFERRED_Q_CHECK_THRESHOLD < pMac->lim.gLimDeferredMsgQ.size )
+ {
+ tANI_U16 idx, count = 0;
+ for(idx = 0; idx < pMac->lim.gLimDeferredMsgQ.size; idx++)
+ {
+ if( SIR_BB_XPORT_MGMT_MSG == pMac->lim.gLimDeferredMsgQ.deferredQueue[idx].type )
+ {
+ count++;
+ }
+ }
+ if( LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count )
+ {
+ //We reach the quota for management frames, drop this one
+ PELOGE(limLog(pMac, LOGE, FL("Cannot deferred. Msg: %d Too many (count=%d) already\n"), limMsg->type, count);)
+ //Return error, caller knows what to do
+ return TX_QUEUE_FULL;
+ }
+ }
+ }
+
+ ++pMac->lim.gLimDeferredMsgQ.size;
+
+ /*
+ ** if the write pointer hits the end of the queue, rewind it
+ **/
+ if (pMac->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN)
+ pMac->lim.gLimDeferredMsgQ.write = 0;
+
+ /*
+ ** save the message to the queue and advanced the write pointer
+ **/
+ palCopyMemory(pMac->hHdd,
+ (tANI_U8 *)&pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.write++],
+ (tANI_U8 *)limMsg,
+ sizeof(tSirMsgQ));
+ return TX_SUCCESS;
+
+}
+
+/*
+ * limReadDeferredMsgQ()
+ *
+ *FUNCTION:
+ * This function dequeues a deferred message for processing on the
+ * STA side.
+ *
+ *PARAMS:
+ * @param pMac - Pointer to Global MAC structure
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ *
+ *RETURNS:
+ * Returns the message at the head of the deferred message queue
+ */
+
+tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac)
+{
+ tSirMsgQ *msg;
+
+ /*
+ ** check any messages left. If no, return
+ **/
+ if (pMac->lim.gLimDeferredMsgQ.size <= 0)
+ return NULL;
+
+ /*
+ ** decrement the queue size
+ **/
+ pMac->lim.gLimDeferredMsgQ.size--;
+
+ /*
+ ** retrieve the message from the head of the queue
+ **/
+ msg = &pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.read];
+
+ /*
+ ** advance the read pointer
+ **/
+ pMac->lim.gLimDeferredMsgQ.read++;
+
+ /*
+ ** if the read pointer hits the end of the queue, rewind it
+ **/
+ if (pMac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN)
+ pMac->lim.gLimDeferredMsgQ.read = 0;
+
+ PELOG1(limLog(pMac, LOG1,
+ FL("** DeQueue a deferred message (size %d read %d) - type 0x%x **\n"),
+ pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
+ msg->type);)
+
+ PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, sme %d, mlme %d, addts %d\n"),
+ limIsSystemInScanState(pMac),
+ pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
+ pMac->lim.gLimAddtsSent);)
+
+ return(msg);
+}
+
+tSirRetStatus
+limSysProcessMmhMsgApi(tpAniSirGlobal pMac,
+ tSirMsgQ *pMsg,
+ tANI_U8 qType)
+{
+// FIXME
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+ SysProcessMmhMsg(pMac, pMsg);
+ return eSIR_SUCCESS;
+#else
+ return(halMmhPostMsgApi(pMac, pMsg, qType));
+#endif
+}
+
+char *limFrameStr(tANI_U32 type, tANI_U32 subType)
+{
+#ifdef FIXME_GEN6
+
+ if (type == SIR_MAC_MGMT_FRAME)
+ {
+ switch (subType)
+ {
+ case SIR_MAC_MGMT_ASSOC_REQ:
+ return "MAC_MGMT_ASSOC_REQ";
+ case SIR_MAC_MGMT_ASSOC_RSP:
+ return "MAC_MGMT_ASSOC_RSP";
+ case SIR_MAC_MGMT_REASSOC_REQ:
+ return "MAC_MGMT_REASSOC_REQ";
+ case SIR_MAC_MGMT_REASSOC_RSP:
+ return "MAC_MGMT_REASSOC_RSP";
+ case SIR_MAC_MGMT_PROBE_REQ:
+ return "MAC_MGMT_PROBE_REQ";
+ case SIR_MAC_MGMT_PROBE_RSP:
+ return "MAC_MGMT_PROBE_RSP";
+ case SIR_MAC_MGMT_BEACON:
+ return "MAC_MGMT_BEACON";
+ case SIR_MAC_MGMT_ATIM:
+ return "MAC_MGMT_ATIM";
+ case SIR_MAC_MGMT_DISASSOC:
+ return "MAC_MGMT_DISASSOC";
+ case SIR_MAC_MGMT_AUTH:
+ return "MAC_MGMT_AUTH";
+ case SIR_MAC_MGMT_DEAUTH:
+ return "MAC_MGMT_DEAUTH";
+ case SIR_MAC_MGMT_ACTION:
+ return "MAC_MGMT_ACTION";
+ case SIR_MAC_MGMT_RESERVED15:
+ return "MAC_MGMT_RESERVED15";
+ default:
+ return "Unknown MGMT Frame";
+ }
+ }
+
+ else if (type == SIR_MAC_CTRL_FRAME)
+ {
+ switch (subType)
+ {
+ case SIR_MAC_CTRL_RR:
+ return "MAC_CTRL_RR";
+ case SIR_MAC_CTRL_BAR:
+ return "MAC_CTRL_BAR";
+ case SIR_MAC_CTRL_BA:
+ return "MAC_CTRL_BA";
+ case SIR_MAC_CTRL_PS_POLL:
+ return "MAC_CTRL_PS_POLL";
+ case SIR_MAC_CTRL_RTS:
+ return "MAC_CTRL_RTS";
+ case SIR_MAC_CTRL_CTS:
+ return "MAC_CTRL_CTS";
+ case SIR_MAC_CTRL_ACK:
+ return "MAC_CTRL_ACK";
+ case SIR_MAC_CTRL_CF_END:
+ return "MAC_CTRL_CF_END";
+ case SIR_MAC_CTRL_CF_END_ACK:
+ return "MAC_CTRL_CF_END_ACK";
+ default:
+ return "Unknown CTRL Frame";
+ }
+ }
+
+ else if (type == SIR_MAC_DATA_FRAME)
+ {
+ switch (subType)
+ {
+ case SIR_MAC_DATA_DATA:
+ return "MAC_DATA_DATA";
+ case SIR_MAC_DATA_DATA_ACK:
+ return "MAC_DATA_DATA_ACK";
+ case SIR_MAC_DATA_DATA_POLL:
+ return "MAC_DATA_DATA_POLL";
+ case SIR_MAC_DATA_DATA_ACK_POLL:
+ return "MAC_DATA_DATA_ACK_POLL";
+ case SIR_MAC_DATA_NULL:
+ return "MAC_DATA_NULL";
+ case SIR_MAC_DATA_NULL_ACK:
+ return "MAC_DATA_NULL_ACK";
+ case SIR_MAC_DATA_NULL_POLL:
+ return "MAC_DATA_NULL_POLL";
+ case SIR_MAC_DATA_NULL_ACK_POLL:
+ return "MAC_DATA_NULL_ACK_POLL";
+ case SIR_MAC_DATA_QOS_DATA:
+ return "MAC_DATA_QOS_DATA";
+ case SIR_MAC_DATA_QOS_DATA_ACK:
+ return "MAC_DATA_QOS_DATA_ACK";
+ case SIR_MAC_DATA_QOS_DATA_POLL:
+ return "MAC_DATA_QOS_DATA_POLL";
+ case SIR_MAC_DATA_QOS_DATA_ACK_POLL:
+ return "MAC_DATA_QOS_DATA_ACK_POLL";
+ case SIR_MAC_DATA_QOS_NULL:
+ return "MAC_DATA_QOS_NULL";
+ case SIR_MAC_DATA_QOS_NULL_ACK:
+ return "MAC_DATA_QOS_NULL_ACK";
+ case SIR_MAC_DATA_QOS_NULL_POLL:
+ return "MAC_DATA_QOS_NULL_POLL";
+ case SIR_MAC_DATA_QOS_NULL_ACK_POLL:
+ return "MAC_DATA_QOS_NULL_ACK_POLL";
+ default:
+ return "Unknown Data Frame";
+ }
+ }
+ else
+ return "Unknown";
+#endif
+return "";
+}
+
+#ifdef WLAN_SOFTAP_FEATURE
+void limHandleUpdateOlbcCache(tpAniSirGlobal pMac)
+{
+ int i;
+ static int enable;
+ tUpdateBeaconParams beaconParams;
+
+ tpPESession psessionEntry = limIsApSessionActive(pMac);
+
+ if (psessionEntry == NULL)
+ return;
+
+ beaconParams.paramChangeBitmap = 0;
+ /*
+ ** This is doing a 2 pass check. The first pass is to invalidate
+ ** all the cache entries. The second pass is to decide whether to
+ ** disable protection.
+ **/
+ if (!enable)
+ {
+
+ PELOG2(limLog(pMac, LOG2, FL("Resetting OLBC cache\n"));)
+ psessionEntry->gLimOlbcParams.numSta = 0;
+ psessionEntry->gLimOverlap11gParams.numSta = 0;
+ psessionEntry->gLimOverlapHt20Params.numSta = 0;
+ psessionEntry->gLimNonGfParams.numSta = 0;
+ psessionEntry->gLimLsigTxopParams.numSta = 0;
+
+ for (i=0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
+ pMac->lim.protStaOverlapCache[i].active = false;
+
+ enable = 1;
+ }
+ else
+ {
+
+ if (!psessionEntry->gLimOverlap11gParams.numSta)
+ {
+ if (psessionEntry->gLimOlbcParams.protectionEnabled)
+ {
+ if (!psessionEntry->gLim11bParams.protectionEnabled)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11B STA detected\n"));)
+ limEnable11gProtection(pMac, false, true, &beaconParams, psessionEntry);
+ }
+ }
+ }
+
+ if (!psessionEntry->gLimOverlap11gParams.numSta)
+ {
+ if (psessionEntry->gLimOverlap11gParams.protectionEnabled)
+ {
+ if (!psessionEntry->gLim11gParams.protectionEnabled)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11G STA detected\n"));)
+ limEnableHtProtectionFrom11g(pMac, false, true, &beaconParams,psessionEntry);
+ }
+ }
+ }
+
+ if (!psessionEntry->gLimOverlapHt20Params.numSta)
+ {
+ if (psessionEntry->gLimOverlapHt20Params.protectionEnabled)
+ {
+ if (!psessionEntry->gLimHt20Params.protectionEnabled)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no HT20 STA detected\n"));)
+ limEnable11gProtection(pMac, false, true, &beaconParams,psessionEntry);
+ }
+ }
+ }
+
+ enable = 0;
+ }
+
+ if(beaconParams.paramChangeBitmap)
+ {
+ schSetFixedBeaconFields(pMac,psessionEntry);
+ limSendBeaconParams(pMac, &beaconParams, psessionEntry);
+ }
+
+ // Start OLBC timer
+ if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGE, FL("tx_timer_activate failed\n"));
+ }
+}
+#endif
+
+/**
+ * limIsNullSsid()
+ *
+ *FUNCTION:
+ * This function checks if Ssid supplied is Null SSID
+ *
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param tSirMacSSid *
+ *
+ *
+ * @return true if SSID is Null SSID else false
+ */
+
+tANI_U8
+limIsNullSsid( tSirMacSSid *pSsid )
+{
+ tANI_U8 fNullSsid = false;
+ tANI_U32 SsidLength;
+ tANI_U8 *pSsidStr;
+
+ do
+ {
+ if ( 0 == pSsid->length )
+ {
+ fNullSsid = true;
+ break;
+ }
+
+#define ASCII_SPACE_CHARACTER 0x20
+ /* If the first charactes is space, then check if all characters in
+ * SSID are spaces to consider it as NULL SSID*/
+ if( ASCII_SPACE_CHARACTER == pSsid->ssId[0])
+ {
+ SsidLength = pSsid->length;
+ pSsidStr = pSsid->ssId;
+ /* check if all the charactes in SSID are spaces*/
+ while ( SsidLength )
+ {
+ if( ASCII_SPACE_CHARACTER != *pSsidStr )
+ break;
+
+ pSsidStr++;
+ SsidLength--;
+ }
+
+ if( 0 == SsidLength )
+ {
+ fNullSsid = true;
+ break;
+ }
+ }
+ else
+ {
+ /* check if all the charactes in SSID are NULL*/
+ SsidLength = pSsid->length;
+ pSsidStr = pSsid->ssId;
+
+ while ( SsidLength )
+ {
+ if( *pSsidStr )
+ break;
+
+ pSsidStr++;
+ SsidLength--;
+ }
+
+ if( 0 == SsidLength )
+ {
+ fNullSsid = true;
+ break;
+ }
+ }
+ }
+ while( 0 );
+
+ return fNullSsid;
+} /****** end limIsNullSsid() ******/
+
+
+
+#ifdef WLAN_SOFTAP_FEATURE
+
+/** -------------------------------------------------------------
+\fn limUpdateProtStaParams
+\brief updates protection related counters.
+\param tpAniSirGlobal pMac
+\param tSirMacAddr peerMacAddr
+\param tLimProtStaCacheType protStaCacheType
+\param tHalBitVal gfSupported
+\param tHalBitVal lsigTxopSupported
+\return None
+ -------------------------------------------------------------*/
+void
+limUpdateProtStaParams(tpAniSirGlobal pMac,
+tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType,
+tHalBitVal gfSupported, tHalBitVal lsigTxopSupported,
+tpPESession psessionEntry)
+{
+ tANI_U32 i;
+
+ PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
+ limLog(pMac,LOG1, FL("Addr : "));
+ limPrintMacAddr(pMac, peerMacAddr, LOG1);)
+
+ for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
+ {
+ if (psessionEntry->protStaCache[i].active)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
+ PELOG1(limPrintMacAddr(pMac, psessionEntry->protStaCache[i].addr, LOG1);)
+
+ if (palEqualMemory( pMac->hHdd,
+ psessionEntry->protStaCache[i].addr,
+ peerMacAddr, sizeof(tSirMacAddr)))
+ {
+ PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active.\n"), i);)
+ return;
+ }
+ }
+ }
+
+ for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
+ {
+ if (!psessionEntry->protStaCache[i].active)
+ break;
+ }
+
+ if (i >= LIM_PROT_STA_CACHE_SIZE)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache\n"));)
+ return;
+ }
+
+ palCopyMemory( pMac->hHdd, psessionEntry->protStaCache[i].addr,
+ peerMacAddr,
+ sizeof(tSirMacAddr));
+
+ psessionEntry->protStaCache[i].protStaCacheType = protStaCacheType;
+ psessionEntry->protStaCache[i].active = true;
+ if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType)
+ {
+ psessionEntry->gLim11bParams.numSta++;
+ limLog(pMac,LOG1, FL("11B, "));
+ }
+ else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType)
+ {
+ psessionEntry->gLim11gParams.numSta++;
+ limLog(pMac,LOG1, FL("11G, "));
+ }
+ else if(eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType)
+ {
+ psessionEntry->gLimHt20Params.numSta++;
+ limLog(pMac,LOG1, FL("HT20, "));
+ }
+
+ if(!gfSupported)
+ {
+ psessionEntry->gLimNonGfParams.numSta++;
+ limLog(pMac,LOG1, FL("NonGf, "));
+ }
+ if(!lsigTxopSupported)
+ {
+ psessionEntry->gLimLsigTxopParams.numSta++;
+ limLog(pMac,LOG1, FL("!lsigTxopSupported\n"));
+ }
+}// ---------------------------------------------------------------------
+
+/** -------------------------------------------------------------
+\fn limDecideApProtection
+\brief Decides all the protection related staiton coexistence and also sets
+\ short preamble and short slot appropriately. This function will be called
+\ when AP is ready to send assocRsp tp the station joining right now.
+\param tpAniSirGlobal pMac
+\param tSirMacAddr peerMacAddr
+\return None
+ -------------------------------------------------------------*/
+void
+limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
+{
+ tANI_U16 tmpAid;
+ tpDphHashNode pStaDs;
+ tSirRFBand rfBand = SIR_BAND_UNKNOWN;
+ tANI_U32 phyMode;
+ tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID;
+ tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET;
+
+ pBeaconParams->paramChangeBitmap = 0;
+ // check whether to enable protection or not
+ pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
+ if(NULL == pStaDs)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("pStaDs is NULL\n"));)
+ return;
+ }
+ limGetRfBand(pMac, &rfBand, psessionEntry);
+ //if we are in 5 GHZ band
+ if(SIR_BAND_5_GHZ == rfBand)
+ {
+ //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
+ //HT20 case is common between both the bands and handled down as common code.
+ if(true == psessionEntry->htCapabality)
+ {
+ //we are 11N and 11A station is joining.
+ //protection from 11A required.
+ if(false == pStaDs->mlmStaContext.htCapability)
+ {
+ limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
+ return;
+ }
+ }
+ }
+ else if(SIR_BAND_2_4_GHZ== rfBand)
+ {
+ limGetPhyMode(pMac, &phyMode, psessionEntry);
+
+ //We are 11G. Check if we need protection from 11b Stations.
+ if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
+ (false == psessionEntry->htCapabality))
+ {
+
+ if (pStaDs->erpEnabled== eHAL_CLEAR)
+ {
+ protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
+ // enable protection
+ PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B\n"));)
+ limEnable11gProtection(pMac, true, false, pBeaconParams,psessionEntry);
+ }
+ }
+
+ //HT station.
+ if (true == psessionEntry->htCapabality)
+ {
+ //check if we need protection from 11b station
+ if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
+ (!pStaDs->mlmStaContext.htCapability))
+ {
+ protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
+ // enable protection
+ PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B\n"));)
+ limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
+ }
+ //station being joined is non-11b and non-ht ==> 11g device
+ else if(!pStaDs->mlmStaContext.htCapability)
+ {
+ protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG;
+ //enable protection
+ limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams, psessionEntry);
+ }
+ //ERP mode is enabled for the latest station joined
+ //latest station joined is HT capable
+ //This case is being handled in common code (commn between both the bands) below.
+ }
+ }
+
+ //we are HT and HT station is joining. This code is common for both the bands.
+ if((true == psessionEntry->htCapabality) &&
+ (true == pStaDs->mlmStaContext.htCapability))
+ {
+ if(!pStaDs->htGreenfield)
+ {
+ limEnableHTNonGfProtection(pMac, true, false, pBeaconParams, psessionEntry);
+ gfSupported = eHAL_CLEAR;
+ }
+ //Station joining is HT 20Mhz
+ if(eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet)
+ {
+ protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20;
+ limEnableHT20Protection(pMac, true, false, pBeaconParams, psessionEntry);
+ }
+ //Station joining does not support LSIG TXOP Protection
+ if(!pStaDs->htLsigTXOPProtection)
+ {
+ limEnableHTLsigTxopProtection(pMac, false, false, pBeaconParams,psessionEntry);
+ lsigTxopSupported = eHAL_CLEAR;
+ }
+ }
+
+ limUpdateProtStaParams(pMac, peerMacAddr, protStaCacheType,
+ gfSupported, lsigTxopSupported, psessionEntry);
+
+ return;
+}
+#endif
+
+
+/** -------------------------------------------------------------
+\fn limEnableOverlap11gProtection
+\brief wrapper function for setting overlap 11g protection.
+\param tpAniSirGlobal pMac
+\param tpUpdateBeaconParams pBeaconParams
+\param tpSirMacMgmtHdr pMh
+\return None
+ -------------------------------------------------------------*/
+void
+limEnableOverlap11gProtection(tpAniSirGlobal pMac,
+tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry)
+{
+ limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOlbcParams));
+
+ if (psessionEntry->gLimOlbcParams.numSta &&
+ !psessionEntry->gLimOlbcParams.protectionEnabled)
+ {
+ // enable protection
+ PELOG1(limLog(pMac, LOG1, FL("OLBC happens!!!\n"));)
+ limEnable11gProtection(pMac, true, true, pBeaconParams,psessionEntry);
+ }
+}
+
+
+/** -------------------------------------------------------------
+\fn limUpdateShortPreamble
+\brief Updates short preamble if needed when a new station joins.
+\param tpAniSirGlobal pMac
+\param tSirMacAddr peerMacAddr
+\param tpUpdateBeaconParams pBeaconParams
+\return None
+ -------------------------------------------------------------*/
+void
+limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
+ tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
+{
+ tANI_U16 tmpAid;
+ tpDphHashNode pStaDs;
+ tANI_U32 phyMode;
+ tANI_U16 i;
+
+ // check whether to enable protection or not
+ pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
+
+ limGetPhyMode(pMac, &phyMode, psessionEntry);
+
+ if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
+
+ {
+ if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
+ {
+ PELOG1(limLog(pMac,LOG1,FL("Short Preamble is not enabled in Assoc Req from "));
+ limPrintMacAddr(pMac, peerMacAddr, LOG1);)
+
+ for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
+ {
+#ifdef WLAN_SOFTAP_FEATURE
+ if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
+ psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
+ {
+ if (palEqualMemory( pMac->hHdd,
+ psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
+ peerMacAddr, sizeof(tSirMacAddr)))
+ return;
+ }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
+#endif
+ {
+ if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
+ {
+ if (palEqualMemory( pMac->hHdd,
+ pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
+ peerMacAddr, sizeof(tSirMacAddr)))
+ return;
+ }
+ }
+ }
+
+
+ for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
+ {
+#ifdef WLAN_SOFTAP_FEATURE
+ if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
+ !psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
+ break;
+ else
+#endif
+ {
+ if (!pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
+ break;
+ }
+ }
+
+ if (i >= LIM_PROT_STA_CACHE_SIZE)
+ {
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
+ limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
+ i, psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
+ limPrintMacAddr(pMac, peerMacAddr, LOGE);
+ return;
+ }
+ else
+#endif
+ {
+ limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
+ i, pMac->lim.gLimNoShortParams.numNonShortPreambleSta);
+ limPrintMacAddr(pMac, peerMacAddr, LOGE);
+ return;
+ }
+
+ }
+
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
+ palCopyMemory( pMac->hHdd, psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
+ peerMacAddr, sizeof(tSirMacAddr));
+ psessionEntry->gLimNoShortParams.staNoShortCache[i].active = true;
+ psessionEntry->gLimNoShortParams.numNonShortPreambleSta++;
+ }else
+#endif
+ {
+ palCopyMemory( pMac->hHdd, pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
+ peerMacAddr, sizeof(tSirMacAddr));
+ pMac->lim.gLimNoShortParams.staNoShortCache[i].active = true;
+ pMac->lim.gLimNoShortParams.numNonShortPreambleSta++;
+ }
+
+
+ // enable long preamble
+ PELOG1(limLog(pMac, LOG1, FL("Disabling short preamble\n"));)
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if (limEnableShortPreamble(pMac, false, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble\n"));)
+#else
+ if (limEnableShortPreamble(pMac, false, pBeaconParams) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble\n"));)
+
+#endif
+ }
+ }
+}
+
+/** -------------------------------------------------------------
+\fn limUpdateShortSlotTime
+\brief Updates short slot time if needed when a new station joins.
+\param tpAniSirGlobal pMac
+\param tSirMacAddr peerMacAddr
+\param tpUpdateBeaconParams pBeaconParams
+\return None
+ -------------------------------------------------------------*/
+
+void
+limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
+ tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
+{
+ tANI_U16 tmpAid;
+ tpDphHashNode pStaDs;
+ tANI_U32 phyMode;
+ tANI_U32 val;
+ tANI_U32 cShortSlot;
+ tANI_U16 i;
+
+ // check whether to enable protection or not
+ pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
+ limGetPhyMode(pMac, &phyMode, psessionEntry);
+
+ if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
+ {
+ if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, &cShortSlot) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("unable to get short slot time\n"));
+
+ if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
+ limPrintMacAddr(pMac, peerMacAddr, LOG1);)
+ for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
+ {
+#ifdef WLAN_SOFTAP_FEATURE
+ if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
+ psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
+ {
+ if (palEqualMemory( pMac->hHdd,
+ psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
+ peerMacAddr, sizeof(tSirMacAddr)))
+ return;
+ }
+ else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
+#endif
+ {
+ if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
+ {
+ if (palEqualMemory( pMac->hHdd,
+ pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
+ peerMacAddr, sizeof(tSirMacAddr)))
+ return;
+ }
+ }
+ }
+
+ for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
+ {
+#ifdef WLAN_SOFTAP_FEATURE
+ if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
+ !psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
+ break;
+ else
+#endif
+ {
+ if (!pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
+ break;
+ }
+ }
+
+ if (i >= LIM_PROT_STA_CACHE_SIZE)
+ {
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
+ limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
+ i, psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta);
+ limPrintMacAddr(pMac, peerMacAddr, LOGE);
+ return;
+ }else
+#endif
+ {
+ limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
+ i, pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
+ limPrintMacAddr(pMac, peerMacAddr, LOGE);
+ return;
+ }
+ }
+
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
+ palCopyMemory( pMac->hHdd, psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
+ peerMacAddr, sizeof(tSirMacAddr));
+ psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
+ psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta++;
+ }else
+#endif
+ {
+ palCopyMemory( pMac->hHdd, pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
+ peerMacAddr, sizeof(tSirMacAddr));
+ pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
+ pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta++;
+ }
+ wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
+ (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && cShortSlot))
+ {
+ // enable long slot time
+ pBeaconParams->fShortSlotTime = false;
+ pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
+ PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time.\n"));)
+ if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, false) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("could not update short slot time at CFG\n"));)
+ }
+ else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
+#endif
+ {
+ if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && cShortSlot)
+ {
+ // enable long slot time
+ pBeaconParams->fShortSlotTime = false;
+ pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
+ PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time.\n"));)
+ if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, false) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("could not update short slot time at CFG\n"));)
+ }
+ }
+ }
+ }
+}
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined (ANI_PRODUCT_TYPE_AP)
+/**
+ * limDetectRadar()
+ *
+ *FUNCTION:
+ * This function is invoked when LIM receives
+ * SIR_LIM_RADAR_DETECT_IND in lim mesage queue.
+ * LIM will notify WSM of this event by sending
+ * WSM the wireless medium status change
+ * notification message.
+ *
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param message - a tSirRadarInfo struct type message send by HAL.
+ * This message is not serialized.
+ *
+ * @return None
+ */
+
+void
+limDetectRadar(tpAniSirGlobal pMac, tANI_U32 *pMsg)
+{
+ tpSirRadarInfo pRadarInfo;
+
+ if (!pMsg)
+ {
+ limLog(pMac, LOGP, FL("Message is NULL\n"));
+ return;
+ }
+
+ pRadarInfo = (tpSirRadarInfo)pMsg;
+
+ if ((pMac->lim.gLimCurrentChannelId == pRadarInfo->channelNumber) &&
+ (pMac->lim.gLimSystemRole != eLIM_UNKNOWN_ROLE))
+ {
+ LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_TRUE);
+ limStopMeasTimers(pMac);
+ /* Stop the transmission of all packets except beacons.
+ * This is done here, assuming that we will definitely get a channel switch
+ * request from WSM.
+ */
+ PELOG1(limLog(pMac, LOG1, "Stopping the transmission on AP\n");)
+ limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_STOP_TX);
+ }
+
+ PELOG1(limLog(pMac, LOG1,
+ FL("limDetectRadar():: pulsewidth = %d, numPulse=%d, channelId=%d\n"),
+ pRadarInfo->radarPulseWidth, pRadarInfo->numRadarPulse,
+ pRadarInfo->channelNumber);)
+
+ limSendSmeWmStatusChangeNtf(pMac,
+ eSIR_SME_RADAR_DETECTED,
+ pMsg,
+ (tANI_U16)sizeof(*pRadarInfo),0);
+
+}
+#endif
+
+# if 0
+//TBD_RAJESH :: TO SOLVE LINKING ISSUE
+void
+limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, //dummy to avoid linking problem
+ tpUpdateBeaconParams pBeaconParams)
+{
+
+}
+
+//TBD_RAJESH :: TO SOLVE LINKING ISSUE
+void
+limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, //dummy to avoid linking problem
+ tpUpdateBeaconParams pBeaconParams)
+
+{
+}
+
+//TBD_RAJESH :: TO SOLVE LINKING ISSUE
+
+void //dummy to avoid linking problem
+limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
+{
+}
+
+#endif
+
+
+/** -------------------------------------------------------------
+\fn limDecideStaProtectionOnAssoc
+\brief Decide protection related settings on Sta while association.
+\param tpAniSirGlobal pMac
+\param tpSchBeaconStruct pBeaconStruct
+\return None
+ -------------------------------------------------------------*/
+void
+limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac,
+ tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry)
+{
+ tSirRFBand rfBand = SIR_BAND_UNKNOWN;
+ tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
+
+ limGetRfBand(pMac, &rfBand, psessionEntry);
+ limGetPhyMode(pMac, &phyMode, psessionEntry);
+
+ if(SIR_BAND_5_GHZ == rfBand)
+ {
+ if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
+ (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
+ {
+ if(pMac->lim.cfgProtection.fromlla)
+ psessionEntry->beaconParams.llaCoexist = true;
+ }
+ else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBeaconStruct->HTInfo.opMode)
+ {
+ if(pMac->lim.cfgProtection.ht20)
+ psessionEntry->beaconParams.ht20Coexist = true;
+ }
+
+ }
+ else if(SIR_BAND_2_4_GHZ == rfBand)
+ {
+ //spec 7.3.2.13
+ //UseProtection will be set when nonERP STA is associated.
+ //NonERPPresent bit will be set when:
+ //--nonERP Sta is associated OR
+ //--nonERP Sta exists in overlapping BSS
+ //when useProtection is not set then protection from nonERP stations is optional.
+
+ //CFG protection from 11b is enabled and
+ //11B device in the BSS
+ /* TODO, This is not sessionized */
+ if (phyMode != WNI_CFG_PHY_MODE_11B)
+ {
+ if (pMac->lim.cfgProtection.fromllb &&
+ pBeaconStruct->erpPresent &&
+ (pBeaconStruct->erpIEInfo.useProtection ||
+ pBeaconStruct->erpIEInfo.nonErpPresent))
+ {
+ psessionEntry->beaconParams.llbCoexist = true;
+ }
+ //AP has no 11b station associated.
+ else
+ {
+ psessionEntry->beaconParams.llbCoexist = false;
+ }
+ }
+ //following code block is only for HT station.
+ if((psessionEntry->htCapabality) &&
+ (pBeaconStruct->HTInfo.present))
+ {
+ tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
+
+ //Obss Non HT STA present mode
+ psessionEntry->beaconParams.gHTObssMode = (tANI_U8)htInfo.obssNonHTStaPresent;
+
+
+ //CFG protection from 11G is enabled and
+ //our AP has at least one 11G station associated.
+ if(pMac->lim.cfgProtection.fromllg &&
+ ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
+ (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
+ (!psessionEntry->beaconParams.llbCoexist))
+ {
+ if(pMac->lim.cfgProtection.fromllg)
+ psessionEntry->beaconParams.llgCoexist = true;
+ }
+
+ //AP has only HT stations associated and at least one station is HT 20
+ //disable protection from any non-HT devices.
+ //decision for disabling protection from 11b has already been taken above.
+ if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
+ {
+ //Disable protection from 11G station.
+ psessionEntry->beaconParams.llgCoexist = false;
+ //CFG protection from HT 20 is enabled.
+ if(pMac->lim.cfgProtection.ht20)
+ psessionEntry->beaconParams.ht20Coexist = true;
+ }
+ //Disable protection from non-HT and HT20 devices.
+ //decision for disabling protection from 11b has already been taken above.
+ if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
+ {
+ psessionEntry->beaconParams.llgCoexist = false;
+ psessionEntry->beaconParams.ht20Coexist = false;
+ }
+
+ }
+ }
+
+ //protection related factors other than HT operating mode. Applies to 2.4 GHZ as well as 5 GHZ.
+ if((psessionEntry->htCapabality) &&
+ (pBeaconStruct->HTInfo.present))
+ {
+ tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
+ psessionEntry->beaconParams.fRIFSMode =
+ ( tANI_U8 ) htInfo.rifsMode;
+ psessionEntry->beaconParams.llnNonGFCoexist =
+ ( tANI_U8 )htInfo.nonGFDevicesPresent;
+ psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
+ ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
+ }
+}
+
+
+/** -------------------------------------------------------------
+\fn limDecideStaProtection
+\brief Decides protection related settings on Sta while processing beacon.
+\param tpAniSirGlobal pMac
+\param tpUpdateBeaconParams pBeaconParams
+\return None
+ -------------------------------------------------------------*/
+void
+limDecideStaProtection(tpAniSirGlobal pMac,
+ tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
+{
+
+ tSirRFBand rfBand = SIR_BAND_UNKNOWN;
+ tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
+
+ limGetRfBand(pMac, &rfBand, psessionEntry);
+ limGetPhyMode(pMac, &phyMode, psessionEntry);
+
+ if(SIR_BAND_5_GHZ == rfBand)
+ {
+ //we are HT capable.
+ if((true == psessionEntry->htCapabality) &&
+ (pBeaconStruct->HTInfo.present))
+ {
+ //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.
+ if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
+ (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
+ {
+ limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
+ }
+ //we are HT capable, AP's HT OPMode is HT20 ==> disable protection from 11A if enabled. enabled
+ //protection from HT20 if needed.
+ else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT== pBeaconStruct->HTInfo.opMode)
+ {
+ limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
+ limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
+ }
+ else if(eSIR_HT_OP_MODE_PURE == pBeaconStruct->HTInfo.opMode)
+ {
+ limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
+ limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
+ }
+ }
+ }
+ else if(SIR_BAND_2_4_GHZ == rfBand)
+ {
+ /* spec 7.3.2.13
+ * UseProtection will be set when nonERP STA is associated.
+ * NonERPPresent bit will be set when:
+ * --nonERP Sta is associated OR
+ * --nonERP Sta exists in overlapping BSS
+ * when useProtection is not set then protection from nonERP stations is optional.
+ */
+
+ if (phyMode != WNI_CFG_PHY_MODE_11B)
+ {
+ if (pBeaconStruct->erpPresent &&
+ (pBeaconStruct->erpIEInfo.useProtection ||
+ pBeaconStruct->erpIEInfo.nonErpPresent))
+ {
+ limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
+ }
+ //AP has no 11b station associated.
+ else
+ {
+ //disable protection from 11b station
+ limEnable11gProtection(pMac, false, false, pBeaconParams, psessionEntry);
+ }
+ }
+
+ //following code block is only for HT station.
+ if((psessionEntry->htCapabality) &&
+ (pBeaconStruct->HTInfo.present))
+ {
+
+ tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
+ //AP has at least one 11G station associated.
+ if(((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
+ (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
+ (!psessionEntry->beaconParams.llbCoexist))
+ {
+ limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams,psessionEntry);
+
+ }
+
+ //no HT operating mode change ==> no change in protection settings except for MIXED_MODE/Legacy Mode.
+ //in Mixed mode/legacy Mode even if there is no change in HT operating mode, there might be change in 11bCoexist
+ //or 11gCoexist. that is why this check is being done after mixed/legacy mode check.
+ if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )htInfo.opMode )
+ {
+ pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )htInfo.opMode;
+
+ //AP has only HT stations associated and at least one station is HT 20
+ //disable protection from any non-HT devices.
+ //decision for disabling protection from 11b has already been taken above.
+ if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
+ {
+ //Disable protection from 11G station.
+ limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
+
+ limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
+ }
+ //Disable protection from non-HT and HT20 devices.
+ //decision for disabling protection from 11b has already been taken above.
+ else if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
+ {
+ limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
+ limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
+
+ }
+ }
+ }
+ }
+
+ //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
+ if((psessionEntry->htCapabality) &&
+ (pBeaconStruct->HTInfo.present))
+ {
+ tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
+ //Check for changes in protection related factors other than HT operating mode.
+ //Check for changes in RIFS mode, nonGFDevicesPresent, lsigTXOPProtectionFullSupport.
+ if ( psessionEntry->beaconParams.fRIFSMode !=
+ ( tANI_U8 ) htInfo.rifsMode )
+ {
+ pBeaconParams->fRIFSMode =
+ psessionEntry->beaconParams.fRIFSMode =
+ ( tANI_U8 ) htInfo.rifsMode;
+ pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
+ }
+
+ if ( psessionEntry->beaconParams.llnNonGFCoexist !=
+ htInfo.nonGFDevicesPresent )
+ {
+ pBeaconParams->llnNonGFCoexist =
+ psessionEntry->beaconParams.llnNonGFCoexist =
+ ( tANI_U8 )htInfo.nonGFDevicesPresent;
+ pBeaconParams->paramChangeBitmap |=
+ PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
+ }
+
+ if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport !=
+ ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport )
+ {
+ pBeaconParams->fLsigTXOPProtectionFullSupport =
+ psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
+ ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
+ pBeaconParams->paramChangeBitmap |=
+ PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
+ }
+
+ // For Station just update the global lim variable, no need to send message to HAL
+ // Station already taking care of HT OPR Mode=01, meaning AP is seeing legacy
+ //stations in overlapping BSS.
+ if ( psessionEntry->beaconParams.gHTObssMode != ( tANI_U8 )htInfo.obssNonHTStaPresent )
+ psessionEntry->beaconParams.gHTObssMode = ( tANI_U8 )htInfo.obssNonHTStaPresent ;
+
+ }
+}
+
+
+/**
+ * limProcessChannelSwitchTimeout()
+ *
+ *FUNCTION:
+ * This function is invoked when Channel Switch Timer expires at
+ * the STA. Now, STA must stop traffic, and then change/disable
+ * primary or secondary channel.
+ *
+ *
+ *NOTE:
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac)
+{
+ tpPESession psessionEntry = NULL;
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ tANI_U8 channel = pMac->lim.gLimChannelSwitch.primaryChannel; // This is received and stored from channelSwitch Action frame
+
+ if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+
+ if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
+ {
+ PELOGW(limLog(pMac, LOGW, "Channel switch can be done only in STA role, Current Role = %d\n", psessionEntry->limSystemRole);)
+ return;
+ }
+ /*
+ * This potentially can create issues if the function tries to set
+ * channel while device is in power-save, hence putting an extra check
+ * to verify if the device is in power-save or not
+ */
+ if(!limIsSystemInActiveState(pMac))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Device is not in active state, cannot switch channel\n"));)
+ return;
+ }
+
+ // Restore Channel Switch parameters to default
+ pMac->lim.gLimChannelSwitch.switchTimeoutValue = 0;
+
+ /* Channel-switch timeout has occurred. reset the state */
+ pMac->lim.gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
+
+ /* Check if the AP is switching to a channel that we support.
+ * Else, just don't bother to switch. Indicate HDD to look for a
+ * better AP to associate
+ */
+ if(!limIsChannelValidForChannelSwitch(pMac, channel))
+ {
+ /* We need to restore pre-channelSwitch state on the STA */
+ if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system\n"));
+ return;
+ }
+
+ /* If the channel-list that AP is asking us to switch is invalid,
+ * then we cannot switch the channel. Just disassociate from AP.
+ * We will find a better AP !!!
+ */
+ limTearDownLinkWithAp(pMac,
+ pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId,
+ eSIR_MAC_UNSPEC_FAILURE_REASON);
+ return;
+ }
+ switch(pMac->lim.gLimChannelSwitch.state)
+ {
+ case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
+ PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_PRIMARY_ONLY \n"));)
+ limSwitchPrimaryChannel(pMac, pMac->lim.gLimChannelSwitch.primaryChannel,psessionEntry);
+ pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
+ break;
+
+ case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
+ PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY \n"));)
+ limSwitchPrimarySecondaryChannel(pMac,
+ psessionEntry->currentOperChannel,
+ pMac->lim.gLimChannelSwitch.secondarySubBand);
+ pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
+ break;
+
+ case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
+ PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY\n"));)
+ limSwitchPrimarySecondaryChannel(pMac,
+ pMac->lim.gLimChannelSwitch.primaryChannel,
+ pMac->lim.gLimChannelSwitch.secondarySubBand);
+ pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
+ break;
+
+ case eLIM_CHANNEL_SWITCH_IDLE:
+ default:
+ PELOGE(limLog(pMac, LOGE, FL("incorrect state \n"));)
+ if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system\n"));
+ }
+ return; /* Please note, this is 'return' and not 'break' */
+ }
+#endif
+ }
+
+/**
+ * limUpdateChannelSwitch()
+ *
+ *FUNCTION:
+ * This function is invoked whenever Station receives
+ * either 802.11h channel switch IE or airgo proprietary
+ * channel switch IE.
+ *
+ *NOTE:
+ * @param pMac - Pointer to Global MAC structure
+ * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
+ * @param psessionentry
+ */
+void
+limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
+{
+
+ tANI_U16 beaconPeriod;
+ tANI_U32 val;
+ tChannelSwitchPropIEStruct *pPropChnlSwitch;
+ tDot11fIEChanSwitchAnn *pChnlSwitch;
+
+
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &val) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Could not retrieve Beacon interval\n"));
+ return;
+ }
+ beaconPeriod = (tANI_U16) val;
+
+ /* STA either received proprietary channel switch IE or 802.11h
+ * standard channel switch IE.
+ */
+ if (pBeacon->propIEinfo.propChannelSwitchPresent)
+ {
+ pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
+
+ /* Add logic to determine which change this is: */
+ /* primary, secondary, both. For now assume both. */
+ pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
+ pMac->lim.gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
+ pMac->lim.gLimChannelSwitch.secondarySubBand = (tAniCBSecondaryMode)pPropChnlSwitch->subBand;
+ pMac->lim.gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
+ pMac->lim.gLimChannelSwitch.switchTimeoutValue =
+ SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
+ pMac->lim.gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
+ }
+ else
+ {
+ pChnlSwitch = &(pBeacon->channelSwitchIE);
+ pMac->lim.gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
+ pMac->lim.gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
+ pMac->lim.gLimChannelSwitch.switchTimeoutValue =
+ SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
+ pMac->lim.gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
+
+ /* Only primary channel switch element is present */
+ pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
+ pMac->lim.gLimChannelSwitch.secondarySubBand = eANI_CB_SECONDARY_NONE;
+
+ /* Do not bother to look and operate on extended channel switch element
+ * if our own channel-bonding state is not enabled
+ */
+ if(GET_CB_ADMIN_STATE(pMac->lim.gCbState))
+ {
+ if (pBeacon->extChannelSwitchPresent)
+ {
+ switch(pBeacon->extChannelSwitchIE.secondaryChannelOffset)
+ {
+ case eHT_SECONDARY_CHANNEL_OFFSET_UP:
+ pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
+ pMac->lim.gLimChannelSwitch.secondarySubBand = eANI_CB_SECONDARY_UP;
+ break;
+
+ case eHT_SECONDARY_CHANNEL_OFFSET_DOWN:
+ pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
+ pMac->lim.gLimChannelSwitch.secondarySubBand = eANI_CB_SECONDARY_DOWN;
+ break;
+
+ case eHT_SECONDARY_CHANNEL_OFFSET_NONE:
+ default:
+ /* Nothing to be done here as of now!! */
+ break;
+ }
+ }
+ }
+ }
+
+ if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch\n"));)
+ }
+
+ limLog(pMac, LOGW,
+ FL("primary chl %d, subband %d, count %d (%d ticks) \n"),
+ pMac->lim.gLimChannelSwitch.primaryChannel,
+ pMac->lim.gLimChannelSwitch.secondarySubBand,
+ pMac->lim.gLimChannelSwitch.switchCount,
+ pMac->lim.gLimChannelSwitch.switchTimeoutValue);
+ return;
+}
+
+/**
+ * limCancelDot11hChannelSwitch
+ *
+ *FUNCTION:
+ * This function is called when STA does not send updated channel-swith IE
+ * after indicating channel-switch start. This will cancel the channel-swith
+ * timer which is already running.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ *
+ * @return None
+ */
+void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
+{
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
+ return;
+
+ PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE\n"));)
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_CHANNEL_SWITCH_TIMER));
+
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!\n"));)
+ }
+
+ /* We need to restore pre-channelSwitch state on the STA */
+ if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, reseting the system\n"));)
+
+ }
+#endif
+}
+
+/**----------------------------------------------
+\fn limCancelDot11hQuiet
+\brief Cancel the quieting on Station if latest
+ beacon doesn't contain quiet IE in it.
+
+\param pMac
+\return NONE
+-----------------------------------------------*/
+void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
+{
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
+ return;
+
+ if (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
+ {
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_QUIET_TIMER));
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed\n"));)
+ }
+ }
+ else if (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
+ {
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_QUIET_BSS_TIMER));
+ if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed\n"));)
+ }
+ /**
+ * If the channel switch is already running in silent mode, dont resume the
+ * transmission. Channel switch timer when timeout, transmission will be resumed.
+ */
+ if(!((pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
+ (pMac->lim.gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
+ {
+ limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
+ limRestorePreQuietState(pMac);
+ }
+ }
+ pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+#endif
+}
+
+/**
+ * limProcessQuietTimeout
+ *
+ * FUNCTION:
+ * This function is active only on the STA.
+ * Handles SIR_LIM_QUIET_TIMEOUT
+ *
+ * LOGIC:
+ * This timeout can occur under only one circumstance:
+ *
+ * 1) When gLimQuietState = eLIM_QUIET_BEGIN
+ * This indicates that the timeout "interval" has
+ * expired. This is a trigger for the STA to now
+ * shut-off Tx/Rx for the specified gLimQuietDuration
+ * -> The TIMER object gLimQuietBssTimer is
+ * activated
+ * -> With timeout = gLimQuietDuration
+ * -> gLimQuietState is set to eLIM_QUIET_RUNNING
+ *
+ * ASSUMPTIONS:
+ * Using two TIMER objects -
+ * gLimQuietTimer & gLimQuietBssTimer
+ *
+ * NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ *
+ * @return None
+ */
+void limProcessQuietTimeout(tpAniSirGlobal pMac)
+{
+#ifdef GEN6_TODO
+ //fetch the sessionEntry based on the sessionId
+ //priority - MEDIUM
+ tpPESession sessionEntry;
+
+ if((sessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+#endif
+
+ PELOG1(limLog(pMac, LOG1, FL("quietState = %d\n"), pMac->lim.gLimSpecMgmt.quietState);)
+ switch( pMac->lim.gLimSpecMgmt.quietState )
+ {
+ case eLIM_QUIET_BEGIN:
+ // Time to Stop data traffic for quietDuration
+ limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_QUIET_BSS_TIMER));
+#ifdef GEN6_TODO
+ /* revisit this piece of code to assign the appropriate sessionId below
+ * priority - HIGH
+ */
+ pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
+#endif
+ if( TX_SUCCESS !=
+ tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
+ {
+ limLog( pMac, LOGW,
+ FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS...\n"));
+ }
+ else
+ {
+ // Transition to eLIM_QUIET_RUNNING
+ pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
+
+ /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
+ /* print message, otherwise, stop data traffic and stay quiet */
+ if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
+ (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
+ {
+ limLog( pMac, LOG2,
+ FL("Attempting to trigger a background scan...\n"));
+ }
+ else
+ {
+ // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
+ /* freeze the transmission */
+ limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
+
+ limLog( pMac, LOG2,
+ FL("Quiet BSS: STA shutting down for %d ticks\n"),
+ pMac->lim.gLimSpecMgmt.quietDuration );
+ }
+ }
+ break;
+
+ case eLIM_QUIET_RUNNING:
+ case eLIM_QUIET_INIT:
+ case eLIM_QUIET_END:
+ default:
+ //
+ // As of now, nothing to be done
+ //
+ break;
+ }
+}
+
+/**
+ * limProcessQuietBssTimeout
+ *
+ * FUNCTION:
+ * This function is active on the AP and STA.
+ * Handles SIR_LIM_QUIET_BSS_TIMEOUT
+ *
+ * LOGIC:
+ * On the AP -
+ * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
+ * an indication for the AP to START sending out the
+ * Quiet BSS IE.
+ * If 802.11H is enabled, the Quiet BSS IE is sent as per
+ * the 11H spec
+ * If 802.11H is not enabled, the Quiet BSS IE is sent as
+ * a Proprietary IE. This will be understood by all the
+ * TITAN STA's
+ * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
+ * initiate the SCH to include the Quiet BSS IE in all
+ * its subsequent Beacons/PR's.
+ * The Quiet BSS IE will be included in all the Beacons
+ * & PR's until the next DTIM period
+ *
+ * On the STA -
+ * When gLimQuietState = eLIM_QUIET_RUNNING
+ * This indicates that the STA was successfully shut-off
+ * for the specified gLimQuietDuration. This is a trigger
+ * for the STA to now resume data traffic.
+ * -> gLimQuietState is set to eLIM_QUIET_INIT
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ *
+ * @return None
+ */
+void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
+{
+ tpPESession sessionEntry;
+
+ if((sessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+
+ PELOG1(limLog(pMac, LOG1, FL("quietState = %d\n"), pMac->lim.gLimSpecMgmt.quietState);)
+ if (eLIM_AP_ROLE == sessionEntry->limSystemRole)
+ {
+#ifdef ANI_PRODUCT_TYPE_AP
+ if (!pMac->sys.gSysEnableLearnMode)
+ {
+ pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_END;
+ return;
+ }
+
+ if( eLIM_QUIET_INIT == pMac->lim.gLimSpecMgmt.quietState )
+ {
+ //QuietCount = 0 is reserved
+ pMac->lim.gLimSpecMgmt.quietCount = 2;
+ // In ms.
+ pMac->lim.gLimSpecMgmt.quietDuration =
+ pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration;
+ // TU is in multiples of 1024 (2^10) us.
+ pMac->lim.gLimSpecMgmt.quietDuration_TU =
+ SYS_MS_TO_TU(pMac->lim.gLimSpecMgmt.quietDuration);
+ // Transition to eLIM_QUIET_BEGIN
+ limLog( pMac, LOG2, FL("Quiet BSS state = eLIM_QUIET_BEGIN\n"));
+ pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_BEGIN;
+ }
+#endif
+ }
+ else
+ {
+ // eLIM_STA_ROLE
+ switch( pMac->lim.gLimSpecMgmt.quietState )
+ {
+ case eLIM_QUIET_RUNNING:
+ // Transition to eLIM_QUIET_INIT
+ pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+
+ if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
+ {
+ // Resume data traffic only if channel switch is not running in silent mode.
+ if (!((pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
+ (pMac->lim.gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
+ {
+ limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
+ limRestorePreQuietState(pMac);
+ }
+
+ /* Reset status flag */
+ if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
+ glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
+
+ limLog( pMac, LOG2,
+ FL("Quiet BSS: Resuming traffic...\n"));
+ }
+ else
+ {
+ //
+ // Nothing specific to be done in this case
+ // A background scan that was triggered during
+ // SIR_LIM_QUIET_TIMEOUT will complete on its own
+ //
+ limLog( pMac, LOG2,
+ FL("Background scan should be complete now...\n"));
+ }
+ break;
+
+ case eLIM_QUIET_INIT:
+ case eLIM_QUIET_BEGIN:
+ case eLIM_QUIET_END:
+ PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING\n"));)
+ /* If the quiet period has ended, then resume the frame transmission */
+ limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
+ limRestorePreQuietState(pMac);
+ pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+ break;
+
+ default:
+ //
+ // As of now, nothing to be done
+ //
+ break;
+ }
+ }
+}
+#ifdef WLAN_SOFTAP_FEATURE
+/**
+ * limProcessWPSOverlapTimeout
+ *
+ * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ *
+ * @return None
+ */
+#if 0
+void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
+{
+
+ tpPESession psessionEntry;
+ tANI_U32 sessionId;
+
+ if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("tx_timer_activate failed\n"));
+ }
+
+ sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
+
+ PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d\n"), sessionId);)
+
+ if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
+ {
+ PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));)
+ return;
+ }
+
+ limWPSPBCTimeout(pMac, psessionEntry);
+}
+#endif
+#endif
+
+/**
+ * limUpdateQuietIEFromBeacon
+ *
+ * FUNCTION:
+ *
+ * LOGIC:
+ * When the Quiet BSS IE is encountered when parsing for
+ * Beacons/PR's, this function is called.
+ * Based on the configuration of the Quiet Interval -
+ * a) A TIMER (gLimQuietTimer) is started for the
+ * specified interval
+ * b) Upon expiry of the TIMER interval, the STA will
+ * shut-off Tx/Rx
+ * c) The STA will then start another TIMER (in this
+ * case, gLimQuietBssTimer TIMER object), with the
+ * timeout duration set to the value specified in the
+ * Quiet BSS IE
+ *
+ * 1) To setup the Quiet BSS "interval". In this case,
+ * this TIMER indicates that the STA has to shut-off its
+ * Tx/Rx AFTER the specified interval
+ * Set gLimQuietState = eLIM_QUIET_BEGIN
+ *
+ * 2) To setup the Quiet BSS "duration". After the said
+ * specified "interval", the STA has to shut-off Tx/Rx
+ * for this duration
+ * Set gLimQuietState = eLIM_QUIET_RUNNING
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param pQuietIE - Pointer to tDot11fIEQuiet
+ *
+ * @return None
+ */
+void limUpdateQuietIEFromBeacon( struct sAniSirGlobal *pMac,
+ tDot11fIEQuiet *pQuietIE, tpPESession psessionEntry )
+{
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ tANI_U16 beaconPeriod;
+ tANI_U32 val;
+
+ if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
+ return;
+
+ PELOG1(limLog(pMac, LOG1, FL("Quiet state = %d, Quiet Count = %d\n"),
+ pMac->lim.gLimSpecMgmt.quietState, pQuietIE->count);)
+ if (!pMac->lim.gLim11hEnable)
+ return;
+ // The (Titan) AP is requesting this (Titan) STA to
+ // honor this Quiet IE REQ and shut-off Tx/Rx. If we're
+ // receiving this a second time around (because the AP
+ // could be down-counting the Quiet BSS Count), the STA
+ // will have to reset the timeout interval accordingly
+ //
+
+ if (pQuietIE->count == 0)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Ignoring quiet count == 0->reserved\n"));)
+ return;
+ }
+
+ if( eSIR_SUCCESS !=
+ wlan_cfgGetInt( pMac, WNI_CFG_BEACON_INTERVAL, &val ))
+ beaconPeriod = (tANI_U16) WNI_CFG_BEACON_INTERVAL_APDEF;
+ else
+ beaconPeriod = (tANI_U16) val;
+
+ /* (qd * 2^10)/1000 */
+ pMac->lim.gLimSpecMgmt.quietDuration_TU = pQuietIE->duration;
+ // The STA needs to shut-off Tx/Rx "for" this interval (in milliSeconds)
+ /* Need to convert from TU to system TICKS */
+ pMac->lim.gLimSpecMgmt.quietDuration = SYS_MS_TO_TICKS(
+ SYS_TU_TO_MS(pMac->lim.gLimSpecMgmt.quietDuration_TU));
+
+ if (pMac->lim.gLimSpecMgmt.quietDuration_TU == 0)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Zero duration in quiet IE\n"));)
+ return;
+ }
+
+ // The STA needs to shut-off Tx/Rx "after" this interval
+ pMac->lim.gLimSpecMgmt.quietTimeoutValue =
+ (beaconPeriod * pQuietIE->count) + pQuietIE->offset;
+
+ limLog( pMac, LOG2,
+ FL( "STA shut-off will begin in %d milliseconds & last for %d ticks\n"),
+ pMac->lim.gLimSpecMgmt.quietTimeoutValue,
+ pMac->lim.gLimSpecMgmt.quietDuration );
+
+ /* Disable, Stop background scan if enabled and running */
+ limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
+
+ /* Stop heart-beat timer to stop heartbeat disassociation */
+ limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
+
+ if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
+ pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
+ {
+ PELOGW(limLog(pMac, LOGW, FL("Posting finish scan as we are in scan state\n"));)
+ /* Stop ongoing scanning if any */
+ if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
+ {
+ //Set the resume channel to Any valid channel (invalid).
+ //This will instruct HAL to set it to any previous valid channel.
+ peSetResumeChannel(pMac, 0, 0);
+ limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
+ }
+ else
+ {
+ limRestorePreQuietState(pMac);
+ }
+ }
+ else
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Not in scan state, start quiet timer\n"));)
+ /** We are safe to switch channel at this point */
+ limStartQuietTimer(pMac, psessionEntry->peSessionId);
+ }
+
+ // Transition to eLIM_QUIET_BEGIN
+ pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_BEGIN;
+#endif
+}
+
+
+/**----------------------------------------------
+\fn limStartQuietTimer
+\brief Starts the quiet timer.
+
+\param pMac
+\return NONE
+-----------------------------------------------*/
+void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
+{
+ tpPESession psessionEntry;
+ psessionEntry = peFindSessionBySessionId(pMac , sessionId);
+
+ if(psessionEntry == NULL) {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+
+ if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
+ return;
+ // First, de-activate Timer, if its already active
+ limCancelDot11hQuiet(pMac, psessionEntry);
+
+ limDeactivateAndChangeTimer(pMac, eLIM_QUIET_TIMER);
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_QUIET_TIMER));
+
+ pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
+ if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
+ {
+ limLog( pMac, LOGE,
+ FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!\n"));
+ limRestorePreQuietState(pMac);
+
+ pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+ return;
+ }
+#endif
+}
+
+#ifdef ANI_PRODUCT_TYPE_AP
+
+/**
+ * computeChannelSwitchCount
+ *
+ * FUNCTION:
+ * Function used by limProcessSmeSwitchChlReq()
+ * to compute channel switch count.
+ *
+ * LOGIC:
+ * Channel Switch Count is the number of TBTT until AP switches
+ * to a new channel. The value of Channel Switch Count is computed
+ * in a way, such that channel switch will always take place after
+ * a DTIM. By doing so, it is guaranteed that station in power save
+ * mode can receive the message and switch to new channel accordingly.
+ * AP can also announce the channel switch several dtims ahead of time.
+ * by setting the dtimFactor value greater than 1.
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param dtimFactor
+ * @return channel switch count
+ */
+tANI_U32 computeChannelSwitchCount(tpAniSirGlobal pMac, tANI_U32 dtimFactor)
+{
+ tANI_U32 dtimPeriod;
+ tANI_U32 dtimCount;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_DTIM_PERIOD, &dtimPeriod) != eSIR_SUCCESS)
+ PELOGE(limLog(pMac, LOGE, FL("wlan_cfgGetInt failed for WNI_CFG_DTIM_PERIOD \n"));)
+
+ dtimCount = pMac->pmm.gPmmTim.dtimCount;
+
+ if (dtimFactor <= 1)
+ return (dtimCount + 1);
+ else
+ return (((dtimFactor -1)*dtimPeriod) + 1 + dtimCount);
+}
+#endif
+
+/** ------------------------------------------------------------------------ **/
+/**
+ * keep track of the number of ANI peers associated in the BSS
+ * For the first and last ANI peer, we have to update EDCA params as needed
+ *
+ * When the first ANI peer joins the BSS, we notify SCH
+ * When the last ANI peer leaves the BSS, we notfiy SCH
+ */
+void
+limUtilCountStaAdd(
+ tpAniSirGlobal pMac,
+ tpDphHashNode pSta,
+ tpPESession psessionEntry)
+{
+
+ if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
+ return;
+
+ pSta->fAniCount = 1;
+
+ if (pMac->lim.gLimNumOfAniSTAs++ != 0)
+ return;
+
+ // get here only if this is the first ANI peer in the BSS
+ schEdcaProfileUpdate(pMac, psessionEntry);
+}
+
+void
+limUtilCountStaDel(
+ tpAniSirGlobal pMac,
+ tpDphHashNode pSta,
+ tpPESession psessionEntry)
+{
+
+ if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
+ return;
+
+ /* Only if sta is invalid and the validInDummyState bit is set to 1,
+ * then go ahead and update the count and profiles. This ensures
+ * that the "number of ani station" count is properly incremented/decremented.
+ */
+ if (pSta->valid == 1)
+ return;
+
+ pSta->fAniCount = 0;
+
+ if (pMac->lim.gLimNumOfAniSTAs <= 0)
+ {
+ limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d\n"),
+ pMac->lim.gLimNumOfAniSTAs);
+ return;
+ }
+
+ pMac->lim.gLimNumOfAniSTAs--;
+
+ if (pMac->lim.gLimNumOfAniSTAs != 0)
+ return;
+
+ // get here only if this is the last ANI peer in the BSS
+ schEdcaProfileUpdate(pMac, psessionEntry);
+}
+
+/** -------------------------------------------------------------
+\fn limGetHtCbAdminState
+\brief provides CB Admin state
+\param tpAniSirGlobal pMac
+\param tDot11fIEHTCaps htCaps,
+\param tANI_U8 *titanHtCaps
+\return none
+ -------------------------------------------------------------*/
+void limGetHtCbAdminState( tpAniSirGlobal pMac,
+ tDot11fIEHTCaps htCaps,
+ tANI_U8 *titanHtCaps )
+{
+ // Extract secondary channel info wrt Channel Bonding
+ if(htCaps.supportedChannelWidthSet)
+ SME_SET_CB_ADMIN_STATE( *titanHtCaps, eHAL_SET );
+ else
+ SME_SET_CB_ADMIN_STATE( *titanHtCaps, eHAL_CLEAR);
+
+
+ // And the final TITAN HT capabilities bitmap is...
+ limLog( pMac, LOG2,
+ FL("TITAN HT capabilities in BSS Description = %1d\n"),
+ *titanHtCaps);
+}
+/** -------------------------------------------------------------
+\fn limGetHtCbOpState
+\brief provides CB operational state
+\param tpAniSirGlobal pMac
+\param tDot11fIEHTInfo htInfo,
+\param tANI_U8 *titanHtCaps
+\return none
+ -------------------------------------------------------------*/
+void limGetHtCbOpState( tpAniSirGlobal pMac,
+ tDot11fIEHTInfo htInfo,
+ tANI_U8 *titanHtCaps )
+{
+ // Extract secondary channel info wrt Channel Bonding
+ if(htInfo.secondaryChannelOffset)
+ {
+ if(PHY_DOUBLE_CHANNEL_LOW_PRIMARY == htInfo.secondaryChannelOffset)
+ SME_SET_CB_OPER_STATE( *titanHtCaps,
+ eANI_CB_SECONDARY_UP );
+ else if(PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == htInfo.secondaryChannelOffset)
+ SME_SET_CB_OPER_STATE( *titanHtCaps,
+ eANI_CB_SECONDARY_DOWN );
+ }
+
+ // And the final TITAN HT capabilities bitmap is...
+ limLog( pMac, LOG2,
+ FL("TITAN HT capabilities in BSS Description = %1d\n"),
+ *titanHtCaps);
+}
+
+/**
+ * limSwitchChannelCback()
+ *
+ *FUNCTION:
+ * This is the callback function registered while requesting to switch channel
+ * after AP indicates a channel switch for spectrum management (11h).
+ *
+ *NOTE:
+ * @param pMac Pointer to Global MAC structure
+ * @param status Status of channel switch request
+ * @param data User data
+ * @param psessionEntry Session information
+ * @return NONE
+ */
+void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
+ tANI_U32 *data, tpPESession psessionEntry)
+{
+ tSirMsgQ mmhMsg = {0};
+ tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
+
+ PELOG1(limLog(pMac, LOG1,FL("Sending message %s with reasonCode %s\n"),
+ limMsgStr(msgType), limResultCodeStr(resultCode));)
+
+ psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
+
+ /* We need to restore pre-channelSwitch state on the STA */
+ if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system\n"));
+ return;
+ }
+
+ mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeSwitchChInd, sizeof(tSirSmeSwitchChannelInd)))
+ {
+ limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor\n"));
+ return;
+ }
+
+ pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
+ pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
+ pSirSmeSwitchChInd->newChannelId = pMac->lim.gLimChannelSwitch.primaryChannel;
+ pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
+ //BSS ID
+ palCopyMemory( pMac->hHdd, pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
+ mmhMsg.bodyptr = pSirSmeSwitchChInd;
+ mmhMsg.bodyval = 0;
+
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+ SysProcessMmhMsg(pMac, &mmhMsg);
+#else
+ if(halMmhPostMsgApi(pMac, &mmhMsg, ePROT) != eSIR_SUCCESS)
+ {
+ palFreeMemory(pMac->hHdd, (void *)msg2Hdd);
+ limLog(pMac, LOGP, FL("Message posting to HAL failed\n"));
+ }
+#endif
+}
+
+/**
+ * limSwitchPrimaryChannel()
+ *
+ *FUNCTION:
+ * This function changes the current operating channel
+ * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
+ *
+ *NOTE:
+ * @param pMac Pointer to Global MAC structure
+ * @param newChannel new chnannel ID
+ * @return NONE
+ */
+void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
+{
+#if !defined WLAN_FEATURE_VOWIFI
+ tANI_U32 localPwrConstraint;
+#endif
+
+ PELOG3(limLog(pMac, LOG3, FL("limSwitchPrimaryChannel: old chnl %d --> new chnl %d \n"),
+ psessionEntry->currentOperChannel, newChannel);)
+ psessionEntry->currentReqChannel = newChannel;
+ psessionEntry->limRFBand = limGetRFBand(newChannel);
+
+ psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
+
+ pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
+ pMac->lim.gpchangeChannelData = NULL;
+
+#if defined WLAN_FEATURE_VOWIFI
+ limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_NONE,
+ psessionEntry->maxTxPower, psessionEntry->peSessionId);
+#else
+ if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
+ {
+ limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg\n" ));
+ return;
+ }
+ limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_NONE,
+ (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
+#endif
+ return;
+}
+
+/**
+ * limSwitchPrimarySecondaryChannel()
+ *
+ *FUNCTION:
+ * This function changes the primary and secondary channel.
+ * If 11h is enabled and user provides a "new channel ID"
+ * that is different from the current operating channel,
+ * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
+ * assign notify LIM of such change.
+ *
+ *NOTE:
+ * @param pMac Pointer to Global MAC structure
+ * @param newChannel New chnannel ID (or current channel ID)
+ * @param subband CB secondary info:
+ * - eANI_CB_SECONDARY_NONE
+ * - eANI_CB_SECONDARY_UP
+ * - eANI_CB_SECONDARY_DOWN
+ * @return NONE
+ */
+void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel, tAniCBSecondaryMode subband)
+{
+#if !defined WLAN_FEATURE_VOWIFI
+ tANI_U32 localPwrConstraint;
+#endif
+
+ tpPESession psessionEntry = &pMac->lim.gpSession[0]; //TBD-RAJESH HOW TO GET sessionEntry?????
+#if !defined WLAN_FEATURE_VOWIFI
+ if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
+ limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg\n" ));
+ return;
+ }
+#endif
+
+ switch(subband)
+ {
+ case eANI_CB_SECONDARY_NONE:
+ PELOGW(limLog(pMac, LOGW, FL("Disable CB SECONDARY\n"));)
+ /* If CB was on, turn it off, otherwise, do nothing */
+ if(GET_CB_OPER_STATE(pMac->lim.gCbState))
+ {
+ /* Turn off CB in HW and SW. SW and HW cbstate must match! Otherwise, will hit ASSERT case */
+ SET_CB_OPER_STATE(pMac->lim.gCbState, eHAL_CLEAR);
+ /* Clean up station entry if we're not STA */
+ }
+ if (cfgSetInt(pMac, WNI_CFG_CB_SECONDARY_CHANNEL_STATE, WNI_CFG_CB_SECONDARY_CHANNEL_STATE_NONE) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("cfgSetInt WNI_CFG_CB_SECONDARY_CHANNEL_STATE failed \n"));
+
+#if defined WLAN_FEATURE_VOWIFI
+ limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_NONE, psessionEntry->maxTxPower, psessionEntry->peSessionId);
+#else
+ //Send Message to HAL to update the channel
+ limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_NONE, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
+#endif
+ break;
+
+ case eANI_CB_SECONDARY_UP:
+ PELOGW(limLog(pMac, LOGW, FL("Switch CB SECONDARY to UP.\n"));)
+ SET_CB_SEC_CHANNEL(pMac->lim.gCbState, eHAL_SET);
+ if (cfgSetInt(pMac, WNI_CFG_CB_SECONDARY_CHANNEL_STATE, WNI_CFG_CB_SECONDARY_CHANNEL_STATE_HIGHER) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("cfgSetInt WNI_CFG_CB_SECONDARY_CHANNEL_STATE failed \n"));
+
+ /* If CB was off, turn it on, otherwise, do nothing */
+ if(!GET_CB_OPER_STATE(pMac->lim.gCbState))
+ {
+ /* Turn on CB in HW and SW. SW and HW cbstate must match! Otherwise, will hit ASSERT case */
+ SET_CB_OPER_STATE(pMac->lim.gCbState, eHAL_SET);
+ }
+ //Send Message to HAL to update the channel
+ //enums for secondary channel offset for Titan and 11n are different
+#if defined WLAN_FEATURE_VOWIFI
+ limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_UP, psessionEntry->maxTxPower, psessionEntry->peSessionId);
+#else
+ limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_UP, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
+#endif
+ break;
+
+ case eANI_CB_SECONDARY_DOWN:
+ PELOGW(limLog(pMac, LOGW, FL("Switch CB SECONDARY to LOWER.\n"));)
+ SET_CB_SEC_CHANNEL(pMac->lim.gCbState, eHAL_CLEAR);
+ if (cfgSetInt(pMac, WNI_CFG_CB_SECONDARY_CHANNEL_STATE, WNI_CFG_CB_SECONDARY_CHANNEL_STATE_LOWER) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("cfgSetInt WNI_CFG_CB_SECONDARY_CHANNEL_STATE failed \n"));
+ /* If CB was off, turn it on, otherwise, do nothing */
+ if(!GET_CB_OPER_STATE(pMac->lim.gCbState))
+ {
+ /* Turn on CB in HW and SW. SW and HW cbstate must match! Otherwise, will hit ASSERT case */
+ SET_CB_OPER_STATE(pMac->lim.gCbState, eHAL_SET);
+ /* Update station entry if we're not STA */
+ }
+ //Send Message to HAL to update the channel
+ //enums for secondary channel offset for Titan and 11n are different
+#if defined WLAN_FEATURE_VOWIFI
+ limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_NONE, psessionEntry->maxTxPower, psessionEntry->peSessionId);
+#else
+ limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_DOWN, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
+#endif
+ break;
+
+ case eANI_DONOT_USE_SECONDARY_MODE:
+ break;
+ }
+
+
+ // We should only be changing primary and secondary channels on the fly
+ // if this is 11h enabled.
+ if (
+#if 0
+ pMac->lim.gLim11hEnable &&
+#endif
+ psessionEntry->currentOperChannel != newChannel)
+ {
+ limLog(pMac, LOGW,
+ FL("switch old chnl %d --> new chnl %d \n"),
+ psessionEntry->currentOperChannel, newChannel);
+
+ #if 0
+
+ if (cfgSetInt(pMac, WNI_CFG_CURRENT_CHANNEL, newChannel) != eSIR_SUCCESS)
+ limLog(pMac, LOGP, FL("set CURRENT_CHANNEL at CFG fail.\n"));
+ #endif // TO SUPPORT BT-AMP
+
+ psessionEntry->currentOperChannel = newChannel;
+ }
+
+ return;
+}
+
+
+/**
+ * limActiveScanAllowed()
+ *
+ *FUNCTION:
+ * Checks if active scans are permitted on the given channel
+ *
+ *LOGIC:
+ * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
+ * Need to check if the channelNum matches, then depending on the corresponding
+ * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param channelNum channel number
+ * @return None
+ */
+
+tANI_U8 limActiveScanAllowed(
+ tpAniSirGlobal pMac,
+ tANI_U8 channelNum)
+{
+ tANI_U32 i;
+ tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
+ tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
+ if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
+ != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list\n"));)
+ return false;
+ }
+
+ if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
+ {
+ limLog(pMac, LOGE, FL("Invalid scan control list length:%d\n"),
+ len);
+ return false;
+ }
+
+ for (i=0; (i+1) < len; i+=2)
+ {
+ if (channelPair[i] == channelNum)
+ return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
+ }
+ return false;
+}
+
+/**
+ * limTriggerBackgroundScanDuringQuietBss()
+ *
+ *FUNCTION:
+ * This function is applicable to the STA only.
+ * This function is called by limProcessQuietTimeout(),
+ * when it is time to honor the Quiet BSS IE from the AP.
+ *
+ *LOGIC:
+ * If 11H is enabled:
+ * We cannot trigger a background scan. The STA needs to
+ * shut-off Tx/Rx.
+ * If 11 is not enabled:
+ * Determine if the next channel that we are going to
+ * scan is NOT the same channel (or not) on which the
+ * Quiet BSS was requested.
+ * If yes, then we cannot trigger a background scan on
+ * this channel. Return with a false.
+ * If no, then trigger a background scan. Return with
+ * a true.
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ * This API is redundant if the existing API,
+ * limTriggerBackgroundScan(), were to return a valid
+ * response instead of returning void.
+ * If possible, try to revisit this API
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @return eSIR_TRUE, if a background scan was attempted
+ * eSIR_FALSE, if not
+ */
+tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
+{
+ tAniBool bScanTriggered = eSIR_FALSE;
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+
+
+
+ //TBD-RAJESH HOW TO GET sessionEntry?????
+ tpPESession psessionEntry = &pMac->lim.gpSession[0];
+
+ if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
+ return bScanTriggered;
+
+ if( !pMac->lim.gLim11hEnable )
+ {
+ tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
+ tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
+
+ // Determine the next scan channel
+
+ // Get background scan channel list from CFG
+ if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
+ WNI_CFG_BG_SCAN_CHANNEL_LIST,
+ (tANI_U8 *) bgScanChannelList,
+ (tANI_U32 *) &len ))
+ {
+ // Ensure that we do not go off scanning on the same
+ // channel on which the Quiet BSS was requested
+ if( psessionEntry->currentOperChannel!=
+ bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
+ {
+ // For now, try and attempt a background scan. It will
+ // be ideal if this API actually returns a success or
+ // failure instead of having a void return type
+ limTriggerBackgroundScan( pMac );
+
+ bScanTriggered = eSIR_TRUE;
+ }
+ else
+ {
+ limLog( pMac, LOGW,
+ FL("The next SCAN channel is the current operating channel on which a Quiet BSS is requested.! A background scan will not be triggered during this Quiet BSS period...\n"));
+ }
+ }
+ else
+ {
+ limLog( pMac, LOGW,
+ FL("Unable to retrieve WNI_CFG_VALID_CHANNEL_LIST from CFG! A background scan will not be triggered during this Quiet BSS period...\n"));
+ }
+ }
+#endif
+ return bScanTriggered;
+}
+
+
+/**
+ * limGetHTCapability()
+ *
+ *FUNCTION:
+ * A utility function that returns the "current HT capability state" for the HT
+ * capability of interest (as requested in the API)
+ *
+ *LOGIC:
+ * This routine will return with the "current" setting of a requested HT
+ * capability. This state info could be retrieved from -
+ * a) CFG (for static entries)
+ * b) Run time info
+ * - Dynamic state maintained by LIM
+ * - Configured at radio init time by SME
+ *
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param pMac Pointer to Global MAC structure
+ * @param htCap The HT capability being queried
+ * @return tANI_U8 The current state of the requested HT capability is returned in a
+ * tANI_U8 variable
+ */
+
+#ifdef WLAN_SOFTAP_FEATURE
+tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
+ tANI_U32 htCap, tpPESession psessionEntry)
+#else
+tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
+ tANI_U32 htCap )
+#endif
+{
+tANI_U8 retVal = 0;
+tANI_U8 *ptr;
+tANI_U32 cfgValue;
+tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
+tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
+tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
+tSirMacASCapabilityInfo macASCapabilityInfo = {0};
+
+ //
+ // Determine which CFG to read from. Not ALL of the HT
+ // related CFG's need to be read each time this API is
+ // accessed
+ //
+ if( htCap >= eHT_ANTENNA_SELECTION &&
+ htCap < eHT_SI_GRANULARITY )
+ {
+ // Get Antenna Seletion HT Capabilities
+ if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
+ cfgValue = 0;
+ ptr = (tANI_U8 *) &macASCapabilityInfo;
+ *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
+ }
+ else
+ {
+ if( htCap >= eHT_TX_BEAMFORMING &&
+ htCap < eHT_ANTENNA_SELECTION )
+ {
+ // Get Transmit Beam Forming HT Capabilities
+ if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
+ cfgValue = 0;
+ ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
+ *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
+ }
+ else
+ {
+ if( htCap >= eHT_PCO &&
+ htCap < eHT_TX_BEAMFORMING )
+ {
+ // Get Extended HT Capabilities
+ if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
+ cfgValue = 0;
+ ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
+ *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
+ }
+ else
+ {
+ if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
+ {
+ // Get HT Capabilities
+ if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
+ cfgValue = 0;
+ ptr = (tANI_U8 *) &macHTCapabilityInfo;
+ // CR 265282 MDM SoftAP 2.4PL: SoftAP boot up crash in 2.4 PL builds while same WLAN SU is working on 2.1 PL
+ *ptr++ = cfgValue & 0xff;
+ *ptr = (cfgValue >> 8) & 0xff;
+ }
+ }
+ }
+ }
+
+ switch( htCap )
+ {
+ case eHT_LSIG_TXOP_PROTECTION:
+ retVal = pMac->lim.gHTLsigTXOPProtection;
+ break;
+
+ case eHT_STBC_CONTROL_FRAME:
+ retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
+ break;
+
+ case eHT_PSMP:
+ retVal = pMac->lim.gHTPSMPSupport;
+ break;
+
+ case eHT_DSSS_CCK_MODE_40MHZ:
+ retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
+ break;
+
+ case eHT_MAX_AMSDU_LENGTH:
+ retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
+ break;
+
+ case eHT_DELAYED_BA:
+ retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
+ break;
+
+ case eHT_RX_STBC:
+ retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
+ break;
+
+ case eHT_TX_STBC:
+ retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
+ break;
+
+ case eHT_SHORT_GI_40MHZ:
+ retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
+ break;
+
+ case eHT_SHORT_GI_20MHZ:
+ retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
+ break;
+
+ case eHT_GREENFIELD:
+ retVal = (tANI_U8) macHTCapabilityInfo.greenField;
+ break;
+
+ case eHT_MIMO_POWER_SAVE:
+ retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
+ break;
+
+ case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
+ retVal = (tANI_U8) macHTCapabilityInfo.supportedChannelWidthSet;
+ break;
+
+ case eHT_ADVANCED_CODING:
+ retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
+ break;
+
+ case eHT_MAX_RX_AMPDU_FACTOR:
+ retVal = pMac->lim.gHTMaxRxAMpduFactor;
+ break;
+
+ case eHT_MPDU_DENSITY:
+ retVal = pMac->lim.gHTAMpduDensity;
+ break;
+
+ case eHT_PCO:
+ retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
+ break;
+
+ case eHT_TRANSITION_TIME:
+ retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
+ break;
+
+ case eHT_MCS_FEEDBACK:
+ retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
+ break;
+
+ case eHT_TX_BEAMFORMING:
+ retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
+ break;
+
+ case eHT_ANTENNA_SELECTION:
+ retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
+ break;
+
+ case eHT_SI_GRANULARITY:
+ retVal = pMac->lim.gHTServiceIntervalGranularity;
+ break;
+
+ case eHT_CONTROLLED_ACCESS:
+ retVal = pMac->lim.gHTControlledAccessOnly;
+ break;
+
+ case eHT_RIFS_MODE:
+ retVal = psessionEntry->beaconParams.fRIFSMode;
+ break;
+
+ case eHT_RECOMMENDED_TX_WIDTH_SET:
+ retVal = pMac->lim.gHTRecommendedTxWidthSet;
+ break;
+
+ case eHT_EXTENSION_CHANNEL_OFFSET:
+ retVal = pMac->lim.gHTSecondaryChannelOffset;
+ break;
+
+ case eHT_OP_MODE:
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
+ retVal = psessionEntry->htOperMode;
+ else
+#endif
+ retVal = pMac->lim.gHTOperMode;
+ break;
+
+ case eHT_BASIC_STBC_MCS:
+ retVal = pMac->lim.gHTSTBCBasicMCS;
+ break;
+
+ case eHT_DUAL_CTS_PROTECTION:
+ retVal = pMac->lim.gHTDualCTSProtection;
+ break;
+
+ case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
+ retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
+ break;
+
+ case eHT_PCO_ACTIVE:
+ retVal = pMac->lim.gHTPCOActive;
+ break;
+
+ case eHT_PCO_PHASE:
+ retVal = pMac->lim.gHTPCOPhase;
+ break;
+
+ default:
+ break;
+ }
+
+ return retVal;
+}
+
+#if 0
+void limSetBssid(tpAniSirGlobal pMac, tANI_U8 *bssId)
+{
+ palCopyMemory( pMac->hHdd, pMac->lim.gLimBssid, bssId, sizeof(tSirMacAddr));
+ return;
+}
+
+void limGetBssid(tpAniSirGlobal pMac, tANI_U8 *bssId)
+{
+ palCopyMemory( pMac->hHdd, bssId, pMac->lim.gLimBssid, sizeof(tSirMacAddr));
+ return;
+}
+
+#endif
+void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
+{
+ palCopyMemory( pMac->hHdd, mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
+ return;
+}
+
+
+
+
+/** -------------------------------------------------------------
+\fn limEnable11aProtection
+\brief based on config setting enables\disables 11a protection.
+\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
+\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
+\param tpUpdateBeaconParams pBeaconParams
+\return None
+ -------------------------------------------------------------*/
+tSirRetStatus
+limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
+ tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
+{
+
+ //overlapping protection configuration check.
+ if(overlap)
+ {
+#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE && !pMac->lim.cfgProtection.overlapFromlla)
+ {
+ // protection disabled.
+ PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11a is disabled\n"));)
+ return eSIR_SUCCESS;
+ }
+#endif
+ }
+ else
+ {
+ //normal protection config check
+ if(!pMac->lim.cfgProtection.fromlla)
+ {
+ // protection disabled.
+ PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled\n"));)
+ return eSIR_SUCCESS;
+ }
+ }
+
+ if (enable)
+ {
+ //If we are AP and HT capable, we need to set the HT OP mode
+ //appropriately.
+ if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
+ (true == psessionEntry->htCapabality))
+ {
+ if(overlap)
+ {
+ pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
+ if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
+ (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
+ {
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
+ psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
+ limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
+ limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
+ }
+ }
+ else
+ {
+ psessionEntry->gLim11aParams.protectionEnabled = true;
+ if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
+ {
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
+ limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
+ limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
+
+ }
+ }
+ }
+
+ //This part is common for staiton as well.
+ if(false == psessionEntry->beaconParams.llaCoexist)
+ {
+ PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled\n"));)
+ pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
+ pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
+ }
+ }
+ else if (true == psessionEntry->beaconParams.llaCoexist)
+ {
+ //for AP role.
+ //we need to take care of HT OP mode change if needed.
+ //We need to take care of Overlap cases.
+ if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
+ {
+ if(overlap)
+ {
+ //Overlap Legacy protection disabled.
+ pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
+
+ //We need to take care of HT OP mode iff we are HT AP.
+ if(psessionEntry->htCapabality)
+ {
+ // no HT op mode change if any of the overlap protection enabled.
+ if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
+ pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
+ pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
+
+ {
+ //Check if there is a need to change HT OP mode.
+ if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
+ {
+ limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+
+ if(psessionEntry->gLimHt20Params.protectionEnabled)
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
+ else
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
+ }
+ }
+ }
+ }
+ else
+ {
+ //Disable protection from 11A stations.
+ psessionEntry->gLim11aParams.protectionEnabled = false;
+ limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+
+ //Check if any other non-HT protection enabled.
+ //Right now we are in HT OP Mixed mode.
+ //Change HT op mode appropriately.
+
+ //Change HT OP mode to 01 if any overlap protection enabled
+ if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
+ pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
+ pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
+
+ {
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
+ limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
+ }
+ else if(psessionEntry->gLimHt20Params.protectionEnabled)
+ {
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
+ limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ }
+ else
+ {
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
+ limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ }
+ }
+ if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
+ !psessionEntry->gLim11aParams.protectionEnabled)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled\n"));)
+ pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
+ pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
+ }
+ }
+ //for station role
+ else
+ {
+ PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled\n"));)
+ pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
+ pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
+ }
+ }
+
+ return eSIR_SUCCESS;
+}
+
+/** -------------------------------------------------------------
+\fn limEnable11gProtection
+\brief based on config setting enables\disables 11g protection.
+\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
+\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
+\param tpUpdateBeaconParams pBeaconParams
+\return None
+ -------------------------------------------------------------*/
+
+tSirRetStatus
+limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
+ tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
+{
+
+ //overlapping protection configuration check.
+ if(overlap)
+ {
+#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+ if(((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE )) && !pMac->lim.cfgProtection.overlapFromllb)
+ {
+ // protection disabled.
+ PELOG1(limLog(pMac, LOG1, FL("overlap protection from 11b is disabled\n"));)
+ return eSIR_SUCCESS;
+ }
+#endif
+ }
+ else
+ {
+ //normal protection config check
+#ifdef WLAN_SOFTAP_FEATURE
+ if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
+ !psessionEntry->cfgProtection.fromllb)
+ {
+ // protection disabled.
+ PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled\n"));)
+ return eSIR_SUCCESS;
+ }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
+#endif
+ {
+ if(!pMac->lim.cfgProtection.fromllb)
+ {
+ // protection disabled.
+ PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled\n"));)
+ return eSIR_SUCCESS;
+ }
+ }
+ }
+
+ if (enable)
+ {
+ //If we are AP and HT capable, we need to set the HT OP mode
+ //appropriately.
+#ifdef WLAN_SOFTAP_FEATURE
+ if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
+ {
+ if(overlap)
+ {
+ psessionEntry->gLimOlbcParams.protectionEnabled = true;
+ PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled\n"));)
+ if(true == psessionEntry->htCapabality)
+ {
+ if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
+ (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
+ {
+ psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
+ }
+ //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
+ // This fixes issue of OBSS bit not set after 11b, 11g station leaves
+ limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
+ //Not processing OBSS bit from other APs, as we are already taking care
+ //of Protection from overlapping BSS based on erp IE or useProtection bit
+ limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
+ }
+ }
+ else
+ {
+ psessionEntry->gLim11bParams.protectionEnabled = true;
+ PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled\n"));)
+ if(true == psessionEntry->htCapabality)
+ {
+ if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
+ {
+ psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
+ limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
+ limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
+ }
+ }
+ }
+ }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
+ (true == psessionEntry->htCapabality))
+#else
+ if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)|| (eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)) &&
+ (true == psessionEntry->htCapabality))
+#endif
+ {
+ if(overlap)
+ {
+ psessionEntry->gLimOlbcParams.protectionEnabled = true;
+ if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
+ (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
+ {
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
+ }
+ //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
+ // This fixes issue of OBSS bit not set after 11b, 11g station leaves
+ limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
+ //Not processing OBSS bit from other APs, as we are already taking care
+ //of Protection from overlapping BSS based on erp IE or useProtection bit
+ limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
+ }
+ else
+ {
+ psessionEntry->gLim11bParams.protectionEnabled = true;
+ if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
+ {
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
+ limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
+ limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
+ }
+ }
+ }
+
+ //This part is common for staiton as well.
+ if(false == psessionEntry->beaconParams.llbCoexist)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled\n"));)
+ pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
+ pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
+ }
+ }
+ else if (true == psessionEntry->beaconParams.llbCoexist)
+ {
+ //for AP role.
+ //we need to take care of HT OP mode change if needed.
+ //We need to take care of Overlap cases.
+#ifdef WLAN_SOFTAP_FEATURE
+ if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
+ {
+ if(overlap)
+ {
+ //Overlap Legacy protection disabled.
+ psessionEntry->gLimOlbcParams.protectionEnabled = false;
+
+ //We need to take care of HT OP mode if we are HT AP.
+ if(psessionEntry->htCapabality)
+ {
+ // no HT op mode change if any of the overlap protection enabled.
+ if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
+ psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
+ psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
+ {
+ //Check if there is a need to change HT OP mode.
+ if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
+ {
+ limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ if(psessionEntry->gLimHt20Params.protectionEnabled){
+ //Commenting out beacuse of CR 258588 WFA cert
+ //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
+ psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
+ }
+ else
+ psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
+ }
+ }
+ }
+ }
+ else
+ {
+ //Disable protection from 11B stations.
+ psessionEntry->gLim11bParams.protectionEnabled = false;
+ PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled\n"));)
+ //Check if any other non-HT protection enabled.
+ if(!psessionEntry->gLim11gParams.protectionEnabled)
+ {
+ //Right now we are in HT OP Mixed mode.
+ //Change HT op mode appropriately.
+ limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+
+ //Change HT OP mode to 01 if any overlap protection enabled
+ if(psessionEntry->gLimOlbcParams.protectionEnabled ||
+ psessionEntry->gLimOverlap11gParams.protectionEnabled ||
+ psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
+ psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
+ {
+ psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
+ PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled\n"));)
+ limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
+ }
+ else if(psessionEntry->gLimHt20Params.protectionEnabled)
+ {
+ //Commenting because of CR 258588 WFA cert
+ //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
+ psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
+ PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled\n"));)
+ limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ }
+ else
+ {
+ psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
+ limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ }
+ }
+ }
+ if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
+ !psessionEntry->gLim11bParams.protectionEnabled)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled\n"));)
+ pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
+ pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
+ }
+ }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
+#else
+ if((eLIM_AP_ROLE == psessionEntry->limSystemRole)||((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)))
+#endif
+ {
+ if(overlap)
+ {
+ //Overlap Legacy protection disabled.
+ psessionEntry->gLimOlbcParams.protectionEnabled = false;
+
+ //We need to take care of HT OP mode iff we are HT AP.
+ if(psessionEntry->htCapabality)
+ {
+ // no HT op mode change if any of the overlap protection enabled.
+ if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
+ pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
+ pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
+
+ {
+ //Check if there is a need to change HT OP mode.
+ if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
+ {
+ limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ if(psessionEntry->gLimHt20Params.protectionEnabled)
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
+ else
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
+ }
+ }
+ }
+ }
+ else
+ {
+ //Disable protection from 11B stations.
+ psessionEntry->gLim11bParams.protectionEnabled = false;
+ //Check if any other non-HT protection enabled.
+ if(!psessionEntry->gLim11gParams.protectionEnabled)
+ {
+ //Right now we are in HT OP Mixed mode.
+ //Change HT op mode appropriately.
+ limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+
+ //Change HT OP mode to 01 if any overlap protection enabled
+ if(psessionEntry->gLimOlbcParams.protectionEnabled ||
+ pMac->lim.gLimOverlap11gParams.protectionEnabled ||
+ pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
+ pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
+
+ {
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
+ limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
+ }
+ else if(psessionEntry->gLimHt20Params.protectionEnabled)
+ {
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
+ limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ }
+ else
+ {
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
+ limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ }
+ }
+ }
+ if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
+ !psessionEntry->gLim11bParams.protectionEnabled)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled\n"));)
+ pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
+ pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
+ }
+ }
+ //for station role
+ else
+ {
+ PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled\n"));)
+ pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
+ pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
+ }
+ }
+ return eSIR_SUCCESS;
+}
+
+/** -------------------------------------------------------------
+\fn limEnableHtProtectionFrom11g
+\brief based on cofig enables\disables protection from 11g.
+\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
+\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
+\param tpUpdateBeaconParams pBeaconParams
+\return None
+ -------------------------------------------------------------*/
+tSirRetStatus
+limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
+ tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
+{
+ if(!psessionEntry->htCapabality)
+ return eSIR_SUCCESS; // protection from 11g is only for HT stations.
+
+ //overlapping protection configuration check.
+ if(overlap)
+ {
+#ifdef WLAN_SOFTAP_FEATURE
+ if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
+ {
+ // protection disabled.
+ PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled\n")););
+ return eSIR_SUCCESS;
+ }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
+#else
+ if(((psessionEntry->limSystemRole == eLIM_AP_ROLE ) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) && (!pMac->lim.cfgProtection.overlapFromllg))
+#endif
+ {
+ // protection disabled.
+ PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled\n")););
+ return eSIR_SUCCESS;
+ }
+ }
+ else
+ {
+ //normal protection config check
+#ifdef WLAN_SOFTAP_FEATURE
+ if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
+ !psessionEntry->cfgProtection.fromllg){
+ // protection disabled.
+ PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled\n"));)
+ return eSIR_SUCCESS;
+ }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
+#endif
+ {
+ if(!pMac->lim.cfgProtection.fromllg)
+ {
+ // protection disabled.
+ PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled\n"));)
+ return eSIR_SUCCESS;
+ }
+ }
+ }
+ if (enable)
+ {
+ //If we are AP and HT capable, we need to set the HT OP mode
+ //appropriately.
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
+ {
+ if(overlap)
+ {
+ psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
+ //11g exists in overlap BSS.
+ //need not to change the operating mode to overlap_legacy
+ //if higher or same protection operating mode is enabled right now.
+ if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
+ (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
+ {
+ psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
+ }
+ limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
+ limEnableHtOBSSProtection(pMac, true , overlap, pBeaconParams, psessionEntry);
+ }
+ else
+ {
+ //11g is associated to an AP operating in 11n mode.
+ //Change the HT operating mode to 'mixed mode'.
+ psessionEntry->gLim11gParams.protectionEnabled = true;
+ if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
+ {
+ psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
+ limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
+ limEnableHtOBSSProtection(pMac, true , overlap, pBeaconParams,psessionEntry);
+ }
+ }
+ }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
+#else
+ if((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))
+#endif
+ {
+ if(overlap)
+ {
+ pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
+ //11g exists in overlap BSS.
+ //need not to change the operating mode to overlap_legacy
+ //if higher or same protection operating mode is enabled right now.
+ if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
+ (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
+ {
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
+ limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
+ }
+ }
+ else
+ {
+ //11g is associated to an AP operating in 11n mode.
+ //Change the HT operating mode to 'mixed mode'.
+ psessionEntry->gLim11gParams.protectionEnabled = true;
+ if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
+ {
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
+ limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
+ limEnableHtOBSSProtection(pMac, true , overlap, pBeaconParams,psessionEntry);
+ }
+ }
+ }
+
+ //This part is common for staiton as well.
+ if(false == psessionEntry->beaconParams.llgCoexist)
+ {
+ pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
+ pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
+ }
+#ifdef WLAN_SOFTAP_FEATURE
+ else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
+ {
+ // As operating mode changed after G station assoc some way to update beacon
+ // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
+ //pMac->sch.schObject.fBeaconChanged = 1;
+ pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
+ }
+#endif
+ }
+ else if (true == psessionEntry->beaconParams.llgCoexist)
+ {
+ //for AP role.
+ //we need to take care of HT OP mode change if needed.
+ //We need to take care of Overlap cases.
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
+ {
+ if(overlap)
+ {
+ //Overlap Legacy protection disabled.
+ if (psessionEntry->gLim11gParams.numSta == 0)
+ psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
+
+ // no HT op mode change if any of the overlap protection enabled.
+ if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
+ psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
+ psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
+ {
+ //Check if there is a need to change HT OP mode.
+ if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
+ {
+ limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+
+ if(psessionEntry->gLimHt20Params.protectionEnabled){
+ //Commenting because of CR 258588 WFA cert
+ //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
+ psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
+ }
+ else
+ psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
+ }
+ }
+ }
+ else
+ {
+ //Disable protection from 11G stations.
+ psessionEntry->gLim11gParams.protectionEnabled = false;
+ //Check if any other non-HT protection enabled.
+ if(!psessionEntry->gLim11bParams.protectionEnabled)
+ {
+
+ //Right now we are in HT OP Mixed mode.
+ //Change HT op mode appropriately.
+ limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+
+ //Change HT OP mode to 01 if any overlap protection enabled
+ if(psessionEntry->gLimOlbcParams.protectionEnabled ||
+ psessionEntry->gLimOverlap11gParams.protectionEnabled ||
+ psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
+ psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
+
+ {
+ psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
+ limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
+ }
+ else if(psessionEntry->gLimHt20Params.protectionEnabled)
+ {
+ //Commenting because of CR 258588 WFA cert
+ //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
+ psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
+ limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ }
+ else
+ {
+ psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
+ limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ }
+ }
+ }
+ if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
+ !psessionEntry->gLim11gParams.protectionEnabled)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled\n"));)
+ pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
+ pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
+ }
+ }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
+#else
+ if((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))
+#endif
+ {
+ if(overlap)
+ {
+ //Overlap Legacy protection disabled.
+ pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
+
+ // no HT op mode change if any of the overlap protection enabled.
+ if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
+ psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
+ psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
+ {
+ //Check if there is a need to change HT OP mode.
+ if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
+ {
+ limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+
+ if(psessionEntry->gLimHt20Params.protectionEnabled)
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
+ else
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
+ }
+ }
+ }
+ else
+ {
+ //Disable protection from 11G stations.
+ psessionEntry->gLim11gParams.protectionEnabled = false;
+ //Check if any other non-HT protection enabled.
+ if(!psessionEntry->gLim11bParams.protectionEnabled)
+ {
+
+ //Right now we are in HT OP Mixed mode.
+ //Change HT op mode appropriately.
+ limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+
+ //Change HT OP mode to 01 if any overlap protection enabled
+ if(psessionEntry->gLimOlbcParams.protectionEnabled ||
+ pMac->lim.gLimOverlap11gParams.protectionEnabled ||
+ pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
+ pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
+
+ {
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
+ limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
+ }
+ else if(psessionEntry->gLimHt20Params.protectionEnabled)
+ {
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
+ limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ }
+ else
+ {
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
+ limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ }
+ }
+ }
+ if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
+ !psessionEntry->gLim11gParams.protectionEnabled)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled\n"));)
+ pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
+ pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
+ }
+ }
+ //for station role
+ else
+ {
+ PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled\n"));)
+ pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
+ pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
+ }
+ }
+ return eSIR_SUCCESS;
+}
+//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
+//This check will be done at the caller.
+
+/** -------------------------------------------------------------
+\fn limEnableHtObssProtection
+\brief based on cofig enables\disables obss protection.
+\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
+\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
+\param tpUpdateBeaconParams pBeaconParams
+\return None
+ -------------------------------------------------------------*/
+tSirRetStatus
+limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
+ tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
+{
+
+
+ if(!psessionEntry->htCapabality)
+ return eSIR_SUCCESS; // this protection is only for HT stations.
+
+ //overlapping protection configuration check.
+ if(overlap)
+ {
+ //overlapping protection configuration check.
+ #if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+ if((psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) && !pMac->lim.cfgProtection.overlapOBSS)
+ { // ToDo Update this field
+ // protection disabled.
+ PELOG1(limLog(pMac, LOG1, FL("overlap protection from Obss is disabled\n"));)
+ return eSIR_SUCCESS;
+ }
+ #endif
+ }
+ else
+ {
+ //normal protection config check
+#ifdef WLAN_SOFTAP_FEATURE
+ if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
+ { //ToDo Update this field
+ // protection disabled.
+ PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled\n"));)
+ return eSIR_SUCCESS;
+ }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
+#endif
+ {
+ if(!pMac->lim.cfgProtection.obss)
+ { //ToDo Update this field
+ // protection disabled.
+ PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled\n"));)
+ return eSIR_SUCCESS;
+ }
+ }
+ }
+
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
+ if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
+ {
+ PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled\n"));)
+ psessionEntry->beaconParams.gHTObssMode = true;
+ pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
+
+ }
+ else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
+ {
+ PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled\n"));)
+ psessionEntry->beaconParams.gHTObssMode = false;
+ pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
+
+ }
+//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
+ if (!enable && !overlap)
+ {
+ psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
+ }
+ } else
+#endif
+ {
+ if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
+ {
+ PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled\n"));)
+ psessionEntry->beaconParams.gHTObssMode = true;
+ pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
+
+ }
+ else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
+ {
+
+ PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled\n"));)
+ psessionEntry->beaconParams.gHTObssMode = false;
+ pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
+
+ }
+ }
+ return eSIR_SUCCESS;
+}
+/** -------------------------------------------------------------
+\fn limEnableHT20Protection
+\brief based on cofig enables\disables protection from Ht20.
+\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
+\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
+\param tpUpdateBeaconParams pBeaconParams
+\return None
+ -------------------------------------------------------------*/
+tSirRetStatus
+limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
+ tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
+{
+ if(!psessionEntry->htCapabality)
+ return eSIR_SUCCESS; // this protection is only for HT stations.
+
+ //overlapping protection configuration check.
+ if(overlap)
+ {
+#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+ if(((psessionEntry->limSystemRole == eLIM_AP_ROLE )||(psessionEntry->limSystemRoleS == eLIM_BT_AMP_AP_ROLE ))&& !pMac->lim.cfgProtection.overlapHt20)
+ {
+ // protection disabled.
+ PELOG3(limLog(pMac, LOG3, FL("overlap protection from HT 20 is disabled\n"));)
+ return eSIR_SUCCESS;
+ }
+#endif
+ }
+ else
+ {
+ //normal protection config check
+#ifdef WLAN_SOFTAP_FEATURE
+ if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
+ !psessionEntry->cfgProtection.ht20)
+ {
+ // protection disabled.
+ PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled\n"));)
+ return eSIR_SUCCESS;
+ }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
+#endif
+ {
+ if(!pMac->lim.cfgProtection.ht20)
+ {
+ // protection disabled.
+ PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled\n"));)
+ return eSIR_SUCCESS;
+ }
+ }
+ }
+
+ if (enable)
+ {
+ //If we are AP and HT capable, we need to set the HT OP mode
+ //appropriately.
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
+ if(overlap)
+ {
+ psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
+ if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
+ (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
+ {
+ psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
+ limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
+ }
+ }
+ else
+ {
+ psessionEntry->gLimHt20Params.protectionEnabled = true;
+ if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
+ {
+ //Commenting because of CR 258588 WFA cert
+ //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
+ psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
+ limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ }
+ }
+ }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
+#else
+ if((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))
+#endif
+ {
+ if(overlap)
+ {
+ pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
+ if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
+ (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
+ {
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
+ limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
+ }
+ }
+ else
+ {
+ psessionEntry->gLimHt20Params.protectionEnabled = true;
+ if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
+ {
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
+ limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ }
+ }
+ }
+
+ //This part is common for staiton as well.
+ if(false == psessionEntry->beaconParams.ht20Coexist)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled\n"));)
+ pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
+ pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
+ }
+ }
+ else if (true == psessionEntry->beaconParams.ht20Coexist)
+ {
+ //for AP role.
+ //we need to take care of HT OP mode change if needed.
+ //We need to take care of Overlap cases.
+#ifdef WLAN_SOFTAP_FEATURE
+ if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
+ if(overlap)
+ {
+ //Overlap Legacy protection disabled.
+ psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
+
+ // no HT op mode change if any of the overlap protection enabled.
+ if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
+ psessionEntry->gLimOverlap11gParams.protectionEnabled ||
+ psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
+ psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
+ {
+
+ //Check if there is a need to change HT OP mode.
+ if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
+ {
+ if(psessionEntry->gLimHt20Params.protectionEnabled)
+ {
+ //Commented beacuse of CR 258588 for WFA Cert
+ //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
+ psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
+ limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ }
+ else
+ {
+ psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
+ }
+ }
+ }
+ }
+ else
+ {
+ //Disable protection from 11G stations.
+ psessionEntry->gLimHt20Params.protectionEnabled = false;
+
+ //Change HT op mode appropriately.
+ if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
+ {
+ psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
+ limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ }
+ }
+ PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled\n"));)
+ pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
+ pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
+ }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
+#else
+ if((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))
+#endif
+ {
+ if(overlap)
+ {
+ //Overlap Legacy protection disabled.
+ pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
+
+ // no HT op mode change if any of the overlap protection enabled.
+ if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
+ pMac->lim.gLimOverlap11gParams.protectionEnabled ||
+ pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
+ pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
+ {
+
+ //Check if there is a need to change HT OP mode.
+ if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
+ {
+ if(psessionEntry->gLimHt20Params.protectionEnabled)
+ {
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
+ limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ }
+ else
+ {
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
+ }
+ }
+ }
+ }
+ else
+ {
+ //Disable protection from 11G stations.
+ psessionEntry->gLimHt20Params.protectionEnabled = false;
+
+ //Change HT op mode appropriately.
+ if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
+ {
+ pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
+ limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
+ }
+ }
+ PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled\n"));)
+ pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
+ pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
+ }
+ //for station role
+ else
+ {
+ PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled\n"));)
+ pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
+ pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
+ }
+ }
+
+ return eSIR_SUCCESS;
+}
+
+/** -------------------------------------------------------------
+\fn limEnableHTNonGfProtection
+\brief based on cofig enables\disables protection from NonGf.
+\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
+\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
+\param tpUpdateBeaconParams pBeaconParams
+\return None
+ -------------------------------------------------------------*/
+tSirRetStatus
+limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
+ tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
+{
+ if(!psessionEntry->htCapabality)
+ return eSIR_SUCCESS; // this protection is only for HT stations.
+
+ //overlapping protection configuration check.
+ if(overlap)
+ {
+#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+ if(((psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) && !pMac->lim.cfgProtection.overlapNonGf)
+ {
+ // protection disabled.
+ PELOG3(limLog(pMac, LOG3, FL("overlap protection from NonGf is disabled\n"));)
+ return eSIR_SUCCESS;
+ }
+#endif
+ }
+ else
+ {
+#ifdef WLAN_SOFTAP_FEATURE
+ //normal protection config check
+ if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
+ !psessionEntry->cfgProtection.nonGf)
+ {
+ // protection disabled.
+ PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled\n"));)
+ return eSIR_SUCCESS;
+ }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
+#endif
+ {
+ //normal protection config check
+ if(!pMac->lim.cfgProtection.nonGf)
+ {
+ // protection disabled.
+ PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled\n"));)
+ return eSIR_SUCCESS;
+ }
+ }
+ }
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
+ if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
+ {
+ PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled\n"));)
+ pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
+ pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
+ }
+ else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
+ {
+ PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled\n"));)
+ pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
+ pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
+ }
+ }else
+#endif
+ {
+ if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
+ {
+ PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled\n"));)
+ pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
+ pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
+ }
+ else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
+ {
+ PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled\n"));)
+ pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
+ pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
+ }
+ }
+
+ return eSIR_SUCCESS;
+}
+
+/** -------------------------------------------------------------
+\fn limEnableHTLsigTxopProtection
+\brief based on cofig enables\disables LsigTxop protection.
+\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
+\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
+\param tpUpdateBeaconParams pBeaconParams
+\return None
+ -------------------------------------------------------------*/
+tSirRetStatus
+limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
+ tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
+{
+ if(!psessionEntry->htCapabality)
+ return eSIR_SUCCESS; // this protection is only for HT stations.
+
+ //overlapping protection configuration check.
+ if(overlap)
+ {
+#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+ if(((psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) && !pMac->lim.cfgProtection.overlapLsigTxop)
+ {
+ // protection disabled.
+ PELOG3(limLog(pMac, LOG3, FL(" overlap protection from LsigTxop not supported is disabled\n"));)
+ return eSIR_SUCCESS;
+ }
+#endif
+ }
+ else
+ {
+#ifdef WLAN_SOFTAP_FEATURE
+ //normal protection config check
+ if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
+ !psessionEntry->cfgProtection.lsigTxop)
+ {
+ // protection disabled.
+ PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled\n"));)
+ return eSIR_SUCCESS;
+ }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
+#endif
+ {
+ //normal protection config check
+ if(!pMac->lim.cfgProtection.lsigTxop)
+ {
+ // protection disabled.
+ PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled\n"));)
+ return eSIR_SUCCESS;
+ }
+ }
+ }
+
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
+ if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
+ {
+ PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled\n"));)
+ pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
+ pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
+ }
+ else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
+ {
+ PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled\n"));)
+ pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
+ pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
+ }
+ }else
+#endif
+ {
+ if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
+ {
+ PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled\n"));)
+ pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
+ pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
+ }
+ else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
+ {
+ PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled\n"));)
+ pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
+ pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
+ }
+ }
+ return eSIR_SUCCESS;
+}
+//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
+//This check will be done at the caller.
+/** -------------------------------------------------------------
+\fn limEnableHtRifsProtection
+\brief based on cofig enables\disables Rifs protection.
+\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
+\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
+\param tpUpdateBeaconParams pBeaconParams
+\return None
+ -------------------------------------------------------------*/
+tSirRetStatus
+limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
+ tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
+{
+ if(!psessionEntry->htCapabality)
+ return eSIR_SUCCESS; // this protection is only for HT stations.
+
+
+ //overlapping protection configuration check.
+ if(overlap)
+ {
+#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+ if(((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||(psessionEntry == eLIM_BT_AMP_AP_ROLE))&& !pMac->lim.cfgProtection.overlapRifs)
+ {
+ // protection disabled.
+ PELOG3(limLog(pMac, LOG3, FL(" overlap protection from Rifs is disabled\n"));)
+ return eSIR_SUCCESS;
+ }
+#endif
+ }
+ else
+ {
+#ifdef WLAN_SOFTAP_FEATURE
+ //normal protection config check
+ if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
+ !psessionEntry->cfgProtection.rifs)
+ {
+ // protection disabled.
+ PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled\n"));)
+ return eSIR_SUCCESS;
+ }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
+#endif
+ {
+ //normal protection config check
+ if(!pMac->lim.cfgProtection.rifs)
+ {
+ // protection disabled.
+ PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled\n"));)
+ return eSIR_SUCCESS;
+ }
+ }
+ }
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
+ // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
+ if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
+ {
+ PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled\n"));)
+ pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
+ pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
+ }
+ // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
+ else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
+ {
+ PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled\n"));)
+ pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
+ pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
+ }
+ }else
+#endif
+ {
+ // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
+ if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
+ {
+ PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled\n"));)
+ pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
+ pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
+ }
+ // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
+ else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
+ {
+ PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled\n"));)
+ pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
+ pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
+ }
+ }
+ return eSIR_SUCCESS;
+}
+
+// ---------------------------------------------------------------------
+/**
+ * limEnableShortPreamble
+ *
+ * FUNCTION:
+ * Enable/Disable short preamble
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param enable Flag to enable/disable short preamble
+ * @return None
+ */
+
+tSirRetStatus
+limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
+{
+ tANI_U32 val;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
+ {
+ /* Could not get short preamble enabled flag from CFG. Log error. */
+ limLog(pMac, LOGP, FL("could not retrieve short preamble flag\n"));
+ return eSIR_FAILURE;
+ }
+
+ if (!val)
+ return eSIR_SUCCESS;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag\n"));
+ return eSIR_FAILURE;
+ }
+
+ if (!val) // 11G short preamble switching is disabled.
+ return eSIR_SUCCESS;
+
+ if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
+ {
+ if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
+ {
+ PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled\n"));)
+ psessionEntry->beaconParams.fShortPreamble = true;
+ pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
+ pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
+ }
+ else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
+ {
+ PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled\n"));)
+ psessionEntry->beaconParams.fShortPreamble = false;
+ pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
+ pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
+ }
+ }
+
+ return eSIR_SUCCESS;
+ }
+
+/**
+ * limTxComplete
+ *
+ * Function:
+ * This is LIM's very own "TX MGMT frame complete" completion routine.
+ *
+ * Logic:
+ * LIM wants to send a MGMT frame (broadcast or unicast)
+ * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
+ * LIM transmits the MGMT frame using the API:
+ * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
+ * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
+ * HDD, if it determines that a TX completion routine (in this case
+ * limTxComplete) has been provided, will invoke this callback
+ * LIM will try to free the TX MGMT packet that was earlier allocated, in order
+ * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
+ *
+ * Assumptions:
+ * Presently, this is ONLY being used for MGMT frames/packets
+ * TODO:
+ * Would it do good for LIM to have some sort of "signature" validation to
+ * ensure that the pData argument passed in was a buffer that was actually
+ * allocated by LIM and/or is not corrupted?
+ *
+ * Note: FIXME and TODO
+ * Looks like palPktFree() is interested in pPacket. But, when this completion
+ * routine is called, only pData is made available to LIM!!
+ *
+ * @param void A pointer to pData. Shouldn't it be pPacket?!
+ *
+ * @return none
+ */
+void limTxComplete( tHalHandle hHal, void *pData )
+{
+ tpAniSirGlobal pMac;
+ pMac = (tpAniSirGlobal)hHal;
+
+#ifdef FIXME_PRIMA
+ /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
+#ifdef TRACE_RECORD
+ {
+ tpSirMacMgmtHdr mHdr;
+ v_U8_t *pRxBd;
+ vos_pkt_t *pVosPkt;
+ VOS_STATUS vosStatus;
+
+
+
+ pVosPkt = (vos_pkt_t *)pData;
+ vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
+
+ if(VOS_IS_STATUS_SUCCESS(vosStatus))
+ {
+ mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
+ MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, 0, mHdr->fc.subType);)
+
+ }
+ }
+#endif
+#endif
+
+ palPktFree( pMac->hHdd,
+ HAL_TXRX_FRM_802_11_MGMT,
+ (void *) NULL, // this is ignored and will likely be removed from this API
+ (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
+}
+
+/**
+ * \brief This function updates lim global structure, if CB parameters in the BSS
+ * have changed, and sends an indication to HAL also with the
+ * updated HT Parameters.
+ * This function does not detect the change in the primary channel, that is done as part
+ * of channel Swtich IE processing.
+ * If STA is configured with '20Mhz only' mode, then this function does not do anything
+ * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
+ *
+ *
+ * \param pMac Pointer to global MAC structure
+ *
+ * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
+ * Probe Response
+ *
+ * \param bssIdx BSS Index of the Bss to which Station is associated.
+ *
+ *
+ */
+
+void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
+ tDot11fIEHTInfo *pHTInfo,
+ tANI_U8 bssIdx,
+ tpPESession psessionEntry)
+{
+ tSirMacHTSecondaryChannelOffset secondaryChnlOffset = eHT_SECONDARY_CHANNEL_OFFSET_NONE;
+#if !defined WLAN_FEATURE_VOWIFI
+ tANI_U32 localPwrConstraint;
+#endif
+
+ //If self capability is set to '20Mhz only', then do not change the CB mode.
+#ifdef WLAN_SOFTAP_FEATURE
+ if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
+#else
+ if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET ))
+#endif
+ return;
+
+#if !defined WLAN_FEATURE_VOWIFI
+ if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
+ limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg\n" ));
+ return;
+ }
+#endif
+
+ if ( pMac->lim.gHTSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
+ pMac->lim.gHTRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
+ {
+ pMac->lim.gHTSecondaryChannelOffset = ( tSirMacHTSecondaryChannelOffset ) pHTInfo->secondaryChannelOffset;
+ pMac->lim.gHTRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
+ //Also update the Proprietary(Titan) CB mode settings, as this setting is used during
+ //background scanning to set the original channel and CB mode as part of finish scan.
+ setupCBState( pMac, limGetAniCBState(pMac->lim.gHTSecondaryChannelOffset));
+
+ // If the Channel Width is 20Mhz, set the channel offset to
+ // NONE. If the Channel Width is 40Mhz, set the channel offset
+ // to what ever is present in beacon.
+ if ( eHT_CHANNEL_WIDTH_40MHZ == pMac->lim.gHTRecommendedTxWidthSet )
+ secondaryChnlOffset = (tSirMacHTSecondaryChannelOffset)pHTInfo->secondaryChannelOffset;
+
+ // Notify HAL
+ limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
+ "d; sending notification to HAL.\n" ) );
+ limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
+ "nel Offset: %d, Channel Width: %d\n" ),
+ pHTInfo->primaryChannel, secondaryChnlOffset,
+ pMac->lim.gHTRecommendedTxWidthSet );
+
+#if defined WLAN_FEATURE_VOWIFI
+ limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
+ secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
+#else
+ limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
+ secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
+#endif
+
+ //In case of IBSS, if STA should update HT Info IE in its beacons.
+ if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
+ {
+ schSetFixedBeaconFields(pMac,psessionEntry);
+ }
+
+ }
+} // End limUpdateStaRunTimeHTParams.
+
+/**
+ * \brief This function updates the lim global structure, if any of the
+ * HT Capabilities have changed.
+ *
+ *
+ * \param pMac Pointer to Global MAC structure
+ *
+ * \param pHTCapability Pointer to HT Capability Information Element
+ * obtained from a Beacon or Probe Response
+ *
+ *
+ *
+ */
+
+void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
+ tDot11fIEHTCaps *pHTCaps )
+{
+
+ if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
+ {
+ pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
+ // Send change notification to HAL
+ }
+
+ if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
+ {
+ pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
+ // Send change notification to HAL
+ }
+
+ if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
+ {
+ pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
+ // Send change notification to HAL
+ }
+
+
+} // End limUpdateStaRunTimeHTCapability.
+
+/**
+ * \brief This function updates lim global structure, if any of the HT
+ * Info Parameters have changed.
+ *
+ *
+ * \param pMac Pointer to the global MAC structure
+ *
+ * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
+ * Probe Response
+ *
+ *
+ */
+
+void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
+ tDot11fIEHTInfo *pHTInfo , tpPESession psessionEntry)
+{
+ if ( pMac->lim.gHTSecondaryChannelOffset != ( tANI_U8)pHTInfo->secondaryChannelOffset)
+ {
+ pMac->lim.gHTSecondaryChannelOffset = ( tSirMacHTSecondaryChannelOffset )pHTInfo->secondaryChannelOffset;
+ // Send change notification to HAL
+ }
+
+ if ( pMac->lim.gHTRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
+ {
+ pMac->lim.gHTRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
+ // Send change notification to HAL
+ }
+
+ if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
+ {
+ psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
+ // Send change notification to HAL
+ }
+
+ if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
+ {
+ pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
+ // Send change notification to HAL
+ }
+
+ if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
+ {
+ pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
+ // Send change notification to HAL
+ }
+
+ if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
+ {
+ psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
+ }
+
+ if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
+ {
+ pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
+ // Send change notification to HAL
+ }
+
+ if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
+ {
+ pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
+ // Send change notification to HAL
+ }
+
+ if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
+ {
+ pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
+ // Send change notification to HAL
+ }
+
+ if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
+ {
+ psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
+ // Send change notification to HAL
+ }
+
+ if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
+ {
+ pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
+ // Send change notification to HAL
+ }
+
+ if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
+ {
+ pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
+ // Send change notification to HAL
+ }
+
+} // End limUpdateStaRunTimeHTInfo.
+
+
+/** -------------------------------------------------------------
+\fn limProcessHalIndMessages
+\brief callback function for HAL indication
+\param tpAniSirGlobal pMac
+\param tANI_U32 mesgId
+\param void *mesgParam
+\return tSirRetStatu - status
+ -------------------------------------------------------------*/
+
+tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
+{
+ //its PE's responsibility to free msgparam when its done extracting the message parameters.
+ tSirMsgQ msg;
+
+ switch(msgId)
+ {
+ case SIR_LIM_DEL_TS_IND:
+ case SIR_LIM_ADD_BA_IND:
+ case SIR_LIM_DEL_BA_ALL_IND:
+ case SIR_LIM_DELETE_STA_CONTEXT_IND:
+ case SIR_LIM_BEACON_GEN_IND:
+ msg.type = (tANI_U16) msgId;
+ msg.bodyptr = msgParam;
+ msg.bodyval = 0;
+ break;
+
+ default:
+ palFreeMemory(pMac->hHdd, msgParam);
+ limLog(pMac, LOGP, FL("invalid message id = %d received\n"), msgId);
+ return eSIR_FAILURE;
+ }
+
+ if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
+ {
+ palFreeMemory(pMac->hHdd, msgParam);
+ limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
+ return eSIR_FAILURE;
+ }
+ return eSIR_SUCCESS;
+}
+
+/** -------------------------------------------------------------
+\fn limValidateDeltsReq
+\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
+\param tpAniSirGlobal pMac
+\param tpSirDeltsReq pDeltsReq
+\param tSirMacAddr peerMacAddr
+\return eSirRetStatus - status
+ -------------------------------------------------------------*/
+
+tSirRetStatus
+limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
+{
+ tpDphHashNode pSta;
+ tANI_U8 tsStatus;
+ tSirMacTSInfo *tsinfo;
+ tANI_U32 i;
+ tANI_U8 tspecIdx;
+ /* if sta
+ * - verify assoc state
+ * - del tspec locally
+ * if ap,
+ * - verify sta is in assoc state
+ * - del sta tspec locally
+ */
+ if(pDeltsReq == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL\n"));)
+ return eSIR_FAILURE;
+ }
+
+ if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
+ {
+ tANI_U32 val;
+
+ // station always talks to the AP
+ pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
+
+ val = sizeof(tSirMacAddr);
+ #if 0
+ if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
+ {
+ /// Could not get BSSID from CFG. Log error.
+ limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
+ return eSIR_FAILURE;
+ }
+ #endif// TO SUPPORT BT-AMP
+ sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
+
+ }
+ else
+ {
+ tANI_U16 assocId;
+ tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
+
+ assocId = pDeltsReq->aid;
+ if (assocId != 0)
+ pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
+ else
+ pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
+
+ if (pSta != NULL)
+ // TBD: check sta assoc state as well
+ for (i =0; i < sizeof(tSirMacAddr); i++)
+ macaddr[i] = pSta->staAddr[i];
+ }
+
+ if (pSta == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req\n");)
+ return eSIR_FAILURE;
+ }
+
+ if ((! pSta->valid) ||
+ (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
+ {
+ PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq\n");)
+ return eSIR_FAILURE;
+ }
+
+ pDeltsReq->req.wsmTspecPresent = 0;
+ pDeltsReq->req.wmeTspecPresent = 0;
+ pDeltsReq->req.lleTspecPresent = 0;
+
+ if ((pSta->wsmEnabled) &&
+ (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
+ pDeltsReq->req.wsmTspecPresent = 1;
+ else if (pSta->wmeEnabled)
+ pDeltsReq->req.wmeTspecPresent = 1;
+ else if (pSta->lleEnabled)
+ pDeltsReq->req.lleTspecPresent = 1;
+ else
+ {
+ PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled\n"));)
+ return eSIR_FAILURE;
+ }
+
+ tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
+ : &pDeltsReq->req.tsinfo;
+ PELOG1(limLog(pMac, LOG1,
+ FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)\n"),
+ pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
+ tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);)
+
+ // if no Access Control, ignore the request
+#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+ if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA))
+ if (((psessionEntry->limSystemRole == eLIM_AP_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))&&
+ (! psessionEntry->gLimEdcaParamsBC[upToAc(tsinfo->traffic.userPrio)].aci.acm))
+ || (((psessionEntry->limSystemRole != eLIM_AP_ROLE) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
+ (! psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)))
+ {
+ limLog(pMac, LOGW, FL("DelTs with acecssPolicy = %d and UP %d , AC = %d has no AC - ignoring request\n"),
+ tsinfo->traffic.accessPolicy, tsinfo->traffic.userPrio, upToAc(tsinfo->traffic.userPrio));
+ return eSIR_FAILURE;
+ }
+#endif
+
+ if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
+ != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)\n",
+ pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
+ return eSIR_FAILURE;
+ }
+ else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
+ (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
+ {
+ //edca only now.
+ }
+ else
+ {
+ if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
+ psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
+ {
+ //send message to HAL to delete TS
+ if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac, pSta->staIndex, tspecIdx, pDeltsReq->req))
+ {
+ limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request\n"),
+ tsinfo->traffic.userPrio);
+ return eSIR_FAILURE;
+ }
+ }
+ }
+ return eSIR_SUCCESS;
+}
+
+/** -------------------------------------------------------------
+\fn limRegisterHalIndCallBack
+\brief registers callback function to HAL for any indication.
+\param tpAniSirGlobal pMac
+\return none.
+ -------------------------------------------------------------*/
+void
+limRegisterHalIndCallBack(tpAniSirGlobal pMac)
+{
+ tSirMsgQ msg;
+ tpHalIndCB pHalCB;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pHalCB, sizeof(tHalIndCB)))
+ {
+ limLog(pMac, LOGP, FL("palAllocateMemory() failed\n"));
+ return;
+ }
+
+ pHalCB->pHalIndCB = limProcessHalIndMessages;
+
+ msg.type = WDA_REGISTER_PE_CALLBACK;
+ msg.bodyptr = pHalCB;
+ msg.bodyval = 0;
+
+ MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+ if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
+ {
+ palFreeMemory(pMac->hHdd, pHalCB);
+ limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed\n"));
+ }
+
+ return;
+}
+
+
+/** -------------------------------------------------------------
+\fn limProcessAddBaInd
+
+\brief handles the BA activity check timeout indication coming from HAL.
+ Validates the request, posts request for sending addBaReq message for every candidate in the list.
+\param tpAniSirGlobal pMac
+\param tSirMsgQ limMsg
+\return None
+-------------------------------------------------------------*/
+void
+limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
+{
+ tANI_U8 i;
+ tANI_U8 tid;
+ tANI_U16 assocId;
+ tpDphHashNode pSta;
+ tpAddBaCandidate pBaCandidate;
+ tANI_U32 baCandidateCnt;
+ tpBaActivityInd pBaActivityInd;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId;
+
+
+
+ if(limMsg->bodyptr == NULL)
+ return;
+
+ pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
+ baCandidateCnt = pBaActivityInd->baCandidateCnt;
+
+ if((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
+ {
+ limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));
+ palFreeMemory(pMac->hHdd, limMsg->bodyptr);
+ return;
+ }
+
+ //if we are not HT capable we don't need to handle BA timeout indication from HAL.
+ if( (baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapabality )
+ {
+ palFreeMemory(pMac->hHdd, limMsg->bodyptr);
+ return;
+ }
+
+ //delete the complete dialoguetoken linked list
+ limDeleteDialogueTokenList(pMac);
+ pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
+
+ for(i=0; i<baCandidateCnt; i++, pBaCandidate++)
+ {
+ pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
+ if( (NULL == pSta) || (!pSta->valid))
+ continue;
+
+ for (tid=0; tid<STACFG_MAX_TC; tid++)
+ {
+ if( (eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
+ (pBaCandidate->baInfo[tid].fBaEnable))
+ {
+ PELOG2(limLog(pMac, LOG2, FL("BA setup for staId = %d, TID: %d, SSN:%d.\n"),
+ pSta->staIndex, tid, pBaCandidate->baInfo[tid].startingSeqNum);)
+ limPostMlmAddBAReq(pMac, pSta, tid, pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
+ }
+ }
+ }
+ palFreeMemory(pMac->hHdd, limMsg->bodyptr);
+ return;
+}
+
+
+/** -------------------------------------------------------------
+\fn limDelAllBASessions
+\brief Deletes all the exisitng BA sessions.
+\ Note : This API is provided for Mac OSx only. The reason for this is that Mac OSx may not
+\ restart after CFG update.
+\param tpAniSirGlobal pMac
+\return None
+-------------------------------------------------------------*/
+
+void
+limDelAllBASessions(tpAniSirGlobal pMac)
+{
+ tANI_U32 i;
+ tANI_U8 tid;
+ tpDphHashNode pSta;
+
+ tpPESession psessionEntry = &pMac->lim.gpSession[0]; //TBD-RAJESH HOW TO GET sessionEntry?????
+ for(tid = 0; tid < STACFG_MAX_TC; tid++)
+ {
+ if((eLIM_AP_ROLE == psessionEntry->limSystemRole) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)||
+ (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole))
+ {
+ for(i = 0; i < pMac->lim.maxStation; i++)
+ {
+ pSta = psessionEntry->dph.dphHashTable.pDphNodeArray + i;
+ if (pSta && pSta->added)
+ {
+ if(eBA_ENABLE == pSta->tcCfg[tid].fUseBATx)
+ {
+ limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid, eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry);
+ }
+ else if(eBA_ENABLE == pSta->tcCfg[tid].fUseBARx)
+ {
+ limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid, eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry);
+ }
+ }
+ }
+ }
+ else if((eLIM_STA_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_STA_ROLE == psessionEntry->limSystemRole))
+ {
+ pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
+ if (pSta && pSta->added)
+ {
+ if(eBA_ENABLE == pSta->tcCfg[tid].fUseBATx)
+ {
+ limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid, eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry);
+ }
+ if(eBA_ENABLE == pSta->tcCfg[tid].fUseBARx)
+ {
+ limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid, eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry);
+ }
+ }
+ }
+ }
+}
+/** -------------------------------------------------------------
+\fn limProcessDelTsInd
+\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
+ Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
+\param tpAniSirGlobal pMac
+\param tSirMsgQ limMsg
+\return None
+-------------------------------------------------------------*/
+void
+limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
+{
+ tpDphHashNode pSta;
+ tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
+ tpSirDeltsReq pDelTsReq = NULL;
+ tSirMacAddr peerMacAddr;
+ tpSirDeltsReqInfo pDelTsReqInfo;
+ tpLimTspecInfo pTspecInfo;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId;
+
+if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
+ {
+ limLog(pMac, LOGE,FL("session does not exist for given BssId\n"));
+ return;
+ }
+
+ pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
+ if(pTspecInfo->inuse == false)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use\n"), pDelTsParam->tspecIdx);)
+ goto error1;
+ }
+
+ pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
+ if(pSta == NULL)
+ {
+ limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d\n"),
+ pTspecInfo->assocId);
+ goto error1;
+ }
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pDelTsReq, sizeof(tSirDeltsReq)))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory() failed\n"));)
+ goto error1;
+ }
+
+ palZeroMemory( pMac->hHdd, (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq));
+
+ if(pSta->wmeEnabled)
+ palCopyMemory(pMac->hHdd, &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
+ else
+ palCopyMemory(pMac->hHdd, &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
+
+
+ //validate the req
+ if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed\n"));)
+ goto error2;
+ }
+ PELOG1(limLog(pMac, LOG1, "Sent DELTS request to station with assocId = %d MacAddr = %x:%x:%x:%x:%x:%x\n",
+ pDelTsReq->aid, peerMacAddr[0], peerMacAddr[1], peerMacAddr[2],
+ peerMacAddr[3], peerMacAddr[4], peerMacAddr[5]);)
+
+ limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
+ psessionEntry);
+
+ // prepare and send an sme indication to HDD
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pDelTsReqInfo, sizeof(tSirDeltsReqInfo)))
+ {
+ PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory() failed\n"));)
+ goto error3;
+ }
+ palZeroMemory( pMac->hHdd, (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo));
+
+ if(pSta->wmeEnabled)
+ palCopyMemory(pMac->hHdd, &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
+ else
+ palCopyMemory(pMac->hHdd, &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
+
+ limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
+
+error3:
+ palFreeMemory(pMac->hHdd, (void *) pDelTsReqInfo);
+error2:
+ palFreeMemory(pMac->hHdd, (void *) pDelTsReq);
+error1:
+ palFreeMemory(pMac->hHdd, (void *)(limMsg->bodyptr));
+ return;
+}
+
+/**
+ * \brief Setup an A-MPDU/BA session
+ *
+ * \sa limPostMlmAddBAReq
+ *
+ * \param pMac The global tpAniSirGlobal object
+ *
+ * \param pStaDs DPH Hash Node object of peer STA
+ *
+ * \param tid TID for which a BA is being setup.
+ * If this is set to 0xFFFF, then we retrieve
+ * the default TID from the CFG
+ *
+ * \return eSIR_SUCCESS if setup completes successfully
+ * eSIR_FAILURE is some problem is encountered
+ */
+tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
+ tpDphHashNode pStaDs,
+ tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
+{
+ tSirRetStatus status = eSIR_SUCCESS;
+ tpLimMlmAddBAReq pMlmAddBAReq;
+ tpDialogueToken dialogueTokenNode;
+ tANI_U32 val = 0;
+
+ // Check if the peer is a 11n capable STA
+ // FIXME - Need a 11n peer indication in DPH.
+ // For now, using the taurusPeer attribute
+ //if( 0 == pStaDs->taurusPeer == )
+ //return eSIR_SUCCESS;
+
+ // Allocate for LIM_MLM_ADDBA_REQ
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pMlmAddBAReq,
+ sizeof( tLimMlmAddBAReq )))
+ {
+ limLog( pMac, LOGP, FL("palAllocateMemory failed\n"));
+ status = eSIR_MEM_ALLOC_FAILED;
+ goto returnFailure;
+ }
+
+ palZeroMemory( pMac->hHdd, (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ));
+
+ // Copy the peer MAC
+ palCopyMemory( pMac->hHdd,
+ pMlmAddBAReq->peerMacAddr,
+ pStaDs->staAddr,
+ sizeof( tSirMacAddr ));
+
+ // Update the TID
+ pMlmAddBAReq->baTID = tid;
+
+ // Determine the supported BA policy of local STA
+ // for the TID of interest
+ pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
+
+ // BA Buffer Size
+ // Requesting the ADDBA recipient to populate the size.
+ // If ADDBA is accepted, a non-zero buffer size should
+ // be returned in the ADDBA Rsp
+ pMlmAddBAReq->baBufferSize = 0;
+
+ limLog( pMac, LOGW,
+ FL( "Requesting an ADDBA to setup a %s BA session with STA %d for TID %d\n" ),
+ (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
+ pStaDs->staIndex,
+ tid );
+
+ // BA Timeout
+ // pMlmAddBAReq->baTimeout = pMac->hal.halMac.baTimeout; // In TU's
+ if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG\n"));
+ status = eSIR_FAILURE;
+ goto returnFailure;
+ }
+ pMlmAddBAReq->baTimeout = val; // In TU's
+
+ // ADDBA Failure Timeout
+ // FIXME_AMPDU - Need to retrieve this from CFG.
+ //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
+ pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
+
+ // BA Starting Sequence Number
+ pMlmAddBAReq->baSSN = startingSeqNum;
+
+ /* Update PE session Id*/
+ pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
+
+ LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
+
+ if( NULL == (dialogueTokenNode = limAssignDialogueToken(pMac)))
+ goto returnFailure;
+
+ pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
+ //set assocId and tid information in the lim linked list
+ dialogueTokenNode->assocId = pStaDs->assocId;
+ dialogueTokenNode->tid = tid;
+ // Send ADDBA Req to MLME
+ limPostMlmMessage( pMac,
+ LIM_MLM_ADDBA_REQ,
+ (tANI_U32 *) pMlmAddBAReq );
+
+returnFailure:
+
+ return status;
+}
+
+/**
+ * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
+ * will then send an ADDBA Rsp to peer MAC entity
+ * with the appropriate ADDBA status code
+ *
+ * \sa limPostMlmAddBARsp
+ *
+ * \param pMac The global tpAniSirGlobal object
+ *
+ * \param peerMacAddr MAC address of peer entity that will
+ * be the recipient of this ADDBA Rsp
+ *
+ * \param baStatusCode ADDBA Rsp status code
+ *
+ * \param baDialogToken ADDBA Rsp dialog token
+ *
+ * \param baTID TID of interest
+ *
+ * \param baPolicy The BA policy
+ *
+ * \param baBufferSize The BA buffer size
+ *
+ * \param baTimeout BA timeout in TU's
+ *
+ * \return eSIR_SUCCESS if setup completes successfully
+ * eSIR_FAILURE is some problem is encountered
+ */
+tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
+ tSirMacAddr peerMacAddr,
+ tSirMacStatusCodes baStatusCode,
+ tANI_U8 baDialogToken,
+ tANI_U8 baTID,
+ tANI_U8 baPolicy,
+ tANI_U16 baBufferSize,
+ tANI_U16 baTimeout,
+ tpPESession psessionEntry)
+{
+tSirRetStatus status = eSIR_SUCCESS;
+tpLimMlmAddBARsp pMlmAddBARsp;
+
+ // Allocate for LIM_MLM_ADDBA_RSP
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pMlmAddBARsp,
+ sizeof( tLimMlmAddBARsp )))
+ {
+ limLog( pMac, LOGE,
+ FL("palAllocateMemory failed with error code %d\n"),
+ status );
+
+ status = eSIR_MEM_ALLOC_FAILED;
+ goto returnFailure;
+ }
+
+ palZeroMemory( pMac->hHdd, (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ));
+
+ // Copy the peer MAC
+ palCopyMemory( pMac->hHdd,
+ pMlmAddBARsp->peerMacAddr,
+ peerMacAddr,
+ sizeof( tSirMacAddr ));
+
+ pMlmAddBARsp->baDialogToken = baDialogToken;
+ pMlmAddBARsp->addBAResultCode = baStatusCode;
+ pMlmAddBARsp->baTID = baTID;
+ pMlmAddBARsp->baPolicy = baPolicy;
+ pMlmAddBARsp->baBufferSize = baBufferSize;
+ pMlmAddBARsp->baTimeout = baTimeout;
+
+ /* UPdate PE session ID*/
+ pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
+
+ // Send ADDBA Rsp to MLME
+ limPostMlmMessage( pMac,
+ LIM_MLM_ADDBA_RSP,
+ (tANI_U32 *) pMlmAddBARsp );
+
+returnFailure:
+
+ return status;
+}
+
+/**
+ * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
+ * will then send an DELBA Ind to peer MAC entity
+ * with the appropriate DELBA status code
+ *
+ * \sa limPostMlmDelBAReq
+ *
+ * \param pMac The global tpAniSirGlobal object
+ *
+ * \param pSta DPH Hash Node object of peer MAC entity
+ * for which the BA session is being deleted
+ *
+ * \param baDirection DELBA direction
+ *
+ * \param baTID TID for which the BA session is being deleted
+ *
+ * \param baReasonCode DELBA Req reason code
+ *
+ * \return eSIR_SUCCESS if setup completes successfully
+ * eSIR_FAILURE is some problem is encountered
+ */
+tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
+ tpDphHashNode pSta,
+ tANI_U8 baDirection,
+ tANI_U8 baTID,
+ tSirMacReasonCodes baReasonCode,
+ tpPESession psessionEntry)
+{
+tSirRetStatus status = eSIR_SUCCESS;
+tpLimMlmDelBAReq pMlmDelBAReq;
+tLimBAState curBaState;
+
+if(NULL == pSta)
+ return eSIR_FAILURE;
+
+LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
+
+ // Need to validate the current BA State.
+ if( eLIM_BA_STATE_IDLE != curBaState)
+ {
+ limLog( pMac, LOGE,
+ FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d\n" ),
+ baTID,
+ curBaState);
+
+ status = eSIR_FAILURE;
+ goto returnFailure;
+ }
+
+ // Allocate for LIM_MLM_DELBA_REQ
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pMlmDelBAReq,
+ sizeof( tLimMlmDelBAReq )))
+ {
+ limLog( pMac, LOGE,
+ FL("palAllocateMemory failed with error code %d\n"),
+ status );
+
+ status = eSIR_MEM_ALLOC_FAILED;
+ goto returnFailure;
+ }
+
+ palZeroMemory( pMac->hHdd, (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ));
+
+ // Copy the peer MAC
+ palCopyMemory( pMac->hHdd,
+ pMlmDelBAReq->peerMacAddr,
+ pSta->staAddr,
+ sizeof( tSirMacAddr ));
+
+ pMlmDelBAReq->baDirection = baDirection;
+ pMlmDelBAReq->baTID = baTID;
+ pMlmDelBAReq->delBAReasonCode = baReasonCode;
+
+ /* Update PE session ID*/
+ pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
+
+ //we don't have valid BA session for the given direction.
+ // HDD wants to get the BA session deleted on PEER in this case.
+ // in this case we just need to send DelBA to the peer.
+ if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
+ ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
+ {
+ // Send DELBA Ind over the air
+ if( eSIR_SUCCESS !=
+ (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
+ status = eSIR_FAILURE;
+
+ palFreeMemory(pMac->hHdd, (void*) pMlmDelBAReq);
+ return status;
+ }
+
+
+ // Update the BA state in STA
+ LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
+
+ // Send DELBA Req to MLME
+ limPostMlmMessage( pMac,
+ LIM_MLM_DELBA_REQ,
+ (tANI_U32 *) pMlmDelBAReq );
+
+returnFailure:
+
+ return status;
+}
+
+/**
+ * \brief Send WDA_ADDBA_REQ to HAL, in order
+ * to setup a new BA session with a peer
+ *
+ * \sa limPostMsgAddBAReq
+ *
+ * \param pMac The global tpAniSirGlobal object
+ *
+ * \param pSta Runtime, STA-related configuration cached
+ * in the HashNode object
+ *
+ * \param baDialogToken The Action Frame dialog token
+ *
+ * \param baTID TID for which the BA session is being setup
+ *
+ * \param baPolicy BA Policy
+ *
+ * \param baBufferSize The requested BA buffer size
+ *
+ * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
+ *
+ * \param baSSN Starting Sequence Number for this BA session
+ *
+ * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
+ *
+ * \return none
+ *
+ */
+tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
+ tpDphHashNode pSta,
+ tANI_U8 baDialogToken,
+ tANI_U8 baTID,
+ tANI_U8 baPolicy,
+ tANI_U16 baBufferSize,
+ tANI_U16 baTimeout,
+ tANI_U16 baSSN,
+ tANI_U8 baDirection,
+ tpPESession psessionEntry)
+{
+tpAddBAParams pAddBAParams = NULL;
+tSirRetStatus retCode = eSIR_SUCCESS;
+eHalStatus status;
+tSirMsgQ msgQ;
+
+#ifdef WLAN_SOFTAP_VSTA_FEATURE
+ // we can only do BA on "hard" STAs
+ if (!(IS_HWSTA_IDX(pSta->staIndex)))
+ {
+ retCode = eHAL_STATUS_FAILURE;
+ goto returnFailure;
+ }
+#endif //WLAN_SOFTAP_VSTA_FEATURE
+
+ // Allocate for WDA_ADDBA_REQ
+ if( eHAL_STATUS_SUCCESS !=
+ (status = palAllocateMemory( pMac->hHdd,
+ (void **) &pAddBAParams,
+ sizeof( tAddBAParams ))))
+ {
+ limLog( pMac, LOGE,
+ FL("palAllocateMemory failed with error code %d\n"),
+ status );
+
+ retCode = eSIR_MEM_ALLOC_FAILED;
+ goto returnFailure;
+ }
+
+ palZeroMemory( pMac->hHdd, (void *) pAddBAParams, sizeof( tAddBAParams ));
+
+ // Copy the peer MAC address
+ palCopyMemory( pMac->hHdd,
+ (void *) pAddBAParams->peerMacAddr,
+ (void *) pSta->staAddr,
+ sizeof( tSirMacAddr ));
+
+ // Populate the REQ parameters
+ pAddBAParams->staIdx = pSta->staIndex;
+ pAddBAParams->baDialogToken = baDialogToken;
+ pAddBAParams->baTID = baTID;
+ pAddBAParams->baPolicy = baPolicy;
+ pAddBAParams->baBufferSize = baBufferSize;
+ pAddBAParams->baTimeout = baTimeout;
+ pAddBAParams->baSSN = baSSN;
+ pAddBAParams->baDirection = baDirection;
+ pAddBAParams->respReqd = 1;
+
+ /* UPdate PE session ID */
+ pAddBAParams->sessionId = psessionEntry->peSessionId;
+
+ // Post WDA_ADDBA_REQ to HAL.
+ msgQ.type = WDA_ADDBA_REQ;
+ //
+ // FIXME_AMPDU
+ // A global counter (dialog token) is required to keep track of
+ // all PE <-> HAL communication(s)
+ //
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pAddBAParams;
+ msgQ.bodyval = 0;
+
+ limLog( pMac, LOGW,
+ FL( "Sending WDA_ADDBA_REQ..." ));
+
+ //defer any other message until we get response back.
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ limLog( pMac, LOGE,
+ FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d\n"),
+ retCode );
+ else
+ return retCode;
+
+returnFailure:
+
+ // Clean-up...
+ if( NULL != pAddBAParams )
+ palFreeMemory( pMac->hHdd, (void *) pAddBAParams );
+
+ return retCode;
+
+}
+
+/**
+ * \brief Send WDA_DELBA_IND to HAL, in order
+ * to delete an existing BA session with peer
+ *
+ * \sa limPostMsgDelBAInd
+ *
+ * \param pMac The global tpAniSirGlobal object
+ *
+ * \param pSta Runtime, STA-related configuration cached
+ * in the HashNode object
+ *
+ * \param baTID TID for which the BA session is being setup
+ *
+ * \param baDirection Identifies whether the DELBA Ind was
+ * sent by the BA initiator or recipient
+ *
+ * \return none
+ *
+ */
+tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
+ tpDphHashNode pSta,
+ tANI_U8 baTID,
+ tANI_U8 baDirection,
+ tpPESession psessionEntry)
+{
+tpDelBAParams pDelBAParams = NULL;
+tSirRetStatus retCode = eSIR_SUCCESS;
+eHalStatus status;
+tSirMsgQ msgQ;
+
+ // Allocate for SIR_HAL_DELBA_IND
+ if( eHAL_STATUS_SUCCESS !=
+ (status = palAllocateMemory( pMac->hHdd,
+ (void **) &pDelBAParams,
+ sizeof( tDelBAParams ))))
+ {
+ limLog( pMac, LOGE,
+ FL("palAllocateMemory failed with error code %d\n"),
+ status );
+
+ retCode = eSIR_MEM_ALLOC_FAILED;
+ goto returnFailure;
+ }
+
+ palZeroMemory( pMac->hHdd, (void *) pDelBAParams, sizeof( tDelBAParams ));
+
+ // Populate the REQ parameters
+ pDelBAParams->staIdx = pSta->staIndex;
+ pDelBAParams->baTID = baTID;
+ pDelBAParams->baDirection = baDirection;
+
+ /* Update PE session ID */
+
+
+ //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
+ //pDelBAParams->sessionId = psessionEntry->peSessionId;
+
+ // Post WDA_DELBA_IND to HAL.
+ msgQ.type = WDA_DELBA_IND;
+ //
+ // FIXME:
+ // A global counter (dialog token) is required to keep track of
+ // all PE <-> HAL communication(s)
+ //
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pDelBAParams;
+ msgQ.bodyval = 0;
+
+ limLog( pMac, LOGW,
+ FL( "Sending SIR_HAL_DELBA_IND..." ));
+
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ limLog( pMac, LOGE,
+ FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d\n"),
+ retCode );
+ else
+ {
+ // Update LIM's internal cache...
+ if( eBA_INITIATOR == baDirection)
+ {
+ pSta->tcCfg[baTID].fUseBATx = 0;
+ pSta->tcCfg[baTID].txBufSize = 0;
+ }
+ else
+ {
+ pSta->tcCfg[baTID].fUseBARx = 0;
+ pSta->tcCfg[baTID].rxBufSize = 0;
+ }
+
+ return retCode;
+ }
+
+returnFailure:
+
+ // Clean-up...
+ if( NULL != pDelBAParams )
+ palFreeMemory( pMac->hHdd, (void *) pDelBAParams );
+
+ return retCode;
+
+}
+
+/**
+ * @function : limPostSMStateUpdate()
+ *
+ * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * NA
+ *
+ * NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param limMsg - Lim Message structure object with the MimoPSparam in body
+ * @return None
+ */
+tSirRetStatus
+limPostSMStateUpdate(tpAniSirGlobal pMac,
+ tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
+{
+ tSirRetStatus retCode = eSIR_SUCCESS;
+ tSirMsgQ msgQ;
+ eHalStatus status;
+ tpSetMIMOPS pMIMO_PSParams;
+
+ msgQ.reserved = 0;
+ msgQ.type = WDA_SET_MIMOPS_REQ;
+
+ // Allocate for WDA_SET_MIMOPS_REQ
+ status = palAllocateMemory( pMac->hHdd, (void **) &pMIMO_PSParams, sizeof( tSetMIMOPS));
+ if( eHAL_STATUS_SUCCESS != status) {
+ limLog( pMac, LOGP,FL(" palAllocateMemory failed with error code %d\n"), status );
+ return eSIR_MEM_ALLOC_FAILED;
+ }
+
+ pMIMO_PSParams->htMIMOPSState = state;
+ pMIMO_PSParams->staIdx = staIdx;
+ pMIMO_PSParams->fsendRsp = true;
+ msgQ.bodyptr = pMIMO_PSParams;
+ msgQ.bodyval = 0;
+
+ limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
+
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ retCode = wdaPostCtrlMsg( pMac, &msgQ );
+ if (eSIR_SUCCESS != retCode)
+ {
+ limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d\n"), retCode );
+ palFreeMemory(pMac->hHdd, (void *) pMIMO_PSParams);
+ return retCode;
+ }
+
+ return retCode;
+}
+
+void limPktFree (
+ tpAniSirGlobal pMac,
+ eFrameType frmType,
+ tANI_U8 *pRxPacketInfo,
+ void *pBody)
+{
+ (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
+#if defined ANI_OS_TYPE_LINUX || defined ANI_OS_TYPE_OSX
+ // Free up allocated SK BUF
+ palPktFree( pMac->hHdd, frmType, pRxPacketInfo, pBody) ;
+#endif
+}
+
+/**
+ * limGetBDfromRxPacket()
+ *
+ *FUNCTION:
+ * This function is called to get pointer to Polaris
+ * Buffer Descriptor containing MAC header & other control
+ * info from the body of the message posted to LIM.
+ *
+ *LOGIC:
+ * NA
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param body - Received message body
+ * @param pRxPacketInfo - Pointer to received BD
+ * @return None
+ */
+
+void
+limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
+{
+#if defined (ANI_OS_TYPE_LINUX) || defined (ANI_OS_TYPE_OSX)
+#ifndef GEN6_ONWARDS
+ palGetPacketDataPtr( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, (void *) body, (void **) pRxPacketInfo );
+#endif //GEN6_ONWARDS
+#else
+ *pRxPacketInfo = (tANI_U32 *) body;
+#endif
+} /*** end limGetBDfromRxPacket() ***/
+
+
+
+
+
+void limRessetScanChannelInfo(tpAniSirGlobal pMac)
+{
+ palZeroMemory(pMac->hHdd, &pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo));
+}
+
+
+void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
+{
+ tANI_U8 i;
+ tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
+
+ for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
+ {
+ if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
+ {
+ pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
+ fFound = eANI_BOOLEAN_TRUE;
+ break;
+ }
+ }
+ if(eANI_BOOLEAN_FALSE == fFound)
+ {
+ if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
+ {
+ pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
+ pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
+ }
+ else
+ {
+ PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac\n"));)
+ }
+ }
+}
+
+
+/**
+ * @function : limIsChannelValidForChannelSwitch()
+ *
+ * @brief : This function checks if the channel to which AP
+ * is expecting us to switch, is a valid channel for us.
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * NA
+ *
+ * NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param channel - New channel to which we are expected to move
+ * @return None
+ */
+tAniBool
+limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
+{
+ tANI_U8 index;
+ tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
+ tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
+
+ if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
+ (tANI_U8 *)validChannelList,
+ (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list\n"));)
+ return (eSIR_FALSE);
+ }
+
+ for(index = 0; index < validChannelListLen; index++)
+ {
+ if(validChannelList[index] == channel)
+ return (eSIR_TRUE);
+ }
+
+ /* channel does not belong to list of valid channels */
+ return (eSIR_FALSE);
+}
+
+/**------------------------------------------------------
+\fn __limFillTxControlParams
+\brief Fill the message for stopping/resuming tx.
+
+\param pMac
+\param pTxCtrlMsg - Pointer to tx control message.
+\param type - Which way we want to stop/ resume tx.
+\param mode - To stop/resume.
+ -------------------------------------------------------*/
+static eHalStatus
+__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
+ tLimQuietTxMode type, tLimControlTx mode)
+{
+
+ //TBD-RAJESH HOW TO GET sessionEntry?????
+ tpPESession psessionEntry = &pMac->lim.gpSession[0];
+
+ if (mode == eLIM_STOP_TX)
+ pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
+ else
+ pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
+
+ switch (type)
+ {
+ case eLIM_TX_ALL:
+ /** Stops/resumes transmission completely */
+ pTxCtrlMsg->fCtrlGlobal = 1;
+ break;
+
+ case eLIM_TX_BSS_BUT_BEACON:
+ /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
+ * stop beacon transmission.
+ */
+ pTxCtrlMsg->ctrlBss = 1;
+ pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
+ break;
+
+ case eLIM_TX_STA:
+ /** Memory for station bitmap is allocated dynamically in caller of this
+ * so decode properly here and fill the bitmap. Now not implemented,
+ * fall through.
+ */
+ case eLIM_TX_BSS:
+ //Fall thru...
+ default:
+ PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled\n"));)
+ return eHAL_STATUS_FAILURE;
+ }
+
+ return eHAL_STATUS_SUCCESS;
+}
+
+/**
+ * @function : limFrameTransmissionControl()
+ *
+ * @brief : This API is called by the user to halt/resume any frame
+ * transmission from the device. If stopped, all frames will be
+ * queued starting from hardware. Then back-pressure
+ * is built till the driver.
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * NA
+ *
+ * NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
+{
+
+ eHalStatus status = eHAL_STATUS_FAILURE;
+ tpTxControlParams pTxCtrlMsg;
+ tSirMsgQ msgQ;
+ tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
+
+ /** Allocate only required number of bytes for station bitmap
+ * Make it to align to 4 byte boundary */
+ nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
+
+ status = palAllocateMemory(pMac->hHdd, (void **) &pTxCtrlMsg,
+ (sizeof(*pTxCtrlMsg) + nBytes));
+ if (status != eHAL_STATUS_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("palAllocateMemory() failed\n"));
+ return;
+ }
+
+ status = palZeroMemory(pMac->hHdd, (void *) pTxCtrlMsg,
+ (sizeof(*pTxCtrlMsg) + nBytes));
+ if (status != eHAL_STATUS_SUCCESS)
+ {
+ palFreeMemory(pMac->hHdd, (void *) pTxCtrlMsg);
+ limLog(pMac, LOGP, FL("palZeroMemory() failed, status = %d\n"), status);
+ return;
+ }
+
+ status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
+ if (status != eHAL_STATUS_SUCCESS)
+ {
+ palFreeMemory(pMac->hHdd, (void *) pTxCtrlMsg);
+ limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d\n"), status);
+ return;
+ }
+
+ msgQ.bodyptr = (void *) pTxCtrlMsg;
+ msgQ.bodyval = 0;
+ msgQ.reserved = 0;
+ msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
+
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
+ {
+ palFreeMemory(pMac->hHdd, (void *) pTxCtrlMsg);
+ limLog( pMac, LOGP, FL("Posting Message to HAL failed\n"));
+ return;
+ }
+
+ if (mode == eLIM_STOP_TX)
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac\n"));)
+ }
+ else
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac\n"));)
+ }
+ return;
+}
+
+
+/**
+ * @function : limRestorePreChannelSwitchState()
+ *
+ * @brief : This API is called by the user to undo any
+ * specific changes done on the device during
+ * channel switch.
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * NA
+ *
+ * NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+tSirRetStatus
+limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
+{
+
+ tSirRetStatus retCode = eSIR_SUCCESS;
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ tANI_U32 val = 0;
+
+ if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
+ return retCode;
+
+ /* Channel switch should be ready for the next time */
+ pMac->lim.gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
+
+ /* Restore the frame transmission, all the time. */
+ limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
+
+ /* Free to enter BMPS */
+ limSendSmePostChannelSwitchInd(pMac);
+
+ //Background scan is now enabled by SME
+ if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
+ {
+ /* Enable background scan if already enabled, else don't bother */
+ if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
+ &val)) != eSIR_SUCCESS)
+
+ {
+ limLog(pMac, LOGP, FL("could not retrieve Background scan period value\n"));
+ return (retCode);
+ }
+
+ if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
+ {
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_BACKGROUND_SCAN_TIMER));
+ if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
+ return (eSIR_FAILURE);
+ }
+
+ }
+ }
+
+ /* Enable heartbeat timer */
+ if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
+ {
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
+ if(limActivateHearBeatTimer(pMac) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
+ return (eSIR_FAILURE);
+ }
+ }
+#endif
+ return (retCode);
+}
+
+
+/**--------------------------------------------
+\fn limRestorePreQuietState
+\brief Restore the pre quiet state
+
+\param pMac
+\return NONE
+---------------------------------------------*/
+tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac)
+{
+
+ tSirRetStatus retCode = eSIR_SUCCESS;
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ tANI_U32 val = 0;
+
+ if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
+ return retCode;
+
+ /* Quiet should be ready for the next time */
+ pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+
+ /* Restore the frame transmission, all the time. */
+ if (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
+ limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
+
+
+ //Background scan is now enabled by SME
+ if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
+ {
+ /* Enable background scan if already enabled, else don't bother */
+ if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
+ &val)) != eSIR_SUCCESS)
+
+ {
+ limLog(pMac, LOGP, FL("could not retrieve Background scan period value\n"));
+ return (retCode);
+ }
+
+ if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
+ {
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_BACKGROUND_SCAN_TIMER));
+ if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
+ return (eSIR_FAILURE);
+ }
+
+ }
+ }
+
+ /* Enable heartbeat timer */
+ if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
+ {
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
+ if(limActivateHearBeatTimer(pMac) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
+ return (eSIR_FAILURE);
+ }
+ }
+#endif
+ return (retCode);
+}
+
+
+/**
+ * @function: limPrepareFor11hChannelSwitch()
+ *
+ * @brief : This API is called by the user to prepare for
+ * 11h channel switch. As of now, the API does
+ * very minimal work. User can add more into the
+ * same API if needed.
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * NA
+ *
+ * NOTE:
+ * NA
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @param psessionEntry
+ * @return None
+ */
+void
+limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
+{
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
+ return;
+
+ /* Flag to indicate 11h channel switch in progress */
+ pMac->lim.gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
+
+ /* Disable, Stop background scan if enabled and running */
+ limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
+
+ /* Stop heart-beat timer to stop heartbeat disassociation */
+ limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
+
+ if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
+ pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state\n"));)
+ /* Stop ongoing scanning if any */
+ if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
+ {
+ //Set the resume channel to Any valid channel (invalid).
+ //This will instruct HAL to set it to any previous valid channel.
+ peSetResumeChannel(pMac, 0, 0);
+ limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
+ }
+ else
+ {
+ limRestorePreChannelSwitchState(pMac, psessionEntry);
+ }
+ return;
+ }
+ else
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer\n"));)
+ /** We are safe to switch channel at this point */
+ limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
+ }
+#endif
+}
+
+
+
+/**----------------------------------------------------
+\fn limGetNwType
+
+\brief Get type of the network from data packet or beacon
+\param pMac
+\param channelNum - Channel number
+\param type - Type of packet.
+\param pBeacon - Pointer to beacon or probe response
+
+\return Network type a/b/g.
+-----------------------------------------------------*/
+tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
+{
+ tSirNwType nwType = eSIR_11B_NW_TYPE;
+
+ if (type == SIR_MAC_DATA_FRAME)
+ {
+ if ((channelNum > 0) && (channelNum < 15))
+ {
+ nwType = eSIR_11G_NW_TYPE;
+ }
+ else
+ {
+ nwType = eSIR_11A_NW_TYPE;
+ }
+ }
+ else
+ {
+ if ((channelNum > 0) && (channelNum < 15))
+ {
+ int i;
+ // 11b or 11g packet
+ // 11g iff extended Rate IE is present or
+ // if there is an A rate in suppRate IE
+ for (i = 0; i < pBeacon->supportedRates.numRates; i++)
+ {
+ if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
+ {
+ nwType = eSIR_11G_NW_TYPE;
+ break;
+ }
+ }
+ if (pBeacon->extendedRatesPresent)
+ {
+ PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G\n"));)
+ nwType = eSIR_11G_NW_TYPE;
+ }
+ }
+ else
+ {
+ // 11a packet
+ PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A\n"));)
+ nwType = eSIR_11A_NW_TYPE;
+ }
+ }
+ return nwType;
+}
+
+
+/**---------------------------------------------------------
+\fn limGetChannelFromBeacon
+\brief To extract channel number from beacon
+
+\param pMac
+\param pBeacon - Pointer to beacon or probe rsp
+\return channel number
+-----------------------------------------------------------*/
+tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
+{
+ tANI_U8 channelNum = 0;
+
+ if (pBeacon->dsParamsPresent)
+ channelNum = pBeacon->channelNumber;
+ else if(pBeacon->HTInfo.present)
+ channelNum = pBeacon->HTInfo.primaryChannel;
+ else
+ channelNum = pBeacon->channelNumber;
+
+ return channelNum;
+}
+
+
+/** ---------------------------------------------------------
+\fn limSetTspecUapsdMask
+\brief This function sets the PE global variable:
+\ 1) gUapsdPerAcTriggerEnableMask and
+\ 2) gUapsdPerAcDeliveryEnableMask
+\ based on the user priority field and direction field
+\ in the TS Info Fields.
+\
+\ An AC is a trigger-enabled AC if the PSB subfield
+\ is set to 1 in the uplink direction.
+\ An AC is a delivery-enabled AC if the PSB subfield
+\ is set to 1 in the down-link direction.
+\
+\param tpAniSirGlobal pMac
+\param tSirMacTSInfo pTsInfo
+\param tANI_U32 action
+\return None
+ ------------------------------------------------------------*/
+void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
+{
+ tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
+ tANI_U16 direction = pTsInfo->traffic.direction;
+ tANI_U8 ac = upToAc(userPrio);
+
+ PELOG1(limLog(pMac, LOG1, FL(" Set UAPSD mask for AC %d, direction %d, action=%d (1=set,0=clear) \n"),ac, direction, action );)
+
+ /* Converting AC to appropriate Uapsd Bit Mask
+ * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
+ * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
+ * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
+ * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
+ */
+ ac = ((~ac) & 0x3);
+
+ if (action == CLEAR_UAPSD_MASK)
+ {
+ if (direction == SIR_MAC_DIRECTION_UPLINK)
+ pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
+ else if (direction == SIR_MAC_DIRECTION_DNLINK)
+ pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
+ else if (direction == SIR_MAC_DIRECTION_BIDIR)
+ {
+ pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
+ pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
+ }
+ }
+ else if (action == SET_UAPSD_MASK)
+ {
+ if (direction == SIR_MAC_DIRECTION_UPLINK)
+ pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
+ else if (direction == SIR_MAC_DIRECTION_DNLINK)
+ pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
+ else if (direction == SIR_MAC_DIRECTION_BIDIR)
+ {
+ pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
+ pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
+ }
+ }
+
+ limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x \n"), pMac->lim.gUapsdPerAcTriggerEnableMask );
+ limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x \n"), pMac->lim.gUapsdPerAcDeliveryEnableMask );
+
+ return;
+}
+
+
+
+void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
+{
+
+ tANI_U8 i;
+ for(i =0;i < pMac->lim.maxBssId;i++)
+ {
+ if(pMac->lim.gpSession[i].valid == TRUE )
+ {
+ if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
+ {
+ limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
+ break;
+ }
+
+ if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
+ (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
+ {
+ limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
+ }
+ }
+ }
+ for(i=0; i< pMac->lim.maxBssId; i++)
+ {
+ if(pMac->lim.gpSession[i].valid == TRUE )
+ {
+ if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
+ (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
+ {
+ if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
+ {
+ /* Activate Probe After HeartBeat Timer incase HB Failure detected */
+ PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d\n"),
+ i);)
+ limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
+ if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer\n"));
+ limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
+ }
+ break;
+ }
+ }
+ }
+ }
+}
+
+tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
+{
+ tANI_U8 i;
+ for(i =0;i < pMac->lim.maxBssId;i++)
+ {
+ if(pMac->lim.gpSession[i].valid == TRUE )
+ {
+ if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
+ (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
+ {
+ return pMac->lim.gpSession[i].currentOperChannel;
+ }
+ }
+ }
+ return 0;
+}
+
+void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
+{
+
+ tpPESession psessionEntry;
+// tANI_U8 sessionId;
+ tpAddStaParams pAddStaParams;
+
+ pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
+
+ if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+ if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
+ (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
+
+ else
+ limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
+
+}
+
+
+void limUpdateBeacon(tpAniSirGlobal pMac)
+{
+ tANI_U8 i;
+
+ for(i =0;i < pMac->lim.maxBssId;i++)
+ {
+ if(pMac->lim.gpSession[i].valid == TRUE )
+ {
+ if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
+ (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
+ && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
+ )
+ {
+ schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
+ limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
+ }
+ else
+ {
+ if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
+ (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
+ {
+
+ if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
+ {
+ schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
+ }
+ }
+ }
+ }
+ }
+}
+
+void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
+{
+ tANI_U8 i;
+ tpPESession psessionEntry;
+ /* Probe response is not received after HB failure. This is handled by LMM sub module. */
+ for(i =0; i < pMac->lim.maxBssId; i++)
+ {
+ if(pMac->lim.gpSession[i].valid == TRUE)
+ {
+ psessionEntry = &pMac->lim.gpSession[i];
+ if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
+ {
+ limLog(pMac, LOGE, FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d\n"),psessionEntry->limSmeState,
+ psessionEntry->limMlmState, psessionEntry->LimRxedBeaconCntDuringHB);
+ if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
+ {
+ if (!LIM_IS_CONNECTION_ACTIVE(psessionEntry))
+ {
+ limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d \n" ),psessionEntry->peSessionId);
+ /* AP did not respond to Probe Request. Tear down link with it.*/
+ limTearDownLinkWithAp(pMac,
+ psessionEntry->peSessionId,
+ eSIR_BEACON_MISSED);
+ pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
+ }
+ else // restart heartbeat timer
+ {
+ limReactivateHeartBeatTimer(pMac, psessionEntry);
+ }
+ }
+ else
+ {
+ limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state \n"));
+ limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
+ limReactivateHeartBeatTimer(pMac, psessionEntry);
+ }
+
+ }
+ }
+ }
+ /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
+ // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
+}
+
+
+/*
+* This function assumes there will not be more than one IBSS session active at any time.
+*/
+tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
+{
+ tANI_U8 i;
+
+ for(i =0;i < pMac->lim.maxBssId;i++)
+ {
+ if( (pMac->lim.gpSession[i].valid) &&
+ (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
+ return (&pMac->lim.gpSession[i]);
+ }
+
+ return NULL;
+}
+
+tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
+{
+ tANI_U8 i;
+
+ for(i =0;i < pMac->lim.maxBssId;i++)
+ {
+ if( (pMac->lim.gpSession[i].valid) &&
+ ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
+ (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
+ return (&pMac->lim.gpSession[i]);
+ }
+
+ return NULL;
+}
+
+/**---------------------------------------------------------
+\fn limHandleDeferMsgError
+\brief handles error scenario, when the msg can not be deferred.
+\param pMac
+\param pLimMsg LIM msg, which could not be deferred.
+\return void
+-----------------------------------------------------------*/
+
+void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
+{
+ if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
+ {
+ vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
+ }
+ else if(pLimMsg->bodyptr != NULL)
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pLimMsg->bodyptr);
+
+}
+
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+/**---------------------------------------------------------
+\fn limDiagEventReport
+\brief This function reports Diag event
+\param pMac
+\param eventType
+\param bssid
+\param status
+\param reasonCode
+\return void
+-----------------------------------------------------------*/
+void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
+{
+ tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
+ WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
+
+ palZeroMemory(pMac->hHdd, &peEvent, sizeof(vos_event_wlan_pe_payload_type));
+
+ if (NULL == pSessionEntry)
+ {
+ palCopyMemory(pMac->hHdd, peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
+ peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
+ peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
+
+ }
+ else
+ {
+ palCopyMemory(pMac->hHdd, peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
+ peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
+ peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
+ }
+ peEvent.event_type = eventType;
+ peEvent.status = status;
+ peEvent.reason_code = reasonCode;
+
+ WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
+ return;
+}
+
+#endif /* FEATURE_WLAN_DIAG_SUPPORT */
+
+void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
+{
+
+ tpAddStaSelfParams pAddStaSelfParams;
+ tSirMsgQ mmhMsg;
+ tpSirSmeAddStaSelfRsp pRsp;
+
+
+ pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pRsp, sizeof(tSirSmeAddStaSelfRsp)))
+ {
+ /// Buffer not available. Log error
+ limLog(pMac, LOGP, FL("call to palAllocateMemory failed for Add Sta self RSP\n"));
+ return;
+ }
+
+ palZeroMemory(pMac, (tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp));
+
+ pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
+ pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
+ pRsp->status = pAddStaSelfParams->status;
+
+ palCopyMemory( pMac->hHdd, pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
+
+ palFreeMemory( pMac->hHdd, (tANI_U8 *)pAddStaSelfParams);
+
+ mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
+ mmhMsg.bodyptr = pRsp;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+
+}
+
+void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
+{
+
+ tpDelStaSelfParams pDelStaSelfParams;
+ tSirMsgQ mmhMsg;
+ tpSirSmeDelStaSelfRsp pRsp;
+
+
+ pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pRsp, sizeof(tSirSmeDelStaSelfRsp)))
+ {
+ /// Buffer not available. Log error
+ limLog(pMac, LOGP, FL("call to palAllocateMemory failed for Add Sta self RSP\n"));
+ return;
+ }
+
+ palZeroMemory(pMac, (tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp));
+
+ pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
+ pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
+ pRsp->status = pDelStaSelfParams->status;
+
+ palCopyMemory( pMac->hHdd, pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
+
+ palFreeMemory( pMac->hHdd, (tANI_U8 *)pDelStaSelfParams);
+
+ mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
+ mmhMsg.bodyptr = pRsp;
+ mmhMsg.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+
+}
+
+/***************************************************************
+* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
+* To unmap the channel to reverse the effect of mapping
+* a band channel in hal .Mapping was done hal to overcome the
+* limitation of the rxbd which use only 4 bit for channel number.
+*****************************************************************/
+tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
+{
+ if( mapChannel > 0 && mapChannel < 25 )
+ return abChannel[mapChannel -1];
+ else
+ return 0;
+}
+
+
+v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
+{
+ int left = length;
+ v_U8_t *ptr = pIes;
+ v_U8_t elem_id;
+ v_U16_t elem_len;
+
+ while(left >= (size_of_len_field+1))
+ {
+ elem_id = ptr[0];
+ if (size_of_len_field == TWO_BYTE)
+ {
+ elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
+ }
+ else
+ {
+ elem_len = ptr[1];
+ }
+
+
+ left -= (size_of_len_field+1);
+ if(elem_len > left)
+ {
+ limLog(pMac, LOGE,
+ "****Invalid IEs eid = %d elem_len=%d left=%d*****\n",
+ eid,elem_len,left);
+ return NULL;
+ }
+ if (elem_id == eid)
+ {
+ return ptr;
+ }
+
+ left -= elem_len;
+ ptr += (elem_len + (size_of_len_field+1));
+ }
+ return NULL;
+}
+
+/* return NULL if oui is not found in ie
+ return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
+ */
+v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
+{
+ int left = ie_len;
+ v_U8_t *ptr = ie;
+ v_U8_t elem_id, elem_len;
+
+ while(left >= 2)
+ {
+ elem_id = ptr[0];
+ elem_len = ptr[1];
+ left -= 2;
+ if(elem_len > left)
+ {
+ limLog( pMac, LOGE,
+ FL("****Invalid IEs eid = %d elem_len=%d left=%d*****\n"),
+ elem_id,elem_len,left);
+ return NULL;
+ }
+ if (SIR_MAC_EID_VENDOR == elem_id)
+ {
+ if(memcmp(&ptr[2], oui, oui_size)==0)
+ return ptr;
+ }
+
+ left -= elem_len;
+ ptr += (elem_len + 2);
+ }
+ return NULL;
+}
+
+#ifdef WLAN_FEATURE_P2P
+//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
+
+v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
+{
+ int length = 0;
+ tANI_U8 *ptr = ie;
+
+ ptr[length++] = SIR_MAC_EID_VENDOR;
+ ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
+ palCopyMemory( pMac->hHdd, &ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
+ palCopyMemory( pMac->hHdd, &ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
+ return (ie_len + SIR_P2P_IE_HEADER_LEN);
+}
+
+//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
+
+v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
+{
+ v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
+ palCopyMemory( pMac->hHdd, overFlowP2pStream, noaStream + noaLen - overFlowLen, overFlowLen);
+ noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
+ noaStream[noaLen - overFlowLen+1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
+ palCopyMemory( pMac->hHdd, noaStream+ noaLen - overFlowLen+2,SIR_MAC_P2P_OUI,SIR_MAC_P2P_OUI_SIZE);
+
+ palCopyMemory( pMac->hHdd, noaStream+ noaLen - overFlowLen+2+SIR_MAC_P2P_OUI_SIZE,overFlowP2pStream,overFlowLen);
+ return (noaLen + SIR_P2P_IE_HEADER_LEN);
+
+}
+
+//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
+v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
+{
+ v_U8_t len=0;
+
+ v_U8_t *pBody = pNoaStream;
+
+
+ if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
+ (psessionEntry->pePersona == VOS_P2P_GO_MODE))
+ {
+ if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
+ && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
+ )
+ return 0; //No NoA Descriptor then return 0
+
+
+ pBody[0] = SIR_P2P_NOA_ATTR;
+
+ pBody[3] = psessionEntry->p2pGoPsUpdate.index;
+ pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
+ len = 5;
+ pBody += len;
+
+
+ if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
+ {
+ *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
+ pBody += 1;
+ len +=1;
+
+ *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
+ pBody += sizeof(tANI_U32);
+ len +=4;
+
+ *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
+ pBody += sizeof(tANI_U32);
+ len +=4;
+
+ *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
+ pBody += sizeof(tANI_U32);
+ len +=4;
+
+ }
+
+ if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
+ {
+ *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
+ pBody += 1;
+ len +=1;
+
+ *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
+ pBody += sizeof(tANI_U32);
+ len +=4;
+
+ *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
+ pBody += sizeof(tANI_U32);
+ len +=4;
+
+ *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
+ pBody += sizeof(tANI_U32);
+ len +=4;
+
+ }
+
+
+ pBody = pNoaStream + 1;
+ *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
+
+ return (len);
+
+ }
+ return 0;
+
+}
+void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, tANI_U8 cbState)
+{
+
+ pMac->lim.gResumeChannel = channel;
+ //TODO : Save Cb State also.
+
+}
+/*--------------------------------------------------------------------------
+
+ \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
+
+ This function itrates the session Table and returns the channel number from first valid session
+ if no sessions are valid/present it returns zero
+
+ \param pMac - pointer to global adapter context
+ \return - channel to scan from valid session else zero.
+
+ \sa
+
+ --------------------------------------------------------------------------*/
+
+tANI_U8 peGetResumeChannel(tpAniSirGlobal pMac)
+
+{
+
+ //Rationale - this could be the suspend/resume for assoc and it is essential that
+ //the new BSS is active for some time. Other BSS was anyway suspended.
+ //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
+ //there will be trouble. But since it is sent on current channel, it will be missed by peer
+ //and hence shpuld be ok. Need to discuss this further
+ if( !IS_MCC_SUPPORTED )
+ {
+ //Get current active session channel
+ return peGetActiveSessionChannel(pMac);
+ }
+ else
+ {
+ return pMac->lim.gResumeChannel;
+ }
+
+}
+
+#endif
+
+tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
+{
+ if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
+ {
+ return eANI_BOOLEAN_TRUE;
+ }
+ else
+ {
+ return eANI_BOOLEAN_FALSE;
+ }
+}
diff --git a/CORE/MAC/src/pe/lim/limUtils.h b/CORE/MAC/src/pe/lim/limUtils.h
new file mode 100644
index 0000000..548370a
--- /dev/null
+++ b/CORE/MAC/src/pe/lim/limUtils.h
@@ -0,0 +1,484 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file limUtils.h contains the utility definitions
+ * LIM uses.
+ * Author: Chandra Modumudi
+ * Date: 02/13/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ */
+#ifndef __LIM_UTILS_H
+#define __LIM_UTILS_H
+
+#include "sirApi.h"
+#include "sirDebug.h"
+#include "cfgApi.h"
+
+#include "limTypes.h"
+#include "limScanResultUtils.h"
+#include "limTimerUtils.h"
+#include "limTrace.h"
+typedef enum
+{
+ ONE_BYTE = 1,
+ TWO_BYTE = 2
+} eSizeOfLenField;
+
+#define LIM_STA_ID_MASK 0x00FF
+#define LIM_AID_MASK 0xC000
+#define LIM_SPECTRUM_MANAGEMENT_BIT_MASK 0x0100
+
+// classifier ID is coded as 0-3: tsid, 4-5:direction
+#define LIM_MAKE_CLSID(tsid, dir) (((tsid) & 0x0F) | (((dir) & 0x03) << 4))
+
+#define LIM_SET_STA_BA_STATE(pSta, tid, newVal) \
+{\
+ pSta->baState = ((pSta->baState | (0x3 << tid*2)) & ((newVal << tid*2) | ~(0x3 << tid*2)));\
+}
+
+#define LIM_GET_STA_BA_STATE(pSta, tid, pCurVal)\
+{\
+ *pCurVal = (tLimBAState)(((pSta->baState >> tid*2) & 0x3));\
+}
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+typedef struct sAddBaInfo
+{
+ tANI_U16 fBaEnable : 1;
+ tANI_U16 startingSeqNum: 12;
+ tANI_U16 reserved : 3;
+}tAddBaInfo, *tpAddBaInfo;
+
+typedef struct sAddBaCandidate
+{
+ tSirMacAddr staAddr;
+ tAddBaInfo baInfo[STACFG_MAX_TC];
+}tAddBaCandidate, *tpAddBaCandidate;
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+// LIM utilility functions
+void limGetBssidFromPkt(tpAniSirGlobal, tANI_U8 *, tANI_U8 *, tANI_U32 *);
+char * limMlmStateStr(tLimMlmStates state);
+char * limSmeStateStr(tLimSmeStates state);
+char * limMsgStr(tANI_U32 msgType);
+char * limResultCodeStr(tSirResultCodes resultCode);
+char* limDot11ModeStr(tpAniSirGlobal pMac, tANI_U8 dot11Mode);
+char* limStaOpRateModeStr(tStaRateMode opRateMode);
+void limPrintMlmState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimMlmStates state);
+void limPrintSmeState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimSmeStates state);
+void limPrintMsgName(tpAniSirGlobal pMac, tANI_U16 logLevel, tANI_U32 msgType);
+void limPrintMsgInfo(tpAniSirGlobal pMac, tANI_U16 logLevel, tSirMsgQ *msg);
+char* limBssTypeStr(tSirBssType bssType);
+
+#if defined FEATURE_WLAN_CCX || defined WLAN_FEATURE_VOWIFI
+extern tSirRetStatus limSendSetMaxTxPowerReq ( tpAniSirGlobal pMac,
+ tPowerdBm txPower,
+ tpPESession pSessionEntry );
+extern tANI_U8 limGetMaxTxPower(tPowerdBm regMax, tPowerdBm apTxPower);
+#endif
+
+tANI_U32 limPostMsgApiNoWait(tpAniSirGlobal, tSirMsgQ *);
+tANI_U8 limIsAddrBC(tSirMacAddr);
+tANI_U8 limIsGroupAddr(tSirMacAddr);
+
+// check for type of scan allowed
+tANI_U8 limActiveScanAllowed(tpAniSirGlobal, tANI_U8);
+
+// AID pool management functions
+void limInitAIDpool(tpAniSirGlobal,tpPESession);
+tANI_U16 limAssignAID(tpAniSirGlobal);
+
+void limEnableOverlap11gProtection(tpAniSirGlobal pMac, tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry);
+void limUpdateOverlapStaParam(tpAniSirGlobal pMac, tSirMacAddr bssId, tpLimProtStaParams pStaParams);
+void limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry);
+void limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry);
+
+/*
+ * The below 'product' check tobe removed if 'Association' is
+ * allowed in IBSS.
+ */
+void limReleaseAID(tpAniSirGlobal, tANI_U16);
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+// LIM informs WSM that radar is detected
+void limDetectRadar(tpAniSirGlobal, tANI_U32 *);
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE
+void limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession);
+void
+limDecideApProtectionOnDelete(tpAniSirGlobal pMac,
+ tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry);
+#else
+void limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams);
+#endif
+
+extern tSirRetStatus limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable, tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession);
+extern tSirRetStatus limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable, tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry);
+extern tSirRetStatus limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable, tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry);
+extern tSirRetStatus limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable, tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession sessionEntry);
+extern tSirRetStatus limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable, tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession);
+extern tSirRetStatus limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable, tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry);
+extern tSirRetStatus limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable, tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession);
+#ifdef WLAN_SOFTAP_FEATURE
+extern tSirRetStatus limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry);
+#else
+extern tSirRetStatus limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams);
+#endif
+extern tSirRetStatus limEnableHtOBSSProtection (tpAniSirGlobal pMac, tANI_U8 enable, tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams, tpPESession);
+void limDecideStaProtection(tpAniSirGlobal pMac, tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry);
+void limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac, tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry);
+void limUpdateStaRunTimeHTSwitchChnlParams(tpAniSirGlobal pMac, tDot11fIEHTInfo * pHTInfo, tANI_U8 bssIdx, tpPESession psessionEntry);
+// Print MAC address utility function
+void limPrintMacAddr(tpAniSirGlobal, tSirMacAddr, tANI_U8);
+
+
+
+// Deferred Message Queue read/write
+tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg);
+tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac);
+void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg);
+
+// Deferred Message Queue Reset
+void limResetDeferredMsgQ(tpAniSirGlobal pMac);
+
+tSirRetStatus limSysProcessMmhMsgApi(tpAniSirGlobal, tSirMsgQ*, tANI_U8);
+
+#ifdef WLAN_SOFTAP_FEATURE
+void limHandleUpdateOlbcCache(tpAniSirGlobal pMac);
+#endif
+
+tANI_U8 limIsNullSsid( tSirMacSSid *pSsid );
+
+void limProcessAddtsRspTimeout(tpAniSirGlobal pMac, tANI_U32 param);
+
+// 11h Support
+#ifdef ANI_PRODUCT_TYPE_AP
+tANI_U32 computeChannelSwitchCount(tpAniSirGlobal, tANI_U32);
+#endif
+void limStopTxAndSwitchChannel(tpAniSirGlobal pMac, tANI_U8 sessionId);
+void limProcessChannelSwitchTimeout(tpAniSirGlobal);
+tSirRetStatus limStartChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry);
+void limUpdateChannelSwitch(tpAniSirGlobal, tpSirProbeRespBeacon, tpPESession psessionEntry);
+void limProcessQuietTimeout(tpAniSirGlobal);
+void limProcessQuietBssTimeout(tpAniSirGlobal);
+
+#ifdef WLAN_SOFTAP_FEATURE
+#if 0
+void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac);
+#endif
+#endif
+
+void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId);
+void limUpdateQuietIEFromBeacon(tpAniSirGlobal, tDot11fIEQuiet *, tpPESession);
+void limGetHtCbAdminState(tpAniSirGlobal pMac, tDot11fIEHTCaps htCaps, tANI_U8 * titanHtCaps);
+void limGetHtCbOpState(tpAniSirGlobal pMac, tDot11fIEHTInfo htInfo, tANI_U8 * titanHtCaps);
+void limSwitchPrimaryChannel(tpAniSirGlobal, tANI_U8,tpPESession);
+void limSwitchPrimarySecondaryChannel(tpAniSirGlobal, tANI_U8, tAniCBSecondaryMode);
+tAniBool limTriggerBackgroundScanDuringQuietBss(tpAniSirGlobal);
+void limUpdateStaRunTimeHTSwtichChnlParams(tpAniSirGlobal pMac, tDot11fIEHTInfo *pRcvdHTInfo, tANI_U8 bssIdx);
+void limUpdateStaRunTimeHTCapability(tpAniSirGlobal pMac, tDot11fIEHTCaps *pHTCaps);
+void limUpdateStaRunTimeHTInfo(struct sAniSirGlobal *pMac, tDot11fIEHTInfo *pRcvdHTInfo, tpPESession psessionEntry);
+void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry);
+void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry);
+tAniBool limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel);
+void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode);
+tSirRetStatus limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry);
+tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac);
+
+void limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry);
+void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
+ tANI_U32 *data, tpPESession psessionEntry);
+
+static inline tSirRFBand limGetRFBand(tANI_U8 channel)
+{
+ if ((channel >= SIR_11A_CHANNEL_BEGIN) &&
+ (channel <= SIR_11A_CHANNEL_END))
+ return SIR_BAND_5_GHZ;
+
+ if ((channel >= SIR_11B_CHANNEL_BEGIN) &&
+ (channel <= SIR_11B_CHANNEL_END))
+ return SIR_BAND_2_4_GHZ;
+
+ return SIR_BAND_UNKNOWN;
+}
+
+
+static inline tSirRetStatus
+limGetMgmtStaid(tpAniSirGlobal pMac, tANI_U16 *staid, tpPESession psessionEntry)
+{
+ if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ *staid = 1;
+ else if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
+ *staid = 0;
+ else
+ return eSIR_FAILURE;
+
+ return eSIR_SUCCESS;
+}
+
+static inline tANI_U8
+limIsSystemInSetMimopsState(tpAniSirGlobal pMac)
+{
+ if (pMac->lim.gLimMlmState == eLIM_MLM_WT_SET_MIMOPS_STATE)
+ return true;
+ return false;
+}
+
+static inline tANI_U8
+ isEnteringMimoPS(tSirMacHTMIMOPowerSaveState curState, tSirMacHTMIMOPowerSaveState newState)
+ {
+ if (curState == eSIR_HT_MIMO_PS_NO_LIMIT &&
+ (newState == eSIR_HT_MIMO_PS_DYNAMIC ||newState == eSIR_HT_MIMO_PS_STATIC))
+ return TRUE;
+ return FALSE;
+}
+
+/// ANI peer station count management and associated actions
+void limUtilCountStaAdd(tpAniSirGlobal pMac, tpDphHashNode pSta, tpPESession psessionEntry);
+void limUtilCountStaDel(tpAniSirGlobal pMac, tpDphHashNode pSta, tpPESession psessionEntry);
+
+#ifdef WLAN_SOFTAP_FEATURE
+tANI_U8 limGetHTCapability( tpAniSirGlobal, tANI_U32, tpPESession);
+#else
+tANI_U8 limGetHTCapability( tpAniSirGlobal, tANI_U32 );
+#endif
+void limTxComplete( tHalHandle hHal, void *pData );
+
+/**********Admit Control***************************************/
+
+//callback function for HAL to issue DelTS request to PE.
+//This function will be registered with HAL for callback when TSPEC inactivity timer fires.
+
+void limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg);
+tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 mesgId, void *mesgParam );
+tSirRetStatus limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry);
+/**********************************************************/
+
+//callback function registration to HAL for any indication.
+void limRegisterHalIndCallBack(tpAniSirGlobal pMac);
+void limPktFree (
+ tpAniSirGlobal pMac,
+ eFrameType frmType,
+ tANI_U8 *pBD,
+ void *body);
+
+
+
+void limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pBD);
+
+/**
+ * \brief Given a base(X) and power(Y), this API will return
+ * the result of base raised to power - (X ^ Y)
+ *
+ * \sa utilsPowerXY
+ *
+ * \param base Base value
+ *
+ * \param power Base raised to this Power value
+ *
+ * \return Result of X^Y
+ *
+ */
+static inline tANI_U32 utilsPowerXY( tANI_U16 base, tANI_U16 power )
+{
+tANI_U32 result = 1, i;
+
+ for( i = 0; i < power; i++ )
+ result *= base;
+
+ return result;
+}
+
+
+
+tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
+ tpDphHashNode pStaDs,
+ tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry);
+tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
+ tSirMacAddr peerMacAddr,
+ tSirMacStatusCodes baStatusCode,
+ tANI_U8 baDialogToken,
+ tANI_U8 baTID,
+ tANI_U8 baPolicy,
+ tANI_U16 baBufferSize,
+ tANI_U16 baTimeout,
+ tpPESession psessionEntry);
+tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
+ tpDphHashNode pSta,
+ tANI_U8 baDirection,
+ tANI_U8 baTID,
+ tSirMacReasonCodes baReasonCode ,
+ tpPESession psessionEntry);
+tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
+ tpDphHashNode pSta,
+ tANI_U8 baDialogToken,
+ tANI_U8 baTID,
+ tANI_U8 baPolicy,
+ tANI_U16 baBufferSize,
+ tANI_U16 baTimeout,
+ tANI_U16 baSSN,
+ tANI_U8 baDirection,
+ tpPESession psessionEntry);
+tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
+ tpDphHashNode pSta,
+ tANI_U8 baTID,
+ tANI_U8 baDirection,
+ tpPESession psessionEntry);
+
+tSirRetStatus limPostSMStateUpdate(tpAniSirGlobal pMac,
+ tANI_U16 StaIdx,
+ tSirMacHTMIMOPowerSaveState MIMOPSState);
+
+void limDeleteStaContext(tpAniSirGlobal pMac, tpSirMsgQ limMsg);
+void limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg);
+void limDelAllBASessions(tpAniSirGlobal pMac);
+void limDeleteDialogueTokenList(tpAniSirGlobal pMac);
+tSirRetStatus limSearchAndDeleteDialogueToken(tpAniSirGlobal pMac, tANI_U8 token, tANI_U16 assocId, tANI_U16 tid);
+void limRessetScanChannelInfo(tpAniSirGlobal pMac);
+void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId);
+
+tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon);
+tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon);
+void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action);
+void limHandleHeartBeatTimeout(tpAniSirGlobal pMac);
+//void limProcessBtampAddBssRsp(tpAniSirGlobal pMac,tpSirMsgQ pMsgQ,tpPESession peSession);
+void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ pMsgQ);
+
+void limUpdateBeacon(tpAniSirGlobal pMac);
+
+void limProcessBtAmpApMlmAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ, tpPESession psessionEntry);
+void limProcessBtAmpApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry);
+
+void limProcessBtAmpApMlmDelStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ,tpPESession psessionEntry);
+tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac);
+tpPESession limIsApSessionActive(tpAniSirGlobal pMac);
+void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac);
+
+void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ);
+void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ);
+v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field);
+
+tANI_U8 limUnmapChannel(tANI_U8 mapChannel);
+
+#define limGetWscIEPtr(pMac, ie, ie_len) \
+ limGetVendorIEOuiPtr(pMac, SIR_MAC_WSC_OUI, SIR_MAC_WSC_OUI_SIZE, ie, ie_len)
+
+#ifdef WLAN_FEATURE_P2P
+#define limGetP2pIEPtr(pMac, ie, ie_len) \
+ limGetVendorIEOuiPtr(pMac, SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE, ie, ie_len)
+
+v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen);
+v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry);
+
+v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len);
+#endif
+v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len);
+tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel);
+tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac);
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+
+typedef enum
+{
+ WLAN_PE_DIAG_SCAN_REQ_EVENT = 0,
+ WLAN_PE_DIAG_SCAN_ABORT_IND_EVENT,
+ WLAN_PE_DIAG_SCAN_RSP_EVENT,
+ WLAN_PE_DIAG_JOIN_REQ_EVENT,
+ WLAN_PE_DIAG_JOIN_RSP_EVENT,
+ WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT,
+ WLAN_PE_DIAG_SETCONTEXT_RSP_EVENT,
+ WLAN_PE_DIAG_REASSOC_REQ_EVENT,
+ WLAN_PE_DIAG_REASSOC_RSP_EVENT,
+ WLAN_PE_DIAG_AUTH_REQ_EVENT,
+ WLAN_PE_DIAG_AUTH_RSP_EVENT,
+ WLAN_PE_DIAG_DISASSOC_REQ_EVENT,
+ WLAN_PE_DIAG_DISASSOC_RSP_EVENT,
+ WLAN_PE_DIAG_DISASSOC_IND_EVENT,
+ WLAN_PE_DIAG_DISASSOC_CNF_EVENT,
+ WLAN_PE_DIAG_DEAUTH_REQ_EVENT,
+ WLAN_PE_DIAG_DEAUTH_RSP_EVENT,
+ WLAN_PE_DIAG_DEAUTH_IND_EVENT,
+ WLAN_PE_DIAG_START_BSS_REQ_EVENT,
+ WLAN_PE_DIAG_START_BSS_RSP_EVENT,
+ WLAN_PE_DIAG_AUTH_IND_EVENT,
+ WLAN_PE_DIAG_ASSOC_IND_EVENT,
+ WLAN_PE_DIAG_ASSOC_CNF_EVENT,
+ WLAN_PE_DIAG_REASSOC_IND_EVENT,
+ WLAN_PE_DIAG_SWITCH_CHL_REQ_EVENT,
+ WLAN_PE_DIAG_SWITCH_CHL_RSP_EVENT,
+ WLAN_PE_DIAG_STOP_BSS_REQ_EVENT,
+ WLAN_PE_DIAG_STOP_BSS_RSP_EVENT,
+ WLAN_PE_DIAG_DEAUTH_CNF_EVENT,
+ WLAN_PE_DIAG_ADDTS_REQ_EVENT,
+ WLAN_PE_DIAG_ADDTS_RSP_EVENT,
+ WLAN_PE_DIAG_DELTS_REQ_EVENT,
+ WLAN_PE_DIAG_DELTS_RSP_EVENT,
+ WLAN_PE_DIAG_DELTS_IND_EVENT,
+ WLAN_PE_DIAG_ENTER_BMPS_REQ_EVENT,
+ WLAN_PE_DIAG_ENTER_BMPS_RSP_EVENT,
+ WLAN_PE_DIAG_EXIT_BMPS_REQ_EVENT,
+ WLAN_PE_DIAG_EXIT_BMPS_RSP_EVENT,
+ WLAN_PE_DIAG_EXIT_BMPS_IND_EVENT,
+ WLAN_PE_DIAG_ENTER_IMPS_REQ_EVENT,
+ WLAN_PE_DIAG_ENTER_IMPS_RSP_EVENT,
+ WLAN_PE_DIAG_EXIT_IMPS_REQ_EVENT,
+ WLAN_PE_DIAG_EXIT_IMPS_RSP_EVENT,
+ WLAN_PE_DIAG_ENTER_UAPSD_REQ_EVENT,
+ WLAN_PE_DIAG_ENTER_UAPSD_RSP_EVENT,
+ WLAN_PE_DIAG_EXIT_UAPSD_REQ_EVENT,
+ WLAN_PE_DIAG_EXIT_UAPSD_RSP_EVENT,
+ WLAN_PE_DIAG_WOWL_ADD_BCAST_PTRN_EVENT,
+ WLAN_PE_DIAG_WOWL_DEL_BCAST_PTRN_EVENT,
+ WLAN_PE_DIAG_ENTER_WOWL_REQ_EVENT,
+ WLAN_PE_DIAG_ENTER_WOWL_RSP_EVENT,
+ WLAN_PE_DIAG_EXIT_WOWL_REQ_EVENT,
+ WLAN_PE_DIAG_EXIT_WOWL_RSP_EVENT,
+ WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT,
+ WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT,
+ WLAN_PE_DIAG_HAL_DELBA_IND_EVENT,
+}WLAN_PE_DIAG_EVENT_TYPE;
+
+void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode);
+#endif /* FEATURE_WLAN_DIAG_SUPPORT */
+
+void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, tANI_U8 cbState);
+/*--------------------------------------------------------------------------
+
+ \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
+
+ This function itrates the session Table and returns the channel number from first valid session
+ if no sessions are valid it returns 0
+
+ \param pMac - pointer to global adapter context
+ \return - channel to scan from valid session else zero.
+
+ \sa
+
+ --------------------------------------------------------------------------*/
+tANI_U8 peGetResumeChannel(tpAniSirGlobal pMac);
+
+
+#endif /* __LIM_UTILS_H */
diff --git a/CORE/MAC/src/pe/pmm/pmmAP.c b/CORE/MAC/src/pe/pmm/pmmAP.c
new file mode 100644
index 0000000..8117d24
--- /dev/null
+++ b/CORE/MAC/src/pe/pmm/pmmAP.c
@@ -0,0 +1,679 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file pmmAP.cc contains AP PM functions
+ *
+ * Author: Sandesh Goel
+ * Date: 02/25/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#include "sirCommon.h"
+
+#include "aniGlobal.h"
+
+#include "schApi.h"
+#include "limApi.h"
+#include "cfgApi.h"
+#include "wniCfgAp.h"
+
+#include "pmmApi.h"
+#include "pmmDebug.h"
+
+#define PMM_TIM_BITS_LIMIT 10
+#define PMM_CF_POLLABLE_SCH_LIMIT 100
+
+// sets how many beacons are skipped after a ps-poll before rxactivityset
+// processing for that sta starts again
+#define PMM_PSPOLL_PERSISTENCE 2
+
+#if (WNI_POLARIS_FW_PRODUCT==AP)
+// --------------------------------------------------------------------
+/**
+ * @function: __isTimChanged
+ *
+ * @brief : Compares and returns TRUE if the TIM BitMap needs change
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pMac AniSirGlobal
+ * @param newTim Newly created Tim Data's
+ * @param prevTim Current Tim Data's
+ * @return eANI_BOOLEAN eANI_BOOLEAN_TRUE - If there is change in Tim Data's
+ * eANI_BOOLEAN_FALSE - If there is no need to change in Tim
+ */
+
+static tANI_BOOLEAN
+__isTimChanged(tpAniSirGlobal pMac, tpPmmTim pNewTim, tpPmmTim pPrevTim)
+{
+ if ( pNewTim->dtimCount != pPrevTim->dtimCount ||
+ pNewTim->maxAssocId != pPrevTim->maxAssocId ||
+ pNewTim->minAssocId != pPrevTim->minAssocId ||
+ pNewTim->numStaWithData != pPrevTim->numStaWithData)
+ return eANI_BOOLEAN_TRUE;
+
+ if (!palEqualMemory(pMac->hHdd, pNewTim->pTim, pPrevTim->pTim, sizeof(*pPrevTim->pTim) * pMac->lim.maxStation))
+ return eANI_BOOLEAN_TRUE;
+
+ return eANI_BOOLEAN_FALSE;
+}
+
+/**
+ * @function: __updatePmmGlobal
+ *
+ * @brief : Updates the PMM Global Structure
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pMac AniSirGlobal
+ * @param newHdr Header Details to be updated in Pmm globalHeader
+ * @param globalHdr global Header
+ * @return None
+ */
+static /*inline */
+void __updatePmmGlobal( tpAniSirGlobal pMac, tpPmmTim pNewTim)
+{
+ tpPmmTim pGlobalTim = &pMac->pmm.gPmmTim;
+ palCopyMemory(pMac->hHdd, pGlobalTim->pTim, pNewTim->pTim,
+ sizeof(*pNewTim->pTim) * pMac->lim.maxStation);
+
+ pGlobalTim->dtimCount = pNewTim->dtimCount;
+ pGlobalTim->maxAssocId = pNewTim->maxAssocId;
+ pGlobalTim->minAssocId = pNewTim->minAssocId;
+ pGlobalTim->numStaWithData = pNewTim->numStaWithData;
+}
+
+
+void pmmUpdatePSPollState(tpAniSirGlobal pMac)
+{
+ tANI_U16 psFlag = 0;
+ tANI_U32 sta;
+
+ // if there are no stations which performed a ps-poll update, we are done
+ if (pMac->pmm.gPmmPsPollUpdate == 0)
+ return;
+
+ /*
+ * for all stations which had a state udpate due to a ps-poll, we check
+ * if it is time to update their state from hardware. This is tracked with
+ * per sta psPollUpdate counter which is initialized during ps-poll
+ * processing.
+ * if no stations need any further ps-poll processing, clear the global flag
+ * so that we don't have to keep going thru the stations at every beacon
+ */
+ for (sta = 1; sta < pMac->lim.maxStation; sta++)
+ {
+ tANI_U8 ps = 0;
+
+ if (pMac->pmm.gpPmmStaState[sta].psPollUpdate == 0)
+ continue;
+
+ if (pMac->pmm.gpPmmStaState[sta].psPollUpdate == 1)
+ {
+ pmmUpdatePMMode(pMac, sta, ps);
+ }
+ pMac->pmm.gpPmmStaState[sta].psPollUpdate--;
+ psFlag++;
+ PELOG4(pmmLog(pMac, LOG4, FL("UpdatePSPollState: sta %d, state %d (count %d)\n"), sta, ps, pMac->pmm.gpPmmStaState[sta].psPollUpdate););
+ }
+
+ if (psFlag == 0)
+ pMac->pmm.gPmmPsPollUpdate = 0;
+ PELOG3(pmmLog(pMac, LOG3, FL("UpdatePSPollState: %d ps-poll flagged sta's\n"), psFlag);)
+}
+
+/**
+ * @function : pmmHandleTimBasedDisassociation
+ *
+ * @brief : Handle TIM based Disassoc for STA's in PS
+ *
+ * LOGIC:
+ * Checks whether the AP has sent TIM enough
+ * number of times for the station and if STA in PS didn't collect the buffered pckts,
+ * disconnect the station
+ *
+ * NOTE:
+ * @param : pMac - tpAniSirGlobal
+ * @return : none
+ **/
+
+void pmmHandleTimBasedDisassociation (tpAniSirGlobal pMac, tpPESession psessionEntry)
+{
+ tpPmmStaInfo pmmStaInfo = pMac->pmm.gPmmTim.pStaInfo;
+ tANI_U32 staCnt;
+ tANI_U32 staWithData = pMac->pmm.gPmmTim.numStaWithData;
+
+
+ /** Traverse through all the assocId's in PS */
+ for (staCnt = 0; staCnt < pMac->pmm.gPmmNumSta; staCnt++) {
+ tpDphHashNode pSta = dphGetHashEntry(pMac, pmmStaInfo[staCnt].assocId);
+
+ if ((pSta == NULL) ||(!pSta->valid )) {
+ pmmLog(pMac, LOGE, FL("Invalid ASSOCID / associd points to notvalid STA assocId [%d] NumSta [%d]\n"),pmmStaInfo[staCnt].assocId,
+ pMac->pmm.gPmmNumSta );
+ continue;
+ }
+
+ if (staCnt >= staWithData) /** If the AP doesn't have any data buffered for this STA*/
+ pSta->timWaitCount = GET_TIM_WAIT_COUNT(pSta->mlmStaContext.listenInterval); /** Reset the timWaitCount*/
+ else { /** AP has got some data buffered for this STA*/
+ if (pSta->curTxMpduCnt == pmmStaInfo[staCnt].staTxAckCnt) {
+ /** If we have sent enough number of TIM's to the STA trigger DisAssoc*/
+ if ( !(--pSta->timWaitCount)) {
+ PELOGE(pmmLog(pMac, LOGE, FL(" STA with AID %d did not respond to TIM, deleting..."),pmmStaInfo[staCnt].assocId);)
+ limTriggerSTAdeletion(pMac, pSta, psessionEntry);
+ continue;
+ }
+ }else /** if the STA in PS came up and got some data*/
+ pSta->timWaitCount = GET_TIM_WAIT_COUNT(pSta->mlmStaContext.listenInterval); /** Reset the timWaitCount*/
+ }
+ pSta->curTxMpduCnt = pmmStaInfo[staCnt].staTxAckCnt;
+ }
+
+ return;
+ }
+
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE
+/**
+ * pmmGenerateTIM
+ *
+ * FUNCTION:
+ * Generate TIM
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pMac pointer to global mac structure
+ * @param **pPtr pointer to the buffer, where the TIM bit is to be written.
+ * @param *timLength pointer to limLength, which needs to be returned.
+ * @return None
+ */
+void pmmGenerateTIM(tpAniSirGlobal pMac, tANI_U8 **pPtr, tANI_U16 *timLength, tANI_U8 dtimPeriod)
+{
+ tANI_U8 *ptr = *pPtr;
+ tANI_U32 val = 0;
+ tANI_U32 minAid = 1; // Always start with AID 1 as minimum
+ tANI_U32 maxAid = HAL_NUM_STA;
+
+
+ // Generate partial virtual bitmap
+ tANI_U8 N1 = minAid / 8;
+ tANI_U8 N2 = maxAid / 8;
+ if (N1 & 1) N1--;
+
+ *timLength = N2 - N1 + 4;
+ val = dtimPeriod;
+
+ /*
+ * 09/23/2011 - ASW team decision;
+ * Write 0xFF to firmware's field to detect firmware's mal-function early.
+ * DTIM count and bitmap control usually cannot be 0xFF, so it is easy to know that
+ * firmware never updated DTIM count/bitmap control field after host driver downloaded
+ * beacon template if end-user complaints that DTIM count and bitmapControl is 0xFF.
+ */
+ *ptr++ = SIR_MAC_TIM_EID;
+ *ptr++ = (tANI_U8)(*timLength);
+ *ptr++ = 0xFF; // location for dtimCount. will be filled in by FW.
+ *ptr++ = (tANI_U8)val;
+
+ *ptr++ = 0xFF; // location for bitmap contorl. will be filled in by FW.
+ ptr += (N2 - N1 + 1);
+
+ PELOG2(sirDumpBuf(pMac, SIR_PMM_MODULE_ID, LOG2, *pPtr, (*timLength)+2);)
+ *pPtr = ptr;
+}
+
+#endif
+#ifdef ANI_PRODUCT_TYPE_AP
+/**
+ * pmmUpdateTIM
+ *
+ * FUNCTION: This function creates TIM information and saves it under PMM context.
+ * This TIM bit information is used to generated beacons later on.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pMac pointer to global mac structure
+ * @param pBeaconGenParams pointer to structure which has power save information returned by HAL.
+ * @return None
+ */
+
+void pmmUpdateTIM(tpAniSirGlobal pMac, tpBeaconGenParams pBeaconGenParams)
+{
+ tANI_U16 i;
+ tANI_U16 assocId;
+ tPmmTim curTim;
+ tPmmTim *pPmmTim = &pMac->pmm.gPmmTim;
+ tANI_U16 totalSta;
+ tpBeaconGenStaInfo pStaInfo;
+
+ totalSta = pBeaconGenParams->numOfSta + pBeaconGenParams->numOfStaWithoutData;
+
+ if(totalSta > pMac->lim.maxStation)
+ {
+ PELOGE(pmmLog(pMac, LOGE, FL("Error in TIM Update: Total STA count %d exceeds the MAX Allowed %d \n"), totalSta, pMac->lim.maxStation);)
+ return;
+ }
+ palZeroMemory(pMac->hHdd, &curTim, sizeof(curTim));
+ palZeroMemory(pMac->hHdd, pMac->pmm.gpPmmPSState,
+ sizeof(*pMac->pmm.gpPmmPSState) * pMac->lim.maxStation);
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &curTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation))
+ {
+ pmmLog( pMac, LOGE, FL( "Unable to PAL allocate memory\n" ));
+ return;
+ }
+ palZeroMemory(pMac->hHdd, curTim.pTim, sizeof(tANI_U8) * pMac->lim.maxStation);
+ pPmmTim->numStaWithData = curTim.numStaWithData = pBeaconGenParams->numOfSta;
+ pMac->pmm.gPmmNumSta = totalSta;
+ curTim.minAssocId= pMac->lim.maxStation - 1;
+ curTim.maxAssocId= 0;
+ curTim.dtimCount = pBeaconGenParams->dtimCount;
+ pStaInfo = (tpBeaconGenStaInfo)((tANI_U8 *)pBeaconGenParams + sizeof(*pBeaconGenParams));
+
+ if (totalSta > 0)
+ palCopyMemory(pMac->hHdd, pPmmTim->pStaInfo, pStaInfo,
+ sizeof(*pPmmTim->pStaInfo) * totalSta);
+
+ for(i=0; i<totalSta; i++)
+ {
+ assocId = pStaInfo[i].assocId;
+ if(assocId < pMac->lim.maxStation)
+ {
+ //Update TIM for power save stations which have data pending.
+ if(i<pBeaconGenParams->numOfSta)
+ {
+ PELOG2(pmmLog(pMac, LOG2, FL("Setting TIM for assocId: %d\n"), assocId);)
+ curTim.pTim[assocId] = 1;
+ if (assocId < curTim.minAssocId)
+ curTim.minAssocId= assocId;
+ if (assocId > curTim.maxAssocId)
+ curTim.maxAssocId= assocId;
+ }
+ pMac->pmm.gpPmmPSState[assocId] = 1;
+
+ }
+ }
+
+ if (!curTim.maxAssocId)
+ curTim.minAssocId = 0;
+
+ if(pBeaconGenParams->fBroadcastTrafficPending)
+ curTim.pTim[0] = 1;
+
+ //Now check if TIM contents have changed from the last beacon.
+ if (!__isTimChanged(pMac, &curTim, pPmmTim)) {
+ palFreeMemory(pMac->hHdd, curTim.pTim);
+ return;
+ }
+
+ //Time to update the beacon
+ __updatePmmGlobal(pMac, &curTim);
+
+ pMac->sch.schObject.fBeaconChanged = 1;
+ palFreeMemory(pMac->hHdd, curTim.pTim);
+
+ return;
+}
+
+
+
+
+// --------------------------------------------------------------------
+/**
+ * pmmProcessPSPoll
+ *
+ * FUNCTION:
+ * Process the PS poll message
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pBD pointer to the buffer descriptor for PS poll message
+ * @return None
+ */
+
+void pmmProcessPSPoll(tpAniSirGlobal pMac, tpHalBufDesc pBd)
+{
+
+ tpSirMacMgmtHdr mh = SIR_MAC_BD_TO_MPDUHEADER(pBd);
+
+
+ // Extract the AID of the station
+ tANI_U16 aid = mh->durationLo + ((mh->durationHi & 0x3f) << 8);
+
+ PELOG1(pmmLog(pMac, LOG1, FL("Received PS Poll AID 0x%x\n"), aid);)
+ if (aid == 0 || aid >= pMac->lim.maxStation)
+ {
+ PELOG1(pmmLog(pMac, LOG1, FL("STA id %d in update PM, should be [1,%d]\n"),
+ aid, pMac->lim.maxStation);)
+ return;
+ }
+
+ tpDphHashNode pSta = dphGetHashEntry(pMac, aid);
+ if (pSta && pSta->valid)
+ pSta->numTimSent = 0;
+
+ /*
+ * since PS poll arrives asynchornously wrt the rx activity set, check
+ * the current state of the BMU PS state for this sta (only for non-Ani)
+ *
+ * Since an asynchronous PS poll is being processed, we can't trust the
+ * rx activity set for PSPOLL_PERSISTENCE beacons. So set the
+ * Update counter - this will be checked during beacon processing
+ */
+ pMac->pmm.gpPmmStaState[aid].psPollUpdate = PMM_PSPOLL_PERSISTENCE;
+ pMac->pmm.gPmmPsPollUpdate = 1;
+ if (mh->fc.powerMgmt != pMac->pmm.gpPmmStaState[aid].powerSave)
+ {
+ tANI_U8 ps = 0;
+ if (pMac->pmm.gpPmmStaState[aid].powerSave != ps)
+ {
+ PELOG1(pmmLog(pMac, LOG1, FL("Sta %d: PS Poll processing PS-state %d -> %d\n"),
+ aid, pMac->pmm.gpPmmStaState[aid].powerSave, ps);)
+ pmmUpdatePMMode(pMac, aid, ps);
+ }
+ }
+
+#ifdef PMM_APSD
+ /*
+ * See if all ACs are trigger enabled.
+ * Section 3.6.1.6 of WMM-APSD spec.
+ *
+ * In case all ACs associated with the WMM STA are delivery-enabled ACs,
+ * then no ACs have been selected for legacy power-save, and the AP shall
+ * immediately send either an ACK frame, a Null function Data frame with
+ * the More Data bit set to zero, or a Null function QoS Data frame with
+ * the More Data bit and the EOSP bit set to zero in response to the
+ * receipt of a PS-Poll frame.
+ */
+
+ {
+ tANI_U8 uapsdFlag = (*((tANI_U8*) &pSta->qos.capability.qosInfo)) & 0xF;
+
+ if ((uapsdFlag & 0xf) == 0xf)
+ {
+ /*
+ * All ACs are trigger/delivery enabled.
+ */
+ apsdSendQosNull(pMac, pSta->assocId, 0, pSta->staAddr);
+ }
+ }
+
+#endif
+
+ /*
+ * Set the PS_EN1 bit in BMU to enable transmission
+ * of one packet from that queue
+ * This is being done by the RHP now
+ */
+
+ // TBD - if HCF mode, schedule a transmission
+}
+
+void pmmProcessRxActivity(tpAniSirGlobal pMac, tANI_U16 staId, tANI_U8 pmMode)
+{
+ if (staId == 0 || staId >= pMac->lim.maxStation)
+ {
+ PELOG1(pmmLog(pMac, LOG1, FL("STA id %d in RxActProc, should be [1,%d]\n"),
+ staId, pMac->lim.maxStation);)
+ return;
+ }
+
+ PELOG1(pmmLog(pMac, LOG1, FL("STA id %d;) pmMode %d\n"), staId, pmMode);)
+
+ // ignore rxActivity if the state has been updated asynchronously
+ if (pMac->pmm.gpPmmStaState[staId].psPollUpdate == 0)
+ {
+ pmmUpdatePMMode(pMac, staId, pmMode);
+ }
+}
+
+// --------------------------------------------------------------------
+/**
+ * pmmUpdatePMMode
+ *
+ * FUNCTION:
+ * Update the power mode bit
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param staId STA id of the station
+ * @param pmMode PM bit received from the STA
+ * @return None
+ */
+
+void pmmUpdatePMMode(tpAniSirGlobal pMac, tANI_U16 staId, tANI_U8 pmMode)
+{
+ if ((staId == 0) ||
+ (staId == 1) ||
+ (staId >= pMac->lim.maxStation))
+ {
+ pmmLog(pMac, LOGE, FL("STA id %d in update PM, should be [2,%d]\n"),
+ staId, pMac->lim.maxStation);
+ return;
+ }
+
+ // If the STA has been deleted, ignore this call
+ tpDphHashNode pSta = dphGetHashEntry(pMac, staId);
+ if (pSta == NULL || pSta->valid == 0)
+ return;
+
+ if (pMac->pmm.gpPmmStaState[staId].powerSave != pmMode)
+ {
+ PELOG1(pmmLog(pMac, LOG1, FL("STA id %d, PM mode %d\n"),
+ staId, pmMode);)
+#ifdef WMM_APSD
+ pmmLog(pMac, LOGE, FL("pm mode change: STA id %d, PM mode %d\n"),
+ staId, pmMode);
+#endif
+
+ // Update PM mode for sta id
+ pMac->pmm.gpPmmStaState[staId].powerSave = pmMode;
+
+ // Find the numerically preceding STA in power save state
+ tANI_U16 i = (staId == 2) ? pMac->lim.maxStation-1 : staId-1;
+ while (i != staId &&
+ !(pMac->pmm.gpPmmStaState[i].powerSave == 1 &&
+ pMac->pmm.gpPmmStaState[i].cfPollable == pMac->pmm.gpPmmStaState[staId].cfPollable)
+ )
+ {
+ i = (i == 2) ? pMac->lim.maxStation-1 : i-1;
+ }
+
+ // Adjust the linked list appropriately
+ if (pMac->pmm.gpPmmStaState[staId].cfPollable)
+ pmmUpdatePollablePMMode(pMac, staId, pmMode, i);
+ else
+ pmmUpdateNonPollablePMMode(pMac, staId, pmMode, i);
+
+ // Update the count of number of STAs in PS
+ if (pmMode)
+ pMac->pmm.gPmmNumSta++;
+ else
+ {
+ pMac->pmm.gPmmNumSta--;
+
+ // reset the num TIMs sent since STA is out of power save
+ pSta->numTimSent = 0;
+ }
+
+ // Update multicast PM mode bit appropriately
+ tANI_U8 multicastPS = pMac->pmm.gPmmNumSta ? 1 : 0;
+ if (pMac->pmm.gpPmmStaState[0].powerSave != multicastPS)
+ {
+ pMac->pmm.gpPmmStaState[0].powerSave = multicastPS;
+ // TBD - write to BMU PS bit for STA 0
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+/**
+ * pmmUpdateNonPollablePMMode
+ *
+ * FUNCTION:
+ * Update the power mode bit
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param staId STA id of the station
+ * @param pmMode PM bit received from the STA
+ * @param i index of the previous STA in the linked list
+ * @return None
+ */
+
+void pmmUpdateNonPollablePMMode(tpAniSirGlobal pMac, tANI_U16 staId, tANI_U8 pmMode, tANI_U16 i)
+{
+ if (i == staId)
+ {
+ // There is no other non pollable STA in PS
+ pMac->pmm.gpPmmStaState[staId].nextPS = (tANI_U8)staId;
+ if (pmMode)
+ {
+ // Current STA is the only non pollable STA in PS
+ pMac->pmm.gPmmNextSta = staId;
+ }
+ else
+ {
+ // There is absolutely no non pollable STA in PS
+ pMac->pmm.gPmmNextSta = 0;
+ }
+ }
+ else
+ {
+ // There is(are) other non pollable STA(s) in PS mode
+ if (pmMode)
+ {
+ // Link in the current STA to the list of non pollable PS STAs
+ pMac->pmm.gpPmmStaState[staId].nextPS = pMac->pmm.gpPmmStaState[i].nextPS;
+ pMac->pmm.gpPmmStaState[i].nextPS = (tANI_U8)staId;
+ }
+ else
+ {
+ // Remove the current STA from the list of non pollable PS STAs
+ pMac->pmm.gpPmmStaState[i].nextPS = pMac->pmm.gpPmmStaState[staId].nextPS;
+
+ // If the STA being removed is the nextSTA, update nextSTA
+ if (staId == pMac->pmm.gPmmNextSta)
+ pMac->pmm.gPmmNextSta = pMac->pmm.gpPmmStaState[staId].nextPS;
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+/**
+ * pmmUpdatePollablePMMode
+ *
+ * FUNCTION:
+ * Update the power mode bit
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param staId STA id of the station
+ * @param pmMode PM bit received from the STA
+ * @param i index of the previous STA in the linked list
+ * @return None
+ */
+
+void pmmUpdatePollablePMMode(tpAniSirGlobal pMac, tANI_U16 staId, tANI_U8 pmMode, tANI_U16 i)
+{
+ if (i == staId)
+ {
+ // There is no other pollable STA in PS
+ pMac->pmm.gpPmmStaState[staId].nextPS = (tANI_U8)staId;
+ if (pmMode)
+ {
+ // Current STA is the only pollable STA in PS
+ pMac->pmm.gPmmNextCFPSta = staId;
+ }
+ else
+ {
+ // There is absolutely no pollable STA in PS
+ pMac->pmm.gPmmNextCFPSta = 0;
+ }
+ }
+ else
+ {
+ // There is(are) other pollable STA(s) in PS mode
+ if (pmMode)
+ {
+ // Link in the current STA to the list of pollable PS STAs
+ pMac->pmm.gpPmmStaState[staId].nextPS = pMac->pmm.gpPmmStaState[i].nextPS;
+ pMac->pmm.gpPmmStaState[i].nextPS = (tANI_U8)staId;
+ }
+ else
+ {
+ // Remove the current STA from the list of pollable PS STAs
+ pMac->pmm.gpPmmStaState[i].nextPS = pMac->pmm.gpPmmStaState[staId].nextPS;
+
+ // If the STA being removed is the nextSTA, update nextSTA
+ if (staId == pMac->pmm.gPmmNextCFPSta)
+ pMac->pmm.gPmmNextCFPSta = pMac->pmm.gpPmmStaState[staId].nextPS;
+ }
+ }
+}
+
+
+
+#endif // (WNI_POLARIS_FW_PRODUCT==AP)
+
+// --------------------------------------------------------------------
+
diff --git a/CORE/MAC/src/pe/pmm/pmmApi.c b/CORE/MAC/src/pe/pmm/pmmApi.c
new file mode 100644
index 0000000..6dcc86a
--- /dev/null
+++ b/CORE/MAC/src/pe/pmm/pmmApi.c
@@ -0,0 +1,2828 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file pmmApi.cc contains functions related to the API exposed
+ * by power management module
+ *
+ * Author: Sandesh Goel
+ * Date: 02/25/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#include "palTypes.h"
+#include "wniCfgSta.h"
+
+#include "sirCommon.h"
+#include "aniGlobal.h"
+
+#include "schApi.h"
+#include "limApi.h"
+#include "limSendMessages.h"
+#include "cfgApi.h"
+#include "limSessionUtils.h"
+#include "limFT.h"
+
+
+#include "pmmApi.h"
+#include "pmmDebug.h"
+#include "sirApi.h"
+#include "wmmApsd.h"
+
+#include "limSendSmeRspMessages.h"
+#include "limTimerUtils.h"
+#include "limTrace.h"
+#include "limUtils.h"
+#include "VossWrapper.h"
+#ifdef INTEGRATION_READY
+#include "vos_status.h" //VOS_STATUS
+#include "vos_mq.h" //vos_mq_post_message()
+#endif
+
+#include "wlan_qct_wda.h"
+
+// --------------------------------------------------------------------
+/**
+ * pmmInitialize
+ *
+ * FUNCTION:
+ * Initialize PMM module
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param mode
+ * @param rate
+ * @return None
+ */
+
+tSirRetStatus
+pmmInitialize(tpAniSirGlobal pMac)
+{
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ pMac->pmm.gPmmNextSta = 0;
+ pMac->pmm.gPmmNumSta = 0;
+#endif
+
+ pmmResetStats(pMac);
+
+ pMac->pmm.gPmmBeaconInterval = WNI_CFG_BEACON_INTERVAL_STADEF;
+ pMac->pmm.gPmmState = ePMM_STATE_READY;
+
+
+#ifdef ANI_PRODUCT_TYPE_AP
+
+ palZeroMemory(pMac->hHdd,
+ pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation);
+
+ palZeroMemory(pMac->hHdd,
+ pMac->pmm.gPmmTim.pStaInfo, sizeof(*pMac->pmm.gPmmTim.pStaInfo)*pMac->lim.maxStation);
+
+ palZeroMemory(pMac->hHdd,
+ pMac->pmm.gpPmmStaState, sizeof(tPmmStaState)*pMac->lim.maxStation);
+
+ palZeroMemory(pMac->hHdd,
+ pMac->pmm.gpPmmPSState, sizeof(tANI_U8)*pMac->lim.maxStation);
+#endif
+
+ pMac->pmm.inMissedBeaconScenario = FALSE;
+
+ return eSIR_SUCCESS;
+}
+
+// --------------------------------------------------------------------
+/**
+ * pmmResetStats
+ *
+ * FUNCTION:
+ * Resets the statistics
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pMac
+ *
+ * @return None
+ */
+
+void
+pmmResetStats(void *pvMac)
+{
+ tpAniSirGlobal pMac = (tpAniSirGlobal)pvMac;
+
+ pMac->pmm.BmpsmaxSleepTime = 0;
+ pMac->pmm.BmpsavgSleepTime = 0;
+ pMac->pmm.BmpsminSleepTime = 0;
+ pMac->pmm.BmpscntSleep = 0;
+
+ pMac->pmm.BmpsmaxTimeAwake = 0;
+ pMac->pmm.BmpsavgTimeAwake = 0;
+ pMac->pmm.BmpsminTimeAwake = 0;
+ pMac->pmm.BmpscntAwake = 0;
+
+ pMac->pmm.BmpsWakeupTimeStamp = 0;
+ pMac->pmm.BmpsSleepTimeStamp = 0;
+
+ pMac->pmm.BmpsHalReqFailCnt = 0;
+ pMac->pmm.BmpsInitFailCnt = 0;
+ pMac->pmm.BmpsInitFailCnt= 0;
+ pMac->pmm.BmpsInvStateCnt= 0;
+ pMac->pmm.BmpsPktDrpInSleepMode= 0;
+ pMac->pmm.BmpsReqInInvalidRoleCnt= 0;
+ pMac->pmm.BmpsSleeReqFailCnt= 0;
+ pMac->pmm.BmpsWakeupIndCnt= 0;
+
+ pMac->pmm.ImpsWakeupTimeStamp = 0;
+ pMac->pmm.ImpsSleepTimeStamp = 0;
+ pMac->pmm.ImpsMaxTimeAwake = 0;
+ pMac->pmm.ImpsMinTimeAwake = 0;
+ pMac->pmm.ImpsAvgTimeAwake = 0;
+ pMac->pmm.ImpsCntAwake = 0;
+
+ pMac->pmm.ImpsCntSleep = 0;
+ pMac->pmm.ImpsMaxSleepTime = 0;
+ pMac->pmm.ImpsMinSleepTime = 0;
+ pMac->pmm.ImpsAvgSleepTime = 0;
+
+ pMac->pmm.ImpsSleepErrCnt = 0;
+ pMac->pmm.ImpsWakeupErrCnt = 0;
+ pMac->pmm.ImpsLastErr = 0;
+ pMac->pmm.ImpsInvalidStateCnt = 0;
+
+ return;
+}
+
+
+
+// --------------------------------------------------------------------
+/**
+ * pmmInitBmpsResponseHandler
+ *
+ * FUNCTION:
+ * This function processes the SIR_HAL_ENTER_BMPS_RSP from HAL.
+ * If the response is successful, it puts PMM in ePMM_STATE_BMP_SLEEP state
+ * and sends back success response to PMC.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param
+ * @return None
+ */
+
+void pmmInitBmpsResponseHandler(tpAniSirGlobal pMac, eHalStatus rspStatus)
+{
+
+
+ tPmmState nextState = pMac->pmm.gPmmState;
+ tSirResultCodes retStatus = eSIR_SME_SUCCESS;
+
+ /* we need to process all the deferred messages enqueued since
+ * the initiating the SIR_HAL_ENTER_BMPS_REQ.
+ */
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+
+ if(pMac->pmm.gPmmState != ePMM_STATE_BMPS_WT_INIT_RSP)
+ {
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("pmmBmps: Received 'InitPwrSaveRsp' while in incorrect state: %d\n"),
+ pMac->pmm.gPmmState);)
+
+ retStatus = eSIR_SME_INVALID_PMM_STATE;
+ pmmBmpsUpdateInvalidStateCnt(pMac);
+ goto failure;
+ }
+
+ //if response is success, then set PMM to BMPS_SLEEP state and send response back to PMC.
+ //If response is failure, then send the response back to PMC and reset its state.
+ if(rspStatus == eHAL_STATUS_SUCCESS)
+ {
+ PELOGW(pmmLog(pMac, LOGW,
+ FL("pmmBmps: Received successful response from HAL to enter BMPS_POWER_SAVE \n"));)
+
+ pMac->pmm.gPmmState = ePMM_STATE_BMPS_SLEEP;
+
+ // Update sleep statistics
+ pmmUpdatePwrSaveStats(pMac);
+
+ // Disable background scan mode
+ pMac->sys.gSysEnableScanMode = false;
+
+ if (pMac->lim.gLimTimersCreated)
+ {
+ /* Disable heartbeat timer as well */
+ if(pMac->lim.limTimers.gLimHeartBeatTimer.pMac)
+ {
+ MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
+ tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
+ }
+ }
+ limSendSmeRsp(pMac, eWNI_PMC_ENTER_BMPS_RSP, retStatus, 0, 0);
+ }
+ else
+ {
+ //if init req failed, then go back to WAKEUP state.
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("pmmBmps: BMPS_INIT_PWR_SAVE_REQ failed, informing SME\n"));)
+
+ pmmBmpsUpdateInitFailureCnt(pMac);
+ nextState = ePMM_STATE_BMPS_WAKEUP;
+ retStatus = eSIR_SME_BMPS_REQ_FAILED;
+ goto failure;
+ }
+ return;
+
+failure:
+
+ //Generate an error response back to PMC
+ pMac->pmm.gPmmState = nextState;
+ pmmBmpsUpdateSleepReqFailureCnt(pMac);
+ limSendSmeRsp(pMac, eWNI_PMC_ENTER_BMPS_RSP, retStatus, 0, 0);
+ return;
+
+}
+
+// --------------------------------------------------------------------
+/**
+ * pmmExitBmpsRequestHandler
+ *
+ * FUNCTION:
+ * This function will send the wakeup message to HAL
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pMac pointer to Global Mac structure.
+
+ * @return None
+ */
+
+void pmmExitBmpsRequestHandler(tpAniSirGlobal pMac, tpExitBmpsInfo pExitBmpsInfo)
+{
+ tSirResultCodes respStatus = eSIR_SME_SUCCESS;
+
+ tPmmState origState = pMac->pmm.gPmmState;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_BMPS_REQ_EVENT, peGetValidPowerSaveSession(pMac), 0, (tANI_U16)pExitBmpsInfo->exitBmpsReason);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ if (NULL == pExitBmpsInfo)
+ {
+ respStatus = eSIR_SME_BMPS_REQ_FAILED;
+ PELOGW(pmmLog(pMac, LOGW, FL("pmmBmps: Rcvd EXIT_BMPS with NULL body\n"));)
+ goto failure;
+ }
+
+ /* PMC is not aware of Background scan, which is done in
+ * BMPS mode while Nth Beacon is delivered. Essentially, PMC
+ * can request the device to get out of power-save while
+ * background scanning is happening. since, the device is already
+ * out of powersave, just inform that device is out of powersave
+ */
+ if(limIsSystemInScanState(pMac))
+ {
+ PELOGW(pmmLog(pMac, LOGW,
+ FL("pmmBmps: Device is already awake and scanning, returning success to PMC \n"));)
+ limSendSmeRsp(pMac, eWNI_PMC_EXIT_BMPS_RSP, respStatus, 0, 0);
+ return;
+ }
+
+ /* send wakeup request, only when in sleep state */
+ PELOGW(pmmLog(pMac, LOGW, FL("pmmBmps: Sending eWNI_PMC_EXIT_BMPS_REQ to HAL\n"));)
+ if (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP)
+ {
+ /* Store the reason code for exiting BMPS. This value will be
+ * checked when PMM receives SIR_HAL_EXIT_BMPS_RSP from HAL
+ */
+ pMac->pmm.gPmmExitBmpsReasonCode = pExitBmpsInfo->exitBmpsReason;
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pExitBmpsInfo);
+
+ PELOGW(pmmLog(pMac, LOGW,
+ FL("pmmBmps: Rcvd EXIT_BMPS with reason code%d \n"), pMac->pmm.gPmmExitBmpsReasonCode);)
+
+
+ // Set PMM to BMPS_WT_WAKEUP_RSP state
+ pMac->pmm.gPmmState = ePMM_STATE_BMPS_WT_WAKEUP_RSP;
+ if(pmmSendChangePowerSaveMsg(pMac) != eSIR_SUCCESS)
+ {
+ /* Wakeup request failed */
+ respStatus = eSIR_SME_BMPS_REQ_FAILED;
+ pmmBmpsUpdateHalReqFailureCnt(pMac);
+ goto failure;
+ }
+ else
+ {
+ PELOG1(pmmLog(pMac, LOG1,
+ FL("pmmBmps: eWNI_PMC_EXIT_BMPS_REQ was successfully sent to HAL\n"));)
+ }
+ }
+ else
+ {
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("pmmBmps: eWNI_PMC_EXIT_BMPS_REQ received in invalid state: %d\n"),
+ pMac->pmm.gPmmState );)
+
+ respStatus = eSIR_SME_INVALID_PMM_STATE;
+ pmmBmpsUpdateInvalidStateCnt(pMac);
+ goto failure;
+ }
+ return;
+
+failure:
+ pMac->pmm.gPmmState = origState;
+ pmmBmpsUpdateWakeupReqFailureCnt(pMac);
+ limSendSmeRsp(pMac, eWNI_PMC_EXIT_BMPS_RSP, respStatus, 0, 0);
+}
+
+
+// --------------------------------------------------------------------
+/**
+ * pmmInitBmpsPwrSave
+ *
+ * FUNCTION:
+ * This function process the eWNI_PMC_ENTER_PMC_REQ from PMC.
+ * It checks for certain conditions before it puts PMM into
+ * BMPS power save state: ePMM_STATE_BMPS_WT_INIT_RSP
+ * It also invokes pmmSendInitPowerSaveMsg() to send ENTER_BMPS_REQ
+ * to HAL.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param mode can be either 0(sleep mode) or 1 (active mode)
+ * @param pMac pointer to Global Mac structure.
+
+ * @return None
+ */
+
+
+void pmmInitBmpsPwrSave(tpAniSirGlobal pMac)
+{
+ tSirRetStatus retStatus = eSIR_SUCCESS;
+ tSirResultCodes respStatus = eSIR_SME_SUCCESS;
+ tpPESession psessionEntry;
+
+ tPmmState origState = pMac->pmm.gPmmState;
+
+ if((psessionEntry = peGetValidPowerSaveSession(pMac))== NULL)
+ {
+ respStatus = eSIR_SME_BMPS_REQ_FAILED;
+ goto failure;
+ }
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_ENTER_BMPS_REQ_EVENT, psessionEntry, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ if ( ((pMac->pmm.gPmmState != ePMM_STATE_READY) &&
+ (pMac->pmm.gPmmState != ePMM_STATE_BMPS_WAKEUP)) ||
+ limIsSystemInScanState(pMac) ||
+ (pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) ||
+ (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING))
+ {
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("pmmBmps: BMPS Request received in invalid state PMM=%d, SME=%d, rejecting the initpwrsave request\n"),
+ pMac->pmm.gPmmState, pMac->lim.gLimSmeState);)
+
+ respStatus = eSIR_SME_INVALID_PMM_STATE;
+ pmmBmpsUpdateInvalidStateCnt(pMac);
+ goto failure;
+ }
+
+
+ /* At this point, device is associated and PMM is not in BMPS_SLEEP state.
+ * Heartbeat timer not running is an indication that PE have detected a
+ * loss of link. In this case, reject BMPS request.
+ */
+ /* TODO : We need to have a better check. This check is not valid */
+#if 0
+ if ( (pMac->sys.gSysEnableLinkMonitorMode) && (pMac->lim.limTimers.gLimHeartBeatTimer.pMac) )
+ {
+ if(VOS_TRUE != tx_timer_running(&pMac->lim.limTimers.gLimHeartBeatTimer))
+ {
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("Reject BMPS_REQ because HeartBeatTimer is not running. \n"));)
+ respStatus = eSIR_SME_BMPS_REQ_FAILED;
+ goto failure;
+ }
+ }
+#endif
+
+ //If the following function returns SUCCESS, then PMM will wait for an explicit
+ //response message from softmac.
+
+ //changing PMM state before posting message to HAL, as this is a synchronous call to HAL
+ pMac->pmm.gPmmState = ePMM_STATE_BMPS_WT_INIT_RSP;
+ if((retStatus = pmmSendInitPowerSaveMsg(pMac,psessionEntry)) != eSIR_SUCCESS)
+ {
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("pmmBmps: Init Power Save Request Failed: Sending Response: %d\n"),
+ retStatus);)
+
+ respStatus = eSIR_SME_BMPS_REQ_FAILED;
+ pmmBmpsUpdateHalReqFailureCnt(pMac);
+ goto failure;
+ }
+ //Update the powerSave sessionId
+ pMac->pmm.sessionId = psessionEntry->peSessionId;
+ return;
+
+failure:
+
+ // Change the state back to original state
+ pMac->pmm.gPmmState =origState;
+ limSendSmeRsp(pMac, eWNI_PMC_ENTER_BMPS_RSP, respStatus, 0, 0);
+ return;
+}
+
+
+/**
+ * pmmSendChangePowerSaveMsg()
+ *
+ *FUNCTION:
+ * This function is called to send SIR_HAL_EXIT_BMPS_REQ to HAL.
+ * This message will trigger HAL to program HW to wake up.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac pointer to Global Mac structure.
+ * @return success if message send is ok, else false.
+ */
+tSirRetStatus pmmSendChangePowerSaveMsg(tpAniSirGlobal pMac)
+{
+ tSirRetStatus retStatus = eSIR_SUCCESS;
+ tpExitBmpsParams pExitBmpsParams;
+ tSirMsgQ msgQ;
+ tANI_U8 currentOperatingChannel = limGetCurrentOperatingChannel(pMac);
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pExitBmpsParams, sizeof(*pExitBmpsParams)) )
+ {
+ pmmLog(pMac, LOGW, FL("palAllocateMemory() failed\n"));
+ retStatus = eSIR_MEM_ALLOC_FAILED;
+ return retStatus;
+ }
+
+ palZeroMemory( pMac->hHdd, (tANI_U8 *)pExitBmpsParams, sizeof(*pExitBmpsParams));
+ msgQ.type = WDA_EXIT_BMPS_REQ;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pExitBmpsParams;
+ msgQ.bodyval = 0;
+
+ /* If reason for full power is disconnecting (ie. link is
+ * disconnected) or becasue of channel switch or full power requested
+ * because of beacon miss and connected on DFS channel
+ * then we should not send data null.
+ * For all other reason code, send data null.
+ */
+ if ( !(SIR_IS_FULL_POWER_REASON_DISCONNECTED(pMac->pmm.gPmmExitBmpsReasonCode) ||
+ ( (eSME_MISSED_BEACON_IND_RCVD == pMac->pmm.gPmmExitBmpsReasonCode) &&
+ limIsconnectedOnDFSChannel(currentOperatingChannel))))
+ pExitBmpsParams->sendDataNull = 1;
+
+ /* we need to defer any incoming messages until we
+ * get a WDA_EXIT_BMPS_RSP from HAL.
+ */
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ retStatus = wdaPostCtrlMsg( pMac, &msgQ);
+ if( eSIR_SUCCESS != retStatus )
+ {
+ PELOGE(pmmLog( pMac, LOGE, FL("Sending WDA_EXIT_BMPS_REQ failed, reason=%X \n"), retStatus );)
+ palFreeMemory(pMac->hHdd, (tANI_U8*)pExitBmpsParams);
+ return retStatus;
+ }
+
+ PELOG1(pmmLog(pMac, LOG1, FL("WDA_EXIT_BMPS_REQ has been successfully sent to HAL\n"));)
+ return retStatus;
+}
+
+
+/**
+ * pmmSendInitPowerSaveMsg()
+ *
+ *FUNCTION:
+ * This function is called to send ENTER_BMPS_REQ message to HAL.
+ * This message is sent to intialize the process of bringing the
+ * station into power save state.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac pointer to Global Mac structure.
+ * @param mode The Power Save or Active State
+ *
+ * @return success if message send is ok, else false.
+ */
+
+tSirRetStatus pmmSendInitPowerSaveMsg(tpAniSirGlobal pMac,tpPESession psessionEntry)
+{
+ tSirRetStatus retCode = eSIR_SUCCESS;
+ tSirMsgQ msgQ;
+ tpEnterBmpsParams pBmpsParams = NULL;
+ int i=0;
+
+ tANI_U32 rssiFilterPeriod = 5;
+ tANI_U32 numBeaconPerRssiAverage = 5;
+ tANI_U32 bRssiFilterEnable = FALSE;
+
+ if(psessionEntry->currentBssBeaconCnt == 0)
+ {
+ PELOGE(pmmLog( pMac, LOGE, FL("Beacon count is zero, can not retrieve the TSF, failing the Enter Bmps Request\n"));)
+ return eSIR_FAILURE;
+ }
+
+ if (palAllocateMemory(pMac->hHdd, (void **)&pBmpsParams, sizeof(tEnterBmpsParams)) != eHAL_STATUS_SUCCESS)
+ {
+ pmmLog(pMac, LOGP, "PMM: Not able to allocate memory for Enter Bmps\n");
+ return eSIR_FAILURE;
+ }
+
+ pMac->pmm.inMissedBeaconScenario = FALSE;
+ pBmpsParams->respReqd = TRUE;
+
+ pBmpsParams->tbtt = psessionEntry->lastBeaconTimeStamp;
+ pBmpsParams->dtimCount = psessionEntry->lastBeaconDtimCount;
+ pBmpsParams->dtimPeriod = psessionEntry->lastBeaconDtimPeriod;
+ pBmpsParams->bssIdx = psessionEntry->bssIdx;
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_RSSI_FILTER_PERIOD, &rssiFilterPeriod) != eSIR_SUCCESS)
+ pmmLog(pMac, LOGP, FL("pmmCfg: cfgGet failed for Rssi filter period"));
+
+ // This flag can be overridden when 11r/CCXEnabled=1 and FastTransition=1
+ if(wlan_cfgGetInt(pMac, WNI_CFG_PS_ENABLE_RSSI_MONITOR, &bRssiFilterEnable) != eSIR_SUCCESS)
+ pmmLog(pMac, LOGP, FL("pmmCfg: cfgGet failed for Rssi monitor enable flag"));
+ pBmpsParams->bRssiFilterEnable = bRssiFilterEnable;
+
+
+#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+ // If there is a CCX assoc or 11r assoc we need to pick up the rssiFilterPeriod from the
+ // FT config value.
+ for(i =0; i < pMac->lim.maxBssId; i++)
+ {
+ if (limisFastTransitionRequired(pMac, i))
+ {
+ if(wlan_cfgGetInt(pMac, WNI_CFG_FT_RSSI_FILTER_PERIOD, &rssiFilterPeriod) != eSIR_SUCCESS)
+ pmmLog(pMac, LOGP, FL("pmmCfg: cfgGet failed for Rssi filter period"));
+ // We need to override the ini value to enable
+ // FW RSSI Monitoring. Basically if CCX and FT are enabled
+ // then enable FW RSSI Monitoring
+
+ pBmpsParams->bRssiFilterEnable = TRUE;
+ break;
+ }
+ }
+#endif
+
+ pBmpsParams->rssiFilterPeriod = (tANI_U8)rssiFilterPeriod;
+
+ /* The numBeaconPerRssiAverage should be <= rssiFilter Period,
+ * and less than the max allowed (default set to 20 in CFG)
+ */
+ if(wlan_cfgGetInt(pMac, WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE, &numBeaconPerRssiAverage) != eSIR_SUCCESS)
+ pmmLog(pMac, LOGP, FL("pmmCfg: cfgGet failed for num beacon per rssi"));
+
+ pBmpsParams->numBeaconPerRssiAverage = (tANI_U8) numBeaconPerRssiAverage;
+ if (numBeaconPerRssiAverage > rssiFilterPeriod)
+ pBmpsParams->numBeaconPerRssiAverage =
+ (tANI_U8)GET_MIN_VALUE(rssiFilterPeriod, WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE_STAMAX);
+
+ pmmLog (pMac, LOG1,
+ "%s: [INFOLOG]RssiFilterInfo..%d %x %x\n", __func__, (int)pBmpsParams->bRssiFilterEnable,
+ (unsigned int)pBmpsParams->rssiFilterPeriod, (unsigned int)pBmpsParams->numBeaconPerRssiAverage);
+
+ msgQ.type = WDA_ENTER_BMPS_REQ;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pBmpsParams;
+ msgQ.bodyval = 0;
+
+ PELOGW(pmmLog( pMac, LOGW,
+ FL( "pmmBmps: Sending WDA_ENTER_BMPS_REQ" ));)
+
+ /* we need to defer any incoming messages until we get a
+ * WDA_ENTER_BMPS_RSP from HAL.
+ */
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ {
+ palFreeMemory(pMac->hHdd, pBmpsParams);
+ PELOGE(pmmLog( pMac, LOGE,
+ FL("Posting WDA_ENTER_BMPS_REQ to HAL failed, reason=%X\n"),
+ retCode );)
+ }
+
+ return retCode;
+}
+
+/**
+ * pmmSendPowerSaveCfg()
+ *
+ *FUNCTION:
+ * This function is called to send power save configurtion.
+ *
+ *NOTE:
+ *
+ * @param pMac pointer to Global Mac structure.
+ * @param mode The Power Save or Active State
+ *
+ * @return success if message send is ok, else false.
+ */
+tSirRetStatus pmmSendPowerSaveCfg(tpAniSirGlobal pMac, tpSirPowerSaveCfg pUpdatedPwrSaveCfg)
+{
+ tSirRetStatus retCode = eSIR_SUCCESS;
+ tSirMsgQ msgQ;
+ tANI_U32 listenInterval;
+ tANI_U32 HeartBeatCount = 1;
+ tANI_U32 maxPsPoll;
+ tANI_U32 numBeaconPerRssiAverage;
+ tANI_U32 minRssiThreshold;
+ tANI_U32 nthBeaconFilter;
+ tANI_U32 broadcastFrameFilter;
+ tANI_U32 rssiFilterPeriod;
+ tANI_U32 ignoreDtim;
+
+ if (NULL == pUpdatedPwrSaveCfg)
+ goto returnFailure;
+
+ if(pMac->lim.gLimSmeState != eLIM_SME_IDLE_STATE )
+ {
+ pmmLog(pMac, LOGE,
+ FL("pmmCfg: Power Save Configuration received in invalid state %d"),
+ pMac->lim.gLimSmeState);
+ retCode = eSIR_SME_INVALID_STATE;
+ goto returnFailure;
+ }
+
+ // Get power save configuration CFG values
+ if(wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
+ pmmLog(pMac, LOGP, FL("pmmCfg: cfgGet failed for listen interval"));
+ pUpdatedPwrSaveCfg->listenInterval = (tANI_U16)listenInterval;
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &HeartBeatCount) != eSIR_SUCCESS)
+ pmmLog(pMac, LOGP, FL("pmmCfg: cfgGet failed for heart beat thresh"));
+
+ pMac->lim.gLimHeartBeatCount = HeartBeatCount;
+ pUpdatedPwrSaveCfg->HeartBeatCount = HeartBeatCount;
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_NTH_BEACON_FILTER, &nthBeaconFilter) != eSIR_SUCCESS)
+ pmmLog(pMac, LOGP, FL("pmmCfg: cfgGet failed for Nth beacon filter"));
+ pUpdatedPwrSaveCfg->nthBeaconFilter = nthBeaconFilter;
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_PS_POLL, &maxPsPoll) != eSIR_SUCCESS)
+ pmmLog(pMac, LOGP, FL("pmmCfg: cfgGet failed for max poll"));
+ pUpdatedPwrSaveCfg->maxPsPoll = maxPsPoll;
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_MIN_RSSI_THRESHOLD, &minRssiThreshold) != eSIR_SUCCESS)
+ pmmLog(pMac, LOGP, FL("pmmCfg: cfgGet failed for min RSSI Threshold"));
+ pUpdatedPwrSaveCfg->minRssiThreshold = minRssiThreshold;
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE, &numBeaconPerRssiAverage) != eSIR_SUCCESS)
+ pmmLog(pMac, LOGP, FL("pmmCfg: cfgGet failed for num beacon per rssi"));
+ pUpdatedPwrSaveCfg->numBeaconPerRssiAverage = (tANI_U8) numBeaconPerRssiAverage;
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_RSSI_FILTER_PERIOD, &rssiFilterPeriod) != eSIR_SUCCESS)
+ pmmLog(pMac, LOGP, FL("pmmCfg: cfgGet failed for Rssi filter period"));
+ pUpdatedPwrSaveCfg->rssiFilterPeriod = (tANI_U8) rssiFilterPeriod;
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE, &broadcastFrameFilter) != eSIR_SUCCESS)
+ pmmLog(pMac, LOGP, FL("pmmCfg: cfgGet failed for Nth beacon filter"));
+ pUpdatedPwrSaveCfg->broadcastFrameFilter = (tANI_U8) broadcastFrameFilter;
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_IGNORE_DTIM, &ignoreDtim) != eSIR_SUCCESS)
+ pmmLog(pMac, LOGP, FL("pmmCfg: cfgGet failed for ignoreDtim"));
+ pUpdatedPwrSaveCfg->ignoreDtim = (tANI_U8) ignoreDtim;
+
+ /* The numBeaconPerRssiAverage should be <= rssiFilter Period,
+ * and less than the max allowed (default set to 20 in CFG)
+ */
+ if (numBeaconPerRssiAverage > rssiFilterPeriod)
+ pUpdatedPwrSaveCfg->numBeaconPerRssiAverage = (tANI_U8)GET_MIN_VALUE(rssiFilterPeriod, WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE_STAMAX);
+
+ //Save a copy of the CFG in global pmm context.
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMac->pmm.gPmmCfg, pUpdatedPwrSaveCfg, sizeof(tSirPowerSaveCfg));
+
+
+ msgQ.type = WDA_PWR_SAVE_CFG;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pUpdatedPwrSaveCfg;
+ msgQ.bodyval = 0;
+
+ PELOG1(pmmLog( pMac, LOG1, FL( "pmmBmps: Sending WDA_PWR_SAVE_CFG to HAL"));)
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ {
+ pmmLog( pMac, LOGP,
+ FL("Posting WDA_PWR_SAVE_CFG to HAL failed, reason=%X"),
+ retCode );
+ goto returnFailure;
+ }
+ return retCode;
+
+returnFailure:
+
+ /* In case of failure, we need to free the memory */
+ if (NULL != pUpdatedPwrSaveCfg)
+ {
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pUpdatedPwrSaveCfg);
+ }
+ return retCode;
+}
+
+/**
+ * pmmExitBmpsResponseHandler
+ *
+ *FUNCTION:
+ * This function processes the Wakeup Rsp from HAL and if successfull,
+ * sends a respnose back to PMC layer.
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac pointer to Global Mac structure.
+ * @param rspStatus Status of the response, Success or an error code.
+ *
+ * @return none.
+ */
+void pmmExitBmpsResponseHandler(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
+{
+ tpExitBmpsParams pExitBmpsRsp;
+ eHalStatus rspStatus;
+ tANI_U8 PowersavesessionId;
+ tpPESession psessionEntry;
+ tSirResultCodes retStatus = eSIR_SME_SUCCESS;
+
+ /* Copy the power save sessionId to the local variable */
+ PowersavesessionId = pMac->pmm.sessionId;
+
+ /* we need to process all the deferred messages enqueued since
+ * the initiating the SIR_HAL_EXIT_BMPS_REQ.
+ */
+
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+
+ if((psessionEntry = peFindSessionBySessionId(pMac,PowersavesessionId))==NULL)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+
+
+
+ /* Update wakeup statistics */
+ pmmUpdateWakeupStats(pMac);
+
+ if (NULL == limMsg->bodyptr)
+ {
+ pmmLog(pMac, LOGE, FL("Received SIR_HAL_EXIT_BMPS_RSP with NULL "));
+ return;
+ }
+ pExitBmpsRsp = (tpExitBmpsParams)(limMsg->bodyptr);
+ rspStatus = pExitBmpsRsp->status;
+
+ if(pMac->pmm.gPmmState != ePMM_STATE_BMPS_WT_WAKEUP_RSP)
+ {
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("Received SIR_HAL_EXIT_BMPS_RSP while in incorrect state: %d\n"),
+ pMac->pmm.gPmmState);)
+
+ retStatus = eSIR_SME_INVALID_PMM_STATE;
+ pmmBmpsUpdateInvalidStateCnt(pMac);
+ }
+ else
+ {
+ PELOGW(pmmLog(pMac, LOGW, FL("Received SIR_HAL_EXIT_BMPS_RSP in correct state. \n"));)
+ }
+
+ /* PE is going to wakeup irrespective of whether
+ * SIR_HAL_EXIT_BMPS_REQ was successful or not
+ */
+ switch (rspStatus)
+ {
+ case eHAL_STATUS_SUCCESS:
+ retStatus = eSIR_SME_SUCCESS;
+ break;
+
+ default:
+ {
+ /* PE is going to be awake irrespective of whether EXIT_BMPS_REQ
+ * failed or not. This is mainly to eliminate the dead-lock condition
+ * But, PMC will be informed about the error.
+ */
+ retStatus = eSIR_SME_BMPS_REQ_FAILED;
+ }
+ break;
+
+ }
+
+ pMac->pmm.gPmmState = ePMM_STATE_BMPS_WAKEUP;
+ pmmUpdateWakeupStats(pMac);
+
+ // turn on background scan
+ pMac->sys.gSysEnableScanMode = true;
+
+ // send response to PMC
+ limSendSmeRsp(pMac, eWNI_PMC_EXIT_BMPS_RSP, retStatus, 0, 0);
+
+ if ( pMac->pmm.gPmmExitBmpsReasonCode == eSME_MISSED_BEACON_IND_RCVD)
+ {
+ PELOGW(pmmLog(pMac, LOGW, FL("Rcvd SIR_HAL_EXIT_BMPS_RSP with MISSED_BEACON\n"));)
+ pmmMissedBeaconHandler(pMac);
+ }
+ else if(pMac->pmm.inMissedBeaconScenario)
+ {
+ PELOGW(pmmLog(pMac, LOGW, FL("Rcvd SIR_HAL_EXIT_BMPS_RSP in missed beacon scenario but reason code not correct"));)
+ pmmMissedBeaconHandler(pMac);
+ }
+ else
+ {
+ // Enable heartbeat timer
+ limReactivateHeartBeatTimer(pMac, psessionEntry);
+ }
+ return;
+}
+
+
+/**
+ * pmmMissedBeaconHandler()
+ *
+ *FUNCTION:
+ * This function is called when PMM receives an eWNI_PMC_EXIT_BMPS_REQ
+ * with reason code being eSME_MISSED_BEACON_IND_RCVD.
+ *
+ *NOTE:
+ * @param pMac pointer to Global Mac structure.
+ * @return none
+ */
+void pmmMissedBeaconHandler(tpAniSirGlobal pMac)
+{
+ tANI_U8 pwrSaveSessionId;
+ tANI_U32 beaconInterval = 0;
+ tANI_U32 heartBeatInterval = pMac->lim.gLimHeartBeatCount;
+ tpPESession psessionEntry;
+
+ /* Copy the power save sessionId to the local variable */
+ pwrSaveSessionId = pMac->pmm.sessionId;
+
+ if((psessionEntry = peFindSessionBySessionId(pMac,pwrSaveSessionId))==NULL)
+ {
+ limLog(pMac, LOGE,FL("Session Does not exist for given sessionID\n"));
+ return;
+ }
+
+
+ PELOGE(pmmLog(pMac, LOG1, FL("The device woke up due to MISSED BEACON \n"));)
+
+ /* Proceed only if HeartBeat timer is created */
+ if((pMac->lim.limTimers.gLimHeartBeatTimer.pMac) &&
+ (pMac->lim.gLimTimersCreated))
+ {
+ if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &beaconInterval) != eSIR_SUCCESS)
+ PELOG1(pmmLog(pMac, LOG1, FL("Fail to get BEACON_INTERVAL value\n"));)
+
+ /* Change timer to reactivate it in future */
+ heartBeatInterval= SYS_MS_TO_TICKS(beaconInterval * heartBeatInterval);
+
+ if( tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer,
+ (tANI_U32)heartBeatInterval, 0) != TX_SUCCESS)
+ {
+ PELOG1(pmmLog(pMac, LOG1, FL("Fail to change HeartBeat timer\n"));)
+ }
+
+ /* update some statistics */
+ if(LIM_IS_CONNECTION_ACTIVE(psessionEntry))
+ {
+ if(psessionEntry->LimRxedBeaconCntDuringHB < MAX_NO_BEACONS_PER_HEART_BEAT_INTERVAL)
+ pMac->lim.gLimHeartBeatBeaconStats[psessionEntry->LimRxedBeaconCntDuringHB]++;
+ else
+ pMac->lim.gLimHeartBeatBeaconStats[0]++;
+ }
+
+ /* To handle the missed beacon failure, message is being posted to self as if the
+ * actual timer has expired. This is done to make sure that there exists one
+ * common entry and exit points
+ */
+ //limResetHBPktCount(pMac); // 090805: Where did this come from?
+ limResetHBPktCount(psessionEntry); // 090805: This is what it SHOULD be. If we even need it.
+ pmmSendMessageToLim(pMac, SIR_LIM_HEART_BEAT_TIMEOUT);
+ }
+ else
+ {
+ PELOGE(pmmLog(pMac, LOGE, FL("HeartBeat Timer is not created, cannot re-activate\n"));)
+ }
+
+ return;
+}
+
+
+/**
+ * pmmExitBmpsIndicationHandler
+ *
+ *FUNCTION:
+ * This function sends a Power Save Indication. back to PMC layer.
+ * This indication is originated from softmac and will occur in the following two
+ * scenarios:
+ * 1) When softmac is in sleep state and wakes up to parse TIM and finds that
+ * AP has the data pending for this STA, then it sends this indication to let PMC know
+ * that it is going to be awake and pass the control over to PMC
+ * 2) When softmac is in sleep state and wakes up to parse TIM and determines that
+ * current TIM is DTIM and AP has buffered broadcast/multicast frames.
+ * In this scenario, softmac needs to remain awake for broadcast/multicast frames and it
+ * sends an indication to PMC that it is awake and passes the control over to PMC.
+ * 3) If station is awake and 'fEnablePwrSaveImmediately' flag is set, then softmac will transmit all
+ * frames in its queues and go to sleep. Before going to sleep it sends the notification to PMC that
+ * it is going to sleep.
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac pointer to Global Mac structure.
+ * @param rspStatus Status of the response, Success or an error code.
+ *
+ * @return none.
+ */
+
+void pmmExitBmpsIndicationHandler(tpAniSirGlobal pMac, tANI_U8 mode, eHalStatus rspStatus)
+{
+
+ tANI_U32 beaconInterval = 0;
+ tANI_U32 heartBeatInterval = pMac->lim.gLimHeartBeatCount;
+ tANI_U8 powersavesessionId;
+ tpPESession psessionEntry;
+
+ /* Copy the power save sessionId to the local variable */
+ powersavesessionId = pMac->pmm.sessionId;
+
+ psessionEntry = peFindSessionBySessionId(pMac,powersavesessionId);
+
+ if(psessionEntry == NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("Session does Not exist with given sessionId :%d \n"),powersavesessionId);)
+ return;
+ }
+
+ /* Since, the hardware is already wokenup, PE also wakesup and informs
+ * the upper layers that the system is waking up. Hence always Success is
+ * sent in the reason code for the message sent to PMC
+ */
+
+ PELOGW(pmmLog(pMac, LOGW,
+ FL("pmmBmps: Received SIR_HAL_EXIT_BMPS_IND from HAL, Exiting BMPS sleep mode\n")); )
+
+
+ pMac->pmm.gPmmState = ePMM_STATE_BMPS_WAKEUP;
+ pmmUpdateWakeupStats(pMac);
+
+ /* turn on background scan */
+ pMac->sys.gSysEnableScanMode = true;
+
+ pmmBmpsUpdateWakeupIndCnt(pMac);
+
+ /* Inform SME about the system awake state */
+ limSendSmeRsp(pMac,
+ eWNI_PMC_EXIT_BMPS_IND,
+ eSIR_SME_SUCCESS, 0, 0);
+
+ switch(rspStatus)
+ {
+
+ /* The SoftMAC sends wakeup indication even when Heart-Beat timer expired
+ * The PE should start taking action against this as soon as it identifies
+ * that the SoftMAC has identified heart-beat miss
+ */
+ case eHAL_STATUS_HEARTBEAT_TMOUT:
+ {
+ PELOG1(pmmLog(pMac, LOG1,
+ FL("pmmBmps: The device woke up due to HeartBeat Timeout\n"));)
+
+ /* Proceed only if HeartBeat timer is created */
+ if((pMac->lim.limTimers.gLimHeartBeatTimer.pMac) &&
+ (pMac->lim.gLimTimersCreated))
+ {
+
+ /* Read the beacon interval from sessionTable */
+ beaconInterval = psessionEntry->beaconParams.beaconInterval;
+
+ /* Change timer to reactivate it in future */
+ heartBeatInterval= SYS_MS_TO_TICKS(beaconInterval * heartBeatInterval);
+
+ if(tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer,
+ (tANI_U32)heartBeatInterval, 0) != TX_SUCCESS)
+ {
+ PELOG1(pmmLog(pMac, LOG1,
+ FL("pmmBmps: Unable to change HeartBeat timer\n"));)
+ }
+
+ /* update some statistics */
+ if(LIM_IS_CONNECTION_ACTIVE(psessionEntry))
+ {
+ if(psessionEntry->LimRxedBeaconCntDuringHB < MAX_NO_BEACONS_PER_HEART_BEAT_INTERVAL)
+ pMac->lim.gLimHeartBeatBeaconStats[psessionEntry->LimRxedBeaconCntDuringHB]++;
+ else
+ pMac->lim.gLimHeartBeatBeaconStats[0]++;
+ }
+
+ /* To handle the heartbeat failure, message is being posted to self as if the
+ * actual timer has expired. This is done to make sure that there exists one
+ * common entry and exit points
+ */
+ pmmSendMessageToLim(pMac, SIR_LIM_HEART_BEAT_TIMEOUT);
+
+ }
+ else
+ {
+
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("pmmBmps: HeartBeat Timer is not created, cannot re-activate\n"));)
+ }
+ }
+ break;
+
+ case eHAL_STATUS_NTH_BEACON_DELIVERY:
+ break;
+
+ default:
+ break;
+
+ }
+
+ return;
+
+}
+
+
+// --------------------------------------------------------------------
+/**
+ * pmmProcessMessageQueue
+ *
+ * FUNCTION:
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param None
+ * @return None
+ */
+
+void pmmProcessMessageQueue(tpAniSirGlobal pMac)
+{
+#if 0
+ tSirMsgQ msg;
+
+ while (1)
+ {
+ if (tx_queue_receive(&pMac->sys.gSirPmmMsgQ, (void *) &msg, TX_WAIT_FOREVER)
+ != TX_SUCCESS)
+ break;
+
+ pmmProcessMessage(pMac, &msg);
+ }
+#endif
+}
+
+// --------------------------------------------------------------------
+/**
+ * pmmProcessMessage
+ *
+ * FUNCTION: Processes the next received Power Management message
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param None
+ * @return None
+ */
+
+void pmmProcessMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
+{
+ switch (pMsg->type)
+ {
+ case eWNI_PMC_PWR_SAVE_CFG:
+ {
+ tpSirPowerSaveCfg pPSCfg;
+ tSirMbMsg *pMbMsg = (tSirMbMsg *)pMsg->bodyptr;
+
+ if (palAllocateMemory(pMac->hHdd, (void **)&pPSCfg, sizeof(tSirPowerSaveCfg)) != eHAL_STATUS_SUCCESS)
+ {
+ pmmLog(pMac, LOGP, "PMM: Not able to allocate memory for PMC Config\n");
+ }
+ (void) palCopyMemory(pMac->hHdd, pPSCfg, pMbMsg->data, sizeof(tSirPowerSaveCfg));
+ (void) pmmSendPowerSaveCfg(pMac, pPSCfg);
+
+ // sending beacon filtering information down to HAL
+ if (limSendBeaconFilterInfo(pMac) != eSIR_SUCCESS)
+ pmmLog(pMac, LOGE, FL("Fail to send Beacon Filter Info \n"));
+ }
+ break;
+
+ case eWNI_PMC_ENTER_BMPS_REQ:
+ pmmInitBmpsPwrSave(pMac);
+ break;
+
+ case WDA_ENTER_BMPS_RSP:
+ pmmInitBmpsResponseHandler(pMac, (eHalStatus)pMsg->bodyval);
+ break;
+
+ case eWNI_PMC_EXIT_BMPS_REQ:
+ {
+ tpExitBmpsInfo pExitBmpsInfo;
+ tSirMbMsg *pMbMsg = (tSirMbMsg *)pMsg->bodyptr;
+
+ if (palAllocateMemory(pMac->hHdd, (void **)&pExitBmpsInfo, sizeof(tExitBmpsInfo)) != eHAL_STATUS_SUCCESS)
+ {
+ pmmLog(pMac, LOGP, "PMM: Failed to allocate memory for Exit BMPS Info \n");
+ }
+ (void) palCopyMemory(pMac->hHdd, pExitBmpsInfo, pMbMsg->data, sizeof(tExitBmpsInfo));
+ (void) pmmExitBmpsRequestHandler(pMac, pExitBmpsInfo);
+ }
+ break;
+
+ case WDA_EXIT_BMPS_RSP:
+ pmmExitBmpsResponseHandler(pMac, pMsg);
+ break;
+
+ case WDA_EXIT_BMPS_IND:
+ pmmExitBmpsIndicationHandler(pMac, SIR_PM_ACTIVE_MODE, (eHalStatus)pMsg->bodyval);
+ break;
+
+ case eWNI_PMC_ENTER_IMPS_REQ:
+ pmmEnterImpsRequestHandler(pMac);
+ break;
+
+ case WDA_ENTER_IMPS_RSP:
+ pmmEnterImpsResponseHandler(pMac, (eHalStatus)pMsg->bodyval);
+ break;
+
+ case eWNI_PMC_EXIT_IMPS_REQ:
+ pmmExitImpsRequestHandler(pMac);
+ break;
+
+ case WDA_EXIT_IMPS_RSP:
+ pmmExitImpsResponseHandler(pMac, (eHalStatus)pMsg->bodyval);
+ break;
+
+ case eWNI_PMC_ENTER_UAPSD_REQ:
+ pmmEnterUapsdRequestHandler(pMac);
+ break;
+
+ case WDA_ENTER_UAPSD_RSP:
+ pmmEnterUapsdResponseHandler(pMac, pMsg);
+ break;
+
+ case eWNI_PMC_EXIT_UAPSD_REQ:
+ pmmExitUapsdRequestHandler(pMac);
+ break;
+
+ case WDA_EXIT_UAPSD_RSP:
+ pmmExitUapsdResponseHandler(pMac, (eHalStatus)pMsg->bodyval);
+ break;
+
+ case eWNI_PMC_WOWL_ADD_BCAST_PTRN:
+ pmmSendWowlAddBcastPtrn(pMac, pMsg);
+ break;
+
+ case eWNI_PMC_WOWL_DEL_BCAST_PTRN:
+ pmmSendWowlDelBcastPtrn(pMac, pMsg);
+ break;
+
+ case eWNI_PMC_ENTER_WOWL_REQ:
+ pmmEnterWowlRequestHandler(pMac, pMsg);
+ break;
+
+ case WDA_WOWL_ENTER_RSP:
+ pmmEnterWowlanResponseHandler(pMac, pMsg);
+ break;
+
+ case eWNI_PMC_EXIT_WOWL_REQ:
+ pmmExitWowlanRequestHandler(pMac);
+ break;
+
+ case WDA_WOWL_EXIT_RSP:
+ pmmExitWowlanResponseHandler(pMac, (eHalStatus)pMsg->bodyval);
+ break;
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+ case WDA_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
+ pmmFilterMatchCountResponseHandler(pMac, pMsg);
+ break;
+#endif // WLAN_FEATURE_PACKET_FILTERING
+
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+ case WDA_GTK_OFFLOAD_GETINFO_RSP:
+ pmmGTKOffloadGetInfoResponseHandler(pMac, pMsg);
+ break;
+#endif // WLAN_FEATURE_GTK_OFFLOAD
+
+ default:
+ PELOGW(pmmLog(pMac, LOGW,
+ FL("PMM: Unknown message in pmmMsgQ type %d, potential memory leak!!\n"),
+ pMsg->type);)
+ }
+
+ if (NULL != pMsg->bodyptr)
+ {
+ palFreeMemory(pMac->hHdd, (tANI_U8 *)pMsg->bodyptr);
+ pMsg->bodyptr = NULL;
+ }
+}
+
+
+
+
+
+
+// --------------------------------------------------------------------
+/**
+ * pmmPostMessage
+ *
+ * FUNCTION:
+ * Post a message to the pmm message queue
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pMsg pointer to message
+ * @return None
+ */
+
+tSirRetStatus
+pmmPostMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
+{
+#if defined(VOSS_ENABLED)
+ VOS_STATUS vosStatus;
+ vosStatus = vos_mq_post_message(VOS_MQ_ID_PE, (vos_msg_t *) pMsg);
+ if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+ {
+ pmmLog(pMac, LOGP, FL("vos_mq_post_message failed with status code %d\n"), vosStatus);
+ return eSIR_FAILURE;
+ }
+#elif defined(ANI_OS_TYPE_WINDOWS)
+ pmmProcessMessage(pMac, pMsg);
+#else
+ if (tx_queue_send(&pMac->sys.gSirPmmMsgQ, pMsg, TX_NO_WAIT) != TX_SUCCESS)
+ return eSIR_FAILURE;
+
+#endif // VOSS_ENABLED
+
+ return eSIR_SUCCESS;
+}
+
+
+
+
+
+/**
+ * pmmUpdatePwrSaveStats
+ *
+ * FUNCTION: updated BMPS stats, when Station is going into power save state.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pMac pointer to Global MAC Structure.
+ * @return None
+ */
+
+void pmmUpdatePwrSaveStats(tpAniSirGlobal pMac)
+{
+/*
+ tANI_U64 TimeAwake = 0;
+
+ pMac->pmm.BmpsSleepTimeStamp = vos_timer_get_system_ticks();
+
+ if (pMac->pmm.BmpsWakeupTimeStamp)
+ TimeAwake = (pMac->pmm.BmpsSleepTimeStamp - pMac->pmm.BmpsWakeupTimeStamp) /10;
+ else
+ TimeAwake = 0; // very first time
+
+ if (TimeAwake > pMac->pmm.BmpsmaxTimeAwake)
+ {
+ pMac->pmm.BmpsmaxTimeAwake = TimeAwake;
+ }
+
+ if ((!pMac->pmm.BmpsminTimeAwake) || (TimeAwake < pMac->pmm.BmpsminTimeAwake))
+ {
+ pMac->pmm.BmpsminTimeAwake = TimeAwake;
+ }
+
+ pMac->pmm.BmpsavgTimeAwake = ( ( (pMac->pmm.BmpsavgTimeAwake * pMac->pmm.BmpscntSleep) + TimeAwake ) / (pMac->pmm.BmpscntSleep + 1) );
+
+ pMac->pmm.BmpscntSleep++;
+ return;
+*/
+}
+
+
+
+
+/**
+ * pmmUpdatePwrSaveStats
+ *
+ * FUNCTION: updated BMPS stats, when Station is waking up.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pMac pointer to Global MAC Structure.
+ * @return None
+ */
+
+void pmmUpdateWakeupStats(tpAniSirGlobal pMac)
+{
+/*
+
+ tANI_U64 SleepTime = 0;
+
+ pMac->pmm.BmpsWakeupTimeStamp = vos_timer_get_system_ticks();
+ SleepTime = (pMac->pmm.BmpsWakeupTimeStamp - pMac->pmm.BmpsSleepTimeStamp) / 10;
+
+ if (SleepTime > pMac->pmm.BmpsmaxSleepTime)
+ {
+ pMac->pmm.BmpsmaxSleepTime = SleepTime;
+ }
+
+ if ((!pMac->pmm.BmpsminSleepTime) || (SleepTime < pMac->pmm.BmpsminSleepTime))
+ {
+ pMac->pmm.BmpsminSleepTime = SleepTime;
+ }
+
+ pMac->pmm.BmpsavgSleepTime = ( ( (pMac->pmm.BmpsavgSleepTime * pMac->pmm.BmpscntAwake) + SleepTime ) / (pMac->pmm.BmpscntAwake + 1) );
+
+ pMac->pmm.BmpscntAwake++;
+ return;
+*/
+}
+
+// --------------------------------------------------------------------
+/**
+ * pmmEnterImpsRequestHandler
+ *
+ * FUNCTION:
+ * This function sends the idle mode power save request from host device
+ * drive to HAL. This function is called from pmmProcessMsg()
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None
+ *
+ * NOTE:
+ *
+ * @param Global handle to MAC
+ * @return None
+ */
+void pmmEnterImpsRequestHandler (tpAniSirGlobal pMac)
+{
+
+ tSirResultCodes resultCode = eSIR_SME_SUCCESS;
+ tSirRetStatus retStatus = eSIR_SUCCESS;
+ tPmmState origState = pMac->pmm.gPmmState;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_ENTER_IMPS_REQ_EVENT, peGetValidPowerSaveSession(pMac), 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ /*Returns True even single active session present */
+ if(peIsAnySessionActive(pMac))
+ {
+ resultCode = eSIR_SME_INVALID_STATE;
+ goto failure;
+ }
+
+ if ( ((pMac->pmm.gPmmState != ePMM_STATE_READY) &&
+ (pMac->pmm.gPmmState != ePMM_STATE_IMPS_WAKEUP)) ||
+ ((pMac->lim.gLimSmeState != eLIM_SME_IDLE_STATE) &&
+ (pMac->lim.gLimSmeState != eLIM_SME_JOIN_FAILURE_STATE)) ||
+ (pMac->lim.gLimMlmState != eLIM_MLM_IDLE_STATE) ||
+ (pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) ||
+ (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING))
+ {
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("pmmImps: PMM State = %d, MLM State = %d, SME State = %d, rejecting the sleep mode request\n"),
+ pMac->pmm.gPmmState, pMac->lim.gLimMlmState, pMac->lim.gLimSmeState);)
+
+ resultCode = eSIR_SME_INVALID_PMM_STATE;
+ pmmImpsUpdateErrStateStats(pMac);
+ goto failure;
+ }
+
+ // change PE state and send the request to HAL
+ pMac->pmm.gPmmState = ePMM_STATE_IMPS_WT_SLEEP_RSP;
+ if( (retStatus = pmmImpsSendChangePwrSaveMsg(pMac, SIR_PM_SLEEP_MODE)) != eSIR_SUCCESS)
+ {
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("pmmImps: IMPS Sleep Request failed: sending response: %x\n"), retStatus);)
+
+ resultCode = eSIR_SME_IMPS_REQ_FAILED;
+ goto failure;
+ }
+ else
+ {
+ PELOG1(pmmLog(pMac, LOG1,
+ FL("pmmImps: Waiting for SoftMac response for IMPS request\n"));)
+ }
+ return;
+
+failure:
+ pMac->pmm.gPmmState = origState;
+ pmmImpsUpdateSleepErrStats(pMac, retStatus);
+
+ limSendSmeRsp(pMac,
+ eWNI_PMC_ENTER_IMPS_RSP,
+ resultCode, 0, 0);
+
+}
+
+// --------------------------------------------------------------------
+/**
+ * pmmEnterImpsResponseHandler
+ *
+ * FUNCTION:
+ * This function receives the response from HAL layer for the idle mode
+ * power save request sent. The function is also responsible for checking
+ * the correctness of the system state before configuring the new state
+ * on success. This function is called by pmmProcessMsg()
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None
+ *
+ * NOTE:
+ *
+ * @param Global handle to MAC, Status code
+ * @return None
+ */
+void pmmEnterImpsResponseHandler (tpAniSirGlobal pMac, eHalStatus rspStatus)
+{
+ tPmmState nextState = pMac->pmm.gPmmState;
+ tSirResultCodes resultCode = eSIR_SME_SUCCESS;
+
+ /* we need to process all the deferred messages enqueued since
+ * the initiating the WDA_ENTER_IMPS_REQ.
+ */
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+
+ if(pMac->pmm.gPmmState != ePMM_STATE_IMPS_WT_SLEEP_RSP)
+ {
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("pmmImps: Receives IMPS sleep rsp in invalid state: %d\n"),
+ pMac->pmm.gPmmState);)
+
+ resultCode = eSIR_SME_INVALID_PMM_STATE;
+ pmmImpsUpdateErrStateStats(pMac);
+
+ goto failure;
+ }
+
+ if(eHAL_STATUS_SUCCESS == rspStatus)
+ {
+ //if success, change the state to IMPS sleep mode
+ pMac->pmm.gPmmState = ePMM_STATE_IMPS_SLEEP;
+
+ PELOGW(pmmLog(pMac, LOGW,
+ FL("pmmImps: Received successful WDA_ENTER_IMPS_RSP from HAL\n"));)
+
+ //update power save statistics
+ pmmImpsUpdatePwrSaveStats(pMac);
+
+ limSendSmeRsp(pMac,
+ eWNI_PMC_ENTER_IMPS_RSP,
+ resultCode, 0, 0);
+ }
+ else
+ {
+ // go back to previous state if request failed
+ nextState = ePMM_STATE_IMPS_WAKEUP;
+ resultCode = eSIR_SME_CANNOT_ENTER_IMPS;
+ goto failure;
+ }
+ return;
+
+failure:
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("pmmImpsSleepRsp failed, Ret Code: %d, next state will be: %d\n"),
+ rspStatus,
+ pMac->pmm.gPmmState);)
+
+ pMac->pmm.gPmmState = nextState;
+
+ limSendSmeRsp(pMac,
+ eWNI_PMC_ENTER_IMPS_RSP,
+ resultCode, 0, 0);
+}
+
+
+// --------------------------------------------------------------------
+/**
+ * pmmExitImpsRequestHandler
+ *
+ * FUNCTION:
+ * This function is called by pmmProcessMsg(). The function sends a request
+ * to HAL to wakeup the device from idle mode power save mode.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None
+ *
+ * NOTE:
+ *
+ * @param Global handle to MAC
+ * @return None
+ */
+void pmmExitImpsRequestHandler (tpAniSirGlobal pMac)
+{
+ tSirRetStatus retStatus = eSIR_SUCCESS;
+ tSirResultCodes resultCode = eSIR_SME_SUCCESS;
+
+ tPmmState origState = pMac->pmm.gPmmState;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_IMPS_REQ_EVENT, peGetValidPowerSaveSession(pMac), 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ if (ePMM_STATE_IMPS_SLEEP == pMac->pmm.gPmmState)
+ {
+ pMac->pmm.gPmmState = ePMM_STATE_IMPS_WT_WAKEUP_RSP;
+ if( (retStatus = pmmImpsSendChangePwrSaveMsg(pMac, SIR_PM_ACTIVE_MODE)) !=
+ eSIR_SUCCESS)
+ {
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("pmmImps: Wakeup request message sent to SoftMac failed\n"));)
+ resultCode = eSIR_SME_IMPS_REQ_FAILED;
+ goto failure;
+ }
+ }
+ else
+ {
+ // PE in invalid state
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("pmmImps: Wakeup Req received in invalid state: %x\n"),
+ pMac->pmm.gPmmState);)
+
+ resultCode = eSIR_SME_INVALID_PMM_STATE;
+ pmmImpsUpdateErrStateStats(pMac);
+
+ goto failure;
+ }
+ return;
+
+failure:
+ PELOGE(pmmLog (pMac, LOGE,
+ FL("pmmImps: Changing to IMPS wakeup mode failed, Ret Code: %d, Next State: %d\n"),
+ retStatus, pMac->pmm.gPmmState);)
+
+ pMac->pmm.gPmmState = origState;
+ pmmImpsUpdateWakeupErrStats(pMac, retStatus);
+
+ limSendSmeRsp(pMac,
+ eWNI_PMC_EXIT_IMPS_RSP,
+ resultCode, 0, 0);
+}
+
+
+// --------------------------------------------------------------------
+/**
+ * pmmExitImpsResponseHandler
+ *
+ * FUNCTION:
+ * This function receives the response from HAL layer for the idle mode
+ * power save request sent. The function is also responsible for checking
+ * the correctness of the system state before configuring the new state
+ * on success. This function is called by pmmProcessMsg()
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None
+ *
+ * NOTE:
+ *
+ * @param Global handle to MAC
+ * @return None
+ */
+void pmmExitImpsResponseHandler(tpAniSirGlobal pMac, eHalStatus rspStatus)
+{
+ tSirResultCodes resultCode = eSIR_SME_SUCCESS;
+
+ /* we need to process all the deferred messages enqueued since
+ * the initiating the WDA_EXIT_IMPS_REQ.
+ */
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+
+ if (pMac->pmm.gPmmState != ePMM_STATE_IMPS_WT_WAKEUP_RSP)
+ {
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("pmmImps: Received 'Wakeup' response in invalid state: %d\n"),
+ pMac->pmm.gPmmState);)
+
+ resultCode = eSIR_SME_INVALID_PMM_STATE;
+ pmmImpsUpdateErrStateStats(pMac);
+ }
+
+ switch(rspStatus)
+ {
+ case eHAL_STATUS_SUCCESS:
+ {
+ resultCode = eSIR_SME_SUCCESS;
+ PELOGW(pmmLog(pMac, LOGW,
+ FL("pmmImps: Received WDA_EXIT_IMPS_RSP with Successful response from HAL\n"));)
+ }
+ break;
+
+ default:
+ {
+ resultCode = eSIR_SME_IMPS_REQ_FAILED;
+ PELOGW(pmmLog(pMac, LOGW,
+ FL("pmmImps: Received WDA_EXIT_IMPS_RSP with Failure Status from HAL\n"));)
+ }
+ break;
+
+ }
+
+ pMac->pmm.gPmmState = ePMM_STATE_IMPS_WAKEUP;
+
+ //update power save statistics
+ pmmImpsUpdateWakeupStats(pMac);
+
+ limSendSmeRsp(pMac,
+ eWNI_PMC_EXIT_IMPS_RSP,
+ resultCode, 0, 0);
+ return;
+
+}
+
+// --------------------------------------------------------------------
+/**
+ * pmmEnterUapsdRequestHandler
+ *
+ * FUNCTION:
+ * This function process the eWNI_PMC_ENTER_UAPSD_REQ from PMC,
+ * checks the correctness of the system state before configuring
+ * PMM to the new ePMM_STATE_UAPSD_WT_SLEEP_RSP state, and invokes
+ * invokes pmmUapsdSendChangePwrSaveMsg() to send
+ * WDA_ENTER_UAPSD_REQ to HAL.
+ *
+ * NOTE:
+ *
+ * @param Global handle to MAC
+ * @return None
+ */
+void pmmEnterUapsdRequestHandler (tpAniSirGlobal pMac)
+{
+ tSirResultCodes resultCode = eSIR_SME_SUCCESS;
+ tSirRetStatus retStatus = eSIR_SUCCESS;
+
+ tPmmState origState = pMac->pmm.gPmmState;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_ENTER_UAPSD_REQ_EVENT, peGetValidPowerSaveSession(pMac), 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ if ( (pMac->pmm.gPmmState != ePMM_STATE_BMPS_SLEEP) ||
+ limIsSystemInScanState(pMac) )
+ {
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("pmmUapsd: PMM State = %d, MLM State = %d, SME State = %d, rejecting the sleep mode request\n"),
+ pMac->pmm.gPmmState, pMac->lim.gLimMlmState, pMac->lim.gLimSmeState);)
+
+ resultCode = eSIR_SME_INVALID_PMM_STATE;
+ goto failure;
+ }
+
+ pMac->pmm.gPmmState = ePMM_STATE_UAPSD_WT_SLEEP_RSP;
+
+ if( (retStatus = pmmUapsdSendChangePwrSaveMsg(pMac, SIR_PM_SLEEP_MODE)) != eSIR_SUCCESS)
+ {
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("pmmUapsd: HAL_ENTER_UAPSD_REQ failed with response: %x\n"), retStatus);)
+ resultCode = eSIR_SME_UAPSD_REQ_FAILED;
+ goto failure;
+ }
+
+ PELOG1(pmmLog(pMac, LOG1, FL("pmmUapsd: Waiting for WDA_ENTER_UAPSD_RSP \n"));)
+ return;
+
+failure:
+ pMac->pmm.gPmmState = origState;
+ limSendSmeRsp(pMac, eWNI_PMC_ENTER_UAPSD_RSP, resultCode, 0, 0);
+ return;
+}
+
+
+// --------------------------------------------------------------------
+/**
+ * pmmEnterUapsdResponseHandler
+ *
+ * FUNCTION:
+ * This function processes the SIR_HAL_ENTER_UAPSD_RSP from HAL.
+ * If the response is successful, it puts PMM into ePMM_STATE_UAPSD_SLEEP
+ * state and sends back success response to PMC.
+ *
+ * NOTE:
+ *
+ * @param limMsg
+ * @return None
+ */
+void pmmEnterUapsdResponseHandler(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
+{
+ tpUapsdParams pUapsdRspMsg;
+ tSirResultCodes retStatus = eSIR_SME_SUCCESS;
+
+ /* we need to process all the deferred messages enqueued since
+ * the initiating the SIR_HAL_ENTER_UAPSD_REQ.
+ */
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+
+
+ if (NULL == limMsg->bodyptr)
+ {
+ PELOGE(pmmLog(pMac, LOGE, FL("pmmUapsd: Received SIR_HAL_ENTER_UAPSD_RSP with NULL "));)
+ return;
+ }
+
+ pUapsdRspMsg = (tpUapsdParams)(limMsg->bodyptr);
+
+ if(pMac->pmm.gPmmState != ePMM_STATE_UAPSD_WT_SLEEP_RSP)
+ {
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("pmmUapsd: Received SIR_HAL_ENTER_UAPSD_RSP while in incorrect state: %d\n"),
+ pMac->pmm.gPmmState);)
+ limSendSmeRsp(pMac, eWNI_PMC_ENTER_UAPSD_RSP, eSIR_SME_INVALID_PMM_STATE, 0, 0);
+ return;
+ }
+
+ if(pUapsdRspMsg->status == eSIR_SUCCESS)
+ {
+ PELOGW(pmmLog(pMac, LOGW,
+ FL("pmmUapsd: Received successful response from HAL to enter UAPSD mode \n"));)
+ pMac->pmm.gPmmState = ePMM_STATE_UAPSD_SLEEP;
+ }
+ else
+ {
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("pmmUapsd: SIR_HAL_ENTER_UAPSD_RSP failed, informing SME\n"));)
+ pMac->pmm.gPmmState = ePMM_STATE_BMPS_SLEEP;
+ retStatus = eSIR_SME_UAPSD_REQ_FAILED;
+ }
+
+ limSendSmeRsp(pMac, eWNI_PMC_ENTER_UAPSD_RSP, retStatus, 0, 0);
+ return;
+}
+
+
+// --------------------------------------------------------------------
+/**
+ * pmmExitUapsdRequestHandler
+ *
+ * FUNCTION:
+ * This function process the eWNI_PMC_EXIT_UAPSD_REQ from PMC,
+ * checks the correctness of the system state before configuring
+ * PMM to the new ePMM_STATE_UAPSD_WT_WAKEUP_RSP state, and
+ * invokes pmmUapsdSendChangePwrSaveMsg() to send
+ * SIR_HAL_EXIT_UAPSD_REQ to HAL.
+ *
+ * NOTE:
+ *
+ * @param Global handle to MAC
+ * @return None
+ */
+void pmmExitUapsdRequestHandler(tpAniSirGlobal pMac)
+{
+ tSirRetStatus retStatus = eSIR_SUCCESS;
+ tSirResultCodes resultCode = eSIR_SME_SUCCESS;
+
+ tPmmState origState = pMac->pmm.gPmmState;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_UAPSD_REQ_EVENT, peGetValidPowerSaveSession(pMac), 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ if (ePMM_STATE_UAPSD_SLEEP == pMac->pmm.gPmmState)
+ {
+ pMac->pmm.gPmmState = ePMM_STATE_UAPSD_WT_WAKEUP_RSP;
+ if( (retStatus = pmmUapsdSendChangePwrSaveMsg(pMac, SIR_PM_ACTIVE_MODE)) !=
+ eSIR_SUCCESS)
+ {
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("pmmUapsd: sending EXIT_UAPSD to HAL failed \n"));)
+ resultCode = eSIR_SME_UAPSD_REQ_FAILED;
+ goto failure;
+ }
+ }
+ else
+ {
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("pmmUapsd: Rcv EXIT_UAPSD from PMC in invalid state: %x\n"),
+ pMac->pmm.gPmmState);)
+
+ resultCode = eSIR_SME_INVALID_PMM_STATE;
+ goto failure;
+ }
+ return;
+
+failure:
+ pMac->pmm.gPmmState = origState;
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("pmmUapsd: Waking up from UAPSD mode failed, Ret Code: %d, Next State: %d\n"),
+ retStatus, pMac->pmm.gPmmState);)
+ limSendSmeRsp(pMac, eWNI_PMC_EXIT_IMPS_RSP, resultCode, 0, 0);
+}
+
+
+// --------------------------------------------------------------------
+/**
+ * pmmExitUapsdResponseHandler
+ *
+ * FUNCTION:
+ * This function receives the SIR_HAL_EXIT_UAPSD_RSP from HAL and is
+ * responsible for checking the correctness of the system state
+ * before configuring PMM to the new ePMM_STATE_BMPS_SLEEP state
+ * and send eWNI_PMC_EXIT_UAPSD_RSP to PMC.
+ *
+ * NOTE:
+ *
+ * @param Global handle to MAC
+ * @return None
+ */
+void pmmExitUapsdResponseHandler(tpAniSirGlobal pMac, eHalStatus rspStatus)
+{
+ tSirResultCodes resultCode = eSIR_SME_SUCCESS;
+
+ /* we need to process all the deferred messages enqueued since
+ * the initiating the SIR_HAL_EXIT_UAPSD_REQ.
+ */
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+
+ if (pMac->pmm.gPmmState != ePMM_STATE_UAPSD_WT_WAKEUP_RSP)
+ {
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("Received HAL_EXIT_UAPSD_RSP in invalid state: %d\n"),
+ pMac->pmm.gPmmState);)
+ limSendSmeRsp(pMac, eWNI_PMC_EXIT_UAPSD_RSP, eSIR_SME_INVALID_PMM_STATE, 0, 0);
+ return;
+ }
+
+ switch(rspStatus)
+ {
+ case eHAL_STATUS_SUCCESS:
+ resultCode = eSIR_SME_SUCCESS;
+ PELOGW(pmmLog(pMac, LOGW,
+ FL("Received SIR_HAL_EXIT_UAPSD_RSP with Successful response \n"));)
+ break;
+ default:
+ resultCode = eSIR_SME_UAPSD_REQ_FAILED;
+ PELOGE(pmmLog(pMac, LOGW,
+ FL("Received SIR_HAL_EXIT_UAPSD_RSP with Failure Status\n"));)
+ break;
+ }
+
+ pMac->pmm.gPmmState = ePMM_STATE_BMPS_SLEEP;
+ limSendSmeRsp(pMac, eWNI_PMC_EXIT_UAPSD_RSP, resultCode, 0, 0);
+ return;
+}
+
+/** ------------------------------------------------------------
+\fn pmmSendWowlAddBcastPtrn
+\brief This function sends a SIR_HAL_WOWL_ADD_BCAST_PTRN
+\ message to HAL.
+\param tpAniSirGlobal pMac
+\param tpSirMsgQ pMsg
+\return None
+ --------------------------------------------------------------*/
+void pmmSendWowlAddBcastPtrn(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
+{
+ tpSirWowlAddBcastPtrn pBcastPtrn;
+ tSirMbMsg *pMbMsg = (tSirMbMsg *)pMsg->bodyptr;
+ tSirRetStatus retCode = eSIR_SUCCESS;
+ tSirMsgQ msgQ;
+
+ if (palAllocateMemory(pMac->hHdd, (void **)&pBcastPtrn, sizeof(*pBcastPtrn)) != eHAL_STATUS_SUCCESS)
+ {
+ pmmLog(pMac, LOGP, FL("Fail to allocate memory for WoWLAN Add Bcast Pattern \n"));
+ return;
+ }
+ (void) palCopyMemory(pMac->hHdd, pBcastPtrn, pMbMsg->data, sizeof(*pBcastPtrn));
+
+ if (NULL == pBcastPtrn)
+ {
+ pmmLog(pMac, LOGE, FL("Add broadcast pattern message is NULL \n"));
+ return;
+ }
+
+ msgQ.type = WDA_WOWL_ADD_BCAST_PTRN;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pBcastPtrn;
+ msgQ.bodyval = 0;
+
+ pmmLog(pMac, LOG1, FL( "Sending WDA_WOWL_ADD_BCAST_PTRN to HAL"));
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_WOWL_ADD_BCAST_PTRN_EVENT, NULL, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ {
+ if (pBcastPtrn != NULL)
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pBcastPtrn);
+ pmmLog( pMac, LOGP, FL("Posting WDA_WOWL_ADD_BCAST_PTRN failed, reason=%X"), retCode );
+ }
+ return;
+}
+
+/** ------------------------------------------------------------
+\fn pmmSendWowlDelBcastPtrn
+\brief This function sends a SIR_HAL_WOWL_DEL_BCAST_PTRN
+\ message to HAL.
+\param tpAniSirGlobal pMac
+\param tpSirMsgQ pMsg
+\return None
+ --------------------------------------------------------------*/
+void pmmSendWowlDelBcastPtrn(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
+{
+ tpSirWowlDelBcastPtrn pDeletePtrn;
+ tSirMbMsg *pMbMsg = (tSirMbMsg *)pMsg->bodyptr;
+ tSirRetStatus retCode = eSIR_SUCCESS;
+ tSirMsgQ msgQ;
+
+ if (palAllocateMemory(pMac->hHdd, (void **)&pDeletePtrn, sizeof(*pDeletePtrn)) != eHAL_STATUS_SUCCESS)
+ {
+ pmmLog(pMac, LOGP, FL("Fail to allocate memory for WoWLAN Delete Bcast Pattern \n"));
+ return;
+ }
+ (void) palCopyMemory(pMac->hHdd, pDeletePtrn, pMbMsg->data, sizeof(*pDeletePtrn));
+
+ if (NULL == pDeletePtrn)
+ {
+ pmmLog(pMac, LOGE, FL("Delete broadcast pattern message is NULL \n"));
+ return;
+ }
+
+ msgQ.type = WDA_WOWL_DEL_BCAST_PTRN;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pDeletePtrn;
+ msgQ.bodyval = 0;
+
+ pmmLog(pMac, LOG1, FL( "Sending WDA_WOWL_DEL_BCAST_PTRN"));
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_WOWL_DEL_BCAST_PTRN_EVENT, NULL, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ {
+ if (NULL != pDeletePtrn)
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pDeletePtrn);
+ pmmLog( pMac, LOGP, FL("Posting WDA_WOWL_DEL_BCAST_PTRN failed, reason=%X"), retCode );
+ }
+ return;
+}
+
+/** ---------------------------------------------------------
+\fn pmmEnterWowlRequestHandler
+\brief LIM process the eWNI_PMC_ENTER_WOWL_REQ message, and
+\ invokes pmmSendWowlEnterRequest() to send
+\ WDA_WOWL_ENTER_REQ message to HAL.
+\param tpAniSirGlobal pMac
+\param tpSirMsgQ pMsg
+\return None
+ ------------------------------------------------------------*/
+void pmmEnterWowlRequestHandler(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
+{
+ tpSirSmeWowlEnterParams pSmeWowlParams = NULL;
+ tpSirHalWowlEnterParams pHalWowlParams = NULL;
+ tSirRetStatus retCode = eSIR_SUCCESS;
+ tANI_U32 cfgValue = 0;
+ tSirMbMsg *pMbMsg = (tSirMbMsg *)pMsg->bodyptr;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_ENTER_WOWL_REQ_EVENT, NULL, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ pSmeWowlParams = (tpSirSmeWowlEnterParams)(pMbMsg->data);
+
+ if (NULL == pSmeWowlParams)
+ return;
+// Need to fix it ASAP - TBH
+#if 0
+ if (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE)
+ {
+ pmmLog(pMac, LOGE, FL("Rcvd PMC_ENTER_WOWL_REQ when station is not associated \n"));
+ limSendSmeRsp(pMac, eWNI_PMC_ENTER_WOWL_RSP, eSIR_SME_STA_NOT_ASSOCIATED, 0, 0);
+ goto end;
+ }
+#endif
+
+
+ if ((pMac->pmm.gPmmState != ePMM_STATE_BMPS_SLEEP) && (pMac->pmm.gPmmState != ePMM_STATE_WOWLAN))
+ {
+ pmmLog(pMac, LOGE, FL("Rcvd PMC_ENTER_WOWL_REQ in invalid Power Save state \n"));
+ limSendSmeRsp(pMac, eWNI_PMC_ENTER_WOWL_RSP, eSIR_SME_INVALID_PMM_STATE, 0, 0);
+ goto end;
+ }
+
+ if (palAllocateMemory(pMac->hHdd, (void **)&pHalWowlParams, sizeof(*pHalWowlParams)) != eHAL_STATUS_SUCCESS)
+ {
+ pmmLog(pMac, LOGP, FL("Fail to allocate memory for Enter Wowl Request \n"));
+ goto end;
+ }
+ (void) palZeroMemory(pMac->hHdd, (tANI_U8 *)pHalWowlParams, sizeof(*pHalWowlParams) );
+
+ // fill in the message field
+ pHalWowlParams->ucMagicPktEnable = pSmeWowlParams->ucMagicPktEnable;
+ pHalWowlParams->ucPatternFilteringEnable = pSmeWowlParams->ucPatternFilteringEnable;
+ (void)palCopyMemory( pMac->hHdd, (tANI_U8 *)pHalWowlParams->magicPtrn, (tANI_U8 *)pSmeWowlParams->magicPtrn, sizeof(tSirMacAddr) );
+
+#ifdef WLAN_WAKEUP_EVENTS
+ pHalWowlParams->ucWoWEAPIDRequestEnable = pSmeWowlParams->ucWoWEAPIDRequestEnable;
+ pHalWowlParams->ucWoWEAPOL4WayEnable = pSmeWowlParams->ucWoWEAPOL4WayEnable;
+ pHalWowlParams->ucWowNetScanOffloadMatch = pSmeWowlParams->ucWowNetScanOffloadMatch;
+ pHalWowlParams->ucWowGTKRekeyError = pSmeWowlParams->ucWowGTKRekeyError;
+ pHalWowlParams->ucWoWBSSConnLoss = pSmeWowlParams->ucWoWBSSConnLoss;
+#endif // WLAN_WAKEUP_EVENTS
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE, &cfgValue) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("cfgGet failed for WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE"));
+ goto end;
+ }
+ pHalWowlParams->ucUcastPatternFilteringEnable = (tANI_U8)cfgValue;
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE, &cfgValue) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("cfgGet failed for WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE"));
+ goto end;
+ }
+ pHalWowlParams->ucWowChnlSwitchRcv = (tANI_U8)cfgValue;
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_WOWLAN_DEAUTH_ENABLE, &cfgValue) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("cfgGet failed for WNI_CFG_WOWLAN_DEAUTH_ENABLE \n"));
+ goto end;
+ }
+ pHalWowlParams->ucWowDeauthRcv = (tANI_U8)cfgValue;
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_WOWLAN_DISASSOC_ENABLE, &cfgValue) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("cfgGet failed for WNI_CFG_WOWLAN_DEAUTH_ENABLE \n"));
+ goto end;
+ }
+ pHalWowlParams->ucWowDisassocRcv = (tANI_U8)cfgValue;
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_WOWLAN_MAX_MISSED_BEACON, &cfgValue) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("cfgGet failed for WNI_CFG_WOWLAN_MAX_MISSED_BEACON \n"));
+ goto end;
+ }
+ pHalWowlParams->ucWowMaxMissedBeacons = (tANI_U8)cfgValue;
+
+ if(wlan_cfgGetInt(pMac, WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD, &cfgValue) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("cfgGet failed for WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD \n"));
+ goto end;
+ }
+ pHalWowlParams->ucWowMaxSleepUsec = (tANI_U8)cfgValue;
+
+ //Send message to HAL
+ if( eSIR_SUCCESS != (retCode = pmmSendWowlEnterRequest( pMac, pHalWowlParams)))
+ {
+ pmmLog(pMac, LOGE, FL("Send ENTER_WOWL_REQ to HAL failed, reasonCode %d \n"), retCode);
+ limSendSmeRsp(pMac, eWNI_PMC_ENTER_WOWL_RSP, eSIR_SME_WOWL_ENTER_REQ_FAILED, 0, 0);
+ goto end;
+ }
+ return;
+
+end:
+ if (pHalWowlParams != NULL)
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pHalWowlParams);
+ return;
+}
+
+
+/** ------------------------------------------------------------
+\fn pmmSendWowlEnterRequest
+\brief LIM sends a WDA_WOWL_ENTER_REQ message to HAL with
+\ the message structure pHalWowlParams. HAL shall later
+\ send a WDA_WOWL_ENTER_RSP with the same pointer
+\ to the message structure back to PMM.
+\param tpAniSirGlobal pMac
+\param tpSirHalWowlEnterParams pHalWowlParams
+\return tSirRetStatus
+ --------------------------------------------------------------*/
+tSirRetStatus pmmSendWowlEnterRequest(tpAniSirGlobal pMac, tpSirHalWowlEnterParams pHalWowlParams)
+{
+ tSirRetStatus retCode = eSIR_SUCCESS;
+ tSirMsgQ msgQ;
+
+ if (NULL == pHalWowlParams)
+ return eSIR_FAILURE;
+
+ msgQ.type = WDA_WOWL_ENTER_REQ;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pHalWowlParams;
+ msgQ.bodyval = 0;
+
+ /* Defer any incoming message until we get
+ * a WDA_WOWL_ENTER_RSP from HAL
+ */
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+
+ retCode = wdaPostCtrlMsg(pMac, &msgQ);
+ if( eSIR_SUCCESS != retCode )
+ {
+ pmmLog( pMac, LOGE, FL("Posting WDA_WOWL_ENTER_REQ failed, reason=%X"), retCode );
+ return retCode;
+ }
+ return retCode;
+}
+
+/** ---------------------------------------------------------
+\fn pmmEnterWowlanResponseHandler
+\brief LIM process the WDA_WOWL_ENTER_RSP message.
+\ and sends eWNI_PMC_ENTER_WOWL_RSP to SME.
+\param tpAniSirGlobal pMac
+\param tpSirMsgQ limMsg
+\return None
+ ------------------------------------------------------------*/
+void pmmEnterWowlanResponseHandler(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
+{
+ tpSirHalWowlEnterParams pHalWowlMsg;
+ eHalStatus rspStatus;
+ tSirResultCodes smeRspCode = eSIR_SME_SUCCESS;
+
+ /* we need to process all the deferred messages enqueued
+ * since the initiating the WDA_WOWL_ENTER_REQ.
+ */
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+
+ pHalWowlMsg = (tpSirHalWowlEnterParams)(limMsg->bodyptr);
+ if (NULL == pHalWowlMsg)
+ {
+ pmmLog(pMac, LOGE, FL("Recvd WDA_WOWL_ENTER_RSP with NULL msg "));
+ smeRspCode = eSIR_SME_WOWL_ENTER_REQ_FAILED;
+ }
+ else
+ {
+ rspStatus = pHalWowlMsg->status;
+ if(rspStatus == eHAL_STATUS_SUCCESS)
+ {
+ pmmLog(pMac, LOGW, FL("Rcv successful response from HAL to enter WOWLAN \n"));
+ pMac->pmm.gPmmState = ePMM_STATE_WOWLAN;
+ }
+ else
+ {
+ pmmLog(pMac, LOGE, FL("HAL enter WOWLAN failed, informing SME\n"));
+ smeRspCode = eSIR_SME_WOWL_ENTER_REQ_FAILED;
+ }
+ }
+
+ limSendSmeRsp(pMac, eWNI_PMC_ENTER_WOWL_RSP, smeRspCode, 0, 0);
+ return;
+}
+
+/** ---------------------------------------------------------
+\fn pmmExitWowlanRequestHandler
+\brief PE process the eWNI_PMC_EXIT_WOWL_REQ message.
+\ and sends WDA_WOWL_EXIT_REQ to HAL.
+\param tpAniSirGlobal pMac
+\return None
+ ------------------------------------------------------------*/
+void pmmExitWowlanRequestHandler(tpAniSirGlobal pMac)
+{
+ tSirRetStatus retStatus = eSIR_SUCCESS;
+ tSirResultCodes smeRspCode = eSIR_SME_SUCCESS;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+ limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_WOWL_REQ_EVENT, NULL, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ if ( pMac->pmm.gPmmState != ePMM_STATE_WOWLAN )
+ {
+ pmmLog(pMac, LOGE,
+ FL("Exit WOWLAN Request received in invalid state PMM=%d \n"),
+ pMac->pmm.gPmmState);
+ smeRspCode = eSIR_SME_INVALID_PMM_STATE;
+ goto failure;
+ }
+
+ if((retStatus = pmmSendExitWowlReq(pMac)) != eSIR_SUCCESS)
+ {
+ pmmLog(pMac, LOGE,
+ FL("Fail to send WDA_WOWL_EXIT_REQ, reason code %d\n"),
+ retStatus);
+ smeRspCode = eSIR_SME_WOWL_EXIT_REQ_FAILED;
+ goto failure;
+ }
+ return;
+
+failure:
+ limSendSmeRsp(pMac, eWNI_PMC_EXIT_WOWL_RSP, smeRspCode, 0, 0);
+ return;
+}
+
+/** ---------------------------------------------------------
+\fn pmmSendExitWowlReq
+\brief This function sends the WDA_WOWL_EXIT_REQ
+\ message to HAL.
+\param tpAniSirGlobal pMac
+\return None
+ ------------------------------------------------------------*/
+tSirRetStatus pmmSendExitWowlReq(tpAniSirGlobal pMac)
+{
+ tSirRetStatus retCode = eSIR_SUCCESS;
+ tSirMsgQ msgQ;
+
+ msgQ.type = WDA_WOWL_EXIT_REQ;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = 0;
+ msgQ.bodyval = 0;
+
+ pmmLog(pMac, LOGW, FL("Sending WDA_WOWL_EXIT_REQ"));
+
+ /* we need to defer any incoming messages until
+ * we get a WDA_WOWL_EXIT_RSP from HAL.
+ */
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ pmmLog( pMac, LOGE,
+ FL("Posting WDA_WOWL_EXIT_REQ failed, reason=%X\n"),
+ retCode );
+
+ return retCode;
+}
+
+/** ---------------------------------------------------------
+\fn pmmExitWowlanResponseHandler
+\brief This function process the WDA_WOWL_EXIT_RSP message.
+\ and sends back eWNI_PMC_EXIT_WOWL_RSP to SME.
+\param tpAniSirGlobal pMac
+\return None
+ ------------------------------------------------------------*/
+void pmmExitWowlanResponseHandler(tpAniSirGlobal pMac, eHalStatus rspStatus)
+{
+ /* we need to process all the deferred messages enqueued
+ * since the initiating the WDA_WOWL_EXIT_REQ.
+ */
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+
+ // restore PMM state to BMPS mode
+ pMac->pmm.gPmmState = ePMM_STATE_BMPS_SLEEP;
+
+ if(rspStatus == eHAL_STATUS_SUCCESS)
+ {
+ pmmLog(pMac, LOGW, FL("Rcvd successful rsp from HAL to exit WOWLAN \n"));
+ limSendSmeRsp(pMac, eWNI_PMC_EXIT_WOWL_RSP, eSIR_SME_SUCCESS, 0, 0);
+ }
+ else
+ {
+ pmmLog(pMac, LOGE, FL("Rcvd failure rsp from HAL to exit WOWLAN \n"));
+ limSendSmeRsp(pMac, eWNI_PMC_EXIT_WOWL_RSP, eSIR_SME_WOWL_EXIT_REQ_FAILED, 0, 0);
+ }
+ return;
+}
+
+
+// --------------------------------------------------------------------
+/**
+ * pmmImpsSendChangePwrSaveMsg
+ *
+ * FUNCTION:
+ * This function is called to toggle the Idle mode power save mode
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None
+ *
+ * NOTE:
+ *
+ * @param Global handle to MAC
+ * @param mode to be configured
+ * @return None
+ */
+
+tSirRetStatus pmmImpsSendChangePwrSaveMsg(tpAniSirGlobal pMac, tANI_U8 mode)
+{
+ tSirRetStatus retStatus = eSIR_SUCCESS;
+ tSirMsgQ msgQ;
+
+ if (SIR_PM_SLEEP_MODE == mode)
+ {
+ msgQ.type = WDA_ENTER_IMPS_REQ;
+ PELOGW(pmmLog (pMac, LOGW, FL("Sending WDA_ENTER_IMPS_REQ to HAL\n"));)
+ }
+ else
+ {
+ msgQ.type = WDA_EXIT_IMPS_REQ;
+ PELOGW(pmmLog (pMac, LOGW, FL("Sending WDA_EXIT_IMPS_REQ to HAL\n"));)
+ }
+
+ msgQ.reserved = 0;
+ msgQ.bodyptr = NULL;
+ msgQ.bodyval = 0;
+
+ /* we need to defer any incoming messages until we get a
+ * WDA_ENTER_IMPS_REQ or WDA_EXIT_IMPS_RSP from HAL.
+ */
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ retStatus = wdaPostCtrlMsg(pMac, &msgQ);
+ if ( eSIR_SUCCESS != retStatus )
+ {
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("WDA_ENTER/EXIT_IMPS_REQ to HAL failed, reason=%X\n"), retStatus);)
+ }
+
+ return retStatus;
+}
+
+// --------------------------------------------------------------------
+/**
+ * pmmUapsdSendChangePwrSaveMsg
+ *
+ * FUNCTION:
+ * This function is called to send either WDA_ENTER_UAPSD_REQ
+ * or WDA_EXIT_UAPSD_REQ to HAL.
+ *
+ * NOTE:
+ *
+ * @param pMac Global handle to MAC
+ * @param mode mode to be configured
+ * @return tSirRetStatus
+ */
+tSirRetStatus pmmUapsdSendChangePwrSaveMsg (tpAniSirGlobal pMac, tANI_U8 mode)
+{
+ tSirRetStatus retStatus = eSIR_SUCCESS;
+ tpUapsdParams pUapsdParams = NULL;
+ tANI_U8 uapsdDeliveryMask = 0;
+ tANI_U8 uapsdTriggerMask = 0;
+ tSirMsgQ msgQ;
+
+ if (SIR_PM_SLEEP_MODE == mode)
+ {
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pUapsdParams, sizeof(tUapsdParams)) )
+ {
+ PELOGW(pmmLog(pMac, LOGW, FL("pmmUapsd :palAllocateMemory() failed\n"));)
+ retStatus = eSIR_MEM_ALLOC_FAILED;
+ return retStatus;
+ }
+ palZeroMemory( pMac->hHdd, (tANI_U8 *)pUapsdParams, sizeof(tUapsdParams));
+ msgQ.type = WDA_ENTER_UAPSD_REQ;
+ msgQ.bodyptr = pUapsdParams;
+
+ uapsdDeliveryMask = (pMac->lim.gUapsdPerAcBitmask | pMac->lim.gUapsdPerAcDeliveryEnableMask);
+ uapsdTriggerMask = (pMac->lim.gUapsdPerAcBitmask | pMac->lim.gUapsdPerAcTriggerEnableMask);
+
+ pUapsdParams->bkDeliveryEnabled = LIM_UAPSD_GET(ACBK, uapsdDeliveryMask);
+ pUapsdParams->beDeliveryEnabled = LIM_UAPSD_GET(ACBE, uapsdDeliveryMask);
+ pUapsdParams->viDeliveryEnabled = LIM_UAPSD_GET(ACVI, uapsdDeliveryMask);
+ pUapsdParams->voDeliveryEnabled = LIM_UAPSD_GET(ACVO, uapsdDeliveryMask);
+ pUapsdParams->bkTriggerEnabled = LIM_UAPSD_GET(ACBK, uapsdTriggerMask);
+ pUapsdParams->beTriggerEnabled = LIM_UAPSD_GET(ACBE, uapsdTriggerMask);
+ pUapsdParams->viTriggerEnabled = LIM_UAPSD_GET(ACVI, uapsdTriggerMask);
+ pUapsdParams->voTriggerEnabled = LIM_UAPSD_GET(ACVO, uapsdTriggerMask);
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("UAPSD Mask: static = 0x%x, DeliveryEnabled = 0x%x, TriggerEnabled = 0x%x \n"),
+ pMac->lim.gUapsdPerAcBitmask,
+ pMac->lim.gUapsdPerAcDeliveryEnableMask,
+ pMac->lim.gUapsdPerAcTriggerEnableMask);)
+
+ PELOG1(pmmLog(pMac, LOG1, FL("Delivery Enabled: BK=%d, BE=%d, Vi=%d, Vo=%d \n"),
+ pUapsdParams->bkDeliveryEnabled,
+ pUapsdParams->beDeliveryEnabled,
+ pUapsdParams->viDeliveryEnabled,
+ pUapsdParams->voDeliveryEnabled);)
+
+ PELOG1(pmmLog(pMac, LOG1, FL("Trigger Enabled: BK=%d, BE=%d, Vi=%d, Vo=%d \n"),
+ pUapsdParams->bkTriggerEnabled,
+ pUapsdParams->beTriggerEnabled,
+ pUapsdParams->viTriggerEnabled,
+ pUapsdParams->voTriggerEnabled);)
+
+ PELOGW(pmmLog (pMac, LOGW, FL("pmmUapsd: Sending WDA_ENTER_UAPSD_REQ to HAL\n"));)
+ }
+ else
+ {
+ msgQ.type = WDA_EXIT_UAPSD_REQ;
+ msgQ.bodyptr = NULL;
+ PELOGW(pmmLog (pMac, LOGW, FL("pmmUapsd: Sending WDA_EXIT_UAPSD_REQ to HAL\n"));)
+ }
+
+ /* we need to defer any incoming messages until we get a
+ * WDA_ENTER/EXIT_UAPSD_RSP from HAL.
+ */
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+
+ msgQ.reserved = 0;
+ msgQ.bodyval = 0;
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ retStatus = wdaPostCtrlMsg(pMac, &msgQ);
+ if ( eSIR_SUCCESS != retStatus )
+ {
+ PELOGE(pmmLog(pMac, LOGE,
+ FL("pmmUapsd: WDA_ENTER/EXIT_UAPSD_REQ to HAL failed, reason=%X\n"),
+ retStatus);)
+ if (SIR_PM_SLEEP_MODE == mode)
+ palFreeMemory(pMac->hHdd, (tANI_U8*)pUapsdParams);
+ }
+
+ return retStatus;
+}
+
+
+// --------------------------------------------------------------------
+/**
+ * pmmUpdateImpsPwrSaveStats
+ *
+ * FUNCTION:
+ * This function is called to update the power save statistics in MAC
+ * for Idle mode power save
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None
+ *
+ * NOTE:
+ *
+ * @param Global handle to MAC
+ * @return None
+ */
+
+void pmmImpsUpdatePwrSaveStats(tpAniSirGlobal pMac)
+{
+/*
+ tANI_U64 TimeAwake = 0;
+
+ pMac->pmm.ImpsSleepTimeStamp = vos_timer_get_system_ticks();
+
+ if (pMac->pmm.ImpsWakeupTimeStamp)
+ {
+ TimeAwake = (pMac->pmm.ImpsSleepTimeStamp - pMac->pmm.ImpsWakeupTimeStamp) / 10 ;
+ }
+ else
+ {
+ TimeAwake = 0;
+ }
+
+ if (TimeAwake > pMac->pmm.ImpsMaxTimeAwake)
+ {
+ pMac->pmm.ImpsMaxTimeAwake = TimeAwake;
+ }
+
+ if ((!pMac->pmm.ImpsMinTimeAwake) || (TimeAwake < pMac->pmm.ImpsMinTimeAwake))
+ {
+ pMac->pmm.ImpsMinTimeAwake = TimeAwake;
+ }
+
+ pMac->pmm.ImpsAvgTimeAwake = ((pMac->pmm.ImpsAvgTimeAwake * pMac->pmm.ImpsCntSleep) + TimeAwake) / (pMac->pmm.ImpsCntSleep + 1);
+
+ (pMac->pmm.ImpsCntSleep)++;
+
+ return;
+*/
+}
+
+
+// --------------------------------------------------------------------
+/**
+ * pmmImpsUpdateWakeupStats
+ *
+ * FUNCTION:
+ * This function is called to update the Wake up statistics in MAC
+ * for Idle mode power save
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None
+ *
+ * NOTE:
+ *
+ * @param Global handle to MAC
+ * @return None
+ */
+
+void pmmImpsUpdateWakeupStats (tpAniSirGlobal pMac)
+{
+/*
+ tANI_U64 SleepTime = 0;
+
+ pMac->pmm.ImpsWakeupTimeStamp = vos_timer_get_system_ticks();
+
+ SleepTime = (pMac->pmm.ImpsWakeupTimeStamp - pMac->pmm.ImpsSleepTimeStamp) / 10;
+
+ if (SleepTime > pMac->pmm.ImpsMaxSleepTime)
+ {
+ pMac->pmm.ImpsMaxSleepTime = SleepTime;
+ }
+
+ if ((!pMac->pmm.ImpsMinSleepTime) || (SleepTime < pMac->pmm.ImpsMinSleepTime))
+ {
+ pMac->pmm.ImpsMinSleepTime = SleepTime;
+ }
+
+ pMac->pmm.ImpsAvgSleepTime = ( ( (pMac->pmm.ImpsAvgSleepTime * pMac->pmm.ImpsCntAwake) + SleepTime) / (pMac->pmm.ImpsCntAwake + 1));
+
+ (pMac->pmm.ImpsCntAwake)++;
+
+ return;
+*/
+}
+
+// Collects number of times error occurred while going to sleep mode
+void pmmImpsUpdateSleepErrStats(tpAniSirGlobal pMac,
+ tSirRetStatus retStatus)
+{
+ pMac->pmm.ImpsSleepErrCnt++;
+ pMac->pmm.ImpsLastErr = retStatus;
+ return;
+}
+
+// Collects number of times error occurred while waking up from sleep mode
+void pmmImpsUpdateWakeupErrStats(tpAniSirGlobal pMac,
+ tSirRetStatus retStatus)
+{
+ pMac->pmm.ImpsWakeupErrCnt++;
+ pMac->pmm.ImpsLastErr = retStatus;
+ return;
+}
+
+
+// Collects number of times the system has received request or
+// response in an invalid state
+void pmmImpsUpdateErrStateStats(tpAniSirGlobal pMac)
+{
+ pMac->pmm.ImpsInvalidStateCnt++;
+ return;
+}
+
+// Collects number of packets dropped while in IMPS mode
+void pmmImpsUpdatePktDropStats(tpAniSirGlobal pMac)
+{
+
+ pMac->pmm.ImpsPktDrpInSleepMode++;
+ return;
+}
+
+// Collects number of packets dropped while in BMPS mode
+void pmmBmpsUpdatePktDropStats(tpAniSirGlobal pMac)
+{
+
+ pMac->pmm.BmpsPktDrpInSleepMode++;
+ return;
+}
+
+// Collects statistics for number of times BMPS init failed
+void pmmBmpsUpdateInitFailureCnt(tpAniSirGlobal pMac)
+{
+
+ pMac->pmm.BmpsInitFailCnt++;
+ return;
+}
+
+// Collects statistics for number of times sleep request failed
+void pmmBmpsUpdateSleepReqFailureCnt(tpAniSirGlobal pMac)
+{
+
+ pMac->pmm.BmpsSleeReqFailCnt++;
+ return;
+}
+
+// Collects statistics for number of times Wakeup request failed
+void pmmBmpsUpdateWakeupReqFailureCnt(tpAniSirGlobal pMac)
+{
+
+ pMac->pmm.BmpsWakeupReqFailCnt++;
+ return;
+}
+
+// Collects statistics for number of times request / response received in invalid state
+void pmmBmpsUpdateInvalidStateCnt(tpAniSirGlobal pMac)
+{
+
+ pMac->pmm.BmpsInvStateCnt++;
+ return;
+}
+
+// Collects statistics for number of times wakeup indications received
+void pmmBmpsUpdateWakeupIndCnt(tpAniSirGlobal pMac)
+{
+ pMac->pmm.BmpsWakeupIndCnt++;
+ return;
+}
+
+// Collects statistics for number of times wakeup indications received
+void pmmBmpsUpdateHalReqFailureCnt(tpAniSirGlobal pMac)
+{
+ pMac->pmm.BmpsHalReqFailCnt++;
+ return;
+}
+
+// Collects statistics for number of times requests received from HDD in
+// invalid device role
+void pmmBmpsUpdateReqInInvalidRoleCnt(tpAniSirGlobal pMac)
+{
+ pMac->pmm.BmpsReqInInvalidRoleCnt++;
+ return;
+}
+
+#if 0
+// Update the sleep statistics
+void pmmUpdateDroppedPktStats(tpAniSirGlobal pMac)
+{
+ switch (pMac->pmm.gPmmState)
+ {
+ case ePMM_STATE_BMPS_SLEEP:
+ pmmBmpsUpdatePktDropStats(pMac);
+ break;
+
+ case ePMM_STATE_IMPS_SLEEP:
+ pmmImpsUpdatePktDropStats(pMac);
+ break;
+
+ default:
+ break;
+ }
+ return;
+
+}
+#endif
+
+// Resets PMM state ePMM_STATE_READY
+void pmmResetPmmState(tpAniSirGlobal pMac)
+{
+ pMac->pmm.gPmmState = ePMM_STATE_READY;
+
+ pMac->pmm.inMissedBeaconScenario = FALSE;
+ return;
+}
+
+/* Sends Background scan message back to Lim */
+void pmmSendMessageToLim(tpAniSirGlobal pMac,
+ tANI_U32 msgId)
+{
+ tSirMsgQ limMsg;
+ tANI_U32 statusCode;
+
+ limMsg.type = (tANI_U16) msgId;
+ limMsg.bodyptr = NULL;
+ limMsg.bodyval = 0;
+
+ if ((statusCode = limPostMsgApi(pMac, &limMsg)) != eSIR_SUCCESS)
+ {
+ PELOGW(pmmLog(pMac, LOGW,
+ FL("posting message %X to LIM failed, reason=%d\n"),
+ limMsg.type, statusCode);)
+ }
+}
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+void pmmFilterMatchCountResponseHandler(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
+{
+ tpSirRcvFltPktMatchRsp pRcvFltPktMatchCntRsp;
+ eHalStatus rspStatus;
+ tSirResultCodes smeRspCode = eSIR_SME_SUCCESS;
+
+ /* we need to process all the deferred messages enqueued
+ * since the initiating the WDA_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ.
+ */
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+
+ pRcvFltPktMatchCntRsp = (tpSirRcvFltPktMatchRsp)(limMsg->bodyptr);
+ if (NULL == pRcvFltPktMatchCntRsp)
+ {
+ pmmLog(pMac, LOGE, FL("Received "
+ "WDA_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP with NULL msg "));
+ smeRspCode = eSIR_SME_PC_FILTER_MATCH_COUNT_REQ_FAILED;
+ }
+ else
+ {
+ rspStatus = pRcvFltPktMatchCntRsp->status;
+ if (eHAL_STATUS_SUCCESS == rspStatus)
+ {
+ pmmLog(pMac, LOGE, FL("Rcv successful response from HAL to get "
+ "Packet Coalescing Filter Match Count\n"));
+ }
+ else
+ {
+ pmmLog(pMac, LOGE, FL("HAL failed to get Packet Coalescing "
+ "Filter Match Count, informing SME\n"));
+ smeRspCode = eSIR_SME_PC_FILTER_MATCH_COUNT_REQ_FAILED;
+ }
+ }
+
+ limSendSmeRsp(pMac, eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP,
+ smeRspCode, 0, 0);
+ return;
+}
+#endif // WLAN_FEATURE_PACKET_FILTERING
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+void pmmGTKOffloadGetInfoResponseHandler(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
+{
+ tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRspParams;
+ eHalStatus rspStatus;
+ tSirResultCodes smeRspCode = eSIR_SME_SUCCESS;
+
+ /* we need to process all the deferred messages enqueued
+ * since the initiating the WDA_GTK_OFFLOAD_GETINFO_REQ.
+ */
+ SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+
+ pGtkOffloadGetInfoRspParams = (tpSirGtkOffloadGetInfoRspParams)(limMsg->bodyptr);
+ if (NULL == pGtkOffloadGetInfoRspParams)
+ {
+ pmmLog(pMac, LOGE, FL("Received WDA_GTK_OFFLOAD_GETINFO_RSP with NULL msg "));
+ smeRspCode = eSIR_SME_GTK_OFFLOAD_GETINFO_REQ_FAILED;
+ }
+ else
+ {
+ rspStatus = pGtkOffloadGetInfoRspParams->ulStatus;
+ if(rspStatus == eHAL_STATUS_SUCCESS)
+ {
+ pmmLog(pMac, LOGW, FL("Rcv successful response from HAL to get GTK Offload Information\n"));
+ }
+ else
+ {
+ pmmLog(pMac, LOGE, FL("HAL failed to get GTK Offload Information, informing SME\n"));
+ smeRspCode = eSIR_SME_GTK_OFFLOAD_GETINFO_REQ_FAILED;
+ }
+ }
+
+ limSendSmeRsp(pMac, eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP, smeRspCode, 0, 0);
+ return;
+}
+#endif // WLAN_FEATURE_GTK_OFFLOAD
diff --git a/CORE/MAC/src/pe/pmm/pmmDebug.c b/CORE/MAC/src/pe/pmm/pmmDebug.c
new file mode 100644
index 0000000..5169eb5
--- /dev/null
+++ b/CORE/MAC/src/pe/pmm/pmmDebug.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**=========================================================================
+
+ \file pmmDebug.c
+
+ \brief implementation for log Debug related APIs
+
+ \author Sunit Bhatia
+
+ Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
+
+ Qualcomm Confidential and Proprietary.
+
+ ========================================================================*/
+
+#include "pmmDebug.h"
+
+void pmmLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
+{
+#ifdef WLAN_DEBUG
+ // Verify against current log level
+ if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_PMM_MODULE_ID )] )
+ return;
+ else
+ {
+ va_list marker;
+
+ va_start( marker, pString ); /* Initialize variable arguments. */
+
+ logDebug(pMac, SIR_PMM_MODULE_ID, loglevel, pString, marker);
+
+ va_end( marker ); /* Reset variable arguments. */
+ }
+#endif
+}
diff --git a/CORE/MAC/src/pe/pmm/pmmDebug.h b/CORE/MAC/src/pe/pmm/pmmDebug.h
new file mode 100644
index 0000000..1f9be6a
--- /dev/null
+++ b/CORE/MAC/src/pe/pmm/pmmDebug.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * Author: Sandesh Goel
+ * Date: 02/25/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#ifndef __PMM_DEBUG_H__
+#define __PMM_DEBUG_H__
+
+#include "utilsApi.h"
+#include "sirDebug.h"
+
+#define UL_HI( field ) ( *( ( (ULONG *)(&(field)) ) + 1 ) )
+#define UL_LO( field ) ( *( ( (ULONG *)(&(field)) ) + 0 ) )
+
+
+void pmmLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...) ;
+
+#endif
+
diff --git a/CORE/MAC/src/pe/rrm/rrmApi.c b/CORE/MAC/src/pe/rrm/rrmApi.c
new file mode 100644
index 0000000..6363f17
--- /dev/null
+++ b/CORE/MAC/src/pe/rrm/rrmApi.c
@@ -0,0 +1,1245 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**=========================================================================
+
+ \file rrmApi.c
+
+ \brief implementation for PE RRM APIs
+
+ Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
+
+ Qualcomm Confidential and Proprietary.
+
+ ========================================================================*/
+
+/* $Header$ */
+
+#if defined WLAN_FEATURE_VOWIFI
+
+/*--------------------------------------------------------------------------
+ Include Files
+ ------------------------------------------------------------------------*/
+#include "palTypes.h"
+#include "wniApi.h"
+#include "sirApi.h"
+#include "aniGlobal.h"
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halDataStruct.h"
+#endif
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+#include "wniCfgAp.h"
+#else
+#include "wniCfgSta.h"
+#endif
+#include "limTypes.h"
+#include "limUtils.h"
+#include "limSendSmeRspMessages.h"
+#include "parserApi.h"
+#include "limSendMessages.h"
+#include "rrmGlobal.h"
+#include "rrmApi.h"
+
+
+// --------------------------------------------------------------------
+/**
+ * rrmCacheMgmtTxPower
+ **
+ * FUNCTION: Store Tx power for management frames.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pSessionEntry session entry.
+ * @return None
+ */
+void
+rrmCacheMgmtTxPower ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry )
+{
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, "Cache Mgmt Tx Power = %d\n", txPower );)
+#endif
+ if( pSessionEntry == NULL )
+ pMac->rrm.rrmPEContext.txMgmtPower = txPower;
+ else
+ pSessionEntry->txMgmtPower = txPower;
+}
+
+// --------------------------------------------------------------------
+/**
+ * rrmGetMgmtTxPower
+ *
+ * FUNCTION: Get the Tx power for management frames.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pSessionEntry session entry.
+ * @return txPower
+ */
+tPowerdBm
+rrmGetMgmtTxPower ( tpAniSirGlobal pMac, tpPESession pSessionEntry )
+{
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, "RrmGetMgmtTxPower called\n" );)
+#endif
+ if( pSessionEntry == NULL )
+ return pMac->rrm.rrmPEContext.txMgmtPower;
+
+ return pSessionEntry->txMgmtPower;
+}
+
+// --------------------------------------------------------------------
+/**
+ * rrmSendSetMaxTxPowerReq
+ *
+ * FUNCTION: Send WDA_SET_MAX_TX_POWER_REQ message to change the max tx power.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param txPower txPower to be set.
+ * @param pSessionEntry session entry.
+ * @return None
+ */
+tSirRetStatus
+rrmSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry )
+{
+ tpMaxTxPowerParams pMaxTxParams;
+ tSirRetStatus retCode = eSIR_SUCCESS;
+ tSirMsgQ msgQ;
+
+ if( pSessionEntry == NULL )
+ {
+ PELOGE(limLog(pMac, LOGE, FL(" Inavalid parameters\n"));)
+ return eSIR_FAILURE;
+ }
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pMaxTxParams, sizeof(tMaxTxPowerParams) ) )
+ {
+ limLog( pMac, LOGP, FL("Unable to allocate memory for pMaxTxParams \n") );
+ return eSIR_MEM_ALLOC_FAILED;
+
+ }
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, FL(" Allocated memory for pMaxTxParams...will be freed in other module\n") );)
+#endif
+ pMaxTxParams->power = txPower;
+ palCopyMemory( pMac->hHdd, pMaxTxParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
+ palCopyMemory( pMac->hHdd, pMaxTxParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
+
+
+ msgQ.type = WDA_SET_MAX_TX_POWER_REQ;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pMaxTxParams;
+ msgQ.bodyval = 0;
+
+ PELOGW(limLog(pMac, LOGW, FL( "Sending WDA_SET_MAX_TX_POWER_REQ to HAL"));)
+
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ {
+ limLog( pMac, LOGP, FL("Posting WDA_SET_MAX_TX_POWER_REQ to HAL failed, reason=%X"), retCode );
+ if (NULL != pMaxTxParams)
+ {
+ palFreeMemory( pMac->hHdd, (tANI_U8 *) pMaxTxParams );
+ }
+ return retCode;
+ }
+ return retCode;
+}
+
+
+// --------------------------------------------------------------------
+/**
+ * rrmSetMaxTxPowerRsp
+ *
+ * FUNCTION: Process WDA_SET_MAX_TX_POWER_RSP message.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param txPower txPower to be set.
+ * @param pSessionEntry session entry.
+ * @return None
+ */
+tSirRetStatus
+rrmSetMaxTxPowerRsp ( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
+{
+ tSirRetStatus retCode = eSIR_SUCCESS;
+ tpMaxTxPowerParams pMaxTxParams = (tpMaxTxPowerParams) limMsgQ->bodyptr;
+ tpPESession pSessionEntry;
+ tANI_U8 sessionId;
+
+ if((pSessionEntry = peFindSessionByBssid(pMac, pMaxTxParams->bssId, &sessionId))==NULL)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Unable to find session:\n") );)
+ retCode = eSIR_FAILURE;
+ }
+ else
+ {
+ rrmCacheMgmtTxPower ( pMac, pMaxTxParams->power, pSessionEntry );
+ }
+
+ palFreeMemory(pMac->hHdd, (void*)limMsgQ->bodyptr);
+ limMsgQ->bodyptr = NULL;
+ return retCode;
+}
+// --------------------------------------------------------------------
+/**
+ * rrmProcessLinkMeasurementRequest
+ *
+ * FUNCTION: Processes the Link measurement request and send the report.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pBd pointer to BD to extract RSSI and SNR
+ * @param pLinkReq pointer to the Link request frame structure.
+ * @param pSessionEntry session entry.
+ * @return None
+ */
+tSirRetStatus
+rrmProcessLinkMeasurementRequest( tpAniSirGlobal pMac,
+ tANI_U8 *pRxPacketInfo,
+ tDot11fLinkMeasurementRequest *pLinkReq,
+ tpPESession pSessionEntry )
+{
+ tSirMacLinkReport LinkReport;
+ tpSirMacMgmtHdr pHdr;
+ v_S7_t currentRSSI = 0;
+
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, "Received Link measurement request\n");)
+#endif
+ if( pRxPacketInfo == NULL || pLinkReq == NULL || pSessionEntry == NULL )
+ {
+ PELOGE(limLog( pMac, LOGE, "%s:%d: Invalid parameters - Ignoring the request\n");)
+ return eSIR_FAILURE;
+ }
+ pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
+#if defined WLAN_VOWIFI_DEBUG
+ if( pSessionEntry->maxTxPower != (tPowerdBm) pLinkReq->MaxTxPower.maxTxPower )
+ {
+ PELOGE(limLog( pMac, LOGE, FL(" maxTx power in link request is not same as local...Local = %d LinkReq = %d\n"),
+ pSessionEntry->maxTxPower, pLinkReq->MaxTxPower.maxTxPower );)
+ }
+#endif
+
+ LinkReport.dialogToken = pLinkReq->DialogToken.token;
+ LinkReport.txPower = pSessionEntry->txMgmtPower;
+ LinkReport.rxAntenna = 0;
+ LinkReport.txAntenna = 0;
+ currentRSSI = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
+
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, "Received Link report frame with %d\n", currentRSSI);)
+#endif
+
+ // 2008 11k spec reference: 18.4.8.5 RCPI Measurement
+ if ((currentRSSI) <= RCPI_LOW_RSSI_VALUE)
+ LinkReport.rcpi = 0;
+ else if ((currentRSSI > RCPI_LOW_RSSI_VALUE) && (currentRSSI <= 0))
+ LinkReport.rcpi = CALCULATE_RCPI(currentRSSI);
+ else
+ LinkReport.rcpi = RCPI_MAX_VALUE;
+
+ LinkReport.rsni = WDA_GET_RX_SNR(pRxPacketInfo);
+
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, "Sending Link report frame\n");)
+#endif
+ return limSendLinkReportActionFrame( pMac, &LinkReport, pHdr->sa, pSessionEntry );
+
+
+}
+
+// --------------------------------------------------------------------
+/**
+ * rrmProcessNeighborReportResponse
+ *
+ * FUNCTION: Processes the Neighbor Report response from the peer AP.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pNeighborRep pointer to the Neighbor report frame structure.
+ * @param pSessionEntry session entry.
+ * @return None
+ */
+tSirRetStatus
+rrmProcessNeighborReportResponse( tpAniSirGlobal pMac,
+ tDot11fNeighborReportResponse *pNeighborRep,
+ tpPESession pSessionEntry )
+{
+ tSirRetStatus status = eSIR_FAILURE;
+ tpSirNeighborReportInd pSmeNeighborRpt = NULL;
+ tANI_U16 length;
+ tANI_U8 i;
+ tSirMsgQ mmhMsg;
+
+ if( pNeighborRep == NULL || pSessionEntry == NULL )
+ {
+ PELOGE(limLog( pMac, LOGE, FL(" Invalid parameters\n") );)
+ return status;
+ }
+
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, FL("Neighbor report response received \n") );)
+#endif
+
+ // Dialog token
+ if( pMac->rrm.rrmPEContext.DialogToken != pNeighborRep->DialogToken.token )
+ {
+ PELOGE(limLog( pMac, LOGE, "Dialog token mismatch in the received Neighbor report\n");)
+ return eSIR_FAILURE;
+ }
+ if( pNeighborRep->num_NeighborReport == 0 )
+ {
+ PELOGE(limLog( pMac, LOGE, "No neighbor report in the frame...Dropping it\n");)
+ return eSIR_FAILURE;
+ }
+ length = (sizeof( tSirNeighborReportInd )) +
+ (sizeof( tSirNeighborBssDescription ) * (pNeighborRep->num_NeighborReport - 1) ) ;
+
+ //Prepare the request to send to SME.
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pSmeNeighborRpt, length ) )
+ {
+ PELOGE(limLog( pMac, LOGP, FL("Unable to allocate memory\n") );)
+ return eSIR_MEM_ALLOC_FAILED;
+
+ }
+ palZeroMemory( pMac->hHdd, pSmeNeighborRpt, length );
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, FL(" Allocated memory for pSmeNeighborRpt...will be freed by other module\n") );)
+#endif
+
+ for( i = 0 ; i < pNeighborRep->num_NeighborReport ; i++ )
+ {
+ pSmeNeighborRpt->sNeighborBssDescription[i].length = sizeof( tSirNeighborBssDescription ); /*+ any optional ies */
+ palCopyMemory( pMac->hHdd, pSmeNeighborRpt->sNeighborBssDescription[i].bssId,
+ pNeighborRep->NeighborReport[i].bssid, sizeof(tSirMacAddr) );
+ pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fApPreauthReachable = pNeighborRep->NeighborReport[i].APReachability;
+ pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fSameSecurityMode = pNeighborRep->NeighborReport[i].Security;
+ pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fSameAuthenticator = pNeighborRep->NeighborReport[i].KeyScope;
+ pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fCapSpectrumMeasurement = pNeighborRep->NeighborReport[i].SpecMgmtCap;
+ pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fCapQos = pNeighborRep->NeighborReport[i].QosCap;
+ pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fCapApsd = pNeighborRep->NeighborReport[i].apsd;
+ pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fCapRadioMeasurement = pNeighborRep->NeighborReport[i].rrm;
+ pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fCapDelayedBlockAck = pNeighborRep->NeighborReport[i].DelayedBA;
+ pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fCapImmediateBlockAck = pNeighborRep->NeighborReport[i].ImmBA;
+ pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fMobilityDomain = pNeighborRep->NeighborReport[i].MobilityDomain;
+
+ pSmeNeighborRpt->sNeighborBssDescription[i].regClass = pNeighborRep->NeighborReport[i].regulatoryClass;
+ pSmeNeighborRpt->sNeighborBssDescription[i].channel = pNeighborRep->NeighborReport[i].channel;
+ pSmeNeighborRpt->sNeighborBssDescription[i].phyType = pNeighborRep->NeighborReport[i].PhyType;
+ }
+
+ pSmeNeighborRpt->messageType = eWNI_SME_NEIGHBOR_REPORT_IND;
+ pSmeNeighborRpt->length = length;
+ pSmeNeighborRpt->numNeighborReports = pNeighborRep->num_NeighborReport;
+ palCopyMemory( pMac->hHdd, pSmeNeighborRpt->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
+
+ //Send request to SME.
+ mmhMsg.type = pSmeNeighborRpt->messageType;
+ mmhMsg.bodyptr = pSmeNeighborRpt;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ status = limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+
+ return status;
+
+}
+
+// --------------------------------------------------------------------
+/**
+ * rrmProcessNeighborReportReq
+ *
+ * FUNCTION:
+ *
+ * LOGIC: Create a Neighbor report request and send it to peer.
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pNeighborReq Neighbor report request params .
+ * @return None
+ */
+tSirRetStatus
+rrmProcessNeighborReportReq( tpAniSirGlobal pMac,
+ tpSirNeighborReportReqInd pNeighborReq )
+{
+ tSirRetStatus status = eSIR_SUCCESS;
+ tSirMacNeighborReportReq NeighborReportReq;
+ tpPESession pSessionEntry ;
+ tANI_U8 sessionId;
+
+ if( pNeighborReq == NULL )
+ {
+ PELOGE(limLog( pMac, LOGE, "NeighborReq is NULL\n" );)
+ return eSIR_FAILURE;
+ }
+ if ((pSessionEntry = peFindSessionByBssid(pMac,pNeighborReq->bssId,&sessionId))==NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId\n"));)
+ return eSIR_FAILURE;
+ }
+
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, FL("Neighbor Request received \n") );)
+ PELOGE(limLog( pMac, LOGE, "SSID present = %d \n", pNeighborReq->noSSID );)
+#endif
+
+ palZeroMemory( pMac->hHdd, &NeighborReportReq, sizeof( tSirMacNeighborReportReq ) );
+
+ NeighborReportReq.dialogToken = ++pMac->rrm.rrmPEContext.DialogToken;
+ NeighborReportReq.ssid_present = !pNeighborReq->noSSID;
+ if( NeighborReportReq.ssid_present )
+ {
+ palCopyMemory( pMac->hHdd, &NeighborReportReq.ssid, &pNeighborReq->ucSSID, sizeof(tSirMacSSid) );
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOGE, (tANI_U8*) NeighborReportReq.ssid.ssId, NeighborReportReq.ssid.length );)
+#endif
+ }
+
+ status = limSendNeighborReportRequestFrame( pMac, &NeighborReportReq, pNeighborReq->bssId, pSessionEntry );
+
+ return status;
+}
+
+#define ABS(x) ((x < 0) ? -x : x)
+// --------------------------------------------------------------------
+/**
+ * rrmProcessBeaconReportReq
+ *
+ * FUNCTION: Processes the Beacon report request from the peer AP.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pCurrentReq pointer to the current Req comtext.
+ * @param pBeaconReq pointer to the beacon report request IE from the peer.
+ * @param pSessionEntry session entry.
+ * @return None
+ */
+static tRrmRetStatus
+rrmProcessBeaconReportReq( tpAniSirGlobal pMac,
+ tpRRMReq pCurrentReq,
+ tDot11fIEMeasurementRequest *pBeaconReq,
+ tpPESession pSessionEntry )
+{
+ tSirMsgQ mmhMsg;
+ tpSirBeaconReportReqInd pSmeBcnReportReq;
+ tANI_U8 num_channels = 0, num_APChanReport;
+ tANI_U16 measDuration, maxMeasduration;
+ tANI_S8 maxDuration;
+ tANI_U8 sign;
+
+ if( pBeaconReq->measurement_request.Beacon.BeaconReporting.present &&
+ (pBeaconReq->measurement_request.Beacon.BeaconReporting.reportingCondition != 0) )
+ {
+ //Repeated measurement is not supported. This means number of repetitions should be zero.(Already checked)
+ //All test case in VoWifi(as of version 0.36) use zero for number of repetitions.
+ //Beacon reporting should not be included in request if number of repetitons is zero.
+ // IEEE Std 802.11k-2008 Table 7-29g and section 11.10.8.1
+
+ PELOGE(limLog( pMac, LOGE, "Droping the request: Reporting condition included in beacon report request and it is not zero\n");)
+ return eRRM_INCAPABLE;
+ }
+
+ /* The logic here is to check the measurement duration passed in the beacon request. Following are the cases handled.
+ Case 1: If measurement duration received in the beacon request is greater than the max measurement duration advertised
+ in the RRM capabilities(Assoc Req), and Duration Mandatory bit is set to 1, REFUSE the beacon request
+ Case 2: If measurement duration received in the beacon request is greater than the max measurement duration advertised
+ in the RRM capabilities(Assoc Req), and Duration Mandatory bit is set to 0, perform measurement for
+ the duration advertised in the RRM capabilities
+
+ maxMeasurementDuration = 2^(nonOperatingChanMax - 4) * BeaconInterval
+ */
+ maxDuration = pMac->rrm.rrmPEContext.rrmEnabledCaps.nonOperatingChanMax - 4;
+ sign = (maxDuration < 0) ? 1 : 0;
+ maxDuration = (1L << ABS(maxDuration));
+ if (!sign)
+ maxMeasduration = maxDuration * pSessionEntry->beaconParams.beaconInterval;
+ else
+ maxMeasduration = pSessionEntry->beaconParams.beaconInterval / maxDuration;
+
+ measDuration = pBeaconReq->measurement_request.Beacon.meas_duration;
+
+#if defined WLAN_VOWIFI_DEBUG
+ limLog( pMac, LOGE, "maxDuration = %d sign = %d maxMeasduration = %d measDuration = %d\n",
+ maxDuration, sign, maxMeasduration, measDuration );
+#endif
+
+ if( maxMeasduration < measDuration )
+ {
+ if( pBeaconReq->durationMandatory )
+ {
+ limLog( pMac, LOGE, "Droping the request: duration mandatory and maxduration > measduration\n");
+ return eRRM_REFUSED;
+ }
+ else
+ measDuration = maxMeasduration;
+ }
+
+ //Cache the data required for sending report.
+ pCurrentReq->request.Beacon.reportingDetail = pBeaconReq->measurement_request.Beacon.BcnReportingDetail.present ?
+ pBeaconReq->measurement_request.Beacon.BcnReportingDetail.reportingDetail :
+ BEACON_REPORTING_DETAIL_ALL_FF_IE ;
+
+ if( pBeaconReq->measurement_request.Beacon.RequestedInfo.present )
+ {
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void**) &pCurrentReq->request.Beacon.reqIes.pElementIds,
+ ( sizeof( tANI_U8) *
+ pBeaconReq->measurement_request.Beacon.RequestedInfo.num_requested_eids ) ) )
+ {
+ limLog( pMac, LOGP,
+ FL( "Unable to PAL allocate memory for request IEs buffer\n" ));
+ return eRRM_FAILURE;
+ }
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, FL(" Allocated memory for pElementIds\n") );)
+#endif
+ pCurrentReq->request.Beacon.reqIes.num = pBeaconReq->measurement_request.Beacon.RequestedInfo.num_requested_eids;
+ palCopyMemory ( pMac->hHdd, pCurrentReq->request.Beacon.reqIes.pElementIds,
+ pBeaconReq->measurement_request.Beacon.RequestedInfo.requested_eids,
+ pCurrentReq->request.Beacon.reqIes.num );
+ }
+
+ if( pBeaconReq->measurement_request.Beacon.num_APChannelReport )
+ {
+ for( num_APChanReport = 0 ; num_APChanReport < pBeaconReq->measurement_request.Beacon.num_APChannelReport ; num_APChanReport++ )
+ num_channels += pBeaconReq->measurement_request.Beacon.APChannelReport[num_APChanReport].num_channelList;
+ }
+
+ //Prepare the request to send to SME.
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pSmeBcnReportReq,
+ (sizeof( tSirBeaconReportReqInd ) + num_channels) ) )
+ {
+ limLog( pMac, LOGP,
+ FL( "Unable to PAL allocate memory during Beacon Report Req Ind to SME\n" ));
+
+ return eRRM_FAILURE;
+
+ }
+
+ palZeroMemory( pMac->hHdd, pSmeBcnReportReq, sizeof( tSirBeaconReportReqInd ) + num_channels );
+
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, FL(" Allocated memory for pSmeBcnReportReq....will be freed by other module\n") );)
+#endif
+ palCopyMemory( pMac->hHdd, pSmeBcnReportReq->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
+ pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND;
+ pSmeBcnReportReq->length = sizeof( tSirBeaconReportReqInd ) + num_channels;
+ pSmeBcnReportReq->uDialogToken = pBeaconReq->measurement_token;
+ //pSmeBcnReportReq->measurementDuration = SYS_TU_TO_MS(pBeaconReq->measurement_request.Beacon.meas_duration);
+ pSmeBcnReportReq->measurementDuration = SYS_TU_TO_MS(measDuration /*pBeaconReq->measurement_request.Beacon.meas_duration*/);
+ pSmeBcnReportReq->randomizationInterval = SYS_TU_TO_MS (pBeaconReq->measurement_request.Beacon.randomization);
+ pSmeBcnReportReq->fMeasurementtype = pBeaconReq->measurement_request.Beacon.meas_mode;
+ pSmeBcnReportReq->channelInfo.regulatoryClass = pBeaconReq->measurement_request.Beacon.regClass;
+ pSmeBcnReportReq->channelInfo.channelNum = pBeaconReq->measurement_request.Beacon.channel;
+ palCopyMemory( pMac->hHdd, pSmeBcnReportReq->macaddrBssid, pBeaconReq->measurement_request.Beacon.BSSID, sizeof(tSirMacAddr) );
+
+ if( pBeaconReq->measurement_request.Beacon.SSID.present )
+ {
+ pSmeBcnReportReq->ssId.length = pBeaconReq->measurement_request.Beacon.SSID.num_ssid;
+ palCopyMemory( pMac->hHdd, pSmeBcnReportReq->ssId.ssId, pBeaconReq->measurement_request.Beacon.SSID.ssid,
+ pSmeBcnReportReq->ssId.length );
+ }
+
+ pCurrentReq->token = pBeaconReq->measurement_token;
+
+ pSmeBcnReportReq->channelList.numChannels = num_channels;
+ if( pBeaconReq->measurement_request.Beacon.num_APChannelReport )
+ {
+ tANI_U8 *pChanList = pSmeBcnReportReq->channelList.channelNumber;
+ for( num_APChanReport = 0 ; num_APChanReport < pBeaconReq->measurement_request.Beacon.num_APChannelReport ; num_APChanReport++ )
+ {
+ palCopyMemory( pMac->hHdd, pChanList,
+ pBeaconReq->measurement_request.Beacon.APChannelReport[num_APChanReport].channelList,
+ pBeaconReq->measurement_request.Beacon.APChannelReport[num_APChanReport].num_channelList );
+
+ pChanList += pBeaconReq->measurement_request.Beacon.APChannelReport[num_APChanReport].num_channelList;
+ }
+ }
+
+ //Send request to SME.
+ mmhMsg.type = eWNI_SME_BEACON_REPORT_REQ_IND;
+ mmhMsg.bodyptr = pSmeBcnReportReq;
+ MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+ return limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+}
+
+// --------------------------------------------------------------------
+/**
+ * rrmFillBeaconIes
+ *
+ * FUNCTION:
+ *
+ * LOGIC: Fills Fixed fields and Ies in bss description to an array of tANI_U8.
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pIes - pointer to the buffer that should be populated with ies.
+ * @param pNumIes - returns the num of ies filled in this param.
+ * @param pIesMaxSize - Max size of the buffer pIes.
+ * @param eids - pointer to array of eids. If NULL, all ies will be populated.
+ * @param numEids - number of elements in array eids.
+ * @param pBssDesc - pointer to Bss Description.
+ * @return None
+ */
+static void
+rrmFillBeaconIes( tpAniSirGlobal pMac,
+ tANI_U8 *pIes, tANI_U8 *pNumIes, tANI_U8 pIesMaxSize,
+ tANI_U8 *eids, tANI_U8 numEids,
+ tpSirBssDescription pBssDesc )
+{
+ tANI_U8 len, *pBcnIes, BcnNumIes, count = 0, i;
+
+ if( (pIes == NULL) || (pNumIes == NULL) || (pBssDesc == NULL) )
+ {
+ PELOGE(limLog( pMac, LOGE, FL(" Invalid parameters\n") );)
+ return;
+ }
+
+ //Make sure that if eid is null, numEids is set to zero.
+ numEids = (eids == NULL) ? 0 : numEids;
+
+ pBcnIes = (tANI_U8*) &pBssDesc->ieFields[0];
+ BcnNumIes = (tANI_U8)GET_IE_LEN_IN_BSS( pBssDesc->length );
+
+ *pNumIes = 0;
+
+ *((tANI_U32*)pIes) = pBssDesc->timeStamp[0];
+ *pNumIes+=sizeof(tANI_U32); pIes+=sizeof(tANI_U32);
+ *((tANI_U32*)pIes) = pBssDesc->timeStamp[1];
+ *pNumIes+=sizeof(tANI_U32); pIes+=sizeof(tANI_U32);
+ *((tANI_U16*)pIes) = pBssDesc->beaconInterval;
+ *pNumIes+=sizeof(tANI_U16); pIes+=sizeof(tANI_U16);
+ *((tANI_U16*)pIes) = pBssDesc->capabilityInfo;
+ *pNumIes+=sizeof(tANI_U16); pIes+=sizeof(tANI_U16);
+
+ while ( BcnNumIes > 0 )
+ {
+ len = *(pBcnIes + 1) + 2; //element id + length.
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, "EID = %d, len = %d total = %d\n", *pBcnIes, *(pBcnIes+1), len );)
+#endif
+
+ i = 0;
+ do
+ {
+ if( ( (eids == NULL) || ( *pBcnIes == eids[i] ) ) &&
+ ( (*pNumIes) + len) < pIesMaxSize )
+ {
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, "Adding Eid %d, len=%d\n", *pBcnIes, len );)
+#endif
+ palCopyMemory( pMac->hHdd, pIes, pBcnIes, len );
+ pIes += len;
+ *pNumIes += len;
+ count++;
+ break;
+ }
+ i++;
+ }while( i < numEids );
+
+ pBcnIes += len;
+ BcnNumIes -= len;
+ }
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, "Total length of Ies added = %d\n", *pNumIes );)
+#endif
+}
+
+// --------------------------------------------------------------------
+/**
+ * rrmProcessBeaconReportXmit
+ *
+ * FUNCTION:
+ *
+ * LOGIC: Create a Radio measurement report action frame and send it to peer.
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pBcnReport Data for beacon report IE from SME.
+ * @return None
+ */
+tSirRetStatus
+rrmProcessBeaconReportXmit( tpAniSirGlobal pMac,
+ tpSirBeaconReportXmitInd pBcnReport)
+{
+ tSirRetStatus status = eSIR_SUCCESS;
+ tSirMacRadioMeasureReport report, *pReport;
+ tpRRMReq pCurrentReq = pMac->rrm.rrmPEContext.pCurrentReq;
+ tpPESession pSessionEntry ;
+ tANI_U8 sessionId;
+
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, "Received beacon report xmit indication\n");)
+#endif
+ if(NULL == pBcnReport)
+ return eSIR_FAILURE;
+
+ if ( pCurrentReq == NULL )
+ {
+ PELOGE(limLog( pMac, LOGE, "Received report xmit while there is no request pending in PE\n");)
+ return eSIR_FAILURE;
+ }
+ if ((pSessionEntry = peFindSessionByBssid(pMac,pBcnReport->bssId,&sessionId))==NULL)
+ {
+ PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId\n"));)
+ return eSIR_FAILURE;
+ }
+
+ pReport = &report;
+ palZeroMemory( pMac->hHdd, pReport, sizeof(tSirMacRadioMeasureReport) );
+ //Prepare the beacon report and send it to the peer.
+ pReport->token = pBcnReport->uDialogToken;
+ pReport->refused = 0;
+ pReport->incapable = 0;
+ pReport->type = SIR_MAC_RRM_BEACON_TYPE;
+
+ //Valid response is included if the size of beacon xmit is == size of beacon xmit ind + ies
+ if ( pBcnReport->length > sizeof( tSirBeaconReportXmitInd ) )
+ {
+ pReport->report.beaconReport.regClass = pBcnReport->regClass;
+ pReport->report.beaconReport.channel = pBcnReport->pBssDescription[0]->channelId;
+ palCopyMemory( pMac->hHdd, pReport->report.beaconReport.measStartTime, pBcnReport->pBssDescription[0]->startTSF, sizeof( pBcnReport->pBssDescription[0]->startTSF) );
+ pReport->report.beaconReport.measDuration = SYS_MS_TO_TU(pBcnReport->duration);
+ pReport->report.beaconReport.phyType = pBcnReport->pBssDescription[0]->nwType; //TODO: check this.
+ pReport->report.beaconReport.bcnProbeRsp = 1;
+ pReport->report.beaconReport.rsni = pBcnReport->pBssDescription[0]->sinr;
+ pReport->report.beaconReport.rcpi = pBcnReport->pBssDescription[0]->rssi;
+
+ pReport->report.beaconReport.antennaId = 0;
+ pReport->report.beaconReport.parentTSF = pBcnReport->pBssDescription[0]->parentTSF;
+ palCopyMemory(pMac->hHdd, pReport->report.beaconReport.bssid, pBcnReport->pBssDescription[0]->bssId, sizeof(tSirMacAddr));
+
+ switch ( pCurrentReq->request.Beacon.reportingDetail )
+ {
+ case BEACON_REPORTING_DETAIL_NO_FF_IE: //0 No need to include any elements.
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog(pMac, LOGE, "No reporting detail requested\n");)
+#endif
+ break;
+ case BEACON_REPORTING_DETAIL_ALL_FF_REQ_IE: //1: Include all FFs and Requested Ies.
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog(pMac, LOGE, "Only requested IEs in reporting detail requested\n");)
+#endif
+
+ rrmFillBeaconIes( pMac, (tANI_U8*) &pReport->report.beaconReport.Ies[0],
+ (tANI_U8*) &pReport->report.beaconReport.numIes, BEACON_REPORT_MAX_IES,
+ pCurrentReq->request.Beacon.reqIes.pElementIds, pCurrentReq->request.Beacon.reqIes.num,
+ pBcnReport->pBssDescription[0] );
+
+ break;
+ case BEACON_REPORTING_DETAIL_ALL_FF_IE: //2 / default - Include all FFs and all Ies.
+ default:
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog(pMac, LOGE, "Default all IEs and FFs\n");)
+#endif
+ rrmFillBeaconIes( pMac, (tANI_U8*) &pReport->report.beaconReport.Ies[0],
+ (tANI_U8*) &pReport->report.beaconReport.numIes, BEACON_REPORT_MAX_IES,
+ NULL, 0,
+ pBcnReport->pBssDescription[0] );
+ break;
+ }
+
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, "Sending Action frame \n");)
+#endif
+ limSendRadioMeasureReportActionFrame( pMac, pCurrentReq->dialog_token, 1,
+ pReport, pBcnReport->bssId, pSessionEntry );
+ }
+
+ if( pBcnReport->fMeasureDone )
+ {
+ PELOGE(limLog( pMac, LOGE, "Measurement done....cleanup the context\n");)
+
+ rrmCleanup(pMac);
+ }
+ return status;
+}
+
+void rrmProcessBeaconRequestFailure(tpAniSirGlobal pMac, tpPESession pSessionEntry,
+ tSirMacAddr peer, tRrmRetStatus status)
+{
+ tpSirMacRadioMeasureReport pReport = NULL;
+ tpRRMReq pCurrentReq = pMac->rrm.rrmPEContext.pCurrentReq;
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pReport,
+ sizeof( tSirMacRadioMeasureReport ) ) )
+ {
+ limLog( pMac, LOGP,
+ FL( "Unable to PAL allocate memory during RRM Req processing\n" ));
+ return;
+ }
+ palZeroMemory( pMac->hHdd, pReport, sizeof(tSirMacRadioMeasureReport) );
+ pReport->token = pCurrentReq->token;
+ pReport->type = SIR_MAC_RRM_BEACON_TYPE;
+
+ switch (status)
+ {
+ case eRRM_REFUSED:
+ pReport->refused = 1;
+ break;
+ case eRRM_INCAPABLE:
+ pReport->incapable = 1;
+ break;
+ default:
+ PELOGE(limLog( pMac, LOGE, FL(" Beacon request processing failed no report sent with status %d \n"), status););
+ palFreeMemory( pMac->hHdd, pReport );
+ return;
+ }
+
+ limSendRadioMeasureReportActionFrame( pMac, pCurrentReq->dialog_token, 1,
+ pReport, peer, pSessionEntry );
+
+ palFreeMemory( pMac->hHdd, pReport );
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, FL(" Free memory for pReport\n") );)
+#endif
+ return;
+}
+
+// --------------------------------------------------------------------
+/**
+ * rrmProcessRadioMeasurementRequest
+ *
+ * FUNCTION: Processes the Radio Resource Measurement request.
+ *
+ * LOGIC:
+
+
+*
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param peer Macaddress of the peer requesting the radio measurement.
+ * @param pRRMReq Array of Measurement request IEs
+ * @param pSessionEntry session entry.
+ * @return None
+ */
+tSirRetStatus
+rrmProcessRadioMeasurementRequest( tpAniSirGlobal pMac,
+ tSirMacAddr peer,
+ tDot11fRadioMeasurementRequest *pRRMReq,
+ tpPESession pSessionEntry )
+{
+ tANI_U8 i;
+ tSirRetStatus status = eSIR_SUCCESS;
+ tpSirMacRadioMeasureReport pReport = NULL;
+ tANI_U8 num_report = 0;
+ tpRRMReq pCurrentReq = pMac->rrm.rrmPEContext.pCurrentReq;
+ tRrmRetStatus rrmStatus = eRRM_SUCCESS;
+
+ if( !pRRMReq->num_MeasurementRequest )
+ {
+ //No measurement requests....
+ //
+ PELOGE(limLog( pMac, LOGE, "No requestIes in the measurement request\n" );)
+ return eSIR_FAILURE;
+ }
+
+ // PF Fix
+ if( pRRMReq->NumOfRepetitions.repetitions > 0 )
+ {
+ //Send a report with incapable bit set. Not supporting repetitions.
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pReport,
+ sizeof( tSirMacRadioMeasureReport ) ) )
+ {
+ limLog( pMac, LOGP,
+ FL( "Unable to PAL allocate memory during RRM Req processing\n" ));
+ return eSIR_MEM_ALLOC_FAILED;
+ }
+ palZeroMemory( pMac->hHdd, pReport, sizeof(tSirMacRadioMeasureReport) );
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, FL(" Allocated memory for pReport\n") );)
+#endif
+ pReport->incapable = 1;
+ pReport->type = pRRMReq->MeasurementRequest[0].measurement_type;
+ num_report = 1;
+ goto end;
+
+ }
+
+ for( i= 0; i < pRRMReq->num_MeasurementRequest; i++ )
+ {
+ switch( pRRMReq->MeasurementRequest[i].measurement_type )
+ {
+ case SIR_MAC_RRM_BEACON_TYPE:
+ //Process beacon request.
+ if( pCurrentReq )
+ {
+ if ( pReport == NULL ) //Allocate memory to send reports for any subsequent requests.
+ {
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pReport,
+ sizeof( tSirMacRadioMeasureReport ) * (pRRMReq->num_MeasurementRequest - i) ) )
+ {
+ limLog( pMac, LOGP,
+ FL( "Unable to PAL allocate memory during RRM Req processing\n" ));
+ return eSIR_MEM_ALLOC_FAILED;
+ }
+ palZeroMemory( pMac->hHdd, pReport, sizeof( tSirMacRadioMeasureReport ) * (pRRMReq->num_MeasurementRequest - i) );
+#if defined WLAN_VOWIFI_DEBUG
+ limLog( pMac, LOGE, FL(" Allocated memory for pReport\n") );
+#endif
+
+ }
+ pReport[num_report].refused = 1;
+ pReport[num_report].type = SIR_MAC_RRM_BEACON_TYPE;
+ pReport[num_report].token = pRRMReq->MeasurementRequest[i].measurement_token;
+ num_report++;
+ continue;
+ }
+ else
+ {
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pCurrentReq,
+ sizeof( *pCurrentReq ) ) )
+ {
+ limLog( pMac, LOGP,
+ FL( "Unable to PAL allocate memory during RRM Req processing\n" ));
+ return eSIR_MEM_ALLOC_FAILED;
+ }
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, FL(" Allocated memory for pCurrentReq\n") );)
+#endif
+ palZeroMemory( pMac->hHdd, pCurrentReq, sizeof( *pCurrentReq ) );
+ pCurrentReq->dialog_token = pRRMReq->DialogToken.token;
+ pCurrentReq->token = pRRMReq->MeasurementRequest[i].measurement_token;
+ pMac->rrm.rrmPEContext.pCurrentReq = pCurrentReq;
+ rrmStatus = rrmProcessBeaconReportReq( pMac, pCurrentReq, &pRRMReq->MeasurementRequest[i], pSessionEntry );
+ if (eRRM_SUCCESS != rrmStatus)
+ {
+ rrmProcessBeaconRequestFailure(pMac, pSessionEntry, peer, rrmStatus);
+ rrmCleanup(pMac);
+ }
+ }
+ break;
+ default:
+ //Send a report with incapabale bit set.
+ if ( pReport == NULL ) //Allocate memory to send reports for any subsequent requests.
+ {
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pReport,
+ sizeof( tSirMacRadioMeasureReport ) * (pRRMReq->num_MeasurementRequest - i) ) )
+ {
+ limLog( pMac, LOGP,
+ FL( "Unable to PAL allocate memory during RRM Req processing\n" ));
+ return eSIR_MEM_ALLOC_FAILED;
+ }
+ palZeroMemory( pMac->hHdd, pReport, sizeof( tSirMacRadioMeasureReport ) * (pRRMReq->num_MeasurementRequest - i) );
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, FL(" Allocated memory for pReport\n") );)
+#endif
+
+ }
+ pReport[num_report].incapable = 1;
+ pReport[num_report].type = pRRMReq->MeasurementRequest[i].measurement_type;
+ pReport[num_report].token = pRRMReq->MeasurementRequest[i].measurement_token;
+ num_report++;
+ break;
+ }
+ }
+
+end:
+ if( pReport )
+ {
+ limSendRadioMeasureReportActionFrame( pMac, pRRMReq->DialogToken.token, num_report,
+ pReport, peer, pSessionEntry );
+
+ palFreeMemory( pMac->hHdd, pReport );
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, FL(" Free memory for pReport\n") );)
+#endif
+ }
+ return status;
+
+}
+
+// --------------------------------------------------------------------
+/**
+ * rrmUpdateStartTSF
+ **
+ * FUNCTION: Store start TSF of measurement.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param startTSF - TSF value at the start of measurement.
+ * @return None
+ */
+void
+rrmUpdateStartTSF ( tpAniSirGlobal pMac, tANI_U32 startTSF[2] )
+{
+#if 0 //defined WLAN_VOWIFI_DEBUG
+ limLog( pMac, LOGE, "Update Start TSF = %d %d\n", startTSF[0], startTSF[1] );
+#endif
+ pMac->rrm.rrmPEContext.startTSF[0] = startTSF[0];
+ pMac->rrm.rrmPEContext.startTSF[1] = startTSF[1];
+}
+
+// --------------------------------------------------------------------
+/**
+ * rrmGetStartTSF
+ *
+ * FUNCTION: Get the Start TSF.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param startTSF - store star TSF in this buffer.
+ * @return txPower
+ */
+void
+rrmGetStartTSF ( tpAniSirGlobal pMac, tANI_U32 *pStartTSF )
+{
+#if 0 //defined WLAN_VOWIFI_DEBUG
+ limLog( pMac, LOGE, "Get the start TSF, TSF = %d %d \n", pMac->rrm.rrmPEContext.startTSF[0], pMac->rrm.rrmPEContext.startTSF[1] );
+#endif
+ pStartTSF[0] = pMac->rrm.rrmPEContext.startTSF[0];
+ pStartTSF[1] = pMac->rrm.rrmPEContext.startTSF[1];
+
+}
+// --------------------------------------------------------------------
+/**
+ * rrmGetCapabilities
+ *
+ * FUNCTION:
+ * Returns a pointer to tpRRMCaps with all the caps enabled in RRM
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pSessionEntry
+ * @return pointer to tRRMCaps
+ */
+tpRRMCaps rrmGetCapabilities ( tpAniSirGlobal pMac,
+ tpPESession pSessionEntry )
+{
+ return &pMac->rrm.rrmPEContext.rrmEnabledCaps;
+}
+
+// --------------------------------------------------------------------
+/**
+ * rrmUpdateConfig
+ *
+ * FUNCTION:
+ * Update the configuration. This is called from limUpdateConfig.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pSessionEntry
+ * @return pointer to tRRMCaps
+ */
+void rrmUpdateConfig ( tpAniSirGlobal pMac,
+ tpPESession pSessionEntry )
+{
+ tANI_U32 val;
+ tpRRMCaps pRRMCaps = &pMac->rrm.rrmPEContext.rrmEnabledCaps;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("cfg get rrm enabled failed\n"));
+ return;
+ }
+ pMac->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_OPERATING_CHAN_MAX, &val) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("cfg get rrm operating channel max measurement duration failed\n"));
+ return;
+ }
+ pRRMCaps->operatingChanMax = (tANI_U8)val;
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_NON_OPERATING_CHAN_MAX, &val) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("cfg get rrm non-operating channel max measurement duration failed\n"));
+ return;
+ }
+ pRRMCaps->nonOperatingChanMax =(tANI_U8) val;
+
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, "RRM enabled = %d OperatingChanMax = %d NonOperatingMax = %d\n", pMac->rrm.rrmPEContext.rrmEnable,
+ pRRMCaps->operatingChanMax, pRRMCaps->nonOperatingChanMax );)
+#endif
+}
+// --------------------------------------------------------------------
+/**
+ * rrmInitialize
+ *
+ * FUNCTION:
+ * Initialize RRM module
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @return None
+ */
+
+tSirRetStatus
+rrmInitialize(tpAniSirGlobal pMac)
+{
+ tpRRMCaps pRRMCaps = &pMac->rrm.rrmPEContext.rrmEnabledCaps;
+
+ pMac->rrm.rrmPEContext.pCurrentReq = NULL;
+ pMac->rrm.rrmPEContext.txMgmtPower = 0;
+ pMac->rrm.rrmPEContext.DialogToken = 0;
+
+ pMac->rrm.rrmPEContext.rrmEnable = 0;
+
+ palZeroMemory( pMac->hHdd, pRRMCaps, sizeof(tRRMCaps) );
+ pRRMCaps->LinkMeasurement = 1;
+ pRRMCaps->NeighborRpt = 1;
+ pRRMCaps->BeaconPassive = 1;
+ pRRMCaps->BeaconActive = 1;
+ pRRMCaps->BeaconTable = 1;
+ pRRMCaps->APChanReport = 1;
+
+ //pRRMCaps->TCMCapability = 1;
+ //pRRMCaps->triggeredTCM = 1;
+ pRRMCaps->operatingChanMax = 3;
+ pRRMCaps->nonOperatingChanMax = 3;
+
+ return eSIR_SUCCESS;
+}
+
+// --------------------------------------------------------------------
+/**
+ * rrmCleanup
+ *
+ * FUNCTION:
+ * cleanup RRM module
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param mode
+ * @param rate
+ * @return None
+ */
+
+tSirRetStatus
+rrmCleanup(tpAniSirGlobal pMac)
+{
+ if( pMac->rrm.rrmPEContext.pCurrentReq )
+ {
+ if( pMac->rrm.rrmPEContext.pCurrentReq->request.Beacon.reqIes.pElementIds )
+ {
+ palFreeMemory( pMac->hHdd, pMac->rrm.rrmPEContext.pCurrentReq->request.Beacon.reqIes.pElementIds );
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, FL(" Free memory for pElementIds\n") );)
+#endif
+ }
+
+ palFreeMemory( pMac->hHdd, pMac->rrm.rrmPEContext.pCurrentReq );
+#if defined WLAN_VOWIFI_DEBUG
+ PELOGE(limLog( pMac, LOGE, FL(" Free memory for pCurrentReq\n") );)
+#endif
+ }
+
+ pMac->rrm.rrmPEContext.pCurrentReq = NULL;
+ return eSIR_SUCCESS;
+}
+
+// --------------------------------------------------------------------
+/**
+ * rrmProcessMessage
+ *
+ * FUNCTION: Processes the next received Radio Resource Management message
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param None
+ * @return None
+ */
+
+void rrmProcessMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
+{
+ switch (pMsg->type)
+ {
+ case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
+ rrmProcessNeighborReportReq( pMac, pMsg->bodyptr );
+ break;
+ case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
+ rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr );
+ break;
+ }
+
+}
+
+#endif
diff --git a/CORE/MAC/src/pe/sch/schApi.c b/CORE/MAC/src/pe/sch/schApi.c
new file mode 100644
index 0000000..8d90e5e
--- /dev/null
+++ b/CORE/MAC/src/pe/sch/schApi.c
@@ -0,0 +1,522 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file schApi.cc contains functions related to the API exposed
+ * by scheduler module
+ *
+ * Author: Sandesh Goel
+ * Date: 02/25/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+#include "palTypes.h"
+#include "sirWrapper.h"
+#include "aniGlobal.h"
+#include "wniCfgAp.h"
+
+#include "sirMacProtDef.h"
+#include "sirMacPropExts.h"
+#include "sirCommon.h"
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halDataStruct.h"
+#include "halCommonApi.h"
+#endif
+
+#include "cfgApi.h"
+#include "pmmApi.h"
+
+#include "limApi.h"
+
+#include "schApi.h"
+#include "schDebug.h"
+
+#include "schSysParams.h"
+#include "limTrace.h"
+#ifdef WLAN_SOFTAP_FEATURE
+#include "limTypes.h"
+#endif
+
+#include "wlan_qct_wda.h"
+
+//--------------------------------------------------------------------
+//
+// Static Variables
+//
+//-------------------------------------------------------------------
+static tANI_U8 gSchProbeRspTemplate[SCH_MAX_PROBE_RESP_SIZE];
+static tANI_U8 gSchBeaconFrameBegin[SCH_MAX_BEACON_SIZE];
+static tANI_U8 gSchBeaconFrameEnd[SCH_MAX_BEACON_SIZE];
+
+// --------------------------------------------------------------------
+/**
+ * schGetCFPCount
+ *
+ * FUNCTION:
+ * Function used by other Sirius modules to read CFPcount
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param None
+ * @return None
+ */
+
+tANI_U8
+schGetCFPCount(tpAniSirGlobal pMac)
+{
+ return pMac->sch.schObject.gSchCFPCount;
+}
+
+// --------------------------------------------------------------------
+/**
+ * schGetCFPDurRemaining
+ *
+ * FUNCTION:
+ * Function used by other Sirius modules to read CFPDuration remaining
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param None
+ * @return None
+ */
+
+tANI_U16
+schGetCFPDurRemaining(tpAniSirGlobal pMac)
+{
+ return pMac->sch.schObject.gSchCFPDurRemaining;
+}
+
+
+// --------------------------------------------------------------------
+/**
+ * schInitialize
+ *
+ * FUNCTION:
+ * Initialize
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param None
+ * @return None
+ */
+
+void
+schInitialize(tpAniSirGlobal pMac)
+{
+ pmmInitialize(pMac);
+}
+
+// --------------------------------------------------------------------
+/**
+ * schInitGlobals
+ *
+ * FUNCTION:
+ * Initialize globals
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param None
+ * @return None
+ */
+
+void
+schInitGlobals(tpAniSirGlobal pMac)
+{
+ pMac->sch.gSchHcfEnabled = false;
+
+ pMac->sch.gSchScanRequested = false;
+ pMac->sch.gSchScanReqRcvd = false;
+
+ pMac->sch.gSchGenBeacon = 1;
+ pMac->sch.gSchBeaconsSent = 0;
+ pMac->sch.gSchBeaconsWritten = 0;
+ pMac->sch.gSchBcnParseErrorCnt = 0;
+ pMac->sch.gSchBcnIgnored = 0;
+ pMac->sch.gSchBBXportRcvCnt = 0;
+ pMac->sch.gSchUnknownRcvCnt = 0;
+ pMac->sch.gSchBcnRcvCnt = 0;
+ pMac->sch.gSchRRRcvCnt = 0;
+ pMac->sch.qosNullCnt = 0;
+ pMac->sch.numData = 0;
+ pMac->sch.numPoll = 0;
+ pMac->sch.numCorrupt = 0;
+ pMac->sch.numBogusInt = 0;
+ pMac->sch.numTxAct0 = 0;
+ pMac->sch.rrTimeout = SCH_RR_TIMEOUT;
+ pMac->sch.pollPeriod = SCH_POLL_PERIOD;
+ pMac->sch.keepAlive = 0;
+ pMac->sch.multipleSched = 1;
+ pMac->sch.maxPollTimeouts = 20;
+ pMac->sch.checkCfbFlagStuck = 0;
+
+ pMac->sch.schObject.gSchProbeRspTemplate = gSchProbeRspTemplate;
+ pMac->sch.schObject.gSchBeaconFrameBegin = gSchBeaconFrameBegin;
+ pMac->sch.schObject.gSchBeaconFrameEnd = gSchBeaconFrameEnd;
+
+}
+
+// --------------------------------------------------------------------
+/**
+ * schPostMessage
+ *
+ * FUNCTION:
+ * Post the beacon message to the scheduler message queue
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pMsg pointer to message
+ * @return None
+ */
+
+tSirRetStatus
+schPostMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
+{
+#if defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_OSX)
+ PELOG3(schLog(pMac, LOG3, FL("Going to post message (%x) to SCH message queue\n"),
+ pMsg->type);)
+ if (tx_queue_send(&pMac->sys.gSirSchMsgQ, pMsg, TX_NO_WAIT) != TX_SUCCESS)
+ return eSIR_FAILURE;
+#else
+ schProcessMessage(pMac, pMsg);
+#endif
+
+ return eSIR_SUCCESS;
+}
+
+
+
+
+
+// ---------------------------------------------------------------------------
+/**
+ * schSendStartScanRsp
+ *
+ * FUNCTION:
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param None
+ * @return None
+ */
+
+void
+schSendStartScanRsp(tpAniSirGlobal pMac)
+{
+ tSirMsgQ msgQ;
+ tANI_U32 retCode;
+
+ PELOG1(schLog(pMac, LOG1, FL("Sending LIM message to go into scan\n"));)
+ msgQ.type = SIR_SCH_START_SCAN_RSP;
+ if ((retCode = limPostMsgApi(pMac, &msgQ)) != eSIR_SUCCESS)
+ schLog(pMac, LOGE,
+ FL("Posting START_SCAN_RSP to LIM failed, reason=%X\n"), retCode);
+}
+
+/**
+ * schSendBeaconReq
+ *
+ * FUNCTION:
+ *
+ * LOGIC:
+ * 1) SCH received SIR_SCH_BEACON_GEN_IND
+ * 2) SCH updates TIM IE and other beacon related IE's
+ * 3) SCH sends WDA_SEND_BEACON_REQ to HAL. HAL then copies the beacon
+ * template to memory
+ *
+ * ASSUMPTIONS:
+ * Memory allocation is reqd to send this message and SCH allocates memory.
+ * The assumption is that HAL will "free" this memory.
+ *
+ * NOTE:
+ *
+ * @param pMac global
+ *
+ * @param beaconPayload
+ *
+ * @param size - Length of the beacon
+ *
+ * @return eHalStatus
+ */
+tSirRetStatus schSendBeaconReq( tpAniSirGlobal pMac, tANI_U8 *beaconPayload, tANI_U16 size, tpPESession psessionEntry)
+{
+ tSirMsgQ msgQ;
+ tpSendbeaconParams beaconParams = NULL;
+ tSirRetStatus retCode;
+
+ schLog( pMac, LOG2,
+ FL( "Indicating HAL to copy the beacon template [%d bytes] to memory\n" ),
+ size );
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &beaconParams,
+ sizeof( tSendbeaconParams )))
+ return eSIR_FAILURE;
+
+ msgQ.type = WDA_SEND_BEACON_REQ;
+
+ // No Dialog Token reqd, as a response is not solicited
+ msgQ.reserved = 0;
+
+ // Fill in tSendbeaconParams members
+ /* Knock off all pMac global addresses */
+ // limGetBssid( pMac, beaconParams->bssId);
+ palCopyMemory(pMac, beaconParams->bssId, psessionEntry->bssId, sizeof(psessionEntry->bssId));
+
+#ifdef WLAN_SOFTAP_FEATURE
+ beaconParams->timIeOffset = pMac->sch.schObject.gSchBeaconOffsetBegin;
+#ifdef WLAN_FEATURE_P2P
+ beaconParams->p2pIeOffset = pMac->sch.schObject.p2pIeOffset;
+#endif
+#ifdef WLAN_SOFTAP_FW_BEACON_TX_PRNT_LOG
+ schLog(pMac, LOGE,FL("TimIeOffset:[%d]\n"),beaconParams->TimIeOffset );
+#endif
+#endif
+
+ beaconParams->beacon = beaconPayload;
+ beaconParams->beaconLength = (tANI_U32) size;
+ msgQ.bodyptr = beaconParams;
+ msgQ.bodyval = 0;
+
+ // Keep a copy of recent beacon frame sent
+
+ // free previous copy of the beacon
+ if (psessionEntry->beacon )
+ {
+ palFreeMemory(pMac->hHdd, psessionEntry->beacon);
+ }
+
+ psessionEntry->bcnLen = 0;
+ psessionEntry->beacon = NULL;
+
+ if ( eHAL_STATUS_SUCCESS == palAllocateMemory( pMac->hHdd,(void **) &psessionEntry->beacon, size))
+ {
+ palCopyMemory(pMac->hHdd, psessionEntry->beacon, beaconPayload, size);
+ psessionEntry->bcnLen = size;
+ }
+
+ MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ {
+ schLog( pMac, LOGE,
+ FL("Posting SEND_BEACON_REQ to HAL failed, reason=%X\n"),
+ retCode );
+ } else
+ {
+ schLog( pMac, LOG2,
+ FL("Successfully posted WDA_SEND_BEACON_REQ to HAL\n"));
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if( (psessionEntry->limSystemRole == eLIM_AP_ROLE )
+ && (psessionEntry->proxyProbeRspEn)
+ && (pMac->sch.schObject.fBeaconChanged))
+ {
+ if(eSIR_SUCCESS != (retCode = limSendProbeRspTemplateToHal(pMac,psessionEntry,
+ &psessionEntry->DefProbeRspIeBitmap[0])))
+ {
+ /* check whether we have to free any memory */
+ schLog(pMac, LOGE, FL("FAILED to send probe response template with retCode %d\n"), retCode);
+ }
+ }
+#endif
+ }
+
+ return retCode;
+}
+
+#ifdef WLAN_SOFTAP_FEATURE
+tANI_U32 limSendProbeRspTemplateToHal(tpAniSirGlobal pMac,tpPESession psessionEntry
+ ,tANI_U32* IeBitmap)
+{
+ tSirMsgQ msgQ;
+ tANI_U8 *pFrame2Hal = pMac->sch.schObject.gSchProbeRspTemplate;
+ tpSendProbeRespParams pprobeRespParams=NULL;
+ tANI_U32 retCode = eSIR_FAILURE;
+ tANI_U32 nPayload,nBytes,nStatus;
+ tpSirMacMgmtHdr pMacHdr;
+ tANI_U32 addnIEPresent;
+ tANI_U32 addnIELen=0;
+ tSirRetStatus nSirStatus;
+
+ nStatus = dot11fGetPackedProbeResponseSize( pMac, &psessionEntry->probeRespFrame, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ schLog( pMac, LOGE, FL("Failed to calculate the packed size f"
+ "or a Probe Response (0x%08x).\n"),
+ nStatus );
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fProbeResponse );
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ schLog( pMac, LOGE, FL("There were warnings while calculating"
+ "the packed size for a Probe Response "
+ "(0x%08x).\n"), nStatus );
+ }
+
+ nBytes = nPayload + sizeof( tSirMacMgmtHdr );
+
+ //Check if probe response IE is set first before checking beacon/probe rsp IE
+ if(wlan_cfgGetInt(pMac, WNI_CFG_PROBE_RSP_ADDNIE_FLAG, &addnIEPresent) != eSIR_SUCCESS)
+ {
+ schLog(pMac, LOGE, FL("Unable to get WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG\n"));
+ return retCode;
+ }
+
+ if(!addnIEPresent)
+ {
+ //TODO: If additional IE needs to be added. Add then alloc required buffer.
+ if(wlan_cfgGetInt(pMac, WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, &addnIEPresent) != eSIR_SUCCESS)
+ {
+ schLog(pMac, LOGE, FL("Unable to get WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG\n"));
+ return retCode;
+ }
+
+ if(addnIEPresent)
+ {
+ if(wlan_cfgGetStrLen(pMac, WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, &addnIELen) != eSIR_SUCCESS)
+ {
+ schLog(pMac, LOGE, FL("Unable to get WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA length"));
+ return retCode;
+ }
+ }
+ }
+ else
+ {
+ //Probe rsp IE available
+ if(wlan_cfgGetStrLen(pMac, WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addnIELen) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA length"));
+ return retCode;
+ }
+ }
+
+ if(addnIEPresent)
+ {
+ if((nBytes + addnIELen) <= SIR_MAX_PACKET_SIZE )
+ nBytes += addnIELen;
+ else
+ addnIEPresent = false; //Dont include the IE.
+ }
+
+ // Paranoia:
+ palZeroMemory( pMac->hHdd, pFrame2Hal, nBytes );
+
+ // Next, we fill out the buffer descriptor:
+ nSirStatus = limPopulateMacHeader( pMac, pFrame2Hal, SIR_MAC_MGMT_FRAME,
+ SIR_MAC_MGMT_PROBE_RSP, psessionEntry->selfMacAddr,psessionEntry->selfMacAddr);
+
+ if ( eSIR_SUCCESS != nSirStatus )
+ {
+ schLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
+ "tor for a Probe Response (%d).\n"),
+ nSirStatus );
+ return retCode;
+ }
+
+ pMacHdr = ( tpSirMacMgmtHdr ) pFrame2Hal;
+
+ sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
+
+ // That done, pack the Probe Response:
+ nStatus = dot11fPackProbeResponse( pMac, &psessionEntry->probeRespFrame, pFrame2Hal + sizeof(tSirMacMgmtHdr),
+ nPayload, &nPayload );
+
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ schLog( pMac, LOGE, FL("Failed to pack a Probe Response (0x%08x).\n"),
+ nStatus );
+ return retCode; // allocated!
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ schLog( pMac, LOGE, FL("There were warnings while packing a P"
+ "robe Response (0x%08x).\n") );
+ }
+
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
+ (void **) &pprobeRespParams,
+ sizeof( tSendProbeRespParams )))
+ {
+ schLog( pMac, LOGE, FL("limSendProbeRspTemplateToHal: HAL probe response params malloc failed for bytes %d\n"), nBytes );
+ }
+ else
+ {
+ /*
+ PELOGE(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOGE,
+ pFrame2Hal,
+ nBytes);)
+ */
+
+ sirCopyMacAddr( pprobeRespParams->bssId , psessionEntry->bssId);
+ pprobeRespParams->pProbeRespTemplate = pFrame2Hal;
+ pprobeRespParams->probeRespTemplateLen = nBytes;
+ palCopyMemory(pMac,pprobeRespParams->ucProxyProbeReqValidIEBmap,IeBitmap,
+ (sizeof(tANI_U32) * 8));
+ msgQ.type = WDA_UPDATE_PROBE_RSP_TEMPLATE_IND;
+ msgQ.reserved = 0;
+ msgQ.bodyptr = pprobeRespParams;
+ msgQ.bodyval = 0;
+
+ if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
+ {
+ /* free the allocated Memory */
+ schLog( pMac,LOGE, FL("limSendProbeRspTemplateToHal: FAIL bytes %d retcode[%X]\n"), nBytes , retCode );
+ palFreeMemory(pMac->hHdd,pprobeRespParams);
+ }
+ else
+ {
+ schLog( pMac,LOGE, FL("limSendProbeRspTemplateToHal: Probe response template msg posted to HAL of bytes %d \n"),nBytes );
+ }
+ }
+
+ return retCode;
+}
+#endif
+
diff --git a/CORE/MAC/src/pe/sch/schBeaconGen.c b/CORE/MAC/src/pe/sch/schBeaconGen.c
new file mode 100644
index 0000000..23b85c3
--- /dev/null
+++ b/CORE/MAC/src/pe/sch/schBeaconGen.c
@@ -0,0 +1,1003 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file schBeaconGen.cc contains beacon generation related
+ * functions
+ *
+ * Author: Sandesh Goel
+ * Date: 02/25/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#include "palTypes.h"
+#include "wniCfgAp.h"
+#include "aniGlobal.h"
+#include "sirMacProtDef.h"
+
+#include "limUtils.h"
+#include "limApi.h"
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halCommonApi.h"
+#include "halDataStruct.h"
+#endif
+
+#include "halMsgApi.h"
+#include "cfgApi.h"
+#include "pmmApi.h"
+#include "schApi.h"
+
+#include "parserApi.h"
+
+#include "schDebug.h"
+
+//
+// March 15, 2006
+// Temporarily (maybe for all of Alpha-1), assuming TIM = 0
+//
+
+const tANI_U8 P2pOui[] = {0x50, 0x6F, 0x9A, 0x9};
+
+#ifdef ANI_PRODUCT_TYPE_AP
+
+static void
+specialBeaconProcessing(tpAniSirGlobal pMac, tANI_U32 beaconSize);
+#endif
+
+#if defined(WLAN_SOFTAP_FEATURE) && defined(WLAN_FEATURE_P2P)
+tSirRetStatus schGetP2pIeOffset(tANI_U8 *pExtraIe, tANI_U32 extraIeLen, tANI_U16 *pP2pIeOffset)
+{
+ tSirRetStatus status = eSIR_FAILURE;
+ *pP2pIeOffset = 0;
+
+ // Extra IE is not present
+ if(0 == extraIeLen)
+ {
+ return status;
+ }
+
+ // Calculate the P2P IE Offset
+ do
+ {
+ if(*pExtraIe == 0xDD)
+ {
+ if(palEqualMemory(NULL, (void *)(pExtraIe+2), &P2pOui, sizeof(P2pOui)))
+ {
+ (*pP2pIeOffset)++;
+ status = eSIR_SUCCESS;
+ break;
+ }
+ }
+
+ (*pP2pIeOffset)++;
+ pExtraIe++;
+ }while(--extraIeLen > 0);
+
+ return status;
+}
+#endif
+
+tSirRetStatus schAppendAddnIE(tpAniSirGlobal pMac, tpPESession psessionEntry,
+ tANI_U8 *pFrame, tANI_U32 maxBeaconSize,
+ tANI_U32 *nBytes)
+{
+ tSirRetStatus status = eSIR_FAILURE;
+ tANI_U32 present, len;
+ tANI_U8 addIE[WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN];
+
+ if((status = wlan_cfgGetInt(pMac, WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG,
+ &present)) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG"));
+ return status;
+ }
+
+ if(present)
+ {
+ if((status = wlan_cfgGetStrLen(pMac, WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA,
+ &len)) != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGP,
+ FL("Unable to get WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA length"));
+ return status;
+ }
+
+ if(len <= WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN && len &&
+ ((len + *nBytes) <= maxBeaconSize))
+ {
+ if((status = wlan_cfgGetStr(pMac,
+ WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, &addIE[0], &len))
+ == eSIR_SUCCESS)
+ {
+#ifdef WLAN_FEATURE_P2P
+ tANI_U8* pP2pIe = limGetP2pIEPtr(pMac, &addIE[0], len);
+ if(pP2pIe != NULL)
+ {
+ tANI_U8 noaLen = 0;
+ tANI_U8 noaStream[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN];
+ //get NoA attribute stream P2P IE
+ noaLen = limGetNoaAttrStream(pMac, noaStream, psessionEntry);
+ if(noaLen)
+ {
+ if(noaLen + len <= WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN)
+ {
+ vos_mem_copy(&addIE[len], noaStream, noaLen);
+ len += noaLen;
+ /* Update IE Len */
+ pP2pIe[1] += noaLen;
+ }
+ else
+ {
+ limLog(pMac, LOGE,
+ FL("Not able to insert NoA because of length constraint"));
+ }
+ }
+ }
+#endif
+ vos_mem_copy(pFrame, &addIE[0], len);
+ *nBytes = *nBytes + len;
+ }
+ }
+ }
+
+ return status;
+}
+
+// --------------------------------------------------------------------
+/**
+ * schSetFixedBeaconFields
+ *
+ * FUNCTION:
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param None
+ * @return None
+ */
+
+tSirRetStatus schSetFixedBeaconFields(tpAniSirGlobal pMac,tpPESession psessionEntry)
+{
+ tpAniBeaconStruct pBeacon = (tpAniBeaconStruct)
+ pMac->sch.schObject.gSchBeaconFrameBegin;
+ tpSirMacMgmtHdr mac;
+ tANI_U16 offset;
+ tANI_U8 *ptr;
+ tDot11fBeacon1 bcn1;
+ tDot11fBeacon2 bcn2;
+ tANI_U32 i, nStatus, nBytes;
+ tANI_U32 wpsApEnable=0, tmp;
+#ifdef WLAN_SOFTAP_FEATURE
+ tDot11fIEWscProbeRes WscProbeRes;
+#ifdef WLAN_FEATURE_P2P
+ tANI_U8 *pExtraIe = NULL;
+ tANI_U32 extraIeLen =0;
+ tANI_U16 extraIeOffset = 0;
+ tANI_U16 p2pIeOffset = 0;
+ tSirRetStatus status = eSIR_SUCCESS;
+#endif
+#endif
+
+ PELOG1(schLog(pMac, LOG1, FL("Setting fixed beacon fields\n"));)
+
+ /*
+ * First set the fixed fields
+ */
+
+ // set the TFP headers
+
+ // set the mac header
+ palZeroMemory( pMac->hHdd, ( tANI_U8*) &pBeacon->macHdr, sizeof( tSirMacMgmtHdr ) );
+ mac = (tpSirMacMgmtHdr) &pBeacon->macHdr;
+ mac->fc.type = SIR_MAC_MGMT_FRAME;
+ mac->fc.subType = SIR_MAC_MGMT_BEACON;
+
+ for (i=0; i<6; i++)
+ mac->da[i] = 0xff;
+
+ /* Knocking out Global pMac update */
+ /* limGetMyMacAddr(pMac, mac->sa); */
+ /* limGetBssid(pMac, mac->bssId); */
+
+ palCopyMemory(pMac->hHdd, mac->sa, psessionEntry->selfMacAddr, sizeof(psessionEntry->selfMacAddr));
+ palCopyMemory(pMac->hHdd, mac->bssId, psessionEntry->bssId, sizeof (psessionEntry->bssId));
+
+ mac->fc.fromDS = 0;
+ mac->fc.toDS = 0;
+
+ /*
+ * Now set the beacon body
+ */
+
+ palZeroMemory( pMac->hHdd, ( tANI_U8*) &bcn1, sizeof( bcn1 ) );
+
+ // Skip over the timestamp (it'll be updated later).
+
+ bcn1.BeaconInterval.interval = pMac->sch.schObject.gSchBeaconInterval;
+ PopulateDot11fCapabilities( pMac, &bcn1.Capabilities, psessionEntry );
+ if (psessionEntry->ssidHidden)
+ {
+ bcn1.SSID.present = 1; //rest of the fileds are 0 for hidden ssid
+ }
+ else
+ {
+ PopulateDot11fSSID( pMac, &psessionEntry->ssId, &bcn1.SSID );
+ }
+
+ PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &bcn1.SuppRates,psessionEntry);
+ PopulateDot11fDSParams( pMac, &bcn1.DSParams, psessionEntry->currentOperChannel, psessionEntry);
+ PopulateDot11fIBSSParams( pMac, &bcn1.IBSSParams,psessionEntry);
+
+ offset = sizeof( tAniBeaconStruct );
+ ptr = pMac->sch.schObject.gSchBeaconFrameBegin + offset;
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if((psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ && (psessionEntry->proxyProbeRspEn))
+ {
+ /* Initialize the default IE bitmap to zero */
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&(psessionEntry->DefProbeRspIeBitmap), (sizeof( tANI_U32 ) * 8));
+
+ /* Initialize the default IE bitmap to zero */
+ palZeroMemory( pMac->hHdd, ( tANI_U8* )&(psessionEntry->probeRespFrame), sizeof(psessionEntry->probeRespFrame));
+
+ /* Can be efficiently updated whenever new IE added in Probe response in future */
+ limUpdateProbeRspTemplateIeBitmapBeacon1(pMac,&bcn1,&psessionEntry->DefProbeRspIeBitmap[0],
+ &psessionEntry->probeRespFrame);
+ }
+#endif
+
+ nStatus = dot11fPackBeacon1( pMac, &bcn1, ptr,
+ SCH_MAX_BEACON_SIZE - offset,
+ &nBytes );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ schLog( pMac, LOGE, FL("Failed to packed a tDot11fBeacon1 (0x%0"
+ "8x.).\n"), nStatus );
+ return eSIR_FAILURE;
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ schLog( pMac, LOGE, FL("There were warnings while packing a tDo"
+ "t11fBeacon1 (0x%08x.).\n"), nStatus );
+ }
+ /*changed to correct beacon corruption */
+ palZeroMemory( pMac->hHdd, ( tANI_U8*) &bcn2, sizeof( bcn2 ) );
+ pMac->sch.schObject.gSchBeaconOffsetBegin = offset + ( tANI_U16 )nBytes;
+ schLog( pMac, LOG1, FL("Initialized beacon begin, offset %d\n"), offset );
+
+ /*
+ * Initialize the 'new' fields at the end of the beacon
+ */
+
+
+ PopulateDot11fCountry( pMac, &bcn2.Country, psessionEntry);
+ if(bcn1.Capabilities.qos)
+ {
+ PopulateDot11fEDCAParamSet( pMac, &bcn2.EDCAParamSet, psessionEntry);
+ }
+
+ if(pMac->lim.gLim11hEnable)
+ {
+ PopulateDot11fPowerConstraints( pMac, &bcn2.PowerConstraints );
+ PopulateDot11fTPCReport( pMac, &bcn2.TPCReport, psessionEntry);
+ }
+
+#ifdef ANI_PRODUCT_TYPE_AP
+ if( pMac->lim.gLim11hEnable && (eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState))
+ {
+ PopulateDot11fQuiet( pMac, &bcn2.Quiet );
+ }
+
+ /* If 11h is enabled, and AP is in the state of changing either the
+ * primary channel, or both primary & secondary channel, and the
+ * channel switch count is still being decremented, then AP shall
+ * populate the 802.11h channel switch IE in its Beacons and Probe
+ * Responses.
+ */
+ if ( (pMac->lim.gLim11hEnable) &&
+ (pMac->lim.gLimChannelSwitch.switchCount != 0) &&
+ (pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING))
+
+ {
+ PopulateDot11fChanSwitchAnn( pMac, &bcn2.ChanSwitchAnn );
+ PopulateDot11fExtChanSwitchAnn(pMac, &bcn2.ExtChanSwitchAnn);
+ }
+#endif
+
+ if (psessionEntry->dot11mode != WNI_CFG_DOT11_MODE_11B)
+ PopulateDot11fERPInfo( pMac, &bcn2.ERPInfo, psessionEntry );
+
+ if(psessionEntry->htCapabality)
+ {
+ PopulateDot11fHTCaps( pMac, &bcn2.HTCaps );
+#ifdef WLAN_SOFTAP_FEATURE
+ PopulateDot11fHTInfo( pMac, &bcn2.HTInfo, psessionEntry );
+#else
+ PopulateDot11fHTInfo( pMac, &bcn2.HTInfo );
+#endif
+ }
+
+ PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
+ &bcn2.ExtSuppRates, psessionEntry );
+
+ if( psessionEntry->pLimStartBssReq != NULL )
+ {
+ PopulateDot11fWPA( pMac, &psessionEntry->pLimStartBssReq->rsnIE,
+ &bcn2.WPA );
+ PopulateDot11fRSN( pMac, &psessionEntry->pLimStartBssReq->rsnIE,
+ &bcn2.RSN );
+ }
+
+ if(psessionEntry->limWmeEnabled)
+ {
+ PopulateDot11fWMM( pMac, &bcn2.WMMInfoAp, &bcn2.WMMParams, &bcn2.WMMCaps, psessionEntry);
+ }
+#ifdef WLAN_SOFTAP_FEATURE
+ if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ {
+ if(psessionEntry->wps_state != SAP_WPS_DISABLED)
+ {
+ PopulateDot11fBeaconWPSIEs( pMac, &bcn2.WscBeacon, psessionEntry);
+ }
+ }
+ else
+ {
+#endif
+ if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_ENABLE, &tmp) != eSIR_SUCCESS)
+ limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_ENABLE );
+
+ wpsApEnable = tmp & WNI_CFG_WPS_ENABLE_AP;
+
+ if (wpsApEnable)
+ {
+ PopulateDot11fWsc(pMac, &bcn2.WscBeacon);
+ }
+
+ if (pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_BEGIN)
+ {
+ PopulateDot11fWscRegistrarInfo(pMac, &bcn2.WscBeacon);
+ pMac->lim.wscIeInfo.wscEnrollmentState = eLIM_WSC_ENROLL_IN_PROGRESS;
+ }
+
+ if (pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_END)
+ {
+ DePopulateDot11fWscRegistrarInfo(pMac, &bcn2.WscBeacon);
+ pMac->lim.wscIeInfo.wscEnrollmentState = eLIM_WSC_ENROLL_NOOP;
+ }
+#ifdef WLAN_SOFTAP_FEATURE
+ }
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE
+ if((psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ && (psessionEntry->proxyProbeRspEn))
+ {
+ /* Can be efficiently updated whenever new IE added in Probe response in future */
+ limUpdateProbeRspTemplateIeBitmapBeacon2(pMac,&bcn2,&psessionEntry->DefProbeRspIeBitmap[0],
+ &psessionEntry->probeRespFrame);
+
+ /* update probe response WPS IE instead of beacon WPS IE
+ * */
+ if(psessionEntry->wps_state != SAP_WPS_DISABLED)
+ {
+ if(psessionEntry->APWPSIEs.SirWPSProbeRspIE.FieldPresent)
+ {
+ PopulateDot11fProbeResWPSIEs(pMac, &WscProbeRes, psessionEntry);
+ }
+ else
+ {
+ WscProbeRes.present = 0;
+ }
+ if(WscProbeRes.present)
+ {
+ SetProbeRspIeBitmap(&psessionEntry->DefProbeRspIeBitmap[0],SIR_MAC_WPA_EID);
+ palCopyMemory(pMac->hHdd,
+ (void *)&psessionEntry->probeRespFrame.WscProbeRes,
+ (void *)&WscProbeRes,
+ sizeof(WscProbeRes));
+ }
+ }
+
+ }
+#endif
+
+ nStatus = dot11fPackBeacon2( pMac, &bcn2,
+ pMac->sch.schObject.gSchBeaconFrameEnd,
+ SCH_MAX_BEACON_SIZE, &nBytes );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ schLog( pMac, LOGE, FL("Failed to packed a tDot11fBeacon2 (0x%0"
+ "8x.).\n"), nStatus );
+ return eSIR_FAILURE;
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ schLog( pMac, LOGE, FL("There were warnings while packing a tDo"
+ "t11fBeacon2 (0x%08x.).\n"), nStatus );
+ }
+
+#if defined(WLAN_SOFTAP_FEATURE) && defined(WLAN_FEATURE_P2P)
+ pExtraIe = pMac->sch.schObject.gSchBeaconFrameEnd + nBytes;
+ extraIeOffset = nBytes;
+#endif
+
+ //TODO: Append additional IE here.
+ schAppendAddnIE(pMac, psessionEntry,
+ pMac->sch.schObject.gSchBeaconFrameEnd + nBytes,
+ SCH_MAX_BEACON_SIZE, &nBytes);
+
+ pMac->sch.schObject.gSchBeaconOffsetEnd = ( tANI_U16 )nBytes;
+
+#if defined(WLAN_SOFTAP_FEATURE) && defined(WLAN_FEATURE_P2P)
+ extraIeLen = nBytes - extraIeOffset;
+
+ //Get the p2p Ie Offset
+ status = schGetP2pIeOffset(pExtraIe, extraIeLen, &p2pIeOffset);
+
+ if(eSIR_SUCCESS == status)
+ {
+ //Update the P2P Ie Offset
+ pMac->sch.schObject.p2pIeOffset =
+ pMac->sch.schObject.gSchBeaconOffsetBegin + TIM_IE_SIZE +
+ extraIeOffset + p2pIeOffset;
+ }
+ else
+ {
+ pMac->sch.schObject.p2pIeOffset = 0;
+ }
+#endif
+
+ schLog( pMac, LOG1, FL("Initialized beacon end, offset %d\n"),
+ pMac->sch.schObject.gSchBeaconOffsetEnd );
+
+ pMac->sch.schObject.fBeaconChanged = 1;
+
+ return eSIR_SUCCESS;
+}
+
+#ifdef WLAN_SOFTAP_FEATURE
+void limUpdateProbeRspTemplateIeBitmapBeacon1(tpAniSirGlobal pMac,
+ tDot11fBeacon1* beacon1,
+ tANI_U32* DefProbeRspIeBitmap,
+ tDot11fProbeResponse* prb_rsp)
+{
+ prb_rsp->BeaconInterval = beacon1->BeaconInterval;
+ palCopyMemory(pMac->hHdd,(void *)&prb_rsp->Capabilities,
+ (void *)&beacon1->Capabilities,
+ sizeof(beacon1->Capabilities));
+
+ /* SSID */
+ if(beacon1->SSID.present)
+ {
+ SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_SSID_EID);
+ /* populating it , because probe response has to go with SSID even in hidden case */
+ PopulateDot11fSSID2( pMac, &prb_rsp->SSID );
+ }
+ /* supported rates */
+ if(beacon1->SuppRates.present)
+ {
+ SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_RATESET_EID);
+ palCopyMemory(pMac->hHdd,(void *)&prb_rsp->SuppRates,
+ (void *)&beacon1->SuppRates,
+ sizeof(beacon1->SuppRates));
+
+ }
+ /* DS Parameter set */
+ if(beacon1->DSParams.present)
+ {
+ SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_DS_PARAM_SET_EID);
+ palCopyMemory(pMac->hHdd,(void *)&prb_rsp->DSParams,
+ (void *)&beacon1->DSParams,
+ sizeof(beacon1->DSParams));
+
+ }
+
+ /* IBSS params will not be present in the Beacons transmitted by AP */
+}
+
+void limUpdateProbeRspTemplateIeBitmapBeacon2(tpAniSirGlobal pMac,
+ tDot11fBeacon2* beacon2,
+ tANI_U32* DefProbeRspIeBitmap,
+ tDot11fProbeResponse* prb_rsp)
+{
+ /* IBSS parameter set - will not be present in probe response tx by AP */
+ /* country */
+ if(beacon2->Country.present)
+ {
+ SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_COUNTRY_EID);
+ palCopyMemory(pMac->hHdd,(void *)&prb_rsp->Country,
+ (void *)&beacon2->Country,
+ sizeof(beacon2->Country));
+
+ }
+ /* Power constraint */
+ if(beacon2->PowerConstraints.present)
+ {
+ SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_PWR_CONSTRAINT_EID);
+ palCopyMemory(pMac->hHdd,(void *)&prb_rsp->PowerConstraints,
+ (void *)&beacon2->PowerConstraints,
+ sizeof(beacon2->PowerConstraints));
+
+ }
+ /* Channel Switch Annoouncement SIR_MAC_CHNL_SWITCH_ANN_EID */
+ if(beacon2->ChanSwitchAnn.present)
+ {
+ SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_CHNL_SWITCH_ANN_EID);
+ palCopyMemory(pMac->hHdd,(void *)&prb_rsp->ChanSwitchAnn,
+ (void *)&beacon2->ChanSwitchAnn,
+ sizeof(beacon2->ChanSwitchAnn));
+
+ }
+ /* ERP information */
+ if(beacon2->ERPInfo.present)
+ {
+ SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_ERP_INFO_EID);
+ palCopyMemory(pMac->hHdd,(void *)&prb_rsp->ERPInfo,
+ (void *)&beacon2->ERPInfo,
+ sizeof(beacon2->ERPInfo));
+
+ }
+ /* Extended supported rates */
+ if(beacon2->ExtSuppRates.present)
+ {
+ SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_EXTENDED_RATE_EID);
+ palCopyMemory(pMac->hHdd,(void *)&prb_rsp->ExtSuppRates,
+ (void *)&beacon2->ExtSuppRates,
+ sizeof(beacon2->ExtSuppRates));
+
+ }
+
+ /* WPA */
+ if(beacon2->WPA.present)
+ {
+ SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_WPA_EID);
+ palCopyMemory(pMac->hHdd,(void *)&prb_rsp->WPA,
+ (void *)&beacon2->WPA,
+ sizeof(beacon2->WPA));
+
+ }
+
+ /* RSN */
+ if(beacon2->RSN.present)
+ {
+ SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_RSN_EID);
+ palCopyMemory(pMac->hHdd,(void *)&prb_rsp->RSN,
+ (void *)&beacon2->RSN,
+ sizeof(beacon2->RSN));
+
+ }
+/*
+ // BSS load
+ if(beacon2->QBSSLoad.present)
+ {
+ SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_QBSS_LOAD_EID);
+ }
+*/
+ /* EDCA Parameter set */
+ if(beacon2->EDCAParamSet.present)
+ {
+ SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_EDCA_PARAM_SET_EID);
+ palCopyMemory(pMac->hHdd,(void *)&prb_rsp->EDCAParamSet,
+ (void *)&beacon2->EDCAParamSet,
+ sizeof(beacon2->EDCAParamSet));
+
+ }
+ /* Vendor specific - currently no vendor specific IEs added */
+ /* Requested IEs - currently we are not processing this will be added later */
+ //HT capability IE
+ if(beacon2->HTCaps.present)
+ {
+ SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_HT_CAPABILITIES_EID);
+ palCopyMemory(pMac->hHdd,(void *)&prb_rsp->HTCaps,
+ (void *)&beacon2->HTCaps,
+ sizeof(beacon2->HTCaps));
+ }
+ // HT Info IE
+ if(beacon2->HTInfo.present)
+ {
+ SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_HT_INFO_EID);
+ palCopyMemory(pMac->hHdd,(void *)&prb_rsp->HTInfo,
+ (void *)&beacon2->HTInfo,
+ sizeof(beacon2->HTInfo));
+ }
+
+ //WMM IE
+ if(beacon2->WMMParams.present)
+ {
+ SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_WPA_EID);
+ palCopyMemory(pMac->hHdd,(void *)&prb_rsp->WMMParams,
+ (void *)&beacon2->WMMParams,
+ sizeof(beacon2->WMMParams));
+ }
+ //WMM capability - most of the case won't be present
+ if(beacon2->WMMCaps.present)
+ {
+ SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_WPA_EID);
+ palCopyMemory(pMac->hHdd,(void *)&prb_rsp->WMMCaps,
+ (void *)&beacon2->WMMCaps,
+ sizeof(beacon2->WMMCaps));
+ }
+
+}
+
+void SetProbeRspIeBitmap(tANI_U32* IeBitmap,tANI_U32 pos)
+{
+ tANI_U32 index,temp;
+
+ index = pos >> 5;
+ if(index >= 8 )
+ {
+ return;
+ }
+ temp = IeBitmap[index];
+
+ temp |= 1 << (pos & 0x1F);
+
+ IeBitmap[index] = temp;
+}
+
+#endif
+
+#ifdef ANI_PRODUCT_TYPE_AP
+
+//----------------------------
+/**
+ * @function : schUpdateCfpParam
+ * @brief : Generate the CFP Parameter Set
+ *
+ * @param : pMac - tpAniSirGlobal
+ * ptr - Pointer to the BeaconFrame
+ * pbeaconSize - The beaconSize
+ *
+ * @return : Return the Updated Ptrlocation
+ */
+static tANI_U8 *
+__schUpdateCfpParam(tpAniSirGlobal pMac, tANI_U8 *ptr, tANI_U32 *pbeaconSize)
+{
+ tANI_U32 val;
+
+ *ptr++ = SIR_MAC_CF_PARAM_SET_EID;
+ *ptr++ = SIR_MAC_CF_PARAM_SET_EID_MIN;
+
+ wlan_cfgGetInt(pMac, WNI_CFG_CFP_PERIOD, &val);
+ if (++pMac->sch.schObject.gSchCFPCount == val)
+ pMac->sch.schObject.gSchCFPCount = 0;
+
+ *ptr++ = pMac->sch.schObject.gSchCFPCount;
+ *ptr++ = (tANI_U8)val;
+
+ wlan_cfgGetInt(pMac, WNI_CFG_CFP_MAX_DURATION, &val);
+ pMac->sch.schObject.gSchCFPMaxDuration = (tANI_U8)val;
+
+ sirStoreU16(ptr, (tANI_U16)val);
+ ptr += 2;
+
+ if (pMac->sch.schObject.gSchCFPCount == 0)
+ pMac->sch.schObject.gSchCFPDurRemaining = pMac->sch.schObject.gSchCFPMaxDuration;
+ else if (pMac->sch.schObject.gSchCFPDurRemaining > pMac->sch.schObject.gSchBeaconInterval)
+ pMac->sch.schObject.gSchCFPDurRemaining -= pMac->sch.schObject.gSchBeaconInterval;
+ else
+ pMac->sch.schObject.gSchCFPDurRemaining = 0;
+
+ sirStoreU16(ptr, pMac->sch.schObject.gSchCFPDurRemaining);
+ ptr += 2;
+
+ (*pbeaconSize) += 2 + SIR_MAC_CF_PARAM_SET_EID_MIN;
+
+ return ptr;
+}
+
+#endif
+
+// --------------------------------------------------------------------
+/**
+ * writeBeaconToMemory
+ *
+ * FUNCTION:
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param None
+ * @param size Size of the beacon to write to memory
+ * @param length Length field of the beacon to write to memory
+ * @return None
+ */
+
+void writeBeaconToMemory(tpAniSirGlobal pMac, tANI_U16 size, tANI_U16 length, tpPESession psessionEntry)
+{
+ tANI_U16 i;
+ tpAniBeaconStruct pBeacon;
+
+ // copy end of beacon only if length > 0
+ if (length > 0)
+ {
+ for (i=0; i < pMac->sch.schObject.gSchBeaconOffsetEnd; i++)
+ pMac->sch.schObject.gSchBeaconFrameBegin[size++] = pMac->sch.schObject.gSchBeaconFrameEnd[i];
+ }
+
+ // Update the beacon length
+ pBeacon = (tpAniBeaconStruct) pMac->sch.schObject.gSchBeaconFrameBegin;
+ // Do not include the beaconLength indicator itself
+ if (length == 0)
+ {
+ pBeacon->beaconLength = 0;
+ // Dont copy entire beacon, Copy length field alone
+ size = 4;
+ }
+ else
+ pBeacon->beaconLength = (tANI_U32) size - sizeof( tANI_U32 );
+
+ // write size bytes from gSchBeaconFrameBegin
+ PELOG2(schLog(pMac, LOG2, FL("Beacon size - %d bytes\n"), size);)
+ PELOG2(sirDumpBuf(pMac, SIR_SCH_MODULE_ID, LOG2, pMac->sch.schObject.gSchBeaconFrameBegin, size);)
+
+ if (! pMac->sch.schObject.fBeaconChanged)
+ return;
+
+ pMac->sch.gSchGenBeacon = 1;
+ if (pMac->sch.gSchGenBeacon)
+ {
+ pMac->sch.gSchBeaconsSent++;
+
+ //
+ // Copy beacon data to SoftMAC shared memory...
+ // Do this by sending a message to HAL
+ //
+
+ size = (size + 3) & (~3);
+ if( eSIR_SUCCESS != schSendBeaconReq( pMac, pMac->sch.schObject.gSchBeaconFrameBegin, size , psessionEntry))
+ PELOGE(schLog(pMac, LOGE, FL("schSendBeaconReq() returned an error (zsize %d)\n"), size);)
+ else
+ {
+ pMac->sch.gSchBeaconsWritten++;
+ }
+ }
+ pMac->sch.schObject.fBeaconChanged = 0;
+}
+
+// --------------------------------------------------------------------
+/**
+ * @function: SchProcessPreBeaconInd
+ *
+ * @brief : Process the PreBeacon Indication from the Lim
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param : pMac - tpAniSirGlobal
+ *
+ * @return None
+ */
+
+void
+schProcessPreBeaconInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
+{
+ tpBeaconGenParams pMsg = (tpBeaconGenParams)limMsg->bodyptr;
+ tANI_U32 beaconSize = pMac->sch.schObject.gSchBeaconOffsetBegin;
+ tpPESession psessionEntry;
+ tANI_U8 sessionId;
+
+ if((psessionEntry = peFindSessionByBssid(pMac,pMsg->bssId, &sessionId))== NULL)
+ {
+ PELOGE(schLog(pMac, LOGE, FL("session lookup fails\n"));)
+ goto end;
+ }
+
+
+
+ // If SME is not in normal mode, no need to generate beacon
+ if (psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE)
+ {
+ PELOGE(schLog(pMac, LOG1, FL("PreBeaconInd received in invalid state: %d\n"), psessionEntry->limSmeState);)
+ goto end;
+ }
+
+ switch(psessionEntry->limSystemRole){
+
+ case eLIM_STA_IN_IBSS_ROLE:
+ case eLIM_BT_AMP_AP_ROLE:
+ case eLIM_BT_AMP_STA_ROLE:
+ // generate IBSS parameter set
+ if(psessionEntry->statypeForBss == STA_ENTRY_SELF)
+ writeBeaconToMemory(pMac, (tANI_U16) beaconSize, (tANI_U16)beaconSize, psessionEntry);
+ else
+ PELOGE(schLog(pMac, LOGE, FL("can not send beacon for PEER session entry\n"));)
+ break;
+
+#ifdef WLAN_SOFTAP_FEATURE
+ case eLIM_AP_ROLE:{
+ tANI_U8 *ptr = &pMac->sch.schObject.gSchBeaconFrameBegin[pMac->sch.schObject.gSchBeaconOffsetBegin];
+ tANI_U16 timLength = 0;
+ if(psessionEntry->statypeForBss == STA_ENTRY_SELF){
+ pmmGenerateTIM(pMac, &ptr, &timLength, psessionEntry->dtimPeriod);
+ beaconSize += 2 + timLength;
+ writeBeaconToMemory(pMac, (tANI_U16) beaconSize, (tANI_U16)beaconSize, psessionEntry);
+ }
+ else
+ PELOGE(schLog(pMac, LOGE, FL("can not send beacon for PEER session entry\n"));)
+ }
+ break;
+#endif
+
+#ifdef ANI_PRODUCT_TYPE_AP
+ case eLIM_AP_ROLE:
+ {
+ tANI_U8 *ptr = &pMac->sch.schObject.gSchBeaconFrameBegin[pMac->sch.schObject.gSchBeaconOffsetBegin];
+ tANI_U16 timLength = 0;
+
+ if (pMac->sch.schObject.gSchCFPEnabled)
+ ptr = __schUpdateCfpParam( pMac, ptr, &beaconSize);
+
+ // generate TIM
+ pmmGenerateTIM(pMac, &ptr, &timLength);
+ beaconSize += 2 + timLength;
+
+ /**
+ * Safe to call this each time.
+ * Based on the requirement for updating the
+ * fixed beacon fields, this routine will
+ * appropriately update the fixed fields
+ */
+ specialBeaconProcessing(pMac, beaconSize);
+ writeBeaconToMemory(pMac, beaconSize, beaconSize, psessionEntry);
+ pmmHandleTimBasedDisassociation( pMac, psessionEntry );
+ }
+ break;
+#endif
+
+ default:
+ PELOGE(schLog(pMac, LOGE, FL("Error-PE has Receive PreBeconGenIndication when System is in %d role"),
+ psessionEntry->limSystemRole);)
+ }
+
+end:
+ palFreeMemory(pMac->hHdd, (void*)pMsg);
+
+}
+
+/**-------------------------------------------------------------
+ \fn specialBeaconProcessing
+ \brief To add/update channel switch IE/ Quiet IE in beacons.
+ And also to resume transmission and measurement after
+ switching the channel.
+
+ \param pMac
+ \param beaconSize Size of the beacon
+ \return NONE
+ --------------------------------------------------------------*/
+#ifdef ANI_PRODUCT_TYPE_AP
+
+static void
+specialBeaconProcessing( tpAniSirGlobal pMac, tANI_U32 beaconSize)
+{
+
+ tpPESession psessionEntry = &pMac->lim.gpSession[0]; //TBD-RAJESH HOW TO GET sessionEntry?????
+ tANI_BOOLEAN fBeaconChanged = eANI_BOOLEAN_FALSE;
+
+ fBeaconChanged = limUpdateQuietIEInBeacons( pMac );
+
+ if((pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_BEGIN) ||
+ (pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_END))
+ {
+ fBeaconChanged = eANI_BOOLEAN_TRUE;
+ }
+
+
+ /*******************************
+ * Processing Channel Switch IE
+ *******************************/
+ if (pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
+ {
+ fBeaconChanged = eANI_BOOLEAN_TRUE;
+
+#if 0
+ // If the station doesn't support 11h or have link monitoring enabled,
+ // AP has to send disassoc frame to indicate station before going
+ // to new channel. Otherwise station wont connect to AP in new channel.
+ if (pMac->lim.gLimChannelSwitch.switchCount == 1)
+ {
+ if((pMac->lim.gLimChannelSwitch.state
+ == eLIM_CHANNEL_SWITCH_PRIMARY_ONLY) ||
+ (pMac->lim.gLimChannelSwitch.state
+ == eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY))
+ {
+ tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+
+ limSendDisassocMgmtFrame(pMac,
+ eSIR_MAC_DISASSOC_LEAVING_BSS_REASON,
+ bcAddr);
+ }
+ }
+#endif
+ if (pMac->lim.gLimChannelSwitch.switchCount == 0)
+ {
+
+ /* length is set to 0, so that no beacon is transmitted without channel switch IE
+ * before switching to new channel */
+ pMac->sch.schObject.fBeaconChanged = 1;
+ writeBeaconToMemory(pMac, beaconSize, 0, psessionEntry);
+ schSetFixedBeaconFields(pMac,psessionEntry);
+
+ PELOG3(limLog(pMac, LOG3, FL("Channel switch state = %d\n"), pMac->lim.gLimChannelSwitch.state);)
+ switch(pMac->lim.gLimChannelSwitch.state)
+ {
+ case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
+ limSwitchPrimaryChannel(pMac, pMac->lim.gLimChannelSwitch.primaryChannel);
+ break;
+ case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
+ limSwitchPrimarySecondaryChannel(pMac,
+ psessionEntry->currentOperChannel,
+ pMac->lim.gLimChannelSwitch.secondarySubBand);
+ break;
+ case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
+ limSwitchPrimarySecondaryChannel(pMac,
+ pMac->lim.gLimChannelSwitch.primaryChannel,
+ pMac->lim.gLimChannelSwitch.secondarySubBand);
+ break;
+ case eLIM_CHANNEL_SWITCH_IDLE:
+ PELOGE(schLog(pMac, LOGE, FL("incorrect state - CHANNEL_SWITCH_IDLE\n"));)
+ break;
+
+ default:
+ break;
+ }
+ pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
+
+ limSendSmeRsp(pMac, eWNI_SME_SWITCH_CHL_RSP, eSIR_SME_SUCCESS);
+
+ limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_RESUME_TX);
+ /* Flag to indicate 11h channel switch is done. */
+ pMac->lim.gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
+ pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+ LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
+
+ if (pMac->lim.gpLimMeasReq)
+ limReEnableLearnMode(pMac);
+
+ return;
+ }
+ }
+
+ if (fBeaconChanged)
+ {
+ schSetFixedBeaconFields(pMac,psessionEntry);
+
+ if (pMac->lim.gLimChannelSwitch.switchCount > 0)
+ pMac->lim.gLimChannelSwitch.switchCount--;
+ }
+}
+#endif
+
+
diff --git a/CORE/MAC/src/pe/sch/schBeaconProcess.c b/CORE/MAC/src/pe/sch/schBeaconProcess.c
new file mode 100644
index 0000000..6d85c12
--- /dev/null
+++ b/CORE/MAC/src/pe/sch/schBeaconProcess.c
@@ -0,0 +1,743 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file schBeaconProcess.cc contains beacon processing related
+ * functions
+ *
+ * Author: Sandesh Goel
+ * Date: 02/25/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#include "palTypes.h"
+#include "wniCfgAp.h"
+
+#include "cfgApi.h"
+#include "pmmApi.h"
+#include "limApi.h"
+#include "utilsApi.h"
+#include "schDebug.h"
+#include "schApi.h"
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halCommonApi.h"
+#endif
+
+#include "limUtils.h"
+#include "limSendMessages.h"
+#include "limStaHashApi.h"
+
+#if defined WLAN_FEATURE_VOWIFI
+#include "rrmApi.h"
+#endif
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+#include "vos_diag_core_log.h"
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+/**
+ * Number of bytes of variation in beacon length from the last beacon
+ * to trigger reprogramming of rx delay register
+ */
+#define SCH_BEACON_LEN_DELTA 3
+
+// calculate 2^cw - 1
+#define CW_GET(cw) (((cw) == 0) ? 1 : ((1 << (cw)) - 1))
+
+static void
+ap_beacon_process(
+ tpAniSirGlobal pMac,
+ tANI_U8* pRxPacketInfo,
+ tpSchBeaconStruct pBcnStruct,
+ tpUpdateBeaconParams pBeaconParams,
+ tpPESession psessionEntry)
+{
+ tpSirMacMgmtHdr pMh = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
+ tANI_U32 phyMode;
+ tSirRFBand rfBand = SIR_BAND_UNKNOWN;
+ //Get RF band from psessionEntry
+ rfBand = psessionEntry->limRFBand;
+
+ limGetPhyMode(pMac, &phyMode, psessionEntry);
+
+ if(SIR_BAND_5_GHZ == rfBand)
+ {
+ if (psessionEntry->htCapabality)
+ {
+ if (pBcnStruct->channelNumber == psessionEntry->currentOperChannel)
+ {
+ //11a (non HT) AP overlaps or
+ //HT AP with HT op mode as mixed overlaps.
+ //HT AP with HT op mode as overlap legacy overlaps.
+ if ((!pBcnStruct->HTInfo.present) ||
+ (eSIR_HT_OP_MODE_MIXED == pBcnStruct->HTInfo.opMode) ||
+ (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBcnStruct->HTInfo.opMode))
+ {
+ limUpdateOverlapStaParam(pMac, pMh->bssId, &(pMac->lim.gLimOverlap11aParams));
+
+ if (pMac->lim.gLimOverlap11aParams.numSta &&
+ !pMac->lim.gLimOverlap11aParams.protectionEnabled)
+ {
+ limEnable11aProtection(pMac, true, true, pBeaconParams,psessionEntry);
+ }
+ }
+ //HT AP with HT20 op mode overlaps.
+ else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBcnStruct->HTInfo.opMode)
+ {
+ limUpdateOverlapStaParam(pMac, pMh->bssId, &(pMac->lim.gLimOverlapHt20Params));
+
+ if (pMac->lim.gLimOverlapHt20Params.numSta &&
+ !pMac->lim.gLimOverlapHt20Params.protectionEnabled)
+ {
+ limEnableHT20Protection(pMac, true, true, pBeaconParams,psessionEntry);
+ }
+ }
+ }
+ }
+ }
+ else if(SIR_BAND_2_4_GHZ == rfBand)
+ {
+ //We are 11G AP.
+ if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
+ (false == psessionEntry->htCapabality))
+ {
+ if (pBcnStruct->channelNumber == psessionEntry->currentOperChannel)
+ {
+ if (((!(pBcnStruct->erpPresent)) &&
+ !(pBcnStruct->HTInfo.present))||
+ //if erp not present then 11B AP overlapping
+ (pBcnStruct->erpPresent &&
+ (pBcnStruct->erpIEInfo.useProtection ||
+ pBcnStruct->erpIEInfo.nonErpPresent)))
+ {
+#ifdef FEATURE_WLAN_CCX
+ if( psessionEntry->isCCXconnection )
+ {
+ VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+ "%s: [INFOLOG]CCX 11g erpPresent=%d useProtection=%d nonErpPresent=%d\n", __func__,
+ pBcnStruct->erpPresent,
+ pBcnStruct->erpIEInfo.useProtection,
+ pBcnStruct->erpIEInfo.nonErpPresent);
+ }
+#endif
+ limEnableOverlap11gProtection(pMac, pBeaconParams, pMh,psessionEntry);
+ }
+
+ }
+ }
+ // handling the case when HT AP has overlapping legacy BSS.
+ else if(psessionEntry->htCapabality)
+ {
+ if (pBcnStruct->channelNumber == psessionEntry->currentOperChannel)
+ {
+ if (pBcnStruct->erpPresent &&
+ (pBcnStruct->erpIEInfo.useProtection ||
+ pBcnStruct->erpIEInfo.nonErpPresent))
+ {
+#ifdef FEATURE_WLAN_CCX
+ if( psessionEntry->isCCXconnection )
+ {
+ VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+ "%s: [INFOLOG]CCX 11g erpPresent=%d useProtection=%d nonErpPresent=%d\n", __func__,
+ pBcnStruct->erpPresent,
+ pBcnStruct->erpIEInfo.useProtection,
+ pBcnStruct->erpIEInfo.nonErpPresent);
+ }
+#endif
+ limEnableOverlap11gProtection(pMac, pBeaconParams, pMh,psessionEntry);
+ }
+
+ //11g device overlaps
+ if (pBcnStruct->erpPresent &&
+ !(pBcnStruct->erpIEInfo.useProtection ||
+ pBcnStruct->erpIEInfo.nonErpPresent) && !(pBcnStruct->HTInfo.present))
+ {
+#ifdef WLAN_SOFTAP_FEATURE
+ limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOverlap11gParams));
+
+ if (psessionEntry->gLimOverlap11gParams.numSta &&
+ !psessionEntry->gLimOverlap11gParams.protectionEnabled)
+#else
+ limUpdateOverlapStaParam(pMac, pMh->bssId, &(pMac->lim.gLimOverlap11gParams));
+
+ if (pMac->lim.gLimOverlap11gParams.numSta &&
+ !pMac->lim.gLimOverlap11gParams.protectionEnabled)
+#endif
+ {
+ limEnableHtProtectionFrom11g(pMac, true, true, pBeaconParams,psessionEntry);
+ }
+ }
+
+ //ht device overlaps.
+ //here we will check for HT related devices only which might need protection.
+ //check for 11b and 11g is already done in the previous blocks.
+ //so we will not check for HT operating mode as MIXED.
+ if (pBcnStruct->HTInfo.present)
+ {
+ //if we are not already in mixed mode or legacy mode as HT operating mode
+ //and received beacon has HT operating mode as legacy
+ //then we need to enable protection from 11g station.
+ //we don't need protection from 11b because if that's needed then our operating
+ //mode would have already been set to legacy in the previous blocks.
+ if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBcnStruct->HTInfo.opMode)
+ {
+ if((eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode) &&
+ (eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode))
+ {
+#ifdef WLAN_SOFTAP_FEATURE
+ limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOverlap11gParams));
+ if (psessionEntry->gLimOverlap11gParams.numSta &&
+ !psessionEntry->gLimOverlap11gParams.protectionEnabled)
+#else
+ limUpdateOverlapStaParam(pMac, pMh->bssId, &(pMac->lim.gLimOverlap11gParams));
+
+ if (pMac->lim.gLimOverlap11gParams.numSta &&
+ !pMac->lim.gLimOverlap11gParams.protectionEnabled)
+#endif
+ {
+ limEnableHtProtectionFrom11g(pMac, true, true, pBeaconParams,psessionEntry);
+ }
+ }
+ }
+ else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBcnStruct->HTInfo.opMode)
+ {
+#ifdef WLAN_SOFTAP_FEATURE
+ limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOverlapHt20Params));
+ if (psessionEntry->gLimOverlapHt20Params.numSta &&
+ !psessionEntry->gLimOverlapHt20Params.protectionEnabled)
+#else
+ limUpdateOverlapStaParam(pMac, pMh->bssId, &(pMac->lim.gLimOverlapHt20Params));
+
+ if (pMac->lim.gLimOverlapHt20Params.numSta &&
+ !pMac->lim.gLimOverlapHt20Params.protectionEnabled)
+#endif
+ {
+ limEnableHT20Protection(pMac, true, true, pBeaconParams,psessionEntry);
+ }
+ }
+ }
+
+ }
+ }
+ }
+ pMac->sch.gSchBcnIgnored++;
+}
+// --------------------------------------------------------------------
+
+
+
+
+/**
+ * __schBeaconProcessNoSession
+ *
+ * FUNCTION:
+ * Process the received beacon frame when
+ * -- Station is not scanning
+ * -- No corresponding session is found
+ *
+ * LOGIC:
+ * Following scenarios exist when Session Does not exist:
+ * * IBSS Beacons, when IBSS session already exists with same SSID,
+ * but from STA which has not yet joined and has a different BSSID.
+ * - invoke limHandleIBSScoalescing with the session context of existing IBSS session.
+ *
+ * * IBSS Beacons when IBSS session does not exist, only Infra or BT-AMP session exists,
+ * then save the beacon in the scan results and throw it away.
+ *
+ * * Infra Beacons
+ * - beacons received when no session active
+ * should not come here, it should be handled as part of scanning,
+ * else they should not be getting received, should update scan results and drop it if that happens.
+ * - beacons received when IBSS session active:
+ * update scan results and drop it.
+ * - beacons received when Infra session(STA) is active:
+ * update scan results and drop it
+ * - beacons received when BT-STA session is active:
+ * update scan results and drop it.
+ * - beacons received when Infra/BT-STA or Infra/IBSS is active.
+ * update scan results and drop it.
+ *
+
+ */
+static void __schBeaconProcessNoSession(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon,tANI_U8* pRxPacketInfo)
+{
+ tpPESession psessionEntry = NULL;
+
+ if( (psessionEntry = limIsIBSSSessionActive(pMac)) != NULL)
+ {
+ limHandleIBSScoalescing(pMac, pBeacon, pRxPacketInfo, psessionEntry);
+ }
+
+ //If station(STA/BT-STA/BT-AP/IBSS) mode, Always save the beacon in the scan results, if atleast one session is active
+ //schBeaconProcessNoSession will be called only when there is atleast one session active, so not checking
+ //it again here.
+ limCheckAndAddBssDescription(pMac, pBeacon, pRxPacketInfo, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE);
+ return;
+}
+
+
+
+/*
+ * __schBeaconProcessForSession
+ *
+ * FUNCTION:
+ * Process the received beacon frame when
+ * -- Station is not scanning
+ * -- Corresponding session is found
+ *
+ * LOGIC:
+ * Following scenarios exist when Session exists
+ * * IBSS STA receving beacons from IBSS Peers, who are part of IBSS.
+ * - call limHandleIBSScoalescing with that session context.
+ * * Infra STA receving beacons from AP to which it is connected
+ * - call schBeaconProcessFromAP with that session's context.
+ * * BTAMP STA receving beacons from BTAMP AP
+ * - call schBeaconProcessFromAP with that session's context.
+ * * BTAMP AP receiving beacons from BTAMP STA
+ * (here need to make sure BTAP creates session entry for BT STA)
+ * - just update the beacon count for heart beat purposes for now,
+ * for now, don't process the beacon.
+ * * Infra/IBSS both active and receives IBSS beacon:
+ * - call limHandleIBSScoalescing with that session context.
+ * * Infra/IBSS both active and receives Infra beacon:
+ * - call schBeaconProcessFromAP with that session's context.
+ * any updates to EDCA parameters will be effective for IBSS as well,
+ * even though no WMM for IBSS ?? Need to figure out how to handle this scenario.
+ * * Infra/BTSTA both active and receive Infra beacon.
+ * - change in EDCA parameters on Infra affect the BTSTA link.
+ * Update the same parameters on BT link
+ * * Infra/BTSTA both active and receive BT-AP beacon.
+ * -update beacon cnt for heartbeat
+ * * Infra/BTAP both active and receive Infra beacon.
+ * - BT-AP starts advertising BE parameters from Infra AP, if they get changed.
+ *
+ * * Infra/BTAP both active and receive BTSTA beacon.
+ * - update beacon cnt for heartbeat
+ */
+
+static void __schBeaconProcessForSession( tpAniSirGlobal pMac,
+ tpSchBeaconStruct pBeacon,
+ tANI_U8* pRxPacketInfo,
+ tpPESession psessionEntry)
+{
+ tANI_U32 bi;
+ tANI_U8 bssIdx = 0;
+ //tpSirMacMgmtHdr pMh = SIR_MAC_BD_TO_MPDUHEADER(pRxPacketInfo);
+ //tANI_U8 bssid[sizeof(tSirMacAddr)];
+ tUpdateBeaconParams beaconParams;
+ tANI_U8 sendProbeReq = FALSE;
+ tpDphHashNode pStaDs = NULL;
+
+
+ beaconParams.paramChangeBitmap = 0;
+
+ if(eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
+ {
+ limHandleIBSScoalescing(pMac, pBeacon, pRxPacketInfo, psessionEntry);
+ }
+ else if( (eLIM_STA_ROLE == psessionEntry->limSystemRole) ||
+ (eLIM_BT_AMP_STA_ROLE == psessionEntry->limSystemRole))
+ {
+ /*
+ * This handles two cases:
+ * -- Infra STA receving beacons from AP
+ * -- BTAMP_STA receving beacons from BTAMP_AP
+ */
+
+
+ //Always save the beacon into LIM's cached scan results
+ limCheckAndAddBssDescription(pMac, pBeacon, pRxPacketInfo, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE);
+
+ /**
+ * This is the Beacon received from the AP we're currently associated with. Check
+ * if there are any changes in AP's capabilities
+ */
+ if((tANI_U8) pBeacon->channelNumber != psessionEntry->currentOperChannel)
+ {
+ PELOGE(limLog(pMac, LOGE, FL("Channel Change from %d --> %d - "
+ "Ignoring beacon!\n"),
+ psessionEntry->currentOperChannel, pBeacon->channelNumber);)
+ goto fail;
+ }
+ limDetectChangeInApCapabilities(pMac, pBeacon, psessionEntry);
+ if(limGetStaHashBssidx(pMac, DPH_STA_HASH_INDEX_PEER, &bssIdx, psessionEntry) != eSIR_SUCCESS)
+ goto fail;
+ beaconParams.bssIdx = bssIdx;
+ palCopyMemory( pMac->hHdd, ( tANI_U8* )&psessionEntry->lastBeaconTimeStamp, ( tANI_U8* )pBeacon->timeStamp, sizeof(tANI_U64) );
+ psessionEntry->lastBeaconDtimCount = pBeacon->tim.dtimCount;
+ psessionEntry->lastBeaconDtimPeriod= pBeacon->tim.dtimPeriod;
+ psessionEntry->currentBssBeaconCnt++;
+
+
+
+ MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, 0, pBeacon->timeStamp[0]);)
+ MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, 0, pBeacon->timeStamp[1]);)
+
+ /* Read beacon interval session Entry */
+ bi = psessionEntry->beaconParams.beaconInterval;
+ if (bi != pBeacon->beaconInterval)
+ {
+ PELOG1(schLog(pMac, LOG1, FL("Beacon interval changed from %d to %d\n"),
+ pBeacon->beaconInterval, bi);)
+
+ bi = pBeacon->beaconInterval;
+ psessionEntry->beaconParams.beaconInterval = (tANI_U16) bi;
+ beaconParams.paramChangeBitmap |= PARAM_BCN_INTERVAL_CHANGED;
+ beaconParams.beaconInterval = (tANI_U16)bi;
+ }
+
+ if (pBeacon->cfPresent)
+ {
+ cfgSetInt(pMac, WNI_CFG_CFP_PERIOD, pBeacon->cfParamSet.cfpPeriod);
+ limSendCFParams(pMac, bssIdx, pBeacon->cfParamSet.cfpCount, pBeacon->cfParamSet.cfpPeriod);
+ }
+
+ if (pBeacon->timPresent)
+ {
+ cfgSetInt(pMac, WNI_CFG_DTIM_PERIOD, pBeacon->tim.dtimPeriod);
+ //No need to send DTIM Period and Count to HAL/SMAC
+ //SMAC already parses TIM bit.
+ }
+
+
+ if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
+
+ limDecideStaProtection(pMac, pBeacon, &beaconParams, psessionEntry);
+ if (pBeacon->erpPresent)
+ {
+#ifdef WLAN_SOFTAP_FEATURE
+ if (pBeacon->erpIEInfo.barkerPreambleMode)
+ limEnableShortPreamble(pMac, false, &beaconParams, psessionEntry);
+ else
+ limEnableShortPreamble(pMac, true, &beaconParams, psessionEntry);
+#else
+ if (pBeacon->erpIEInfo.barkerPreambleMode)
+ limEnableShortPreamble(pMac, false, &beaconParams);
+ else
+ limEnableShortPreamble(pMac, true, &beaconParams);
+#endif
+ }
+ limUpdateShortSlot(pMac, pBeacon, &beaconParams,psessionEntry);
+
+ pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
+ if ((pBeacon->wmeEdcaPresent && (psessionEntry->limWmeEnabled)) ||
+ (pBeacon->edcaPresent && (psessionEntry->limQosEnabled)))
+ {
+ if(pBeacon->edcaParams.qosInfo.count != psessionEntry->gLimEdcaParamSetCount)
+ {
+ if (schBeaconEdcaProcess(pMac, &pBeacon->edcaParams, psessionEntry) != eSIR_SUCCESS)
+ PELOGE(schLog(pMac, LOGE, FL("EDCA parameter processing error\n"));)
+ else if(pStaDs != NULL)
+ {
+ // If needed, downgrade the EDCA parameters
+ limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
+
+ if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
+ limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
+ else
+ limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
+ }
+ else
+ PELOGE(limLog(pMac, LOGE, FL("Self Entry missing in Hash Table\n"));)
+ }
+ }
+ else if( (pBeacon->qosCapabilityPresent && psessionEntry->limQosEnabled) &&
+ (pBeacon->qosCapability.qosInfo.count != psessionEntry->gLimEdcaParamSetCount))
+ sendProbeReq = TRUE;
+ }
+
+ if ( pMac->lim.htCapability && pBeacon->HTInfo.present )
+ {
+ limUpdateStaRunTimeHTSwitchChnlParams( pMac, &pBeacon->HTInfo, bssIdx,psessionEntry);
+ }
+
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+ if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) ||
+ (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
+ {
+ if(pBeacon->quietIEPresent)
+ {
+ limUpdateQuietIEFromBeacon(pMac, &(pBeacon->quietIE), psessionEntry);
+ }
+ else if ((pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN) ||
+ (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING))
+ {
+ PELOG1(limLog(pMac, LOG1, FL("Received a beacon without Quiet IE\n"));)
+ limCancelDot11hQuiet(pMac, psessionEntry);
+ }
+
+ /* Channel Switch information element updated */
+ if(pBeacon->channelSwitchPresent ||
+ pBeacon->propIEinfo.propChannelSwitchPresent)
+ {
+ limUpdateChannelSwitch(pMac, pBeacon, psessionEntry);
+ }
+ else if (pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
+ {
+ limCancelDot11hChannelSwitch(pMac, psessionEntry);
+ }
+ }
+#endif
+
+#if defined FEATURE_WLAN_CCX
+ if( psessionEntry->isCCXconnection )
+ {
+ tPowerdBm localConstraint = 0, regMax = 0, maxTxPower = 0;
+ if (pBeacon->ccxTxPwr.present)
+ {
+ localConstraint = pBeacon->ccxTxPwr.power_limit;
+ regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
+ maxTxPower = limGetMaxTxPower(regMax, localConstraint);
+
+ //If maxTxPower is increased or decreased
+ if( maxTxPower != psessionEntry->maxTxPower )
+ {
+ limLog( pMac, LOG1, "RegMax = %d, lpc = %d, MaxTx = %d", regMax, localConstraint, maxTxPower );
+ limLog( pMac, LOG1, "Local power constraint change..updating new maxTx power to HAL");
+ if( limSendSetMaxTxPowerReq ( pMac, maxTxPower, psessionEntry ) == eHAL_STATUS_SUCCESS )
+ psessionEntry->maxTxPower = maxTxPower;
+ }
+ }
+ }
+#endif
+
+
+#if defined WLAN_FEATURE_VOWIFI
+ if( pMac->rrm.rrmPEContext.rrmEnable )
+ {
+ tPowerdBm localConstraint = 0, regMax = 0, maxTxPower = 0;
+ if (pBeacon->powerConstraintPresent && pMac->rrm.rrmPEContext.rrmEnable)
+ {
+ localConstraint = pBeacon->localPowerConstraint.localPowerConstraints;
+ }
+ else
+ {
+ localConstraint = 0;
+ }
+ regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
+ maxTxPower = VOS_MIN( regMax , (regMax - localConstraint) );
+ //If maxTxPower is increased or decreased
+ if( maxTxPower != psessionEntry->maxTxPower )
+ {
+#if defined WLAN_VOWIFI_DEBUG
+ limLog( pMac, LOGE, "Regulatory max = %d, local power constraint = %d, max tx = %d", regMax, localConstraint, maxTxPower );
+ limLog( pMac, LOGE, "Local power constraint change..updating mew maxTx power to HAL");
+#endif
+ if( rrmSendSetMaxTxPowerReq ( pMac, maxTxPower, psessionEntry ) == eHAL_STATUS_SUCCESS )
+ psessionEntry->maxTxPower = maxTxPower;
+
+ }
+ }
+#endif
+
+ // Indicate to LIM that Beacon is received
+
+ if (pBeacon->HTInfo.present)
+ limReceivedHBHandler(pMac, (tANI_U8)pBeacon->HTInfo.primaryChannel, psessionEntry);
+ else
+ limReceivedHBHandler(pMac, (tANI_U8)pBeacon->channelNumber, psessionEntry);
+
+ // I don't know if any additional IE is required here. Currently, not include addIE.
+ if(sendProbeReq)
+ limSendProbeReqMgmtFrame(pMac, &psessionEntry->ssId,
+ psessionEntry->bssId, psessionEntry->currentOperChannel,psessionEntry->selfMacAddr,
+ psessionEntry->dot11mode, 0, NULL);
+
+ PELOG2(schLog(pMac, LOG2, "Received Beacon's SeqNum=%d\n",
+ (pMh->seqControl.seqNumHi << 4) | (pMh->seqControl.seqNumLo));)
+
+ if(beaconParams.paramChangeBitmap)
+ {
+ PELOGW(schLog(pMac, LOGW, FL("Beacon for session[%d] got changed. \n"), psessionEntry->peSessionId);)
+ PELOGW(schLog(pMac, LOGW, FL("sending beacon param change bitmap: 0x%x \n"), beaconParams.paramChangeBitmap);)
+ limSendBeaconParams(pMac, &beaconParams, psessionEntry);
+ }
+
+fail:
+ return;
+
+}
+
+
+
+/**
+ * schBeaconProcess
+ *
+ * FUNCTION:
+ * Process the received beacon frame
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pRxPacketInfo pointer to buffer descriptor
+ * @return None
+ */
+
+void schBeaconProcess(tpAniSirGlobal pMac, tANI_U8* pRxPacketInfo, tpPESession psessionEntry)
+{
+ static tSchBeaconStruct beaconStruct;
+ tUpdateBeaconParams beaconParams;
+ tpPESession pAPSession = NULL;
+ beaconParams.paramChangeBitmap = 0;
+
+ pMac->sch.gSchBcnRcvCnt++;
+
+ // Convert the beacon frame into a structure
+ if (sirConvertBeaconFrame2Struct(pMac, (tANI_U8 *) pRxPacketInfo, &beaconStruct)!= eSIR_SUCCESS)
+ {
+ PELOGE(schLog(pMac, LOGE, FL("beacon parsing failed\n"));)
+ pMac->sch.gSchBcnParseErrorCnt++;
+ return;
+ }
+
+ if (beaconStruct.ssidPresent)
+ {
+ beaconStruct.ssId.ssId[beaconStruct.ssId.length] = 0;
+ }
+
+ /*
+ * First process the beacon in the context of any existing AP or BTAP session.
+ * This takes cares of following two scenarios:
+ * - psessionEntry = NULL:
+ * e.g. beacon received from a neighboring BSS, you want to apply the protection settings to BTAP/InfraAP beacons
+ * - psessionEntry is non NULL:
+ * e.g. beacon received is from the INFRA AP to which you are connected on another concurrent link.
+ * In this case also, we want to apply the protection settings(as advertised by Infra AP) to BTAP beacons
+ *
+ *
+ */
+
+ if((pAPSession = limIsApSessionActive(pMac)) != NULL)
+ {
+ beaconParams.bssIdx = pAPSession->bssIdx;
+#ifdef WLAN_SOFTAP_FEATURE
+ if (pAPSession->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
+#else
+ if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
+#endif
+ ap_beacon_process(pMac, pRxPacketInfo, &beaconStruct, &beaconParams, pAPSession);
+
+ if (beaconParams.paramChangeBitmap)
+ {
+ //Update the beacons and apply the new settings to HAL
+ schSetFixedBeaconFields(pMac, pAPSession);
+ PELOG1(schLog(pMac, LOG1, FL("Beacon for PE session[%d] got changed. \n"), pAPSession->peSessionId);)
+ PELOG1(schLog(pMac, LOG1, FL("sending beacon param change bitmap: 0x%x \n"), beaconParams.paramChangeBitmap);)
+ limSendBeaconParams(pMac, &beaconParams, pAPSession);
+ }
+ }
+
+ /*
+ * Now process the beacon in the context of the BSS which is transmitting the beacons, if one is found
+ */
+ if(psessionEntry == NULL)
+ {
+ __schBeaconProcessNoSession(pMac, &beaconStruct, pRxPacketInfo );
+ }
+ else
+ {
+ __schBeaconProcessForSession(pMac, &beaconStruct, pRxPacketInfo, psessionEntry );
+ }
+
+}
+
+
+
+
+
+// --------------------------------------------------------------------
+/**
+ * schBeaconEdcaProcess
+ *
+ * FUNCTION:
+ * Process the EDCA parameter set in the received beacon frame
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param edca reference to edca parameters in beacon struct
+ * @return success
+ */
+
+tSirRetStatus schBeaconEdcaProcess(tpAniSirGlobal pMac, tSirMacEdcaParamSetIE *edca, tpPESession psessionEntry)
+{
+ tANI_U8 i;
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+ vos_log_qos_edca_pkt_type *log_ptr = NULL;
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+ PELOG1(schLog(pMac, LOG1, FL("Updating parameter set count: Old %d ---> new %d\n"),
+ psessionEntry->gLimEdcaParamSetCount, edca->qosInfo.count);)
+
+ psessionEntry->gLimEdcaParamSetCount = edca->qosInfo.count;
+ psessionEntry->gLimEdcaParams[EDCA_AC_BE] = edca->acbe;
+ psessionEntry->gLimEdcaParams[EDCA_AC_BK] = edca->acbk;
+ psessionEntry->gLimEdcaParams[EDCA_AC_VI] = edca->acvi;
+ psessionEntry->gLimEdcaParams[EDCA_AC_VO] = edca->acvo;
+//log: LOG_WLAN_QOS_EDCA_C
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+ WLAN_VOS_DIAG_LOG_ALLOC(log_ptr, vos_log_qos_edca_pkt_type, LOG_WLAN_QOS_EDCA_C);
+ if(log_ptr)
+ {
+ log_ptr->aci_be = psessionEntry->gLimEdcaParams[EDCA_AC_BE].aci.aci;
+ log_ptr->cw_be = psessionEntry->gLimEdcaParams[EDCA_AC_BE].cw.max << 4 |
+ psessionEntry->gLimEdcaParams[EDCA_AC_BE].cw.min;
+ log_ptr->txoplimit_be = psessionEntry->gLimEdcaParams[EDCA_AC_BE].txoplimit;
+ log_ptr->aci_bk = psessionEntry->gLimEdcaParams[EDCA_AC_BK].aci.aci;
+ log_ptr->cw_bk = psessionEntry->gLimEdcaParams[EDCA_AC_BK].cw.max << 4 |
+ psessionEntry->gLimEdcaParams[EDCA_AC_BK].cw.min;
+ log_ptr->txoplimit_bk = psessionEntry->gLimEdcaParams[EDCA_AC_BK].txoplimit;
+ log_ptr->aci_vi = psessionEntry->gLimEdcaParams[EDCA_AC_VI].aci.aci;
+ log_ptr->cw_vi = psessionEntry->gLimEdcaParams[EDCA_AC_VI].cw.max << 4 |
+ psessionEntry->gLimEdcaParams[EDCA_AC_VI].cw.min;
+ log_ptr->txoplimit_vi = psessionEntry->gLimEdcaParams[EDCA_AC_VI].txoplimit;
+ log_ptr->aci_vo = psessionEntry->gLimEdcaParams[EDCA_AC_VO].aci.aci;
+ log_ptr->cw_vo = psessionEntry->gLimEdcaParams[EDCA_AC_VO].cw.max << 4 |
+ psessionEntry->gLimEdcaParams[EDCA_AC_VO].cw.min;
+ log_ptr->txoplimit_vo = psessionEntry->gLimEdcaParams[EDCA_AC_VO].txoplimit;
+ }
+ WLAN_VOS_DIAG_LOG_REPORT(log_ptr);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+ PELOG1(schLog(pMac, LOGE, FL("Updating Local EDCA Params(gLimEdcaParams) to: "));)
+ for(i=0; i<MAX_NUM_AC; i++)
+ {
+ PELOG1(schLog(pMac, LOG1, FL("AC[%d]: AIFSN: %d, ACM %d, CWmin %d, CWmax %d, TxOp %d\n"),
+ i,
+ psessionEntry->gLimEdcaParams[i].aci.aifsn,
+ psessionEntry->gLimEdcaParams[i].aci.acm,
+ psessionEntry->gLimEdcaParams[i].cw.min,
+ psessionEntry->gLimEdcaParams[i].cw.max,
+ psessionEntry->gLimEdcaParams[i].txoplimit);)
+ }
+
+ return eSIR_SUCCESS;
+}
diff --git a/CORE/MAC/src/pe/sch/schDebug.c b/CORE/MAC/src/pe/sch/schDebug.c
new file mode 100644
index 0000000..c6b3473
--- /dev/null
+++ b/CORE/MAC/src/pe/sch/schDebug.c
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file schDebug.cc contains some debug functions.
+ *
+ * Author: Sandesh Goel
+ * Date: 02/25/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+
+#include "schDebug.h"
+
+void schLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
+{
+#ifdef WLAN_DEBUG
+ // Verify against current log level
+ if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SCH_MODULE_ID )] )
+ return;
+ else
+ {
+ va_list marker;
+
+ va_start( marker, pString ); /* Initialize variable arguments. */
+
+ logDebug(pMac, SIR_SCH_MODULE_ID, loglevel, pString, marker);
+
+ va_end( marker ); /* Reset variable arguments. */
+ }
+#endif
+}
+
+#if (WNI_POLARIS_FW_PRODUCT==AP)
+#ifdef WMM_SA
+
+#include "schClass.h"
+#include "schDebug.h"
+
+
+void dumpSchedule(tANI_U8 index)
+{
+ tpSchSchedule s = &schedule[index];
+
+ PELOG2(schLog(pMac, LOG2, FL("============== SCHEDULE %d ===============\n"), index);)
+ dumpSchedule(s);
+}
+
+void schClass::dumpSchedule(tpSchSchedule s)
+{
+ PELOG2(schLog(pMac, LOG2, FL("\ttotTxop %d totInst %d curInst %d\n"),
+ s->totTxopLo+0x100*s->totTxopHi, s->totInst, s->curInst);)
+ for(tANI_U32 i=0; i<s->totInst; i++)
+ {
+ PELOG2(schLog(pMac, LOG2, FL("\t[%d] "), i);)
+ dumpInstruction(&s->inst[i]);
+ }
+ PELOG2(schLog(pMac, LOG2, FL("\t+++++++++++++++++++++++++++++++++++++++++++\n"));)
+}
+
+void dumpInstruction(tpSchInstruction t)
+{
+ if (t->type == SCH_INST_DATA)
+ PELOG2(schLog(pMac, LOG2, "DATA (%d,%d) txop %d feedback %d\n",
+ t->staidLo+0x10*t->staidHi, t->pri,
+ t->txopLo+0x100*t->txopHi, t->feedback);)
+ else
+ PELOG2(schLog(pMac, LOG2, "POLL (%d,%d) txop %d feedback %d\n",
+ t->staidLo+0x10*t->staidHi, t->pri,
+ t->txopLo+0x100*t->txopHi, t->feedback);)
+}
+
+void dumpQueueSizes()
+{
+ PELOG3(schLog(pMac, LOG3, FL("------- QUEUE SIZES [sta][pri][DL(0)/UL(1)] -------\n"));)
+ for(int i=0; i<256; i++)
+ for(int j=0; j<8; j++)
+ for(int k=0; k<2; k++)
+ {
+ if (queue[i][j][k].packets > 0)
+ PELOG3(schLog(pMac, LOG3, FL("\tQueueLength[%d][%d][%d] = %d packets %d txop (serviced %d)\n"),
+ i, j, k,
+ queue[i][j][k].packets, queue[i][j][k].txop, queue[i][j][k].serviced);)
+ }
+}
+
+void printQosClass(tANI_U8 classId)
+{
+ schQoSClass *q = &qosClass[classId];
+
+ if (q->activeNext == NULL)
+ PELOG3(schLog(pMac, LOG3, FL("printQosClass[%d] : Active list empty\n"), classId);)
+ else
+ {
+ tpSchQueueState ptr = q->activeNext->next;
+ tANI_U16 i;
+ for(i=1; ptr != q->activeNext; ptr = ptr->next, i++);
+ PELOG3(schLog(pMac, LOG3, FL("printQosClass[%d] : Active Qs %d nextPtr %x prevPtr %x creditsRem %d\n"),
+ classId, i, (tANI_U32) q->activeNext, (tANI_U32) q->activePrev, q->creditsRemaining);)
+ }
+}
+
+#endif /* WMM_SA */
+#endif // (WNI_POLARIS_FW_PRODUCT==AP)
+
+// --------------------------------------------------------------------
diff --git a/CORE/MAC/src/pe/sch/schDebug.h b/CORE/MAC/src/pe/sch/schDebug.h
new file mode 100644
index 0000000..6cd523e
--- /dev/null
+++ b/CORE/MAC/src/pe/sch/schDebug.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file schDebug.h contains some debug macros.
+ *
+ * Author: Sandesh Goel
+ * Date: 02/25/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#ifndef __SCH_DEBUG_H__
+#define __SCH_DEBUG_H__
+
+#include "utilsApi.h"
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halCommonApi.h"
+#endif
+#include "sirDebug.h"
+
+
+
+void schLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...) ;
+
+// -------------------------------------------------------------
+/**
+ *
+ */
+
+#ifdef SCH_DEBUG_STATS
+inline void schClass::schTrace(tSchTrace event, tANI_U32 arg)
+{
+ if (gSchFreezeDump) return;
+ if ((tANI_U32)event >= traceLevel) return;
+
+ traceBuf[curTrace].event = event;
+ traceBuf[curTrace].arg = arg;
+ traceBuf[curTrace].timestamp = halGetTsfLow(pMac);
+ curTrace = (curTrace+1)%SCH_TRACE_BUF_SIZE;
+}
+#endif
+
+#endif
diff --git a/CORE/MAC/src/pe/sch/schMessage.c b/CORE/MAC/src/pe/sch/schMessage.c
new file mode 100644
index 0000000..58bb1b0
--- /dev/null
+++ b/CORE/MAC/src/pe/sch/schMessage.c
@@ -0,0 +1,688 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file schMessage.cc contains the message handler
+ *
+ * Author: Sandesh Goel
+ * Date: 02/25/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+#include "palTypes.h"
+#include "sirCommon.h"
+
+#include "wniCfgAp.h"
+#include "aniGlobal.h"
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halCommonApi.h"
+#endif
+#include "cfgApi.h"
+#include "limApi.h"
+#include "pmmApi.h"
+#include "limSendMessages.h"
+
+
+#include "schApi.h"
+#include "schDebug.h"
+
+/// Minimum beacon interval allowed (in Kus)
+#define SCH_BEACON_INTERVAL_MIN 10
+
+/// Maximum beacon interval allowed (in Kus)
+#define SCH_BEACON_INTERVAL_MAX 10000
+
+/// convert the CW values into a tANI_U16
+#define GET_CW(pCw) ((tANI_U16) ((*(pCw) << 8) + *((pCw) + 1)))
+
+// local functions
+static tSirRetStatus getWmmLocalParams(tpAniSirGlobal pMac, tANI_U32 params[][WNI_CFG_EDCA_ANI_ACBK_LOCAL_LEN]);
+static void setSchEdcaParams(tpAniSirGlobal pMac, tANI_U32 params[][WNI_CFG_EDCA_ANI_ACBK_LOCAL_LEN], tpPESession psessionEntry);
+
+// --------------------------------------------------------------------
+/**
+ * schSetBeaconInterval
+ *
+ * FUNCTION:
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param None
+ * @return None
+ */
+
+void schSetBeaconInterval(tpAniSirGlobal pMac,tpPESession psessionEntry)
+{
+ tANI_U32 bi;
+
+ bi = psessionEntry->beaconParams.beaconInterval;
+
+ if (bi < SCH_BEACON_INTERVAL_MIN || bi > SCH_BEACON_INTERVAL_MAX)
+ {
+ schLog(pMac, LOGE, FL("Invalid beacon interval %d (should be [%d,%d]\n"),
+ bi, SCH_BEACON_INTERVAL_MIN, SCH_BEACON_INTERVAL_MAX);
+ return;
+ }
+
+ pMac->sch.schObject.gSchBeaconInterval = (tANI_U16)bi;
+}
+
+
+// --------------------------------------------------------------------
+/**
+ * schSetInitParams
+ *
+ * FUNCTION:
+ * Initialize parameters from CFG which do not depend on any other config
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param None
+ * @return None
+ */
+
+#if 0 /* This function is not used anywhere */
+void
+schSetInitParams(tpAniSirGlobal pMac)
+{
+ pMac->sch.schObject.gSchDTIMCount = 0;
+ pMac->sch.schObject.gSchCFPCount = 0;
+
+ schQosUpdateLocal(pMac);
+
+ PELOG1(schLog(pMac, LOG1, FL("Finished init of SCH params\n"));)
+}
+#endif
+
+// --------------------------------------------------------------------
+/**
+ * schProcessMessage
+ *
+ * FUNCTION:
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param None
+ * @return None
+ */
+
+void schProcessMessage(tpAniSirGlobal pMac,tpSirMsgQ pSchMsg)
+{
+#ifdef FIXME_GEN6
+ tANI_U32 *pBD;
+ tpSirMacMgmtHdr mh;
+ void *pPacket;
+#endif
+ tANI_U32 val;
+
+ tpPESession psessionEntry = &pMac->lim.gpSession[0]; //TBD-RAJESH HOW TO GET sessionEntry?????
+ PELOG3(schLog(pMac, LOG3, FL("Received message (%x) \n"), pSchMsg->type);)
+
+ switch (pSchMsg->type)
+ {
+#ifdef FIXME_GEN6
+ case SIR_BB_XPORT_MGMT_MSG:
+ pMac->sch.gSchBBXportRcvCnt++;
+
+
+#if defined (ANI_OS_TYPE_LINUX) || defined (ANI_OS_TYPE_OSX)
+ {
+ palGetPacketDataPtr( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, pSchMsg->bodyptr, (void **) &(pBD) );
+ }
+#else
+ pBD = (tANI_U32 *) pSchMsg->bodyptr;
+#endif
+
+
+ mh = SIR_MAC_BD_TO_MPDUHEADER( pBD );
+
+ if (mh->fc.type == SIR_MAC_MGMT_FRAME &&
+ mh->fc.subType == SIR_MAC_MGMT_BEACON)
+ schBeaconProcess(pMac, pBD);
+ else
+ {
+ schLog(pMac, LOGE, FL("Unexpected message (%d,%d) rcvd\n"),
+ mh->fc.type, mh->fc.subType);
+ pMac->sch.gSchUnknownRcvCnt++;
+ }
+#if defined (ANI_OS_TYPE_LINUX) || defined (ANI_OS_TYPE_OSX)
+ // Free up allocated SK BUF
+ //for Windows, this is freed up by palHandleRxFrames
+ palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, pBD, (void *) pSchMsg->bodyptr) ;
+#endif
+ break;
+#endif
+
+ case SIR_SCH_CHANNEL_SWITCH_REQUEST:
+ schLog(pMac, LOGE,
+ FL("Channel switch request not handled\n"));
+ break;
+
+ case SIR_SCH_START_SCAN_REQ:
+ SIR_SCHED_LOCK();
+ pMac->sch.gSchScanReqRcvd = true;
+ if (pMac->sch.gSchHcfEnabled)
+ {
+ // In HCF mode, wait for TFP to stop before sending a response
+ if (pMac->sch.schObject.gSchCFBInitiated ||
+ pMac->sch.schObject.gSchCFPInitiated)
+ {
+ PELOG1(schLog(pMac, LOG1,
+ FL("Waiting for TFP to halt before sending "
+ "start scan response\n"));)
+ }
+ else
+ schSendStartScanRsp(pMac);
+ }
+ else
+ {
+ // In eDCF mode, send the response right away
+ schSendStartScanRsp(pMac);
+ }
+ SIR_SCHED_UNLOCK();
+ break;
+
+ case SIR_SCH_END_SCAN_NTF:
+ PELOG3(schLog(pMac, LOG3,
+ FL("Received STOP_SCAN_NTF from LIM\n"));)
+ pMac->sch.gSchScanReqRcvd = false;
+#ifdef WMM_SA
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ if (psessionEntry->limSystemRole == eLIM_AP_ROLE && pMac->sch.gSchHcfEnabled)
+ startCFB();
+#endif
+#endif
+ break;
+
+ case SIR_CFG_PARAM_UPDATE_IND:
+
+ if (wlan_cfgGetInt(pMac, (tANI_U16) pSchMsg->bodyval, &val) != eSIR_SUCCESS)
+ schLog(pMac, LOGP, FL("failed to cfg get id %d\n"), pSchMsg->bodyval);
+
+ switch (pSchMsg->bodyval)
+ {
+ case WNI_CFG_BEACON_INTERVAL:
+ // What to do for IBSS ?? - TBD
+ if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ schSetBeaconInterval(pMac,psessionEntry);
+ break;
+
+
+ case WNI_CFG_DTIM_PERIOD:
+ pMac->sch.schObject.gSchDTIMCount = 0;
+ break;
+
+ case WNI_CFG_CFP_PERIOD:
+ pMac->sch.schObject.gSchCFPCount = 0;
+ break;
+
+ case WNI_CFG_EDCA_PROFILE:
+ schEdcaProfileUpdate(pMac, psessionEntry);
+ break;
+
+ case WNI_CFG_EDCA_ANI_ACBK_LOCAL:
+ case WNI_CFG_EDCA_ANI_ACBE_LOCAL:
+ case WNI_CFG_EDCA_ANI_ACVI_LOCAL:
+ case WNI_CFG_EDCA_ANI_ACVO_LOCAL:
+ case WNI_CFG_EDCA_WME_ACBK_LOCAL:
+ case WNI_CFG_EDCA_WME_ACBE_LOCAL:
+ case WNI_CFG_EDCA_WME_ACVI_LOCAL:
+ case WNI_CFG_EDCA_WME_ACVO_LOCAL:
+ if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ schQosUpdateLocal(pMac, psessionEntry);
+ break;
+
+ case WNI_CFG_EDCA_ANI_ACBK:
+ case WNI_CFG_EDCA_ANI_ACBE:
+ case WNI_CFG_EDCA_ANI_ACVI:
+ case WNI_CFG_EDCA_ANI_ACVO:
+ case WNI_CFG_EDCA_WME_ACBK:
+ case WNI_CFG_EDCA_WME_ACBE:
+ case WNI_CFG_EDCA_WME_ACVI:
+ case WNI_CFG_EDCA_WME_ACVO:
+ if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ {
+ psessionEntry->gLimEdcaParamSetCount++;
+ schQosUpdateBroadcast(pMac, psessionEntry);
+ }
+ break;
+
+ default:
+ schLog(pMac, LOGE, FL("Cfg param %d indication not handled\n"),
+ pSchMsg->bodyval);
+ }
+ break;
+
+ default:
+ schLog(pMac, LOGE, FL("Unknown message in schMsgQ type %d\n"),
+ pSchMsg->type);
+ }
+
+}
+
+
+// --------------------------------------------------------------------
+/**
+ * schProcessMessageQueue
+ *
+ * FUNCTION:
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param None
+ * @return None
+ */
+
+void schProcessMessageQueue(tpAniSirGlobal pMac)
+{
+ tSirMsgQ schMsg;
+
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
+ pMac->sch.gSchRRRecd = false;
+#endif
+ memset(&schMsg, 0, sizeof(tSirMsgQ));
+ while (1)
+ {
+ if (tx_queue_receive(&pMac->sys.gSirSchMsgQ, (void *) &schMsg, TX_WAIT_FOREVER)
+ != TX_SUCCESS)
+ break;
+
+ schProcessMessage(pMac, &schMsg);
+ }
+#ifdef WMM_SA
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+ if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE && pMac->sch.gSchRRRecd)
+ startCFB();
+#endif
+#endif
+}
+
+#if 0 /* This function is not used anywhere */
+// set the default values for all params of interest
+void
+schUpdateQosInfo( tpAniSirGlobal pMac)
+{
+ // need to populate local info only on AP or IBSS, beacon processing
+ // takes care of others
+ psessionEntry->gLimEdcaParamSetCount = 0xFF;
+
+ if (pMac->lim.gLimSystemRole == eLIM_STA_IN_IBSS_ROLE)
+ {
+ schQosUpdateLocal(pMac);
+ }
+ else if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
+ {
+ // fill local AP values
+ schQosUpdateLocal(pMac);
+
+ // fill broadcast values
+ schQosUpdateBroadcast(pMac, psessionEntry);
+ }
+}
+
+#endif
+
+// get the local or broadcast parameters based on the profile sepcified in the config
+// params are delivered in this order: BK, BE, VI, VO
+tSirRetStatus
+schGetParams(
+ tpAniSirGlobal pMac,
+ tANI_U32 params[][WNI_CFG_EDCA_ANI_ACBK_LOCAL_LEN],
+ tANI_U8 local)
+{
+ tANI_U32 val;
+ tANI_U32 i,idx;
+ tANI_U32 *prf;
+
+ tANI_U32 ani_l[] = { WNI_CFG_EDCA_ANI_ACBE_LOCAL,WNI_CFG_EDCA_ANI_ACBK_LOCAL,
+ WNI_CFG_EDCA_ANI_ACVI_LOCAL, WNI_CFG_EDCA_ANI_ACVO_LOCAL };
+ tANI_U32 wme_l[] = {WNI_CFG_EDCA_WME_ACBE_LOCAL, WNI_CFG_EDCA_WME_ACBK_LOCAL,
+ WNI_CFG_EDCA_WME_ACVI_LOCAL, WNI_CFG_EDCA_WME_ACVO_LOCAL};
+ tANI_U32 demo_l[] = {WNI_CFG_EDCA_TIT_DEMO_ACBE_LOCAL, WNI_CFG_EDCA_TIT_DEMO_ACBK_LOCAL,
+ WNI_CFG_EDCA_TIT_DEMO_ACVI_LOCAL, WNI_CFG_EDCA_TIT_DEMO_ACVO_LOCAL};
+ tANI_U32 ani_b[] = {WNI_CFG_EDCA_ANI_ACBE, WNI_CFG_EDCA_ANI_ACBK,
+ WNI_CFG_EDCA_ANI_ACVI, WNI_CFG_EDCA_ANI_ACVO};
+ tANI_U32 wme_b[] = {WNI_CFG_EDCA_WME_ACBE, WNI_CFG_EDCA_WME_ACBK,
+ WNI_CFG_EDCA_WME_ACVI, WNI_CFG_EDCA_WME_ACVO};
+ tANI_U32 demo_b[] = {WNI_CFG_EDCA_TIT_DEMO_ACBE, WNI_CFG_EDCA_TIT_DEMO_ACBK,
+ WNI_CFG_EDCA_TIT_DEMO_ACVI, WNI_CFG_EDCA_TIT_DEMO_ACVO};
+
+ if (wlan_cfgGetInt(pMac, WNI_CFG_EDCA_PROFILE, &val) != eSIR_SUCCESS)
+ {
+ schLog(pMac, LOGP, FL("failed to cfg get EDCA_PROFILE id %d\n"),
+ WNI_CFG_EDCA_PROFILE);
+ return eSIR_FAILURE;
+ }
+
+ if (val >= WNI_CFG_EDCA_PROFILE_MAX)
+ {
+ schLog(pMac, LOGE, FL("Invalid EDCA_PROFILE %d, using %d instead\n"),
+ val, WNI_CFG_EDCA_PROFILE_ANI);
+ val = WNI_CFG_EDCA_PROFILE_ANI;
+ }
+
+ schLog(pMac, LOGW, FL("EdcaProfile: Using %d (%s)\n"), val,
+ ((val == WNI_CFG_EDCA_PROFILE_WMM) ? "WMM"
+ : ( (val == WNI_CFG_EDCA_PROFILE_TIT_DEMO) ? "Titan" : "HiPerf")));
+
+ if (local)
+ {
+ switch (val)
+ {
+ case WNI_CFG_EDCA_PROFILE_WMM:
+ prf = &wme_l[0];
+ break;
+ case WNI_CFG_EDCA_PROFILE_TIT_DEMO:
+ prf = &demo_l[0];
+ break;
+ case WNI_CFG_EDCA_PROFILE_ANI:
+ default:
+ prf = &ani_l[0];
+ break;
+ }
+ }
+ else
+ {
+ switch (val)
+ {
+ case WNI_CFG_EDCA_PROFILE_WMM:
+ prf = &wme_b[0];
+ break;
+ case WNI_CFG_EDCA_PROFILE_TIT_DEMO:
+ prf = &demo_b[0];
+ break;
+ case WNI_CFG_EDCA_PROFILE_ANI:
+ default:
+ prf = &ani_b[0];
+ break;
+ }
+ }
+
+ for (i=0; i < 4; i++)
+ {
+ tANI_U8 data[WNI_CFG_EDCA_ANI_ACBK_LEN];
+ tANI_U32 len = WNI_CFG_EDCA_ANI_ACBK_LOCAL_LEN;
+ if (wlan_cfgGetStr(pMac, (tANI_U16) prf[i], (tANI_U8 *) &data[0], &len) != eSIR_SUCCESS)
+ {
+ schLog(pMac, LOGP, FL("cfgGet failed for %d\n"), prf[i]);
+ return eSIR_FAILURE;
+ }
+ if (len > WNI_CFG_EDCA_ANI_ACBK_LOCAL_LEN)
+ {
+ schLog(pMac, LOGE, FL("cfgGet for %d: length is %d instead of %d\n"),
+ prf[i], len, WNI_CFG_EDCA_ANI_ACBK_LOCAL_LEN);
+ return eSIR_FAILURE;
+ }
+ for (idx=0; idx < len; idx++)
+ params[i][idx] = (tANI_U32) data[idx];
+ }
+ PELOG1(schLog(pMac, LOG1, FL("GetParams: local=%d, profile = %d Done\n"), local, val);)
+ return eSIR_SUCCESS;
+}
+
+void
+schQosUpdateBroadcast(tpAniSirGlobal pMac, tpPESession psessionEntry)
+{
+ tANI_U32 params[4][WNI_CFG_EDCA_ANI_ACBK_LOCAL_LEN];
+ tANI_U32 cwminidx, cwmaxidx, txopidx;
+ tANI_U32 phyMode;
+ tANI_U8 i;
+
+ if (schGetParams(pMac, params, false) != eSIR_SUCCESS)
+ {
+ PELOGE(schLog(pMac, LOGE, FL("QosUpdateBroadcast: failed\n"));)
+ return;
+ }
+ limGetPhyMode(pMac, &phyMode, psessionEntry);
+
+ PELOG1(schLog(pMac, LOG1, "QosUpdBcast: mode %d\n", phyMode);)
+
+ if (phyMode == WNI_CFG_PHY_MODE_11G)
+ {
+ cwminidx = WNI_CFG_EDCA_PROFILE_CWMING_IDX;
+ cwmaxidx = WNI_CFG_EDCA_PROFILE_CWMAXG_IDX;
+ txopidx = WNI_CFG_EDCA_PROFILE_TXOPG_IDX;
+ }
+ else if (phyMode == WNI_CFG_PHY_MODE_11B)
+ {
+ cwminidx = WNI_CFG_EDCA_PROFILE_CWMINB_IDX;
+ cwmaxidx = WNI_CFG_EDCA_PROFILE_CWMAXB_IDX;
+ txopidx = WNI_CFG_EDCA_PROFILE_TXOPB_IDX;
+ }
+ else // This can happen if mode is not set yet, assume 11a mode
+ {
+ cwminidx = WNI_CFG_EDCA_PROFILE_CWMINA_IDX;
+ cwmaxidx = WNI_CFG_EDCA_PROFILE_CWMAXA_IDX;
+ txopidx = WNI_CFG_EDCA_PROFILE_TXOPA_IDX;
+ }
+
+
+ for(i=0; i<MAX_NUM_AC; i++)
+ {
+ psessionEntry->gLimEdcaParamsBC[i].aci.acm = (tANI_U8) params[i][WNI_CFG_EDCA_PROFILE_ACM_IDX];
+ psessionEntry->gLimEdcaParamsBC[i].aci.aifsn = (tANI_U8) params[i][WNI_CFG_EDCA_PROFILE_AIFSN_IDX];
+ psessionEntry->gLimEdcaParamsBC[i].cw.min = convertCW(GET_CW(¶ms[i][cwminidx]));
+ psessionEntry->gLimEdcaParamsBC[i].cw.max = convertCW(GET_CW(¶ms[i][cwmaxidx]));
+ psessionEntry->gLimEdcaParamsBC[i].txoplimit= (tANI_U16) params[i][txopidx];
+
+ PELOG1(schLog(pMac, LOG1, "QoSUpdateBCast: AC :%d: AIFSN: %d, ACM %d, CWmin %d, CWmax %d, TxOp %d\n", i,
+ psessionEntry->gLimEdcaParamsBC[i].aci.aifsn,
+ psessionEntry->gLimEdcaParamsBC[i].aci.acm,
+ psessionEntry->gLimEdcaParamsBC[i].cw.min,
+ psessionEntry->gLimEdcaParamsBC[i].cw.max,
+ psessionEntry->gLimEdcaParamsBC[i].txoplimit);)
+
+ }
+
+ if (schSetFixedBeaconFields(pMac,psessionEntry) != eSIR_SUCCESS)
+ PELOGE(schLog(pMac, LOGE, "Unable to set beacon fields!\n");)
+}
+
+void
+schQosUpdateLocal(tpAniSirGlobal pMac, tpPESession psessionEntry)
+{
+
+ tANI_U32 params[4][WNI_CFG_EDCA_ANI_ACBK_LOCAL_LEN];
+ tANI_BOOLEAN highPerformance=eANI_BOOLEAN_TRUE;
+
+ if (schGetParams(pMac, params, true /*local*/) != eSIR_SUCCESS)
+ {
+ PELOGE(schLog(pMac, LOGE, FL("schGetParams(local) failed\n"));)
+ return;
+ }
+
+ setSchEdcaParams(pMac, params, psessionEntry);
+
+ if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
+ {
+ if (pMac->lim.gLimNumOfAniSTAs)
+ highPerformance = eANI_BOOLEAN_TRUE;
+ else
+ highPerformance = eANI_BOOLEAN_FALSE;
+ }
+ else if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
+ {
+ highPerformance = eANI_BOOLEAN_TRUE;
+ }
+
+ //For AP, the bssID is stored in LIM Global context.
+ limSendEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry->bssIdx, highPerformance);
+}
+
+/** ----------------------------------------------------------
+\fn schSetDefaultEdcaParams
+\brief This function sets the gLimEdcaParams to the default
+\ local wmm profile.
+\param tpAniSirGlobal pMac
+\return none
+\ ------------------------------------------------------------ */
+void
+schSetDefaultEdcaParams(tpAniSirGlobal pMac, tpPESession psessionEntry)
+{
+ tANI_U32 params[4][WNI_CFG_EDCA_ANI_ACBK_LOCAL_LEN];
+
+ if (getWmmLocalParams(pMac, params) != eSIR_SUCCESS)
+ {
+ PELOGE(schLog(pMac, LOGE, FL("getWmmLocalParams() failed\n"));)
+ return;
+ }
+
+ setSchEdcaParams(pMac, params, psessionEntry);
+ return;
+}
+
+
+/** ----------------------------------------------------------
+\fn setSchEdcaParams
+\brief This function fills in the gLimEdcaParams structure
+\ with the given edca params.
+\param tpAniSirGlobal pMac
+\return none
+\ ------------------------------------------------------------ */
+static void
+setSchEdcaParams(tpAniSirGlobal pMac, tANI_U32 params[][WNI_CFG_EDCA_ANI_ACBK_LOCAL_LEN], tpPESession psessionEntry)
+{
+ tANI_U32 i;
+ tANI_U32 cwminidx, cwmaxidx, txopidx;
+ tANI_U32 phyMode;
+
+ limGetPhyMode(pMac, &phyMode, psessionEntry);
+
+ PELOG1(schLog(pMac, LOG1, FL("limGetPhyMode() = %d\n"), phyMode);)
+
+ //if (pMac->lim.gLimPhyMode == WNI_CFG_PHY_MODE_11G)
+ if (phyMode == WNI_CFG_PHY_MODE_11G)
+ {
+ cwminidx = WNI_CFG_EDCA_PROFILE_CWMING_IDX;
+ cwmaxidx = WNI_CFG_EDCA_PROFILE_CWMAXG_IDX;
+ txopidx = WNI_CFG_EDCA_PROFILE_TXOPG_IDX;
+ }
+ //else if (pMac->lim.gLimPhyMode == WNI_CFG_PHY_MODE_11B)
+ else if (phyMode == WNI_CFG_PHY_MODE_11B)
+ {
+ cwminidx = WNI_CFG_EDCA_PROFILE_CWMINB_IDX;
+ cwmaxidx = WNI_CFG_EDCA_PROFILE_CWMAXB_IDX;
+ txopidx = WNI_CFG_EDCA_PROFILE_TXOPB_IDX;
+ }
+ else // This can happen if mode is not set yet, assume 11a mode
+ {
+ cwminidx = WNI_CFG_EDCA_PROFILE_CWMINA_IDX;
+ cwmaxidx = WNI_CFG_EDCA_PROFILE_CWMAXA_IDX;
+ txopidx = WNI_CFG_EDCA_PROFILE_TXOPA_IDX;
+ }
+
+ for(i=0; i<MAX_NUM_AC; i++)
+ {
+ psessionEntry->gLimEdcaParams[i].aci.acm = (tANI_U8) params[i][WNI_CFG_EDCA_PROFILE_ACM_IDX];
+ psessionEntry->gLimEdcaParams[i].aci.aifsn = (tANI_U8) params[i][WNI_CFG_EDCA_PROFILE_AIFSN_IDX];
+ psessionEntry->gLimEdcaParams[i].cw.min = convertCW(GET_CW(¶ms[i][cwminidx]));
+ psessionEntry->gLimEdcaParams[i].cw.max = convertCW(GET_CW(¶ms[i][cwmaxidx]));
+ psessionEntry->gLimEdcaParams[i].txoplimit= (tANI_U16) params[i][txopidx];
+
+ PELOG1(schLog(pMac, LOG1, FL("AC :%d: AIFSN: %d, ACM %d, CWmin %d, CWmax %d, TxOp %d\n"), i,
+ psessionEntry->gLimEdcaParams[i].aci.aifsn,
+ psessionEntry->gLimEdcaParams[i].aci.acm,
+ psessionEntry->gLimEdcaParams[i].cw.min,
+ psessionEntry->gLimEdcaParams[i].cw.max,
+ psessionEntry->gLimEdcaParams[i].txoplimit);)
+
+ }
+ return;
+}
+
+/** ----------------------------------------------------------
+\fn getWmmLocalParams
+\brief This function gets the WMM local edca parameters.
+\param tpAniSirGlobal pMac
+\param tANI_U32 params[][WNI_CFG_EDCA_ANI_ACBK_LOCAL_LEN]
+\return none
+\ ------------------------------------------------------------ */
+static tSirRetStatus
+getWmmLocalParams(tpAniSirGlobal pMac, tANI_U32 params[][WNI_CFG_EDCA_ANI_ACBK_LOCAL_LEN])
+{
+ tANI_U32 i,idx;
+ tANI_U32 *prf;
+ tANI_U32 wme_l[] = {WNI_CFG_EDCA_WME_ACBE_LOCAL, WNI_CFG_EDCA_WME_ACBK_LOCAL,
+ WNI_CFG_EDCA_WME_ACVI_LOCAL, WNI_CFG_EDCA_WME_ACVO_LOCAL};
+
+ prf = &wme_l[0];
+ for (i=0; i < 4; i++)
+ {
+ tANI_U8 data[WNI_CFG_EDCA_ANI_ACBK_LEN];
+ tANI_U32 len = WNI_CFG_EDCA_ANI_ACBK_LOCAL_LEN;
+ if (wlan_cfgGetStr(pMac, (tANI_U16) prf[i], (tANI_U8 *) &data[0], &len) != eSIR_SUCCESS)
+ {
+ schLog(pMac, LOGP, FL("cfgGet failed for %d\n"), prf[i]);
+ return eSIR_FAILURE;
+ }
+ if (len > WNI_CFG_EDCA_ANI_ACBK_LOCAL_LEN)
+ {
+ schLog(pMac, LOGE, FL("cfgGet for %d: length is %d instead of %d\n"),
+ prf[i], len, WNI_CFG_EDCA_ANI_ACBK_LOCAL_LEN);
+ return eSIR_FAILURE;
+ }
+ for (idx=0; idx < len; idx++)
+ params[i][idx] = (tANI_U32) data[idx];
+ }
+ return eSIR_SUCCESS;
+}
+
+
+/** ----------------------------------------------------------
+\fn schEdcaProfileUpdate
+\brief This function updates the local and broadcast
+\ EDCA params in the gLimEdcaParams structure. It also
+\ updates the edcaParamSetCount.
+\param tpAniSirGlobal pMac
+\return none
+\ ------------------------------------------------------------ */
+void
+schEdcaProfileUpdate(tpAniSirGlobal pMac, tpPESession psessionEntry)
+{
+ if (psessionEntry->limSystemRole == eLIM_AP_ROLE || psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
+ {
+ schQosUpdateLocal(pMac, psessionEntry);
+ psessionEntry->gLimEdcaParamSetCount++;
+ schQosUpdateBroadcast(pMac, psessionEntry);
+ }
+}
+
+// --------------------------------------------------------------------
diff --git a/CORE/MAC/src/pe/sch/schSysParams.h b/CORE/MAC/src/pe/sch/schSysParams.h
new file mode 100644
index 0000000..18da485
--- /dev/null
+++ b/CORE/MAC/src/pe/sch/schSysParams.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file schSysParams.h contains scheduler parameter definitions
+ *
+ * Author: Sandesh Goel
+ * Date: 02/25/02
+ * History:-
+ * Date Modified by Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#ifndef __SCH_SYS_PARAMS_H__
+#define __SCH_SYS_PARAMS_H__
+
+/// Unsolicited poll period (ms) (0 to disable)
+#define SCH_POLL_PERIOD 1000
+
+/// RR timeout value (ms) (0 to disable)
+#define SCH_RR_TIMEOUT_MS 40
+
+/// Default CP:CFP ratio
+#define SCH_DEFAULT_CP_TO_CFP_RATIO 0
+
+/// Default maximum CFP duration (us)
+#define SCH_DEFAULT_MAX_CFP_TIME 60000
+
+/// Default minimum CP duration (us)
+#define SCH_DEFAULT_MIN_CP_TIME 100
+
+/// Amount of delay prior to starting CFP (us)
+#define SCH_CFP_START_DELAY 100
+
+/// Unit of Txop in micro seconds
+#define TXOP_UNIT_IN_USEC 32
+
+/// Minimum amount of time granted per instruction on average (units of txop)
+#define MIN_TXOP_PER_INSTRUCTION 50
+
+/// Maximum amount of time granted per instruction (units of txop)
+#define MAX_TXOP_PER_INSTRUCTION 300 // HACK - 100
+
+/// Maximum amount of time granted to one entire schedule (units of txop)
+#define MAX_TXOP_PER_SCHEDULE 400
+
+/// Scheduling quantum (units of TXOP)
+#define SCH_QUANTUM_QUEUE 4
+
+/// Maximum unused quantum allowed to be accumulated by a queue
+#define MAX_ACCUMULATED_QUANTUM 500
+
+/// Minimum allocated quantum for an uplink flow before a poll instruction is written
+#define SCH_MIN_UL_ALLOC 12
+
+// ---- Scheduling Policy ----
+
+/// Number of QOS classes
+#define SCH_NUM_QOS_CLASSES 2
+
+#define SCH_POLICY_STRICT_PRI 0
+#define SCH_POLICY_DRR 1
+
+/// Scheduling quantum for each class if using DRR
+#define SCH_QUANTUM_CLASS 100
+
+/// The default scheduling policy between classes
+#define SCH_POLICY_DEFAULT SCH_POLICY_STRICT_PRI
+
+// Scheduling weights for each priority
+
+#define SCH_QUANTUM_0 40
+#define SCH_QUANTUM_1 36
+#define SCH_QUANTUM_2 32
+#define SCH_QUANTUM_3 28
+#define SCH_QUANTUM_4 24
+#define SCH_QUANTUM_5 20
+#define SCH_QUANTUM_6 16
+#define SCH_QUANTUM_7 12
+
+#endif